on master help sign in
add error message when "exposed-modules" are missing
commit1bd298f45d6298b3e77d5bf0df59c415a1ed448a authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 24 Jun 2019, 18:03 (7 years ago) parent5a1cc18
1 file changed+41−2
builder/src/Reporting/Exit.hs+41−2
builder/src/Reporting/Exit.hs+41−2
@@ -1597,8 +1597,47 @@ toProjectProblemReport projectProblem =
15971597 ++ D.makeLink "import-cycles"
15981598 ]
15991599
1600− BP_MissingExposed _ ->
1601− error "TODO BP_MissingExposed"
1600+ BP_MissingExposed (NE.List (name, problem) _) ->
1601+ case problem of
1602+ Import.NotFound ->
1603+ Help.report "MISSING MODULE" (Just "elm.json")
1604+ "The \"exposed-modules\" of your elm.json lists the following module:"
1605+ [ D.indent 4 $ D.red $ D.fromName name
1606+ , D.reflow $
1607+ "But I cannot find it in your src/ directory. Is there a typo? Was it renamed?"
1608+ ]
1609+
1610+ Import.Ambiguous _ _ pkg _ ->
1611+ Help.report "AMBIGUOUS MODULE NAME" (Just "elm.json")
1612+ "The \"exposed-modules\" of your elm.json lists the following module:"
1613+ [ D.indent 4 $ D.red $ D.fromName name
1614+ , D.reflow $
1615+ "But a module from " ++ Pkg.toChars pkg ++ " already uses that name. Try\
1616+ \ choosing a different name for your local file."
1617+ ]
1618+
1619+ Import.AmbiguousLocal path1 path2 paths ->
1620+ Help.report "AMBIGUOUS MODULE NAME" (Just "elm.json")
1621+ "The \"exposed-modules\" of your elm.json lists the following module:"
1622+ [ D.indent 4 $ D.red $ D.fromName name
1623+ , D.reflow $
1624+ "But I found multiple files with that name:"
1625+ , D.dullyellow $ D.indent 4 $ D.vcat $
1626+ map D.fromChars (path1:path2:paths)
1627+ , D.reflow $
1628+ "Change the module names to be distinct!"
1629+ ]
1630+
1631+ Import.AmbiguousForeign _ _ _ ->
1632+ Help.report "MISSING MODULE" (Just "elm.json")
1633+ "The \"exposed-modules\" of your elm.json lists the following module:"
1634+ [ D.indent 4 $ D.red $ D.fromName name
1635+ , D.reflow $
1636+ "But I cannot find it in your src/ directory. Is there a typo? Was it renamed?"
1637+ , D.toSimpleNote $
1638+ "It is not possible to \"re-export\" modules from other packages. You can only\
1639+ \ expose modules that you define in your own code."
1640+ ]
16021641
16031642
16041643