@@ -157,8 +157,6 @@ data DeclDef
157 | DeclDefIndentType Row Col
157 | DeclDefIndentType Row Col
158 | DeclDefIndentEquals Row Col
158 | DeclDefIndentEquals Row Col
159 | DeclDefIndentBody Row Col
159 | DeclDefIndentBody Row Col
161− | DeclDefFreshLineAfterType Row Col
@@ -1516,9 +1514,12 @@ toDeclDefReport source name declDef startRow startCol =
1516 "I just saw the type annotation for `" ++ Name.toChars name
1514 "I just saw the type annotation for `" ++ Name.toChars name
1517 ++ "` so I was expecting to see its definition here:"
1515 ++ "` so I was expecting to see its definition here:"
1519− D.reflow $
1518+ [ D.reflow $
1520− "Type annotations always appear directly above the relevant\
1519+ "Type annotations always appear directly above the relevant\
1521− \ definition, without anything else (even doc comments) in between."
1520+ \ definition, without anything else (even doc comments) in between."
1524 DeclDefNameMatch defName row col ->
1525 DeclDefNameMatch defName row col ->
@@ -1541,16 +1542,76 @@ toDeclDefReport source name declDef startRow startCol =
1543 DeclDefIndentType row col ->
1544 DeclDefIndentType row col ->
1544− error "TODO DeclDefIndentType" row col
1545+ let
1546+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1547+ region = toRegion row col
1549+ Report.Report "UNFINISHED DEFINITION" region [] $
1550+ Code.toSnippet source surroundings (Just region)
1553+ "I got stuck while parsing the `" ++ Name.toChars name ++ "` type annotation:"
1557+ "I just saw a colon, so I am expecting to see a type next."
1546 DeclDefIndentEquals row col ->
1562 DeclDefIndentEquals row col ->
1547− error "TODO DeclDefIndentEquals" row col
1563+ let
1564+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1565+ region = toRegion row col
1567+ Report.Report "UNFINISHED DEFINITION" region [] $
1568+ Code.toSnippet source surroundings (Just region)
1571+ "I got stuck while parsing the `" ++ Name.toChars name ++ "` definition:"
1575+ "I was expecting to see an argument or an equals sign next."
1549 DeclDefIndentBody row col ->
1580 DeclDefIndentBody row col ->
1550− error "TODO DeclDefIndentBody" row col
1581+ let
1582+ surroundings = A.Region (A.Position startRow startCol) (A.Position row col)
1583+ region = toRegion row col
1585+ Report.Report "UNFINISHED DEFINITION" region [] $
1586+ Code.toSnippet source surroundings (Just region)
1589+ "I got stuck while parsing the `" ++ Name.toChars name ++ "` definition:"
1593+ "I was expecting to see an expression next. What is it equal to?"
1552− DeclDefFreshLineAfterType row col ->
1598+
1553− error "TODO DeclDefFreshLineAfterType" row col
1599+declDefNote :: D.Doc
1603+ "Here is a valid definition (with a type annotation) for reference:"
1605+ [ D.fillSep [D.green "add",":","Int","->","Int","->","Int"]
1606+ , D.fillSep [D.green "add","x","y","="]
1607+ , D.fillSep [" ","x","+","y"]
1610+ "The top line (called a \"type annotation\") is optional. You can leave it off\
1611+ \ if you want. As you get more comfortable with Elm and as your project grows,\
1612+ \ it becomes more and more valuable to add them though! They work great as\
1613+ \ compiler-verified documentation, and they often improve error messages!"