Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Fix does not take aliases into account #16 #19

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/Internal/ResolvedType.elm
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ refToExpr currentModule imports ref =

else
case List.Extra.find (\import_ -> import_.moduleName == ref.modulePath) imports of
Just { moduleAlias, exposingList } ->
Just { exposingList } ->
if isExposed exposingList ref.name then
Elm.CodeGen.fun ref.name

else
case moduleAlias of
Just moduleAlias_ ->
Elm.CodeGen.fqFun [ moduleAlias_ ] ref.name

Nothing ->
Elm.CodeGen.fqFun ref.modulePath ref.name
Elm.CodeGen.fqFun ref.modulePath ref.name

Nothing ->
Elm.CodeGen.fqFun ref.modulePath ref.name
Expand Down
36 changes: 35 additions & 1 deletion tests/FuzzerCodeGenTest.elm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module FuzzerCodeGenTest exposing (suite)

import CodeGenerator.Test exposing (FakeDependency, codeGenTest)
import CodeGenerator.Test exposing (FakeDependency, codeGenIncrementalTest, codeGenTest)
import StandardModule
import Test exposing (Test, describe)

Expand Down Expand Up @@ -109,5 +109,39 @@ bFuzzer =
(Fuzz.map Dict.fromList (Fuzz.list (Fuzz.pair Fuzz.string Fuzz.niceFloat)))
(Fuzz.pair (Fuzz.maybe Fuzz.string) Fuzz.bool)
(Fuzz.map2 (\\a b -> { a = a, b = b }) Fuzz.int Fuzz.int)
"""
, codeGenIncrementalTest "Issue #16"
[ elmJson ]
[]
[ """module SQLite.Statement.CreateTable exposing (ColumnConstraint(..), InnerColumnConstraint(..))

type alias ColumnConstraint =
{ foo : (Maybe String), bar : InnerColumnConstraint }

type InnerColumnConstraint =
InnerColumnConstraint String
"""
, """module ParserTest exposing (suite)

import SQLite.Statement.CreateTable as CreateTable
import Fuzz exposing (Fuzzer)

columnConstraintFuzzer : Fuzzer CreateTable.ColumnConstraint
columnConstraintFuzzer =
Debug.todo ""
"""
]
"""module ParserTest exposing (suite)

import SQLite.Statement.CreateTable as CreateTable
import Fuzz exposing (Fuzzer)

columnConstraintFuzzer : Fuzzer CreateTable.ColumnConstraint
columnConstraintFuzzer =
Fuzz.map2 CreateTable.ColumnConstraint (Fuzz.maybe Fuzz.string) innerColumnConstraintFuzzer

innerColumnConstraintFuzzer : Fuzzer CreateTable.InnerColumnConstraint
innerColumnConstraintFuzzer =
Debug.todo ""
"""
]
Loading