git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Make some errors simpler. Fix #1387.
commitd1bd11dc615d01be53680383db9fd2f0a73bb032 authorPhil Freeman <paf31@cantab.net> dateWed 9 Sep 2015, 15:53 (11 years ago) parent5fdc977
1 file changed+16−11
src/Language/PureScript/Errors.hs+16−11
src/Language/PureScript/Errors.hs+16−11
@@ -443,9 +443,9 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
443443 , indent . line $ path
444444 ]
445445 goSimple InvalidDoBind =
446− line "Bind statement cannot be the last statement in a do block"
446+ line "Bind statement cannot be the last statement in a do block. The last statement must be an expression."
447447 goSimple InvalidDoLet =
448− line "Let statement cannot be the last statement in a do block"
448+ line "Let statement cannot be the last statement in a do block. The last statement must be an expression."
449449 goSimple CannotReorderOperators =
450450 line "Unable to reorder operators"
451451 goSimple UnspecifiedSkolemScope =
@@ -453,11 +453,11 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
453453 goSimple OverlappingNamesInLet =
454454 line "Overlapping names in let binding."
455455 goSimple (InfiniteType ty) =
456− paras [ line "Infinite type detected: "
456+ paras [ line "An infinite type was inferred for an expression: "
457457 , indent $ line $ prettyPrintType ty
458458 ]
459459 goSimple (InfiniteKind ki) =
460− paras [ line "Infinite kind detected: "
460+ paras [ line "An infinite kind was inferred for a type: "
461461 , indent $ line $ prettyPrintKind ki
462462 ]
463463 goSimple (MultipleFixities name) =
@@ -534,9 +534,11 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
534534 goSimple (UndefinedTypeVariable name) =
535535 line $ "Type variable " ++ show name ++ " is undefined"
536536 goSimple (PartiallyAppliedSynonym name) =
537− line $ "Partially applied type synonym " ++ show name
537+ paras [ line $ "Partially applied type synonym " ++ show name
538+ , line "Type synonyms must be applied to all of their type arguments."
539+ ]
538540 goSimple (EscapedSkolem binding) =
539− paras $ [ line "Rigid/skolem type variable has escaped." ]
541+ paras $ [ line "A type variable has escaped its scope." ]
540542 <> foldMap (\expr -> [ line "Relevant expression: "
541543 , indent $ line $ prettyPrintValue expr
542544 ]) binding
@@ -610,7 +612,10 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
610612 goSimple TypeSynonymInstance =
611613 line "Type synonym instances are disallowed"
612614 goSimple (OrphanInstance nm cnm ts) =
613− line $ "Instance " ++ show nm ++ " for " ++ show cnm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ " is an orphan instance"
615+ paras [ line $ "Instance " ++ show nm ++ " for " ++ show cnm ++ " " ++ unwords (map prettyPrintTypeAtom ts) ++ " is an orphan instance."
616+ , line "An orphan instance is an instance which is defined in neither the class module nor the data type module."
617+ , line "Consider moving the instance, if possible, or using a newtype wrapper."
618+ ]
614619 goSimple InvalidNewtype =
615620 line "Newtypes must define a single constructor with a single argument"
616621 goSimple (InvalidInstanceHead ty) =
@@ -634,13 +639,13 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
634639 goSimple (WildcardInferredType ty) =
635640 line $ "The wildcard type definition has the inferred type " ++ prettyPrintType ty
636641 goSimple (NotExhaustivePattern bs b) =
637− indent $ paras $ [ line "Pattern could not be determined to cover all cases."
638− , line $ "The definition has the following uncovered cases:\n"
642+ indent $ paras $ [ line "A case expression could not be determined to cover all inputs."
643+ , line $ "The following additional cases are required to cover all inputs:\n"
639644 , Box.hsep 1 Box.left (map (paras . map (line . prettyPrintBinderAtom)) (transpose bs))
640645 ] ++ if not b then [line "..."] else []
641646 goSimple (OverlappingPattern bs b) =
642− indent $ paras $ [ line "Redundant cases have been detected."
643− , line $ "The definition has the following redundant cases:\n"
647+ indent $ paras $ [ line "A case expression contains redundant cases."
648+ , line $ "The expression has the following redundant cases:\n"
644649 , Box.hsep 1 Box.left (map (paras . map (line . prettyPrintBinderAtom)) (transpose bs))
645650 ] ++ if not b then [line "..."] else []
646651 go (NotYetDefined names err) =