@@ -1001,10 +1001,43 @@ toDeclDefReport source name declDef startRow startCol =
1001 toExprReport source (InDef name startRow startCol) expr row col
1001 toExprReport source (InDef name startRow startCol) expr row col
1003 DeclDefNameRepeat row col ->
1003 DeclDefNameRepeat row col ->
1004− error "TODO DeclDefNameRepeat" name row col
1004+ let
1005+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1006+ region = toRegion row col
1008+ Report.Report "EXPECTING DEFINITION" region [] $
1009+ Code.toSnippet source surroundings (Just region)
1012+ "I just saw the type annotation for `" ++ Name.toChars name
1013+ ++ "` so I was expecting to see its definition here:"
1016+ "Type annotations always appear directly above the relevant\
1017+ \ definition, without anything else (even doc comments) in between."
1006 DeclDefNameMatch defName row col ->
1020 DeclDefNameMatch defName row col ->
1007− error "TODO DeclDefNameMatch" name defName row col
1021+ let
1022+ expected = Name.toChars name
1023+ actual = Name.toChars defName
1025+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1026+ region = toRegion row col
1028+ Report.Report "NAME MISMATCH" region [] $
1029+ Code.toSnippet source surroundings (Just region)
1032+ "I got stuck after parsing the `" ++ expected ++ "` type annotation:"
1036+ "I am seeing `" ++ actual ++ "` defined next. These names do not match! Is there a typo?"
1037+ , D.indent 4 $ D.fillSep $
1038+ [D.dullyellow (D.fromChars actual),"->",D.green (D.fromChars expected)]
1009 DeclDefIndentType row col ->
1042 DeclDefIndentType row col ->
1010 error "TODO DeclDefIndentType" row col
1043 error "TODO DeclDefIndentType" row col
@@ -2597,41 +2630,4 @@ toFuncReport source context func startRow startCol =
2597 "Equality on floats can be unreliable, so you usually want to check that they\
2630 "Equality on floats can be unreliable, so you usually want to check that they\
2598 \ are nearby with some sort of (abs (actual - expected) < 0.001) check."
2631 \ are nearby with some sort of (abs (actual - expected) < 0.001) check."
2601− -- Parse.Expression
2603− MatchingName name ->
2604− Report.Report "EXPECTING A DEFINITION" region [] $
2605− Code.toSnippet source region Nothing
2608− "I just saw the type annotation for `" ++ Name.toChars name
2609− ++ "` so I was expecting to see its definition here:"
2612− "Type annotations always appear directly above the relevant\
2613− \ definition, without anything else (even doc comments) in between."
2619− TypeWithBadDefinition region annName defName ->
2620− Report.Report "ANNOTATION MISMATCH" region [] $
2621− Code.toSnippet source region Nothing
2624− "I see a `" <> Name.toChars annName
2625− <> "` annotation, but it is followed by a `"
2626− <> Name.toChars defName <> "` definition."
2629− ["The","annotation","and","definition","names","must","match!"
2630− ,"Is","there","a","typo","between"
2631− , D.dullyellow (D.fromName annName)
2633− , D.dullyellow (D.fromName defName) <> "?"