mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 02:02:29 +03:00
Register type constructors from visited modules in Scope
This commit is contained in:
parent
061a950679
commit
56e766ad62
@ -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
|
||||
|
@ -10,7 +10,13 @@ elmCore =
|
||||
, modules =
|
||||
[ { name = "Basics"
|
||||
, comment = ""
|
||||
, unions = []
|
||||
, unions =
|
||||
[ { name = "Bool"
|
||||
, comment = ""
|
||||
, args = []
|
||||
, tags = [ ( "True", [] ), ( "False", [] ) ]
|
||||
}
|
||||
]
|
||||
, aliases = []
|
||||
, values =
|
||||
[ { name = "always"
|
||||
|
@ -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
|
||||
<nothing>.exposedElement -> ExposesSomeThings.exposedElement
|
||||
<nothing>.nonExposedElement -> <nothing>.nonExposedElement
|
||||
<nothing>.elementFromExposesEverything -> ExposesEverything.elementFromExposesEverything
|
||||
<nothing>.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
|
||||
<nothing>.get -> Http.get
|
||||
<nothing>.always -> Basics.always
|
||||
<nothing>.True -> Basics.True
|
||||
<nothing>.Just -> Maybe.Just"""
|
||||
, details = [ "details" ]
|
||||
, under = "module"
|
||||
|
Loading…
Reference in New Issue
Block a user