diff --git a/src/Scope2.elm b/src/Scope2.elm index 06607918..ec331997 100644 --- a/src/Scope2.elm +++ b/src/Scope2.elm @@ -477,7 +477,9 @@ registerExposed declaration innerContext = { name = Node.value type_.name , comment = "" , args = [] - , tags = [] + , tags = + type_.constructors + |> List.map (\constructor -> ( Node.value (Node.value constructor).name, [] )) } :: innerContext.exposedUnions } @@ -661,7 +663,12 @@ registerImportExposed import_ innerContext = exposedValues : Dict String (List String) exposedValues = List.concat - [ List.map nameWithModuleName module_.unions + [ List.concatMap + (\union -> + nameWithModuleName union + :: List.map (\( name, _ ) -> ( name, moduleName )) union.tags + ) + module_.unions , List.map nameWithModuleName module_.values , List.map nameWithModuleName module_.aliases , List.map nameWithModuleName module_.binops diff --git a/tests/Dependencies.elm b/tests/Dependencies.elm index 9736f318..98c34c3f 100644 --- a/tests/Dependencies.elm +++ b/tests/Dependencies.elm @@ -10,7 +10,13 @@ elmCore = , modules = [ { name = "Basics" , comment = "" - , unions = [] + , unions = + [ { name = "Bool" + , comment = "" + , args = [] + , tags = [ ( "True", [] ), ( "False", [] ) ] + } + ] , aliases = [] , values = [ { name = "always" diff --git a/tests/Scope2Test.elm b/tests/Scope2Test.elm index 4e29594c..d506eced 100644 --- a/tests/Scope2Test.elm +++ b/tests/Scope2Test.elm @@ -15,10 +15,9 @@ import Test exposing (Test, test) all : Test all = - Test.only <| - Test.describe "Scope" - [ realFunctionOrTypeTests - ] + Test.describe "Scope" + [ realFunctionOrTypeTests + ] realFunctionOrTypeTests : Test @@ -42,6 +41,7 @@ a = localValue exposedElement nonExposedElement elementFromExposesEverything + VariantA Foo.bar Foo.Bar Baz.foo @@ -50,6 +50,7 @@ a = localValue Http.get get always + True Just """, """module ExposesSomeThings exposing (SomeOtherTypeAlias, exposedElement) type NonExposedCustomType = Variant @@ -75,6 +76,7 @@ elementFromExposesEverything = 1 .exposedElement -> ExposesSomeThings.exposedElement .nonExposedElement -> .nonExposedElement .elementFromExposesEverything -> ExposesEverything.elementFromExposesEverything +.VariantA -> ExposesEverything.VariantA Foo.bar -> Foo.bar Foo.Bar -> Foo.Bar Baz.foo -> Bar.foo @@ -83,6 +85,7 @@ Baz.foo -> Bar.foo Http.get -> Http.get .get -> Http.get .always -> Basics.always +.True -> Basics.True .Just -> Maybe.Just""" , details = [ "details" ] , under = "module"