on master help sign in
Merge pull request #1137 from elm-lang/dev
8bbb580Evan Czaplicki
src/Reporting/Error/Type.hs+20−2
@@ -302,16 +302,34 @@ mismatchToReport localizer (MismatchInfo hint leftType rightType maybeReason) =
302 )
302 )
303 )
303 )
304
304
305+ FunctionArity maybeName 0 actual region ->
306+ let
307+ arg =
308+ if actual == 1 then "an argument" else show actual ++ " arguments"
309+
310+ preHint =
311+ case maybeName of
312+ Nothing ->
313+ "You are giving " ++ arg ++ " to something that is not a function!"
314+
315+ Just name ->
316+ prettyName name ++ " is not a function, but you are giving it " ++ arg ++ "!"
317+ in
318+ report
319+ (Just region)
320+ preHint
321+ (text "Maybe you forgot some parentheses? Or a comma?")
322+
305 FunctionArity maybeName expected actual region ->
323 FunctionArity maybeName expected actual region ->
306 let
324 let
307− s = if expected <= 1 then "" else "s"
325+ s = if expected == 1 then "" else "s"
308 in
326 in
309 report
327 report
310 (Just region)
328 (Just region)
311 ( Help.capitalize (funcName maybeName) ++ " is expecting " ++ show expected
329 ( Help.capitalize (funcName maybeName) ++ " is expecting " ++ show expected
312 ++ " argument" ++ s ++ ", but was given " ++ show actual ++ "."
330 ++ " argument" ++ s ++ ", but was given " ++ show actual ++ "."
313 )
331 )
314− (text "Maybe you forgot some parentheses somewhere?")
332+ (text "Maybe you forgot some parentheses? Or a comma?")
315
333
316 BadTypeAnnotation name ->
334 BadTypeAnnotation name ->
317 report
335 report