@@ -140,6 +140,8 @@ data SimpleErrorMessage
140 | InvalidInstanceHead Type
140 | InvalidInstanceHead Type
141 | TransitiveExportError DeclarationRef [DeclarationRef]
141 | TransitiveExportError DeclarationRef [DeclarationRef]
142 | ShadowedName Ident
142 | ShadowedName Ident
143+ | ShadowedTypeVar String
144+ | UnusedTypeVar String
143 | WildcardInferredType Type
145 | WildcardInferredType Type
144 | NotExhaustivePattern [[Binder]] Bool
146 | NotExhaustivePattern [[Binder]] Bool
145 | OverlappingPattern [[Binder]] Bool
147 | OverlappingPattern [[Binder]] Bool
@@ -168,6 +170,7 @@ data ErrorMessage
168 | ErrorInDataBindingGroup ErrorMessage
170 | ErrorInDataBindingGroup ErrorMessage
169 | ErrorInTypeSynonym ProperName ErrorMessage
171 | ErrorInTypeSynonym ProperName ErrorMessage
170 | ErrorInValueDeclaration Ident ErrorMessage
172 | ErrorInValueDeclaration Ident ErrorMessage
173+ | ErrorInTypeDeclaration Ident ErrorMessage
171 | ErrorInForeignImport Ident ErrorMessage
174 | ErrorInForeignImport Ident ErrorMessage
172 | PositionedError SourceSpan ErrorMessage
175 | PositionedError SourceSpan ErrorMessage
173 | SimpleErrorWrapper SimpleErrorMessage
176 | SimpleErrorWrapper SimpleErrorMessage
@@ -266,6 +269,8 @@ errorCode em = case unwrapErrorMessage em of
266 InvalidInstanceHead{} -> "InvalidInstanceHead"
269 InvalidInstanceHead{} -> "InvalidInstanceHead"
267 TransitiveExportError{} -> "TransitiveExportError"
270 TransitiveExportError{} -> "TransitiveExportError"
268 ShadowedName{} -> "ShadowedName"
271 ShadowedName{} -> "ShadowedName"
272+ ShadowedTypeVar{} -> "ShadowedTypeVar"
273+ UnusedTypeVar{} -> "UnusedTypeVar"
269 WildcardInferredType{} -> "WildcardInferredType"
274 WildcardInferredType{} -> "WildcardInferredType"
270 NotExhaustivePattern{} -> "NotExhaustivePattern"
275 NotExhaustivePattern{} -> "NotExhaustivePattern"
271 OverlappingPattern{} -> "OverlappingPattern"
276 OverlappingPattern{} -> "OverlappingPattern"
@@ -336,6 +341,7 @@ unwrapErrorMessage em = case em of
336 (ErrorInTypeConstructor _ err) -> unwrapErrorMessage err
341 (ErrorInTypeConstructor _ err) -> unwrapErrorMessage err
337 (ErrorInTypeSynonym _ err) -> unwrapErrorMessage err
342 (ErrorInTypeSynonym _ err) -> unwrapErrorMessage err
338 (ErrorInValueDeclaration _ err) -> unwrapErrorMessage err
343 (ErrorInValueDeclaration _ err) -> unwrapErrorMessage err
344+ (ErrorInTypeDeclaration _ err) -> unwrapErrorMessage err
339 (ErrorInferringType _ err) -> unwrapErrorMessage err
345 (ErrorInferringType _ err) -> unwrapErrorMessage err
340 (ErrorUnifyingTypes _ _ err) -> unwrapErrorMessage err
346 (ErrorUnifyingTypes _ _ err) -> unwrapErrorMessage err
341 (NotYetDefined _ err) -> unwrapErrorMessage err
347 (NotYetDefined _ err) -> unwrapErrorMessage err
@@ -382,6 +388,7 @@ onTypesInErrorMessageM f = g
382 g (ErrorInDataBindingGroup e) = ErrorInDataBindingGroup <$> (g e)
388 g (ErrorInDataBindingGroup e) = ErrorInDataBindingGroup <$> (g e)
383 g (ErrorInTypeSynonym x e) = ErrorInTypeSynonym x <$> (g e)
389 g (ErrorInTypeSynonym x e) = ErrorInTypeSynonym x <$> (g e)
384 g (ErrorInValueDeclaration x e) = ErrorInValueDeclaration x <$> (g e)
390 g (ErrorInValueDeclaration x e) = ErrorInValueDeclaration x <$> (g e)
391+ g (ErrorInTypeDeclaration x e) = ErrorInTypeDeclaration x <$> (g e)
385 g (ErrorInForeignImport x e) = ErrorInForeignImport x <$> (g e)
392 g (ErrorInForeignImport x e) = ErrorInForeignImport x <$> (g e)
386 g (PositionedError x e) = PositionedError x <$> (g e)
393 g (PositionedError x e) = PositionedError x <$> (g e)
387 g (SimpleErrorWrapper sem) = SimpleErrorWrapper <$> gSimple sem
394 g (SimpleErrorWrapper sem) = SimpleErrorWrapper <$> gSimple sem
@@ -628,7 +635,11 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
628 paras $ line ("An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
635 paras $ line ("An export for " ++ prettyPrintExport x ++ " requires the following to also be exported: ")
629 : map (line . prettyPrintExport) ys
636 : map (line . prettyPrintExport) ys
630 goSimple (ShadowedName nm) =
637 goSimple (ShadowedName nm) =
631− line $ "Name '" ++ showIdent nm ++ "' was shadowed."
638+ line $ "Name '" ++ showIdent nm ++ "' was shadowed"
639+ goSimple (ShadowedTypeVar tv) =
640+ line $ "Type variable '" ++ tv ++ "' was shadowed"
641+ goSimple (UnusedTypeVar tv) =
642+ line $ "Type variable '" ++ tv ++ "' was declared but not used"
632 goSimple (ClassOperator className opName) =
643 goSimple (ClassOperator className opName) =
633 paras [ line $ "Class '" ++ runProperName className ++ "' declares operator " ++ showIdent opName ++ "."
644 paras [ line $ "Class '" ++ runProperName className ++ "' declares operator " ++ showIdent opName ++ "."
634 , indent $ line "This may be disallowed in the future - consider declaring a named member in the class and making the operator an alias:"
645 , indent $ line "This may be disallowed in the future - consider declaring a named member in the class and making the operator an alias:"
@@ -732,6 +743,10 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
732 paras [ lineWithLevel $ "in value declaration " ++ showIdent n ++ ":"
743 paras [ lineWithLevel $ "in value declaration " ++ showIdent n ++ ":"
746+ go (ErrorInTypeDeclaration n err) =
747+ paras [ lineWithLevel $ "in type declaration for " ++ showIdent n ++ ":"
735 go (ErrorInForeignImport nm err) =
750 go (ErrorInForeignImport nm err) =
736 paras [ lineWithLevel $ "in foreign import " ++ showIdent nm ++ ":"
751 paras [ lineWithLevel $ "in foreign import " ++ showIdent nm ++ ":"
@@ -797,6 +812,7 @@ prettyPrintSingleError full level e = prettyPrintErrorMessage <$> onTypesInError
797 unwrap pos (ErrorInDataBindingGroup err) = ErrorInDataBindingGroup (unwrap pos err)
812 unwrap pos (ErrorInDataBindingGroup err) = ErrorInDataBindingGroup (unwrap pos err)
798 unwrap pos (ErrorInTypeSynonym nm err) = ErrorInTypeSynonym nm (unwrap pos err)
813 unwrap pos (ErrorInTypeSynonym nm err) = ErrorInTypeSynonym nm (unwrap pos err)
799 unwrap pos (ErrorInValueDeclaration nm err) = ErrorInValueDeclaration nm (unwrap pos err)
814 unwrap pos (ErrorInValueDeclaration nm err) = ErrorInValueDeclaration nm (unwrap pos err)
815+ unwrap pos (ErrorInTypeDeclaration nm err) = ErrorInTypeDeclaration nm (unwrap pos err)
800 unwrap pos (ErrorInForeignImport nm err) = ErrorInForeignImport nm (unwrap pos err)
816 unwrap pos (ErrorInForeignImport nm err) = ErrorInForeignImport nm (unwrap pos err)
801 unwrap pos (NotYetDefined ns err) = NotYetDefined ns (unwrap pos err)
817 unwrap pos (NotYetDefined ns err) = NotYetDefined ns (unwrap pos err)
802 unwrap _ (PositionedError pos err) = unwrap (Just pos) err
818 unwrap _ (PositionedError pos err) = unwrap (Just pos) err