Skip to content

Commit

Permalink
Fixes lazy code for the blessed implementations hack
Browse files Browse the repository at this point in the history
  • Loading branch information
gampleman committed May 13, 2024
1 parent c2beb99 commit ab7c86b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Internal/Builtin/MiniBillCodec.elm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ codeGen =
, CodeGenerator.float (val "float")
, CodeGenerator.string (val "string")
, CodeGenerator.list (fn1 "list")
, CodeGenerator.maybe (fn1 "nullable")
, CodeGenerator.use "Codec.nullable"
, CodeGenerator.dict
(\key value ->
CG.apply
Expand Down
8 changes: 6 additions & 2 deletions src/Internal/DependencyScanner.elm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Elm.Syntax.ModuleName exposing (ModuleName)
import Elm.Type as T exposing (Type)
import Internal.CodeGenerator exposing (ConfiguredCodeGenerator, ExistingFunctionProvider)
import List.Extra
import Maybe.Extra
import ResolvedType as RT exposing (ResolvedType)
import Review.Project.Dependency as Dependency exposing (Dependency)
import TypePattern as TP exposing (TypePattern)
Expand Down Expand Up @@ -105,8 +106,11 @@ heuristicRejectIfMultiplePatternsForSameType codeGens providers =
Dict.get provider.codeGenId codeGens
|> Maybe.andThen
(\codeGen ->
List.Extra.find (\ref -> ref.modulePath == provider.moduleName && ref.name == provider.functionName) codeGen.blessedImplementations
|> Maybe.map (always provider)
List.Extra.find
(\{ moduleName, functionName } ->
Maybe.Extra.isJust (List.Extra.find (\ref -> ref.modulePath == moduleName && ref.name == functionName) codeGen.blessedImplementations)
)
(provider :: rest)
)
)

Expand Down

0 comments on commit ab7c86b

Please sign in to comment.