on master help sign in
Move two error messages up from comment world
1f2f6b9Evan Czaplicki
compiler/src/Reporting/Error/Syntax.hs+29−36
@@ -542,10 +542,36 @@ toReport source err =
542 )
542 )
543
543
544 UnexpectedPort region ->
544 UnexpectedPort region ->
545− error "TODO UnexpectedPort" region
545+ Report.Report "UNEXPECTED PORTS" region [] $
546+ Code.toSnippet source region Nothing
547+ (
548+ D.reflow $
549+ "You are declaring ports in a normal module."
550+ ,
551+ D.stack
552+ [ D.fillSep
553+ ["Switch","this","to","say",D.green "port module","instead,"
554+ ,"marking","that","this","module","contains","port","declarations."
555+ ]
556+ , D.link "Note"
557+ "Ports are not a traditional FFI for calling JS functions directly. They need a different mindset! Read"
558+ "ports"
559+ "to learn the syntax and how to use it effectively."
560+ ]
561+ )
546
562
547 NoPorts region ->
563 NoPorts region ->
548− error "TODO NoPorts" region
564+ Report.Report "NO PORTS" region [] $
565+ Code.toSnippet source region Nothing
566+ (
567+ D.reflow $
568+ "This module does not declare any ports, but it says it will:"
569+ ,
570+ D.fillSep
571+ ["Switch","this","to",D.green "module"
572+ ,"and","you","should","be","all","set!"
573+ ]
574+ )
549
575
550 ParseError modul ->
576 ParseError modul ->
551 toParseErrorReport source modul
577 toParseErrorReport source modul
@@ -640,8 +666,7 @@ toParseErrorReport source modul =
640 [ D.fillSep [D.blue "port",D.blue "module","WebSockets",D.blue "exposing","(send, listen, keepAlive)"]
666 [ D.fillSep [D.blue "port",D.blue "module","WebSockets",D.blue "exposing","(send, listen, keepAlive)"]
641 , D.fillSep [D.blue "port",D.blue "module","Maps",D.blue "exposing","(Location, goto)"]
667 , D.fillSep [D.blue "port",D.blue "module","Maps",D.blue "exposing","(Location, goto)"]
642 ]
668 ]
643− , D.reflow $
669+ , D.link "Note" "Read" "ports" "for more help."
644− "Go to the section in https://guide.elm-lang.org on ports for more information!"
645 ]
670 ]
646 )
671 )
647
672
@@ -2500,38 +2525,6 @@ toFuncReport source context func startRow startCol =
2500 \ maybe this comment is here by accident?"
2525 \ maybe this comment is here by accident?"
2501 )
2526 )
2502
2527
2503− UnexpectedPort region ->
2504− Report.Report "UNEXPECTED PORTS" region [] $
2505− Code.toSnippet source region Nothing
2506− (
2507− D.reflow $
2508− "You are declaring ports in a normal module."
2509− ,
2510− D.stack
2511− [ D.fillSep
2512− ["Switch","this","to","say",D.green "port module","instead,"
2513− ,"marking","that","this","module","contains","port","declarations."
2514− ]
2515− , D.link "Note"
2516− "Ports are not a traditional FFI for calling JS functions directly. They need a different mindset! Read"
2517− "ports"
2518− "to learn the syntax and how to use it effectively."
2519− ]
2520− )
2521−
2522− NoPorts region ->
2523− Report.Report "NO PORTS" region [] $
2524− Code.toSnippet source region Nothing
2525− (
2526− D.reflow $
2527− "This module does not declare any ports, but it says it will:"
2528− ,
2529− D.fillSep
2530− ["Switch","this","to",D.green "module"
2531− ,"and","you","should","be","all","set!"
2532− ]
2533− )
2534−
2535 ParseError row col context expectation ->
2528 ParseError row col context expectation ->
2536 let
2529 let
2537 pos = A.Position row col
2530 pos = A.Position row col