on master help sign in
Move two error messages up from comment world
commit1f2f6b952b954a6a9b36eec6b013bd42c8273b38 authorEvan Czaplicki <evancz@users.noreply.github.com> dateThu 9 May 2019, 15:57 (7 years ago) parent6e01ea5
1 file changed+29−36
compiler/src/Reporting/Error/Syntax.hs+29−36
compiler/src/Reporting/Error/Syntax.hs+29−36
@@ -542,10 +542,36 @@ toReport source err =
542542 )
543543
544544 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+ )
546562
547563 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+ )
549575
550576 ParseError modul ->
551577 toParseErrorReport source modul
@@ -640,8 +666,7 @@ toParseErrorReport source modul =
640666 [ D.fillSep [D.blue "port",D.blue "module","WebSockets",D.blue "exposing","(send, listen, keepAlive)"]
641667 , D.fillSep [D.blue "port",D.blue "module","Maps",D.blue "exposing","(Location, goto)"]
642668 ]
643− , D.reflow $
644− "Go to the section in https://guide.elm-lang.org on ports for more information!"
669+ , D.link "Note" "Read" "ports" "for more help."
645670 ]
646671 )
647672
@@ -2500,38 +2525,6 @@ toFuncReport source context func startRow startCol =
25002525 \ maybe this comment is here by accident?"
25012526 )
25022527
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−
25352528 ParseError row col context expectation ->
25362529 let
25372530 pos = A.Position row col