diff --git a/purescript.cabal b/purescript.cabal index 84458234c4..36c07b51ad 100644 --- a/purescript.cabal +++ b/purescript.cabal @@ -342,6 +342,7 @@ library Language.PureScript.Sugar.Names.Env Language.PureScript.Sugar.Names.Exports Language.PureScript.Sugar.Names.Imports + Language.PureScript.Sugar.Names.Requalify Language.PureScript.Sugar.ObjectWildcards Language.PureScript.Sugar.Operators Language.PureScript.Sugar.Operators.Binders diff --git a/src/Language/PureScript/Errors.hs b/src/Language/PureScript/Errors.hs index eecbfc3ce3..db524e154b 100644 --- a/src/Language/PureScript/Errors.hs +++ b/src/Language/PureScript/Errors.hs @@ -104,6 +104,7 @@ data SimpleErrorMessage | UndefinedTypeVariable (ProperName 'TypeName) | PartiallyAppliedSynonym (Qualified (ProperName 'TypeName)) | EscapedSkolem Text (Maybe SourceSpan) SourceType + | TypeConstructorsDoNotUnify ModuleName SourceType ModuleName SourceType | TypesDoNotUnify SourceType SourceType | KindsDoNotUnify SourceType SourceType | ConstrainedTypeUnified SourceType SourceType @@ -283,6 +284,7 @@ errorCode em = case unwrapErrorMessage em of UndefinedTypeVariable{} -> "UndefinedTypeVariable" PartiallyAppliedSynonym{} -> "PartiallyAppliedSynonym" EscapedSkolem{} -> "EscapedSkolem" + TypeConstructorsDoNotUnify{} -> "TypeConstructorsDoNotUnify" TypesDoNotUnify{} -> "TypesDoNotUnify" KindsDoNotUnify{} -> "KindsDoNotUnify" ConstrainedTypeUnified{} -> "ConstrainedTypeUnified" @@ -410,6 +412,13 @@ addHint hint = addHints [hint] addHints :: [ErrorMessageHint] -> MultipleErrors -> MultipleErrors addHints hints = onErrorMessages $ \(ErrorMessage hints' se) -> ErrorMessage (hints ++ hints') se +mkTypesDoNotUnify :: SourceType -> SourceType -> SimpleErrorMessage +mkTypesDoNotUnify + t1@(TypeConstructor _ (Qualified (ByModuleName mn1) _)) + t2@(TypeConstructor _ (Qualified (ByModuleName mn2) _)) + = TypeConstructorsDoNotUnify mn1 t1 mn2 t2 +mkTypesDoNotUnify t1 t2 = TypesDoNotUnify t1 t2 + -- | A map from rigid type variable name/unknown variable pairs to new variables. data TypeMap = TypeMap { umSkolemMap :: M.Map Int (String, Int, Maybe SourceSpan) @@ -462,7 +471,9 @@ onTypesInErrorMessageM :: Applicative m => (SourceType -> m SourceType) -> Error onTypesInErrorMessageM f (ErrorMessage hints simple) = ErrorMessage <$> traverse gHint hints <*> gSimple simple where gSimple (InfiniteType t) = InfiniteType <$> f t + gSimple (TypeConstructorsDoNotUnify mn1 t1 mn2 t2) = TypeConstructorsDoNotUnify mn1 <$> f t1 <*> pure mn2 <*> f t2 gSimple (TypesDoNotUnify t1 t2) = TypesDoNotUnify <$> f t1 <*> f t2 + gSimple (KindsDoNotUnify t1 t2) = KindsDoNotUnify <$> f t1 <*> f t2 gSimple (ConstrainedTypeUnified t1 t2) = ConstrainedTypeUnified <$> f t1 <*> f t2 gSimple (ExprDoesNotHaveType e t) = ExprDoesNotHaveType e <$> f t gSimple (InvalidInstanceHead t) = InvalidInstanceHead <$> f t @@ -855,6 +866,16 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath fileCon , line "with type" , row2Box ] + renderSimpleErrorMessage (TypeConstructorsDoNotUnify mn1 u1 mn2 u2) + = let (row1Box, row2Box) = printRows u1 u2 + + in paras [ line "Could not match type" + , row1Box + , line $ "(defined in module " <> markCode (runModuleName mn1) <> ")" + , line "with type" + , row2Box + , line $ "(defined in module " <> markCode (runModuleName mn2) <> ")" + ] renderSimpleErrorMessage (KindsDoNotUnify k1 k2) = paras [ line "Could not match kind" @@ -1564,14 +1585,13 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath fileCon -- If verbose print all rows else only print unique rows printRows :: Type a -> Type a -> (Box.Box, Box.Box) printRows r1 r2 = case (full, r1, r2) of - (True, _ , _) -> (printRow typeAsBox r1, printRow typeAsBox r2) + (True, _ , _) -> (printRow prettyTypeWithDepth r1, printRow prettyTypeWithDepth r2) (_, RCons{}, RCons{}) -> let (sorted1, sorted2) = filterRows (rowToList r1) (rowToList r2) in (printRow typeDiffAsBox sorted1, printRow typeDiffAsBox sorted2) - (_, _, _) -> (printRow typeAsBox r1, printRow typeAsBox r2) - + (_, _, _) -> (printRow prettyTypeWithDepth r1, printRow prettyTypeWithDepth r2) -- Keep the unique labels only filterRows :: ([RowListItem a], Type a) -> ([RowListItem a], Type a) -> (Type a, Type a) @@ -1646,13 +1666,15 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath fileCon prettyTypeWithDepth :: Int -> Type a -> Box.Box prettyTypeWithDepth depth - | full = typeAsBox depth - | otherwise = typeAsBox depth . eraseForAllKindAnnotations . eraseKindApps + | full = typeAsBoxWith depth prettyOptions + | otherwise = typeAsBoxWith depth prettyOptions . eraseForAllKindAnnotations . eraseKindApps prettyTypeAtom :: Type a -> Box.Box prettyTypeAtom - | full = typeAtomAsBox prettyDepth - | otherwise = typeAtomAsBox prettyDepth . eraseForAllKindAnnotations . eraseKindApps + | full = typeAtomAsBoxWith prettyDepth prettyOptions + | otherwise = typeAtomAsBoxWith prettyDepth prettyOptions . eraseForAllKindAnnotations . eraseKindApps + + prettyOptions = defaultTypeRenderOptions { troDisqualifyNames = False } levelText :: Text levelText = case level of @@ -1684,6 +1706,10 @@ prettyPrintSingleError (PPEOptions codeColor full level showDocs relPath fileCon where isCheckHint ErrorCheckingType{} = True isCheckHint _ = False + stripRedundantHints TypeConstructorsDoNotUnify{} = stripFirst isUnifyHint + where + isUnifyHint ErrorUnifyingTypes{} = True + isUnifyHint _ = False stripRedundantHints TypesDoNotUnify{} = stripFirst isUnifyHint where isUnifyHint ErrorUnifyingTypes{} = True diff --git a/src/Language/PureScript/Make.hs b/src/Language/PureScript/Make.hs index d9e7157f16..efffb80e60 100644 --- a/src/Language/PureScript/Make.hs +++ b/src/Language/PureScript/Make.hs @@ -41,6 +41,7 @@ import Language.PureScript.ModuleDependencies import Language.PureScript.Names import Language.PureScript.Renamer import Language.PureScript.Sugar +import Language.PureScript.Sugar.Names.Requalify import Language.PureScript.TypeChecker import Language.PureScript.Make.BuildPlan import qualified Language.PureScript.Make.BuildPlan as BuildPlan @@ -87,13 +88,14 @@ rebuildModuleWithIndex rebuildModuleWithIndex MakeActions{..} exEnv externs m@(Module _ _ moduleName _ _) moduleIndex = do progress $ CompilingModule moduleName moduleIndex let env = foldl' (flip applyExternsFileToEnvironment) initEnvironment externs - withPrim = importPrim m + withPrim = importPrim m -- TODO: are we importing Prim twice lint withPrim ((Module ss coms _ elaborated exps, env'), nextVar) <- runSupplyT 0 $ do (desugared, (exEnv', usedImports)) <- runStateT (desugar externs withPrim) (exEnv, mempty) let modulesExports = (\(_, _, exports) -> exports) <$> exEnv' - (checked, CheckState{..}) <- runStateT (typeCheckModule modulesExports desugared) $ emptyCheckState env + localImports = maybe (internalError "no local imports") (\(_, imports, _) -> imports) $ M.lookup moduleName exEnv' + (checked, CheckState{..}) <- rethrow (requalifyTypesInErrors localImports) $ runStateT (typeCheckModule modulesExports desugared) $ emptyCheckState env let usedImports' = foldl' (flip $ \(fromModuleName, newtypeCtorName) -> M.alter (Just . (fmap DctorName newtypeCtorName :) . fold) fromModuleName) usedImports checkConstructorImportsForCoercible -- Imports cannot be linted before type checking because we need to diff --git a/src/Language/PureScript/Names.hs b/src/Language/PureScript/Names.hs index 16dda5e1bb..20fc554de5 100644 --- a/src/Language/PureScript/Names.hs +++ b/src/Language/PureScript/Names.hs @@ -127,7 +127,7 @@ isPlainIdent _ = False -- Operator alias names. -- newtype OpName (a :: OpNameType) = OpName { runOpName :: Text } - deriving (Show, Eq, Ord, Generic) + deriving (Show, Read, Eq, Ord, Generic) instance NFData (OpName a) instance Serialise (OpName a) @@ -156,7 +156,7 @@ coerceOpName = OpName . runOpName -- Proper names, i.e. capitalized names for e.g. module names, type//data constructors. -- newtype ProperName (a :: ProperNameType) = ProperName { runProperName :: Text } - deriving (Show, Eq, Ord, Generic) + deriving (Show, Read, Eq, Ord, Generic) instance NFData (ProperName a) instance Serialise (ProperName a) @@ -188,7 +188,7 @@ coerceProperName = ProperName . runProperName -- Module names -- newtype ModuleName = ModuleName Text - deriving (Show, Eq, Ord, Generic) + deriving (Show, Read, Eq, Ord, Generic) deriving newtype Serialise instance NFData ModuleName diff --git a/src/Language/PureScript/Pretty/Types.hs b/src/Language/PureScript/Pretty/Types.hs index d7c90374c3..d5ad6bf140 100644 --- a/src/Language/PureScript/Pretty/Types.hs +++ b/src/Language/PureScript/Pretty/Types.hs @@ -7,13 +7,17 @@ module Language.PureScript.Pretty.Types ( PrettyPrintType(..) , PrettyPrintConstraint + , TypeRenderOptions(..) + , defaultTypeRenderOptions , convertPrettyPrintType , typeAsBox + , typeAsBoxWith , typeDiffAsBox , prettyPrintType , prettyPrintTypeWithUnicode , prettyPrintSuggestedType , typeAtomAsBox + , typeAtomAsBoxWith , prettyPrintTypeAtom , prettyPrintLabel , prettyPrintObjectKey @@ -181,7 +185,7 @@ explicitParens = mkPattern match match _ = Nothing matchTypeAtom :: TypeRenderOptions -> Pattern () PrettyPrintType Box -matchTypeAtom tro@TypeRenderOptions{troSuggesting = suggesting} = +matchTypeAtom tro@TypeRenderOptions{troSuggesting = suggesting, troDisqualifyNames = disqualifying} = typeLiterals <+> fmap ((`before` text ")") . (text "(" <>)) (matchType tro) where typeLiterals :: Pattern () PrettyPrintType Box @@ -190,7 +194,10 @@ matchTypeAtom tro@TypeRenderOptions{troSuggesting = suggesting} = match (PPTypeVar var _) = Just $ text $ T.unpack var match (PPTypeLevelString s) = Just $ text $ T.unpack $ prettyPrintString s match (PPTypeLevelInt n) = Just $ text $ show n - match (PPTypeConstructor ctor) = Just $ text $ T.unpack $ runProperName $ disqualify ctor + match (PPTypeConstructor ctor) = Just $ text $ T.unpack $ + if disqualifying + then runProperName $ disqualify ctor + else showQualified runProperName ctor match (PPTUnknown u) | suggesting = Just $ text "_" | otherwise = Just $ text $ 't' : show u @@ -238,10 +245,16 @@ forall_ = mkPattern match match (PPForAll idents ty) = Just (map (first T.unpack) idents, ty) match _ = Nothing -typeAtomAsBox' :: PrettyPrintType -> Box -typeAtomAsBox' +typeAtomAsBoxWith' :: TypeRenderOptions -> PrettyPrintType -> Box +typeAtomAsBoxWith' tro = fromMaybe (internalError "Incomplete pattern") - . PA.pattern (matchTypeAtom defaultOptions) () + . PA.pattern (matchTypeAtom tro) () + +typeAtomAsBox' :: PrettyPrintType -> Box +typeAtomAsBox' = typeAtomAsBoxWith' defaultTypeRenderOptions + +typeAtomAsBoxWith :: Int -> TypeRenderOptions -> Type a -> Box +typeAtomAsBoxWith maxDepth tro = typeAtomAsBoxWith' tro . convertPrettyPrintType maxDepth typeAtomAsBox :: Int -> Type a -> Box typeAtomAsBox maxDepth = typeAtomAsBox' . convertPrettyPrintType maxDepth @@ -250,14 +263,22 @@ typeAtomAsBox maxDepth = typeAtomAsBox' . convertPrettyPrintType maxDepth prettyPrintTypeAtom :: Int -> Type a -> String prettyPrintTypeAtom maxDepth = render . typeAtomAsBox maxDepth +typeAsBoxWith' :: TypeRenderOptions -> PrettyPrintType -> Box +typeAsBoxWith' tro + = fromMaybe (internalError "Incomplete pattern") + . PA.pattern (matchType tro) () + +typeAsBoxWith :: Int -> TypeRenderOptions -> Type a -> Box +typeAsBoxWith maxDepth tro = typeAsBoxWith' tro . convertPrettyPrintType maxDepth + typeAsBox' :: PrettyPrintType -> Box -typeAsBox' = typeAsBoxImpl defaultOptions +typeAsBox' = typeAsBoxWith' defaultTypeRenderOptions typeAsBox :: Int -> Type a -> Box typeAsBox maxDepth = typeAsBox' . convertPrettyPrintType maxDepth typeDiffAsBox' :: PrettyPrintType -> Box -typeDiffAsBox' = typeAsBoxImpl diffOptions +typeDiffAsBox' = typeAsBoxWith' diffOptions typeDiffAsBox :: Int -> Type a -> Box typeDiffAsBox maxDepth = typeDiffAsBox' . convertPrettyPrintType maxDepth @@ -266,28 +287,29 @@ data TypeRenderOptions = TypeRenderOptions { troSuggesting :: Bool , troUnicode :: Bool , troRowAsDiff :: Bool + , troDisqualifyNames :: Bool } -suggestingOptions :: TypeRenderOptions -suggestingOptions = TypeRenderOptions True False False +defaultTypeRenderOptions :: TypeRenderOptions +defaultTypeRenderOptions = TypeRenderOptions + { troSuggesting = False + , troUnicode = False + , troRowAsDiff = False + , troDisqualifyNames = True + } -defaultOptions :: TypeRenderOptions -defaultOptions = TypeRenderOptions False False False +suggestingOptions :: TypeRenderOptions +suggestingOptions = defaultTypeRenderOptions { troSuggesting = True } diffOptions :: TypeRenderOptions -diffOptions = TypeRenderOptions False False True +diffOptions = defaultTypeRenderOptions { troRowAsDiff = True } unicodeOptions :: TypeRenderOptions -unicodeOptions = TypeRenderOptions False True False - -typeAsBoxImpl :: TypeRenderOptions -> PrettyPrintType -> Box -typeAsBoxImpl tro - = fromMaybe (internalError "Incomplete pattern") - . PA.pattern (matchType tro) () +unicodeOptions = defaultTypeRenderOptions { troUnicode = True } -- | Generate a pretty-printed string representing a 'Type' prettyPrintType :: Int -> Type a -> String -prettyPrintType = flip prettyPrintType' defaultOptions +prettyPrintType = flip prettyPrintType' defaultTypeRenderOptions -- | Generate a pretty-printed string representing a 'Type' using unicode -- symbols where applicable @@ -299,7 +321,7 @@ prettyPrintSuggestedType :: Type a -> String prettyPrintSuggestedType = prettyPrintType' maxBound suggestingOptions prettyPrintType' :: Int -> TypeRenderOptions -> Type a -> String -prettyPrintType' maxDepth tro = render . typeAsBoxImpl tro . convertPrettyPrintType maxDepth +prettyPrintType' maxDepth tro = render . typeAsBoxWith' tro . convertPrettyPrintType maxDepth prettyPrintLabel :: Label -> Text prettyPrintLabel (Label s) = diff --git a/src/Language/PureScript/Sugar/Names/Requalify.hs b/src/Language/PureScript/Sugar/Names/Requalify.hs new file mode 100644 index 0000000000..d1e4a46880 --- /dev/null +++ b/src/Language/PureScript/Sugar/Names/Requalify.hs @@ -0,0 +1,194 @@ +-- | This module provides functions for "re-qualifying" names in a type given +-- an Imports record, so that they can be displayed unambiguously in +-- diagnostics and suggestions without unnecessary qualification. That is, +-- given a fully qualified name like `Foo.Bar.X`, this module lets you go to +-- simply `X` (no qualification) if the given Imports record includes an open +-- import for `X` from `Foo.Bar`, or alternatively if `Foo.Bar` is imported +-- like `import Foo.Bar as F` then it produces `F.X`. +module Language.PureScript.Sugar.Names.Requalify + ( ReverseImports(..) + , buildReverseImports + , requalify + , requalifyConstraint + , reverseLookup + , requalifyTypesInErrors + ) where + +import Debug.Trace +import Prelude +import Control.Monad +import qualified Data.Map as M +import Data.Maybe +import Data.Set (Set) +import qualified Data.Set as Set +import qualified Data.Text as T +import qualified Language.PureScript.Constants.Prim as Prim +import Language.PureScript.Errors +import Language.PureScript.Names +import Language.PureScript.Types +import Language.PureScript.Sugar.Names.Env + +type ReverseImportMap a = M.Map (ModuleName, a) QualifiedBy + +-- | Like an Imports record, except this only contains type and type operator +-- names, and is reversed - while an Imports record maps local names to fully +-- qualified names, this data type maps fully qualified names to local names. +-- This enables 'requalifying' qualified names with their locally qualified +-- names if any, or no qualification if they were imported open +data ReverseImports = ReverseImports + { reverseImportsTypes :: ReverseImportMap (ProperName 'TypeName) + , reverseImportsTypeOps :: ReverseImportMap (OpName 'TypeOpName) + , reverseImportsTypeClasses :: ReverseImportMap (ProperName 'ClassName) + } + deriving (Show) + +buildReverseImports :: Imports -> ReverseImports +buildReverseImports (Imports { importedTypes, importedTypeOps, importedTypeClasses }) = + trace (show revimps) revimps + where + revimps = ReverseImports + { reverseImportsTypes = + M.fromListWith preferShortest $ + mapMaybe (toReverseAssoc typeExceptions) $ + M.toList importedTypes + , reverseImportsTypeOps = + M.fromListWith preferShortest $ + mapMaybe (toReverseAssoc typeOpExceptions) $ + M.toList importedTypeOps + , reverseImportsTypeClasses = + M.fromListWith preferShortest $ + mapMaybe (toReverseAssoc typeClassExceptions) $ + M.toList importedTypeClasses + } + + preferShortest :: QualifiedBy -> QualifiedBy -> QualifiedBy + preferShortest x@(BySourcePos _) _ = x + preferShortest _ y@(BySourcePos _) = y + preferShortest (ByModuleName x) (ByModuleName y) = do + ByModuleName $ + if T.length (runModuleName x) < T.length (runModuleName y) + then x + else y + + -- | Given an entry from an ImportMap from an Imports (see Sugar.Names.Env) + -- which maps a local name to a fully qualified name, produce an entry for + -- the corresponding ReverseImports. + -- + -- TODO does this need to care about situations where this is ambiguous i.e. + -- there are two different declarations that a given name could refer to? I + -- think the answer is yes. Eg: + -- + -- import Foo as X + -- import Bar as X + -- + -- is fine, as long as you don't do X.whatever for anything that both modules + -- export + -- + -- We make exceptions for anything that has special cases in the type + -- pretty-printer such as Record and Function + toReverseAssoc :: Ord a => Set (Qualified a) -> (Qualified a, [ImportRecord a]) -> Maybe ((ModuleName, a), QualifiedBy) + toReverseAssoc exceptions (Qualified localModName name, importRecords) = + case importRecords of + [] -> + -- Probably shouldn't happen + Nothing + (ImportRecord { importName = importName@(Qualified mFullModName _) } : _) -> do + guard (not (Set.member importName exceptions)) + -- TODO need to check the whole list including provenance? eg in the + -- case of two open imports with overlap and we're warning but it still + -- compiles + fullModName <- toMaybeModuleName mFullModName + pure ((fullModName, name), localModName) + + typeExceptions :: Set (Qualified (ProperName 'TypeName)) + typeExceptions = Set.fromList + [ Prim.Function + , Prim.Record + ] + + typeOpExceptions :: Set (Qualified (OpName 'TypeOpName)) + typeOpExceptions = Set.empty + + typeClassExceptions :: Set (Qualified (ProperName 'ClassName)) + typeClassExceptions = Set.fromList + [ Prim.Fail + , Prim.Partial + ] + +-- | This module provides functions for "re-qualifying" names in a type given +-- an Imports record, so that they can be displayed unambiguously in +-- diagnostics and suggestions without unnecessary qualification. That is, +-- given a fully qualified name like `Foo.Bar.X`, this module lets you go to +-- simply `X` (no qualification) if the given Imports record includes an open +-- import for `X` from `Foo.Bar`, or alternatively if `Foo.Bar` is imported +-- like `import Foo.Bar as F` then it produces `F.X`. +requalify :: ReverseImports -> Type a -> Type a +requalify revMap = + everywhereOnTypes $ \ty -> fromMaybe ty $ case ty of + TypeConstructor ann fullyQualifiedName -> + TypeConstructor ann + <$> reverseLookup (reverseImportsTypes revMap) fullyQualifiedName + TypeOp ann fullyQualifiedName -> do + TypeOp ann + <$> reverseLookup (reverseImportsTypeOps revMap) fullyQualifiedName + ConstrainedType ann fullyQualifiedConstraint ty' -> do + localConstraint <- reverseLookup (reverseImportsTypeClasses revMap) (constraintClass fullyQualifiedConstraint) + pure (ConstrainedType ann (fullyQualifiedConstraint { constraintClass = localConstraint }) ty') + _ -> + Nothing + +requalifyConstraint :: ReverseImports -> Constraint a -> Constraint a +requalifyConstraint revMap fullyQualifiedConstraint = + fromMaybe fullyQualifiedConstraint $ do + localConstraint <- reverseLookup (reverseImportsTypeClasses revMap) (constraintClass fullyQualifiedConstraint) + pure $ fullyQualifiedConstraint + { constraintClass = localConstraint + , constraintKindArgs = requalify revMap <$> constraintKindArgs fullyQualifiedConstraint + , constraintArgs = requalify revMap <$> constraintArgs fullyQualifiedConstraint + } + +reverseLookup :: Show a => Ord a => ReverseImportMap a -> Qualified a -> Maybe (Qualified a) +reverseLookup revMap (Qualified mFullModName name) = do + fullModName <- toMaybeModuleName mFullModName + mLocalModName <- M.lookup (fullModName, name) revMap + pure $ Qualified mLocalModName name + + +-- | Convert fully qualified names in errors back to unqualified or locally +-- qualified forms in certain hints and error messages, to make errors easier +-- to understand and to avoid error messages like @Could not match type Query +-- with type Query@. +requalifyTypesInErrors :: Imports -> MultipleErrors -> MultipleErrors +requalifyTypesInErrors imports = + onErrorMessages $ \e -> + case e of + ErrorMessage hints (NoInstanceFound con ambig unks) -> + ErrorMessage hints $ NoInstanceFound (requalifyConstraint revImports con) ambig unks + _ -> onTypesInErrorMessage requal e + + where + revImports = buildReverseImports imports + requal = requalify revImports + +-- requalifyMessage = +-- TypesDoNotUnify ty1 ty2 -> TypesDoNotUnify (requal ty1) (requal ty2) +-- KindsDoNotUnify ty1 ty2 -> KindsDoNotUnify (requal ty1) (requal ty2) +-- other -> other +-- +-- requalifyHints = map $ \case +-- ErrorUnifyingTypes ty1 ty2 -> +-- ErrorUnifyingTypes (requal ty1) (requal ty2) +-- ErrorInInstance clsName tys -> +-- ErrorInInstance clsName (map requal tys) +-- ErrorInSubsumption ty1 ty2 -> +-- ErrorInSubsumption (requal ty1) (requal ty2) +-- ErrorCheckingType expr ty -> +-- ErrorCheckingType expr (requal ty) +-- ErrorCheckingKind ty1 ty2 -> +-- ErrorCheckingKind (requal ty1) (requal ty2) +-- ErrorInferringKind ty -> +-- ErrorInferringKind (requal ty) +-- ErrorInApplication expr1 ty expr2 -> +-- ErrorInApplication expr1 (requal ty) expr2 +-- other -> +-- other diff --git a/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs b/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs index ab6a2338a2..f119d81dc6 100644 --- a/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs +++ b/src/Language/PureScript/TypeChecker/Entailment/Coercible.hs @@ -598,7 +598,7 @@ canonRow a b (deriveds, (([], tail1), ([], tail2))) -> do pure . Canonicalized . S.fromList $ (tail1, tail2) : deriveds (_, (rl1, rl2)) -> - throwError . errorMessage $ TypesDoNotUnify (rowFromList rl1) (rowFromList rl2) + throwError . errorMessage $ mkTypesDoNotUnify (rowFromList rl1) (rowFromList rl2) | otherwise = empty -- | Unwraping a newtype can fails in two ways: @@ -768,7 +768,7 @@ decompose env tyName axs bxs = do | ax == bx -> pure mempty | otherwise -> - throwError . errorMessage $ TypesDoNotUnify ax bx + throwError . errorMessage $ mkTypesDoNotUnify ax bx Representational -> pure $ S.singleton (ax, bx) Phantom -> diff --git a/src/Language/PureScript/TypeChecker/Unify.hs b/src/Language/PureScript/TypeChecker/Unify.hs index 38e181b365..6a5528cd45 100644 --- a/src/Language/PureScript/TypeChecker/Unify.hs +++ b/src/Language/PureScript/TypeChecker/Unify.hs @@ -130,7 +130,7 @@ unifyTypes t1 t2 = do unifyTypes' ty f@ForAll{} = f `unifyTypes` ty unifyTypes' (TypeVar _ v1) (TypeVar _ v2) | v1 == v2 = return () unifyTypes' ty1@(TypeConstructor _ c1) ty2@(TypeConstructor _ c2) = - guardWith (errorMessage (TypesDoNotUnify ty1 ty2)) (c1 == c2) + guardWith (errorMessage (mkTypesDoNotUnify ty1 ty2)) (c1 == c2) unifyTypes' (TypeLevelString _ s1) (TypeLevelString _ s2) | s1 == s2 = return () unifyTypes' (TypeLevelInt _ n1) (TypeLevelInt _ n2) | n1 == n2 = return () unifyTypes' (TypeApp _ t3 t4) (TypeApp _ t5 t6) = do @@ -154,7 +154,7 @@ unifyTypes t1 t2 = do throwError . errorMessage $ ConstrainedTypeUnified ty1 ty2 unifyTypes' t3 t4@ConstrainedType{} = unifyTypes' t4 t3 unifyTypes' t3 t4 = - throwError . errorMessage $ TypesDoNotUnify t3 t4 + throwError . errorMessage $ mkTypesDoNotUnify t3 t4 -- | Unify two rows, updating the current substitution -- @@ -177,7 +177,7 @@ unifyRows r1 r2 = sequence_ matches *> uncurry unifyTails rest where solveType u1 (rowFromList (sd2, rest')) solveType u2 (rowFromList (sd1, rest')) unifyTails _ _ = - throwError . errorMessage $ TypesDoNotUnify r1 r2 + throwError . errorMessage $ mkTypesDoNotUnify r1 r2 -- | -- Replace type wildcards with unknowns diff --git a/tests/purs/failing/1175.out b/tests/purs/failing/1175.out index 5d8ca2447e..76c3c5141d 100644 --- a/tests/purs/failing/1175.out +++ b/tests/purs/failing/1175.out @@ -6,10 +6,12 @@ at tests/purs/failing/1175.purs:11:11 - 11:12 (line 11, column 11 - line 11, col    Int   + (defined in module Prim) with type    String   + (defined in module Prim) while checking that type Int is at least as general as type String @@ -17,6 +19,6 @@ while checking that expression 1 has type String in value declaration f -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/1175.purs b/tests/purs/failing/1175.purs index 13f1f703b9..f3a86ae542 100644 --- a/tests/purs/failing/1175.purs +++ b/tests/purs/failing/1175.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module X where class Foo where diff --git a/tests/purs/failing/1310.out b/tests/purs/failing/1310.out index 4e558ad248..23404393b1 100644 --- a/tests/purs/failing/1310.out +++ b/tests/purs/failing/1310.out @@ -3,10 +3,10 @@ in module Issue1310 at tests/purs/failing/1310.purs:18:8 - 18:31 (line 18, column 8 - line 18, column 31) No type class instance was found for -   -  Issue1310.Inject Oops  -  Effect -   +   +  Inject Oops  +  Effect +   while applying a function inj of type Inject @t0 t1 t2 => t1 t3 -> t2 t3 diff --git a/tests/purs/failing/1570.out b/tests/purs/failing/1570.out index 1b1a0fde57..5f429f21b7 100644 --- a/tests/purs/failing/1570.out +++ b/tests/purs/failing/1570.out @@ -8,9 +8,9 @@ at tests/purs/failing/1570.purs:6:10 - 6:16 (line 6, column 10 - line 6, column  F   having the kind -   -  Type -> Type -   +   +  Prim.Type -> Prim.Type +   instead. while inferring the type of \$0 ->  diff --git a/tests/purs/failing/3275-BindingGroupErrorPos.out b/tests/purs/failing/3275-BindingGroupErrorPos.out index 99207ba3b2..3c23c595aa 100644 --- a/tests/purs/failing/3275-BindingGroupErrorPos.out +++ b/tests/purs/failing/3275-BindingGroupErrorPos.out @@ -8,7 +8,7 @@ at tests/purs/failing/3275-BindingGroupErrorPos.purs:11:17 - 11:23 (line 11, col   with kind   -  Type -> t3 +  Type -> t0   while checking that type Result diff --git a/tests/purs/failing/3275-DataBindingGroupErrorPos.out b/tests/purs/failing/3275-DataBindingGroupErrorPos.out index 1039d74617..5488415337 100644 --- a/tests/purs/failing/3275-DataBindingGroupErrorPos.out +++ b/tests/purs/failing/3275-DataBindingGroupErrorPos.out @@ -7,9 +7,9 @@ at tests/purs/failing/3275-DataBindingGroupErrorPos.purs:7:19 - 7:22 (line 7, co  Type   with kind -   -  t10 -> t11 -   +   +  t0 -> t1 +   while checking that type Bar a has kind t0 -> t1 diff --git a/tests/purs/failing/3329.out b/tests/purs/failing/3329.out index ce9bbe6c77..ad34cb45ad 100644 --- a/tests/purs/failing/3329.out +++ b/tests/purs/failing/3329.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/3329.purs:24:8 - 24:11 (line 24, column 8 - line 24, column 11) No type class instance was found for -   -  Main.Inject g0  -  (Either f1 g0) -   +   +  Inject g0  +  (Either f1 g0) +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: Main.injectLeft diff --git a/tests/purs/failing/3531-2.out b/tests/purs/failing/3531-2.out index dcb39d4592..4bac28bf2e 100644 --- a/tests/purs/failing/3531-2.out +++ b/tests/purs/failing/3531-2.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/3531-2.purs:22:11 - 22:22 (line 22, column 11 - line 22, column 22) No type class instance was found for -   -  Main.C (X t2 Int) -   +   +  C (X t2 Int) +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: Main.cx diff --git a/tests/purs/failing/3531-3.out b/tests/purs/failing/3531-3.out index 8f52a662cc..d0dae73681 100644 --- a/tests/purs/failing/3531-3.out +++ b/tests/purs/failing/3531-3.out @@ -3,15 +3,15 @@ in module Main at tests/purs/failing/3531-3.purs:22:11 - 22:22 (line 22, column 11 - line 22, column 22) No type class instance was found for -   -  Main.C (X  -  { foo :: Int -  | t1  -  }  -  { foo :: Int -  }  -  )  -   +   +  C (X  +  { foo :: Int +  | t1  +  }  +  { foo :: Int +  }  +  )  +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: Main.cx diff --git a/tests/purs/failing/3531-4.out b/tests/purs/failing/3531-4.out index 04b5b756d5..725a306d66 100644 --- a/tests/purs/failing/3531-4.out +++ b/tests/purs/failing/3531-4.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/3531-4.purs:21:7 - 21:27 (line 21, column 7 - line 21, column 27) No type class instance was found for -   -  Main.C a4 -  b5 -   +   +  C a4 +  b5 +   The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered: Main.c1 diff --git a/tests/purs/failing/3531-5.out b/tests/purs/failing/3531-5.out index f82fb0d6a1..660fc54e3e 100644 --- a/tests/purs/failing/3531-5.out +++ b/tests/purs/failing/3531-5.out @@ -3,13 +3,13 @@ in module Main at tests/purs/failing/3531-5.purs:16:7 - 16:27 (line 16, column 7 - line 16, column 27) No type class instance was found for -   -  Main.C a4 -  b5 -   +   +  C a4 +  b5 +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: - instance in module Main with type forall a. C String (Array a) (line 9, column 1 - line 10, column 15) + instance in module Main with type forall a. Main.C Prim.String (Prim.Array a) (line 9, column 1 - line 10, column 15) while applying a function c diff --git a/tests/purs/failing/3531-6.out b/tests/purs/failing/3531-6.out index f454d0679e..faec02139f 100644 --- a/tests/purs/failing/3531-6.out +++ b/tests/purs/failing/3531-6.out @@ -3,14 +3,14 @@ in module Main at tests/purs/failing/3531-6.purs:21:7 - 21:27 (line 21, column 7 - line 21, column 27) No type class instance was found for -   -  Main.C a4 -  b5 -   +   +  C a4 +  b5 +   The following instances partially overlap the above constraint, which means the rest of their instance chains will not be considered: - instance in module Main with type forall a. C String (Array a) (line 9, column 1 - line 10, column 15) - instance in module Main with type C Int Int (line 14, column 1 - line 15, column 15) + instance in module Main with type forall a. Main.C Prim.String (Prim.Array a) (line 9, column 1 - line 10, column 15) + instance in module Main with type Main.C Prim.Int Prim.Int (line 14, column 1 - line 15, column 15) while applying a function c diff --git a/tests/purs/failing/3531.out b/tests/purs/failing/3531.out index 71e3f55972..d3b19a02c5 100644 --- a/tests/purs/failing/3531.out +++ b/tests/purs/failing/3531.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/3531.purs:16:7 - 16:27 (line 16, column 7 - line 16, column 27) No type class instance was found for -   -  Main.C a2 -   +   +  C a2 +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: Main.c1 diff --git a/tests/purs/failing/3765-kinds.out b/tests/purs/failing/3765-kinds.out index 138b69ba35..55531b60db 100644 --- a/tests/purs/failing/3765-kinds.out +++ b/tests/purs/failing/3765-kinds.out @@ -5,13 +5,13 @@ at tests/purs/failing/3765-kinds.purs:7:28 - 7:29 (line 7, column 28 - line 7, c Could not match kind    ( a :: Int -  | t11  +  | t0   )    with kind    ( b :: Int -  | t11  +  | t0   )    diff --git a/tests/purs/failing/4024-2.out b/tests/purs/failing/4024-2.out index af53a798d9..6fa44c2709 100644 --- a/tests/purs/failing/4024-2.out +++ b/tests/purs/failing/4024-2.out @@ -3,11 +3,11 @@ in module Main at tests/purs/failing/4024-2.purs:10:8 - 10:13 (line 10, column 8 - line 10, column 13) No type class instance was found for -   -  Main.Foo t2  -  t3  -  String -   +   +  Foo t2  +  t3  +  String +   The instance head contains unknown type variables. Consider adding a type annotation. while applying a function bar diff --git a/tests/purs/failing/4024.out b/tests/purs/failing/4024.out index 15184fe83e..07877fb218 100644 --- a/tests/purs/failing/4024.out +++ b/tests/purs/failing/4024.out @@ -3,11 +3,11 @@ in module Main at tests/purs/failing/4024.purs:10:8 - 10:13 (line 10, column 8 - line 10, column 13) No type class instance was found for -   -  Main.Foo String -  t2  -  t3  -   +   +  Foo String +  t2  +  t3  +   while applying a function bar of type Foo @Type @t0 @t1 String t2 t3 => Int -> String diff --git a/tests/purs/failing/4028.out b/tests/purs/failing/4028.out index 477c18364a..22f2ae5254 100644 --- a/tests/purs/failing/4028.out +++ b/tests/purs/failing/4028.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/4028.purs:29:12 - 29:37 (line 29, column 12 - line 29, column 37) No type class instance was found for -   -  Main.TLShow (S i2) -   +   +  TLShow (S i2) +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: Main.tlShow2 diff --git a/tests/purs/failing/ArrayType.out b/tests/purs/failing/ArrayType.out index 3c892bd842..9da9e9aa84 100644 --- a/tests/purs/failing/ArrayType.out +++ b/tests/purs/failing/ArrayType.out @@ -6,10 +6,12 @@ at tests/purs/failing/ArrayType.purs:10:7 - 10:8 (line 10, column 7 - line 10, c    Int   + (defined in module Prim) with type    Number   + (defined in module Prim) while checking that type Int is at least as general as type Number @@ -17,6 +19,6 @@ while checking that expression x has type Number in value declaration foo -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/ArrayType.purs b/tests/purs/failing/ArrayType.purs index 708fa5cdf4..86df70893e 100644 --- a/tests/purs/failing/ArrayType.purs +++ b/tests/purs/failing/ArrayType.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where diff --git a/tests/purs/failing/CoercibleHigherKindedData.out b/tests/purs/failing/CoercibleHigherKindedData.out index afad7f895c..2550728cd7 100644 --- a/tests/purs/failing/CoercibleHigherKindedData.out +++ b/tests/purs/failing/CoercibleHigherKindedData.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleHigherKindedData.purs:13:17 - 13:23 (line 13, column 17 - line 13, column 23) No type class instance was found for -   -  Prim.Coerce.Coercible (Unary t5)  -  (Binary a3 t5) -   +   +  Prim.Coerce.Coercible (Main.Unary t5)  +  (Main.Binary a3 t5) +   The instance head contains unknown type variables. Consider adding a type annotation. while solving type class constraint diff --git a/tests/purs/failing/CoercibleHigherKindedNewtypes.out b/tests/purs/failing/CoercibleHigherKindedNewtypes.out index 39c89d83dc..c997cefd6c 100644 --- a/tests/purs/failing/CoercibleHigherKindedNewtypes.out +++ b/tests/purs/failing/CoercibleHigherKindedNewtypes.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleHigherKindedNewtypes.purs:13:8 - 13:14 (line 13, column 8 - line 13, column 14) No type class instance was found for -   -  Prim.Coerce.Coercible Int  -  String -   +   +  Prim.Coerce.Coercible Prim.Int  +  Prim.String +   while solving type class constraint   diff --git a/tests/purs/failing/CoercibleKindMismatch.out b/tests/purs/failing/CoercibleKindMismatch.out index 30ef9b17fc..41e5c172ed 100644 --- a/tests/purs/failing/CoercibleKindMismatch.out +++ b/tests/purs/failing/CoercibleKindMismatch.out @@ -7,9 +7,9 @@ at tests/purs/failing/CoercibleKindMismatch.purs:15:17 - 15:23 (line 15, column  Type   with kind -   -  t29 -> Type -   +   +  t2 -> Type +   while solving type class constraint   diff --git a/tests/purs/failing/CoercibleNominalTypeApp.out b/tests/purs/failing/CoercibleNominalTypeApp.out index 2cc4b5a2a9..26c5e27fec 100644 --- a/tests/purs/failing/CoercibleNominalTypeApp.out +++ b/tests/purs/failing/CoercibleNominalTypeApp.out @@ -6,10 +6,12 @@ at tests/purs/failing/CoercibleNominalTypeApp.purs:13:8 - 13:14 (line 13, column    Int   + (defined in module Prim) with type    String   + (defined in module Prim) while solving type class constraint   @@ -22,6 +24,6 @@ while checking that expression coerce has type G @Type Maybe Int -> G @Type Maybe String in value declaration gToG -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CoercibleNominalTypeApp.purs b/tests/purs/failing/CoercibleNominalTypeApp.purs index 80112d2c8e..0087fedb9c 100644 --- a/tests/purs/failing/CoercibleNominalTypeApp.purs +++ b/tests/purs/failing/CoercibleNominalTypeApp.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Safe.Coerce (coerce) diff --git a/tests/purs/failing/CoercibleNonCanonical1.out b/tests/purs/failing/CoercibleNonCanonical1.out index 80405754e0..93bfdee622 100644 --- a/tests/purs/failing/CoercibleNonCanonical1.out +++ b/tests/purs/failing/CoercibleNonCanonical1.out @@ -3,16 +3,11 @@ in module Main at tests/purs/failing/CoercibleNonCanonical1.purs:11:27 - 11:33 (line 11, column 27 - line 11, column 33) No type class instance was found for -   -  Prim.Coerce.Coercible a0  -  (D (N a0)) -   +   +  Coercible a0  +  (D (N a0)) +   -while solving type class constraint -  - Prim.Coerce.Coercible a0  - (N @Type a0) -  while checking that type forall (a :: Type) (b :: Type). Coercible @Type a b => a -> b is at least as general as type a0 -> N @Type a0 while checking that expression coerce diff --git a/tests/purs/failing/CoercibleNonCanonical2.out b/tests/purs/failing/CoercibleNonCanonical2.out index b1bb270ff2..6d963627e1 100644 --- a/tests/purs/failing/CoercibleNonCanonical2.out +++ b/tests/purs/failing/CoercibleNonCanonical2.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleNonCanonical2.purs:10:27 - 10:33 (line 10, column 27 - line 10, column 33) No type class instance was found for -   -  Prim.Coerce.Coercible a0 -  b1 -   +   +  Coercible a0 +  b1 +   while checking that type forall (a :: Type) (b :: Type). Coercible @Type a b => a -> b is at least as general as type a0 -> b1 diff --git a/tests/purs/failing/CoercibleRepresentational2.out b/tests/purs/failing/CoercibleRepresentational2.out index 435c8421cc..1d3556478d 100644 --- a/tests/purs/failing/CoercibleRepresentational2.out +++ b/tests/purs/failing/CoercibleRepresentational2.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational2.purs:9:14 - 9:20 (line 9, column 14 - line 9, column 20) No type class instance was found for -   -  Prim.Coerce.Coercible Int  -  String -   +   +  Prim.Coerce.Coercible Prim.Int  +  Prim.String +   while solving type class constraint   diff --git a/tests/purs/failing/CoercibleRepresentational3.out b/tests/purs/failing/CoercibleRepresentational3.out index f718b3c4cb..fe665bf9e3 100644 --- a/tests/purs/failing/CoercibleRepresentational3.out +++ b/tests/purs/failing/CoercibleRepresentational3.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational3.purs:9:14 - 9:20 (line 9, column 14 - line 9, column 20) No type class instance was found for -   -  Prim.Coerce.Coercible Int  -  String -   +   +  Prim.Coerce.Coercible Prim.Int  +  Prim.String +   while solving type class constraint   diff --git a/tests/purs/failing/CoercibleRepresentational4.out b/tests/purs/failing/CoercibleRepresentational4.out index 50d61e5c8b..71d50d6e7a 100644 --- a/tests/purs/failing/CoercibleRepresentational4.out +++ b/tests/purs/failing/CoercibleRepresentational4.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational4.purs:11:38 - 11:44 (line 11, column 38 - line 11, column 44) No type class instance was found for -   -  Prim.Coerce.Coercible Int  -  String -   +   +  Prim.Coerce.Coercible Prim.Int  +  Prim.String +   while solving type class constraint   diff --git a/tests/purs/failing/CoercibleRepresentational5.out b/tests/purs/failing/CoercibleRepresentational5.out index 6c215721cf..afe78f2599 100644 --- a/tests/purs/failing/CoercibleRepresentational5.out +++ b/tests/purs/failing/CoercibleRepresentational5.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational5.purs:15:38 - 15:44 (line 15, column 38 - line 15, column 44) No type class instance was found for -   -  Prim.Coerce.Coercible Int  -  String -   +   +  Prim.Coerce.Coercible Prim.Int  +  Prim.String +   while solving type class constraint   diff --git a/tests/purs/failing/CoercibleRepresentational6.out b/tests/purs/failing/CoercibleRepresentational6.out index a587159c40..14f549a356 100644 --- a/tests/purs/failing/CoercibleRepresentational6.out +++ b/tests/purs/failing/CoercibleRepresentational6.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational6.purs:8:10 - 8:16 (line 8, column 10 - line 8, column 16) No type class instance was found for -   -  Prim.Coerce.Coercible (N a0) -  a0  -   +   +  Prim.Coerce.Coercible (N.N a0) +  a0  +   Solving this instance requires the newtype constructor N to be in scope. diff --git a/tests/purs/failing/CoercibleRepresentational7.out b/tests/purs/failing/CoercibleRepresentational7.out index 0c5c1005a5..8088b7ec40 100644 --- a/tests/purs/failing/CoercibleRepresentational7.out +++ b/tests/purs/failing/CoercibleRepresentational7.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational7.purs:8:10 - 8:16 (line 8, column 10 - line 8, column 16) No type class instance was found for -   -  Prim.Coerce.Coercible (N a0) -  a0  -   +   +  Prim.Coerce.Coercible (N.N a0) +  a0  +   Solving this instance requires the newtype constructor N to be in scope. diff --git a/tests/purs/failing/CoercibleRepresentational8.out b/tests/purs/failing/CoercibleRepresentational8.out index cb5275fcbf..e3800ebc7b 100644 --- a/tests/purs/failing/CoercibleRepresentational8.out +++ b/tests/purs/failing/CoercibleRepresentational8.out @@ -3,10 +3,10 @@ in module Main at tests/purs/failing/CoercibleRepresentational8.purs:9:16 - 9:22 (line 9, column 16 - line 9, column 22) No type class instance was found for -   -  Prim.Coerce.Coercible a0 -  b1 -   +   +  Coercible a0 +  b1 +   while checking that type forall (a :: Type) (b :: Type). Coercible @Type a b => a -> b is at least as general as type a0 -> b1 diff --git a/tests/purs/failing/CompareInt1.out b/tests/purs/failing/CompareInt1.out index 452403b8b6..1b1c069140 100644 --- a/tests/purs/failing/CompareInt1.out +++ b/tests/purs/failing/CompareInt1.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt1.purs:14:16 - 14:29 (line 14, column 16 - line    EQ   + (defined in module Prim.Ordering) with type    GT   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a0 is a rigid type variable b1 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt1.purs b/tests/purs/failing/CompareInt1.purs index d53a28c5f7..763b430ddc 100644 --- a/tests/purs/failing/CompareInt1.purs +++ b/tests/purs/failing/CompareInt1.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt10.out b/tests/purs/failing/CompareInt10.out index 35b30cb145..c760dd9820 100644 --- a/tests/purs/failing/CompareInt10.out +++ b/tests/purs/failing/CompareInt10.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt10.purs:14:16 - 14:27 (line 14, column 16 - line    LT   + (defined in module Prim.Ordering) with type    EQ   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a1 is a rigid type variable c0 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt10.purs b/tests/purs/failing/CompareInt10.purs index fef893fbcf..41259d66a6 100644 --- a/tests/purs/failing/CompareInt10.purs +++ b/tests/purs/failing/CompareInt10.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt11.out b/tests/purs/failing/CompareInt11.out index 930710c038..8bf96b6e4f 100644 --- a/tests/purs/failing/CompareInt11.out +++ b/tests/purs/failing/CompareInt11.out @@ -3,11 +3,11 @@ in module Main at tests/purs/failing/CompareInt11.purs:14:14 - 14:26 (line 14, column 14 - line 14, column 26) No type class instance was found for -   -  Prim.Int.Compare a0 -  5  -  LT -   +   +  Compare a0 +  5  +  LT +   while checking that type forall (l :: Int) (r :: Int).   Compare l r LT => Proxy @(Row Int) diff --git a/tests/purs/failing/CompareInt12.out b/tests/purs/failing/CompareInt12.out index 8a56b46db2..08ac3ad113 100644 --- a/tests/purs/failing/CompareInt12.out +++ b/tests/purs/failing/CompareInt12.out @@ -3,11 +3,11 @@ in module Main at tests/purs/failing/CompareInt12.purs:14:14 - 14:27 (line 14, column 14 - line 14, column 27) No type class instance was found for -   -  Prim.Int.Compare a0 -  20 -  GT -   +   +  Compare a0 +  20 +  GT +   while checking that type forall (l :: Int) (r :: Int).   Compare l r GT => Proxy @(Row Int) diff --git a/tests/purs/failing/CompareInt2.out b/tests/purs/failing/CompareInt2.out index 8817b303d9..5efa78fd30 100644 --- a/tests/purs/failing/CompareInt2.out +++ b/tests/purs/failing/CompareInt2.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt2.purs:14:14 - 14:27 (line 14, column 14 - line    LT   + (defined in module Prim.Ordering) with type    GT   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a1 is a rigid type variable b0 is a rigid type variable bound at (line 14, column 14 - line 14, column 27) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt2.purs b/tests/purs/failing/CompareInt2.purs index 06ba919f83..e8ac291afa 100644 --- a/tests/purs/failing/CompareInt2.purs +++ b/tests/purs/failing/CompareInt2.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt3.out b/tests/purs/failing/CompareInt3.out index 35c8a1d0da..90ae237a66 100644 --- a/tests/purs/failing/CompareInt3.out +++ b/tests/purs/failing/CompareInt3.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt3.purs:14:16 - 14:28 (line 14, column 16 - line    EQ   + (defined in module Prim.Ordering) with type    LT   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a0 is a rigid type variable b1 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt3.purs b/tests/purs/failing/CompareInt3.purs index 93bc00b8c2..89ea3f00cd 100644 --- a/tests/purs/failing/CompareInt3.purs +++ b/tests/purs/failing/CompareInt3.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt4.out b/tests/purs/failing/CompareInt4.out index d2c7f2956d..4cd43583e7 100644 --- a/tests/purs/failing/CompareInt4.out +++ b/tests/purs/failing/CompareInt4.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt4.purs:14:14 - 14:26 (line 14, column 14 - line    GT   + (defined in module Prim.Ordering) with type    LT   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a1 is a rigid type variable b0 is a rigid type variable bound at (line 14, column 14 - line 14, column 26) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt4.purs b/tests/purs/failing/CompareInt4.purs index fca2e6d42a..b33aca1aeb 100644 --- a/tests/purs/failing/CompareInt4.purs +++ b/tests/purs/failing/CompareInt4.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt5.out b/tests/purs/failing/CompareInt5.out index a7e90314c4..c6c8e801e8 100644 --- a/tests/purs/failing/CompareInt5.out +++ b/tests/purs/failing/CompareInt5.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt5.purs:14:16 - 14:29 (line 14, column 16 - line    LT   + (defined in module Prim.Ordering) with type    GT   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a1 is a rigid type variable c0 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt5.purs b/tests/purs/failing/CompareInt5.purs index f4f8fba8a8..8350453d53 100644 --- a/tests/purs/failing/CompareInt5.purs +++ b/tests/purs/failing/CompareInt5.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt6.out b/tests/purs/failing/CompareInt6.out index a355c5dba3..87a70f63ee 100644 --- a/tests/purs/failing/CompareInt6.out +++ b/tests/purs/failing/CompareInt6.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt6.purs:14:16 - 14:28 (line 14, column 16 - line    GT   + (defined in module Prim.Ordering) with type    LT   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a1 is a rigid type variable c0 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt6.purs b/tests/purs/failing/CompareInt6.purs index d9ba79f870..a773fd2dff 100644 --- a/tests/purs/failing/CompareInt6.purs +++ b/tests/purs/failing/CompareInt6.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt7.out b/tests/purs/failing/CompareInt7.out index f065e86703..983321af1e 100644 --- a/tests/purs/failing/CompareInt7.out +++ b/tests/purs/failing/CompareInt7.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt7.purs:14:16 - 14:27 (line 14, column 16 - line    LT   + (defined in module Prim.Ordering) with type    EQ   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a0 is a rigid type variable c1 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt7.purs b/tests/purs/failing/CompareInt7.purs index 2155a911d2..bdbca20d9e 100644 --- a/tests/purs/failing/CompareInt7.purs +++ b/tests/purs/failing/CompareInt7.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt8.out b/tests/purs/failing/CompareInt8.out index e7c4cbd1d0..3e3263a4b7 100644 --- a/tests/purs/failing/CompareInt8.out +++ b/tests/purs/failing/CompareInt8.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt8.purs:14:16 - 14:27 (line 14, column 16 - line    GT   + (defined in module Prim.Ordering) with type    EQ   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a0 is a rigid type variable c1 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt8.purs b/tests/purs/failing/CompareInt8.purs index 85bf481870..7134061370 100644 --- a/tests/purs/failing/CompareInt8.purs +++ b/tests/purs/failing/CompareInt8.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/CompareInt9.out b/tests/purs/failing/CompareInt9.out index 9e55dcf883..0b2429203c 100644 --- a/tests/purs/failing/CompareInt9.out +++ b/tests/purs/failing/CompareInt9.out @@ -6,10 +6,12 @@ at tests/purs/failing/CompareInt9.purs:14:16 - 14:27 (line 14, column 16 - line    GT   + (defined in module Prim.Ordering) with type    EQ   + (defined in module Prim.Ordering) while solving type class constraint   @@ -38,6 +40,6 @@ where a1 is a rigid type variable c0 is a rigid type variable bound at (line 0, column 0 - line 0, column 0) -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/CompareInt9.purs b/tests/purs/failing/CompareInt9.purs index 21743243b2..10dbd2138c 100644 --- a/tests/purs/failing/CompareInt9.purs +++ b/tests/purs/failing/CompareInt9.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prim.Int (class Compare) diff --git a/tests/purs/failing/ConstraintFailure.out b/tests/purs/failing/ConstraintFailure.out index 17d2c94bad..fd159d3e6a 100644 --- a/tests/purs/failing/ConstraintFailure.out +++ b/tests/purs/failing/ConstraintFailure.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/ConstraintFailure.purs:12:8 - 12:12 (line 12, column 8 - line 12, column 12) No type class instance was found for -   -  Data.Show.Show Foo -   +   +  Data.Show.Show Main.Foo +   while checking that type forall (a :: Type). Show a => a -> String is at least as general as type t0 t1 t2 diff --git a/tests/purs/failing/DiffKindsSameName.out b/tests/purs/failing/DiffKindsSameName.out index 13f180f524..6f7803b6de 100644 --- a/tests/purs/failing/DiffKindsSameName.out +++ b/tests/purs/failing/DiffKindsSameName.out @@ -3,13 +3,13 @@ in module DiffKindsSameName at tests/purs/failing/DiffKindsSameName.purs:13:18 - 13:31 (line 13, column 18 - line 13, column 31) Could not match kind -   -  DemoKind -   +   +  LibB.DemoKind +   with kind -   -  DemoKind -   +   +  LibA.DemoKind +   while checking that type DemoData has kind DemoKind diff --git a/tests/purs/failing/DoNotSuggestComposition2.out b/tests/purs/failing/DoNotSuggestComposition2.out index 5126c8a650..986b025070 100644 --- a/tests/purs/failing/DoNotSuggestComposition2.out +++ b/tests/purs/failing/DoNotSuggestComposition2.out @@ -3,13 +3,13 @@ in module DoNotSuggestComposition2 at tests/purs/failing/DoNotSuggestComposition2.purs:7:27 - 7:30 (line 7, column 27 - line 7, column 30) Could not match type -   -  Record -   +   +  Prim.Record +   with type -   -  Function Int -   +   +  Prim.Function Int +   while trying to match type { y :: Int }  diff --git a/tests/purs/failing/FoldableInstance4.out b/tests/purs/failing/FoldableInstance4.out index 4e53669e6b..ee84c4237a 100644 --- a/tests/purs/failing/FoldableInstance4.out +++ b/tests/purs/failing/FoldableInstance4.out @@ -3,9 +3,9 @@ in module FoldableInstance4 at tests/purs/failing/FoldableInstance4.purs:8:1 - 8:27 (line 8, column 1 - line 8, column 27) No type class instance was found for -   -  Data.Foldable.Foldable (Function t3) -   +   +  Foldable (Prim.Function t3) +   The instance head contains unknown type variables. Consider adding a type annotation. while applying a function foldl diff --git a/tests/purs/failing/InfiniteKind2.out b/tests/purs/failing/InfiniteKind2.out index c06581ce76..214a7c65e2 100644 --- a/tests/purs/failing/InfiniteKind2.out +++ b/tests/purs/failing/InfiniteKind2.out @@ -3,9 +3,9 @@ in module InfiniteKind2 at tests/purs/failing/InfiniteKind2.purs:5:23 - 5:27 (line 5, column 23 - line 5, column 27) An infinite kind was inferred for a type: -   -  (t5 -> t6) -> Type -   +   +  (t5 -> t6) -> Prim.Type +   while checking that type Tree has kind t0 diff --git a/tests/purs/failing/InstanceChainBothUnknownAndMatch.out b/tests/purs/failing/InstanceChainBothUnknownAndMatch.out index a097d1936c..cfd530ae67 100644 --- a/tests/purs/failing/InstanceChainBothUnknownAndMatch.out +++ b/tests/purs/failing/InstanceChainBothUnknownAndMatch.out @@ -3,19 +3,19 @@ in module InstanceChains.BothUnknownAndMatch at tests/purs/failing/InstanceChainBothUnknownAndMatch.purs:15:13 - 15:53 (line 15, column 13 - line 15, column 53) No type class instance was found for -   -  InstanceChains.BothUnknownAndMatch.Same (Proxy  -  ( m :: Int -  , u :: t3  -  )  -  )  -  (Proxy  -  ( m :: Int -  , u :: Int -  )  -  )  -  t4  -   +   +  Same (Proxy  +  ( m :: Int +  , u :: t3  +  )  +  )  +  (Proxy  +  ( m :: Int +  , u :: Int +  )  +  )  +  t4  +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: InstanceChains.BothUnknownAndMatch.sameY diff --git a/tests/purs/failing/InstanceChainSkolemUnknownMatch.out b/tests/purs/failing/InstanceChainSkolemUnknownMatch.out index 82e1ace510..67c5e4cc46 100644 --- a/tests/purs/failing/InstanceChainSkolemUnknownMatch.out +++ b/tests/purs/failing/InstanceChainSkolemUnknownMatch.out @@ -3,11 +3,11 @@ in module InstanceChainSkolemUnknownMatch at tests/purs/failing/InstanceChainSkolemUnknownMatch.purs:13:13 - 13:36 (line 13, column 13 - line 13, column 36) No type class instance was found for -   -  InstanceChainSkolemUnknownMatch.Same (Proxy t3)  -  (Proxy Int) -  t4  -   +   +  Same (Proxy t3)  +  (Proxy Int) +  t4  +   The following instance partially overlaps the above constraint, which means the rest of its instance chain will not be considered: InstanceChainSkolemUnknownMatch.sameY diff --git a/tests/purs/failing/InstanceSigsBodyIncorrect.out b/tests/purs/failing/InstanceSigsBodyIncorrect.out index d29e6cddbc..b585689db4 100644 --- a/tests/purs/failing/InstanceSigsBodyIncorrect.out +++ b/tests/purs/failing/InstanceSigsBodyIncorrect.out @@ -6,10 +6,12 @@ at tests/purs/failing/InstanceSigsBodyIncorrect.purs:10:9 - 10:13 (line 10, colu    Boolean   + (defined in module Prim) with type    Number   + (defined in module Prim) while checking that type Boolean is at least as general as type Number @@ -17,6 +19,6 @@ while checking that expression true has type Number in value declaration fooNumber -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/InstanceSigsBodyIncorrect.purs b/tests/purs/failing/InstanceSigsBodyIncorrect.purs index fd3c4370d5..023c9feeff 100644 --- a/tests/purs/failing/InstanceSigsBodyIncorrect.purs +++ b/tests/purs/failing/InstanceSigsBodyIncorrect.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where diff --git a/tests/purs/failing/InstanceSigsDifferentTypes.out b/tests/purs/failing/InstanceSigsDifferentTypes.out index f06904a946..8a551c60ec 100644 --- a/tests/purs/failing/InstanceSigsDifferentTypes.out +++ b/tests/purs/failing/InstanceSigsDifferentTypes.out @@ -6,10 +6,12 @@ at tests/purs/failing/InstanceSigsDifferentTypes.purs:10:9 - 10:12 (line 10, col    Number   + (defined in module Prim) with type    Int   + (defined in module Prim) while checking that type Number is at least as general as type Int @@ -17,6 +19,6 @@ while checking that expression 0.0 has type Int in value declaration fooNumber -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/InstanceSigsDifferentTypes.purs b/tests/purs/failing/InstanceSigsDifferentTypes.purs index 0de2109d4d..19af12ab4e 100644 --- a/tests/purs/failing/InstanceSigsDifferentTypes.purs +++ b/tests/purs/failing/InstanceSigsDifferentTypes.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where diff --git a/tests/purs/failing/InstanceSigsIncorrectType.out b/tests/purs/failing/InstanceSigsIncorrectType.out index c8779b4aab..3292c4ce69 100644 --- a/tests/purs/failing/InstanceSigsIncorrectType.out +++ b/tests/purs/failing/InstanceSigsIncorrectType.out @@ -6,10 +6,12 @@ at tests/purs/failing/InstanceSigsIncorrectType.purs:8:1 - 10:13 (line 8, column    Boolean   + (defined in module Prim) with type    Number   + (defined in module Prim) while trying to match type Foo$Dict t0 with type Foo$Dict Number @@ -20,6 +22,6 @@ in value declaration fooNumber where t0 is an unknown type -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/InstanceSigsIncorrectType.purs b/tests/purs/failing/InstanceSigsIncorrectType.purs index f452f2ebb8..42a683dc30 100644 --- a/tests/purs/failing/InstanceSigsIncorrectType.purs +++ b/tests/purs/failing/InstanceSigsIncorrectType.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where diff --git a/tests/purs/failing/InvalidCoercibleInstanceDeclaration.out b/tests/purs/failing/InvalidCoercibleInstanceDeclaration.out index 34e8147142..7ae0a6d26b 100644 --- a/tests/purs/failing/InvalidCoercibleInstanceDeclaration.out +++ b/tests/purs/failing/InvalidCoercibleInstanceDeclaration.out @@ -2,10 +2,10 @@ Error found: at tests/purs/failing/InvalidCoercibleInstanceDeclaration.purs:8:1 - 8:36 (line 8, column 1 - line 8, column 36) Invalid type class instance declaration for -   -  Prim.Coerce.Coercible D -  D -   +   +  Prim.Coerce.Coercible Main.D +  Main.D +   Instance declarations of this type class are disallowed. diff --git a/tests/purs/failing/KindError.out b/tests/purs/failing/KindError.out index fe56bd3e06..2603bdece1 100644 --- a/tests/purs/failing/KindError.out +++ b/tests/purs/failing/KindError.out @@ -8,7 +8,7 @@ at tests/purs/failing/KindError.purs:6:35 - 6:36 (line 6, column 35 - line 6, co   with kind   -  t8 -> t9 +  t0 -> t1   while checking that type f diff --git a/tests/purs/failing/KindStar.out b/tests/purs/failing/KindStar.out index 03dc0acb69..81f9491be5 100644 --- a/tests/purs/failing/KindStar.out +++ b/tests/purs/failing/KindStar.out @@ -8,9 +8,9 @@ at tests/purs/failing/KindStar.purs:7:1 - 7:13 (line 7, column 1 - line 7, colum  List   having the kind -   -  Type -> Type -   +   +  Prim.Type -> Prim.Type +   instead. in value declaration test diff --git a/tests/purs/failing/LacksWithSubGoal.out b/tests/purs/failing/LacksWithSubGoal.out index 4938a23c86..fd7d150bb9 100644 --- a/tests/purs/failing/LacksWithSubGoal.out +++ b/tests/purs/failing/LacksWithSubGoal.out @@ -3,10 +3,10 @@ in module LacksWithSubGoal at tests/purs/failing/LacksWithSubGoal.purs:14:11 - 14:33 (line 14, column 11 - line 14, column 33) No type class instance was found for -   -  Prim.Row.Lacks "hello" -  r0  -   +   +  Lacks "hello" +  r0  +   while solving type class constraint   diff --git a/tests/purs/failing/MissingClassMember.out b/tests/purs/failing/MissingClassMember.out index fcbd3dcf19..ab75861e5f 100644 --- a/tests/purs/failing/MissingClassMember.out +++ b/tests/purs/failing/MissingClassMember.out @@ -2,8 +2,8 @@ Error found: at tests/purs/failing/MissingClassMember.purs:9:1 - 10:10 (line 9, column 1 - line 10, column 10) The following type class members have not been implemented: - b :: String -> Number - c :: forall f. String -> f String + b :: Prim.String -> Prim.Number + c :: forall f. Prim.String -> f Prim.String in type class instance   diff --git a/tests/purs/failing/MultipleErrors.out b/tests/purs/failing/MultipleErrors.out index b33b1ad362..3698a0150e 100644 --- a/tests/purs/failing/MultipleErrors.out +++ b/tests/purs/failing/MultipleErrors.out @@ -7,10 +7,12 @@ Error 1 of 2:    String   + (defined in module Prim) with type    Int   + (defined in module Prim) while checking that type String is at least as general as type Int @@ -18,7 +20,7 @@ Error 1 of 2: has type Int in binding group foo, bar - See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, + See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. Error 2 of 2: @@ -30,10 +32,12 @@ Error 2 of 2:    String   + (defined in module Prim) with type    Int   + (defined in module Prim) while checking that type String is at least as general as type Int @@ -41,6 +45,6 @@ Error 2 of 2: has type Int in binding group foo, bar - See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, + See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/MultipleErrors.purs b/tests/purs/failing/MultipleErrors.purs index b1d8a8cacd..ae31b19b52 100644 --- a/tests/purs/failing/MultipleErrors.purs +++ b/tests/purs/failing/MultipleErrors.purs @@ -1,5 +1,5 @@ --- @shouldFailWith TypesDoNotUnify --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module MultipleErrors where import Prelude diff --git a/tests/purs/failing/OverlapAcrossModulesUnnamedInstance.out b/tests/purs/failing/OverlapAcrossModulesUnnamedInstance.out index 9ea61e29b4..e2936cbc25 100644 --- a/tests/purs/failing/OverlapAcrossModulesUnnamedInstance.out +++ b/tests/purs/failing/OverlapAcrossModulesUnnamedInstance.out @@ -10,7 +10,7 @@ at tests/purs/failing/OverlapAcrossModulesUnnamedInstance.purs:6:1 - 6:15 (line The following instances were found: OverlapAcrossModules.X.cX - instance in module OverlapAcrossModules with type C X Y (line 6, column 1 - line 6, column 15) + instance in module OverlapAcrossModules with type OverlapAcrossModules.Class.C X Y (line 6, column 1 - line 6, column 15) in type class instance diff --git a/tests/purs/failing/OverlappingUnnamedInstances.out b/tests/purs/failing/OverlappingUnnamedInstances.out index 22f0525f1c..629e174bef 100644 --- a/tests/purs/failing/OverlappingUnnamedInstances.out +++ b/tests/purs/failing/OverlappingUnnamedInstances.out @@ -8,8 +8,8 @@ at tests/purs/failing/OverlappingUnnamedInstances.purs:10:1 - 11:13 (line 10, co   The following instances were found: - instance in module Main with type forall a. Test a (line 7, column 1 - line 8, column 13) - instance in module Main with type Test Int (line 10, column 1 - line 11, column 13) + instance in module Main with type forall a. Main.Test a (line 7, column 1 - line 8, column 13) + instance in module Main with type Main.Test Int (line 10, column 1 - line 11, column 13) in type class instance diff --git a/tests/purs/failing/OverlappingVars.out b/tests/purs/failing/OverlappingVars.out index 8f49802299..95b7d37342 100644 --- a/tests/purs/failing/OverlappingVars.out +++ b/tests/purs/failing/OverlappingVars.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/OverlappingVars.purs:14:8 - 14:20 (line 14, column 8 - line 14, column 20) No type class instance was found for -   -  Main.OverlappingVars (Foo String Int) -   +   +  OverlappingVars (Foo String Int) +   while applying a function f of type OverlappingVars t0 => t0 -> t0 diff --git a/tests/purs/failing/PolykindUnnamedInstanceOverlapping.out b/tests/purs/failing/PolykindUnnamedInstanceOverlapping.out index 5e84fbb8e9..fcf987f1df 100644 --- a/tests/purs/failing/PolykindUnnamedInstanceOverlapping.out +++ b/tests/purs/failing/PolykindUnnamedInstanceOverlapping.out @@ -8,8 +8,8 @@ at tests/purs/failing/PolykindUnnamedInstanceOverlapping.purs:12:1 - 13:19 (line   The following instances were found: - instance in module Main with type forall a. ShowP (Proxy a) (line 9, column 1 - line 10, column 19) - instance in module Main with type forall a. ShowP (Proxy a) (line 12, column 1 - line 13, column 19) + instance in module Main with type forall a. Main.ShowP (Proxy a) (line 9, column 1 - line 10, column 19) + instance in module Main with type forall a. Main.ShowP (Proxy a) (line 12, column 1 - line 13, column 19) in type class instance diff --git a/tests/purs/failing/QualifiedErrorsUnification.out b/tests/purs/failing/QualifiedErrorsUnification.out new file mode 100644 index 0000000000..a0814bd7eb --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnification.out @@ -0,0 +1,26 @@ +Error found: +in module Main +at tests/purs/failing/QualifiedErrorsUnification.purs:9:15 - 9:18 (line 9, column 15 - line 9, column 18) + + Could not match type +   +  Data.List.Lazy.Types.List +   + (defined in module Data.List.Lazy.Types) + with type +   +  List +   + (defined in module Data.List.Types) + +while trying to match type List t0 + with type List Unit +while checking that expression nil + has type List Unit +in value declaration wrongModule + +where t0 is an unknown type + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/QualifiedErrorsUnification.purs b/tests/purs/failing/QualifiedErrorsUnification.purs new file mode 100644 index 0000000000..3d106d9ba9 --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnification.purs @@ -0,0 +1,9 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Prelude (Unit) +import Data.List.Lazy (nil) +import Data.List.Types (List) + +wrongModule :: List Unit +wrongModule = nil diff --git a/tests/purs/failing/QualifiedErrorsUnificationLocal.out b/tests/purs/failing/QualifiedErrorsUnificationLocal.out new file mode 100644 index 0000000000..a723e0d140 --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnificationLocal.out @@ -0,0 +1,26 @@ +Error found: +in module Main +at tests/purs/failing/QualifiedErrorsUnificationLocal.purs:10:15 - 10:18 (line 10, column 15 - line 10, column 18) + + Could not match type +   +  Data.List.Lazy.Types.List +   + (defined in module Data.List.Lazy.Types) + with type +   +  List +   + (defined in module Main) + +while trying to match type List t0 + with type List Unit +while checking that expression nil + has type List Unit +in value declaration wrongModule + +where t0 is an unknown type + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/QualifiedErrorsUnificationLocal.purs b/tests/purs/failing/QualifiedErrorsUnificationLocal.purs new file mode 100644 index 0000000000..0fd79aec2e --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnificationLocal.purs @@ -0,0 +1,10 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Prelude (Unit) +import Data.List.Lazy (nil) + +data List (a :: Type) + +wrongModule :: List Unit +wrongModule = nil diff --git a/tests/purs/failing/QualifiedErrorsUnificationReexport.out b/tests/purs/failing/QualifiedErrorsUnificationReexport.out new file mode 100644 index 0000000000..91ca58f910 --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnificationReexport.out @@ -0,0 +1,26 @@ +Error found: +in module Main +at tests/purs/failing/QualifiedErrorsUnificationReexport.purs:9:15 - 9:18 (line 9, column 15 - line 9, column 18) + + Could not match type +   +  Data.List.Lazy.Types.List +   + (defined in module Data.List.Lazy.Types) + with type +   +  Data.List.Types.List +   + (defined in module Data.List.Types) + +while trying to match type List t0 + with type List Unit +while checking that expression nil + has type List Unit +in value declaration wrongModule + +where t0 is an unknown type + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/QualifiedErrorsUnificationReexport.purs b/tests/purs/failing/QualifiedErrorsUnificationReexport.purs new file mode 100644 index 0000000000..2627d4ba31 --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnificationReexport.purs @@ -0,0 +1,9 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Prelude (Unit) +import Data.List.Lazy (nil) +import Data.List (List) + +wrongModule :: List Unit +wrongModule = nil diff --git a/tests/purs/failing/QualifiedErrorsUnificationShadow.out b/tests/purs/failing/QualifiedErrorsUnificationShadow.out new file mode 100644 index 0000000000..286cb9b113 --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnificationShadow.out @@ -0,0 +1,26 @@ +Error found: +in module Main +at tests/purs/failing/QualifiedErrorsUnificationShadow.purs:9:15 - 9:18 (line 9, column 15 - line 9, column 18) + + Could not match type +   +  Data.List.Lazy.Types.List +   + (defined in module Data.List.Lazy.Types) + with type +   +  Data.List.Lazy.Types.List +   + (defined in module Data.List.Types) + +while trying to match type List t0 + with type List Unit +while checking that expression nil + has type List Unit +in value declaration wrongModule + +where t0 is an unknown type + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/QualifiedErrorsUnificationShadow.purs b/tests/purs/failing/QualifiedErrorsUnificationShadow.purs new file mode 100644 index 0000000000..45d3d59a20 --- /dev/null +++ b/tests/purs/failing/QualifiedErrorsUnificationShadow.purs @@ -0,0 +1,9 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Prelude (Unit) +import Data.List.Lazy (nil) +import Data.List.Types (List) as Data.List.Lazy.Types + +wrongModule :: Data.List.Lazy.Types.List Unit +wrongModule = nil diff --git a/tests/purs/failing/RowLacks.out b/tests/purs/failing/RowLacks.out index bd424a618a..6c1c49c510 100644 --- a/tests/purs/failing/RowLacks.out +++ b/tests/purs/failing/RowLacks.out @@ -3,13 +3,13 @@ in module Main at tests/purs/failing/RowLacks.purs:16:9 - 16:66 (line 16, column 9 - line 16, column 66) No type class instance was found for -   -  Prim.Row.Lacks "x"  -  ( x :: Int  -  , y :: Int  -  , z :: String -  )  -   +   +  Lacks "x"  +  ( x :: Int  +  , y :: Int  +  , z :: String +  )  +   while applying a function lacksX of type Lacks @t1 "x" t2 => Proxy @(Row t1) t2 -> Proxy @(Row t3) (() @t3) diff --git a/tests/purs/failing/RowsInKinds.out b/tests/purs/failing/RowsInKinds.out index a226e71125..6b3c35fea3 100644 --- a/tests/purs/failing/RowsInKinds.out +++ b/tests/purs/failing/RowsInKinds.out @@ -5,7 +5,7 @@ at tests/purs/failing/RowsInKinds.purs:14:16 - 14:17 (line 14, column 16 - line Could not match kind    ( z :: Type -  | t25  +  | t0   )    with kind @@ -23,6 +23,8 @@ while checking that type Z while inferring the kind of P Z in type synonym Test3 +where t0 is an unknown type + See https://github.com/purescript/documentation/blob/master/errors/KindsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/SkolemEscape.out b/tests/purs/failing/SkolemEscape.out index 8217eff0aa..38512e1ce0 100644 --- a/tests/purs/failing/SkolemEscape.out +++ b/tests/purs/failing/SkolemEscape.out @@ -7,9 +7,9 @@ at tests/purs/failing/SkolemEscape.purs:8:1 - 8:19 (line 8, column 1 - line 8, c tests/purs/failing/SkolemEscape.purs:8:18 - 8:19 (line 8, column 18 - line 8, column 19) has escaped its scope, appearing in the type -   -  (a0 -> a0) -> Number -   +   +  (a0 -> a0) -> Prim.Number +   in the expression \x ->   foo x diff --git a/tests/purs/failing/SkolemEscape2.out b/tests/purs/failing/SkolemEscape2.out index 98f7d3ad24..3f6024afaf 100644 --- a/tests/purs/failing/SkolemEscape2.out +++ b/tests/purs/failing/SkolemEscape2.out @@ -7,9 +7,9 @@ at tests/purs/failing/SkolemEscape2.purs:9:1 - 11:9 (line 9, column 1 - line 11, tests/purs/failing/SkolemEscape2.purs:10:21 - 10:34 (line 10, column 21 - line 10, column 34) has escaped its scope, appearing in the type -   -  t1 -> t2 (STRef r0 Int) -   +   +  t1 -> t2 (Control.Monad.ST.Internal.STRef r0 Prim.Int) +   in the expression \$0 ->   ((bind $dictBind1) ((...) (...))) (\r ->  diff --git a/tests/purs/failing/SkolemEscapeKinds.out b/tests/purs/failing/SkolemEscapeKinds.out index a1732cc381..b624fc6380 100644 --- a/tests/purs/failing/SkolemEscapeKinds.out +++ b/tests/purs/failing/SkolemEscapeKinds.out @@ -7,9 +7,9 @@ at tests/purs/failing/SkolemEscapeKinds.purs:8:10 - 8:17 (line 8, column 10 - li tests/purs/failing/SkolemEscapeKinds.purs:8:16 - 8:17 (line 8, column 16 - line 8, column 17) has escaped its scope, appearing in the type -   -  Proxy -   +   +  Main.Proxy +   in type synonym B diff --git a/tests/purs/failing/SuggestComposition.out b/tests/purs/failing/SuggestComposition.out index a588608250..ed08f22fe9 100644 --- a/tests/purs/failing/SuggestComposition.out +++ b/tests/purs/failing/SuggestComposition.out @@ -3,13 +3,13 @@ in module SuggestComposition at tests/purs/failing/SuggestComposition.purs:7:5 - 7:6 (line 7, column 5 - line 7, column 6) Could not match type -   -  Record -   +   +  Prim.Record +   with type -   -  Function Int -   +   +  Prim.Function Int +   while trying to match type { g :: t0 | t1  diff --git a/tests/purs/failing/Superclasses1.out b/tests/purs/failing/Superclasses1.out index ed16d56c71..ea2b54cc8f 100644 --- a/tests/purs/failing/Superclasses1.out +++ b/tests/purs/failing/Superclasses1.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/Superclasses1.purs:12:1 - 13:17 (line 12, column 1 - line 13, column 17) No type class instance was found for -   -  Main.Su Number -   +   +  Su Number +   while checking that expression #dict Su has type Su$Dict t0 diff --git a/tests/purs/failing/TypeClasses2.out b/tests/purs/failing/TypeClasses2.out index 799aff9e9d..21a5a9bc12 100644 --- a/tests/purs/failing/TypeClasses2.out +++ b/tests/purs/failing/TypeClasses2.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/TypeClasses2.purs:7:8 - 7:22 (line 7, column 8 - line 7, column 22) No type class instance was found for -   -  Main.Show String -   +   +  Show String +   while applying a function show of type Show t0 => t0 -> String diff --git a/tests/purs/failing/TypeError.out b/tests/purs/failing/TypeError.out index 0cc707d1bd..7b21aed68f 100644 --- a/tests/purs/failing/TypeError.out +++ b/tests/purs/failing/TypeError.out @@ -6,10 +6,12 @@ at tests/purs/failing/TypeError.purs:6:13 - 6:16 (line 6, column 13 - line 6, co    String   + (defined in module Prim) with type    Int   + (defined in module Prim) while checking that type String is at least as general as type Int @@ -17,6 +19,6 @@ while checking that expression "A" has type Int in value declaration test -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/TypeError.purs b/tests/purs/failing/TypeError.purs index 1c5c980067..d0c7d67f01 100644 --- a/tests/purs/failing/TypeError.purs +++ b/tests/purs/failing/TypeError.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prelude diff --git a/tests/purs/failing/TypeQualification1.out b/tests/purs/failing/TypeQualification1.out new file mode 100644 index 0000000000..51bb828676 --- /dev/null +++ b/tests/purs/failing/TypeQualification1.out @@ -0,0 +1,24 @@ +Error found: +in module Main +at tests/purs/failing/TypeQualification1.purs:10:6 - 10:13 (line 10, column 6 - line 10, column 13) + + Could not match type +   +  String +   + (defined in module Prim) + with type +   +  L1.X +   + (defined in module Lib1) + +while checking that type String + is at least as general as type X +while checking that expression "wrong" + has type X +in value declaration x1 + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/TypeQualification1.purs b/tests/purs/failing/TypeQualification1.purs new file mode 100644 index 0000000000..2599601f01 --- /dev/null +++ b/tests/purs/failing/TypeQualification1.purs @@ -0,0 +1,10 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Lib1 as L +import Lib1 as L1 +import Lib2 as M +import Lib3 as L + +x1 :: L1.X +x1 = "wrong" diff --git a/tests/purs/failing/TypeQualification1/Lib1.purs b/tests/purs/failing/TypeQualification1/Lib1.purs new file mode 100644 index 0000000000..93b3eb1a96 --- /dev/null +++ b/tests/purs/failing/TypeQualification1/Lib1.purs @@ -0,0 +1,4 @@ +module Lib1 where + +data X +data Y diff --git a/tests/purs/failing/TypeQualification1/Lib2.purs b/tests/purs/failing/TypeQualification1/Lib2.purs new file mode 100644 index 0000000000..25bae92a24 --- /dev/null +++ b/tests/purs/failing/TypeQualification1/Lib2.purs @@ -0,0 +1,4 @@ +module Lib2 where + +data X +data Y diff --git a/tests/purs/failing/TypeQualification1/Lib3.purs b/tests/purs/failing/TypeQualification1/Lib3.purs new file mode 100644 index 0000000000..90bbf0439f --- /dev/null +++ b/tests/purs/failing/TypeQualification1/Lib3.purs @@ -0,0 +1,5 @@ +module Lib3 where + +data X +data Y +data Z diff --git a/tests/purs/failing/TypeQualification2.out b/tests/purs/failing/TypeQualification2.out new file mode 100644 index 0000000000..8e85981538 --- /dev/null +++ b/tests/purs/failing/TypeQualification2.out @@ -0,0 +1,24 @@ +Error found: +in module Main +at tests/purs/failing/TypeQualification2.purs:10:6 - 10:13 (line 10, column 6 - line 10, column 13) + + Could not match type +   +  String +   + (defined in module Prim) + with type +   +  M.Y +   + (defined in module Lib2) + +while checking that type String + is at least as general as type Y +while checking that expression "wrong" + has type Y +in value declaration x2 + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/TypeQualification2.purs b/tests/purs/failing/TypeQualification2.purs new file mode 100644 index 0000000000..5fa096ce8d --- /dev/null +++ b/tests/purs/failing/TypeQualification2.purs @@ -0,0 +1,10 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Lib1 as L +import Lib1 as L1 +import Lib2 as M +import Lib3 as L + +x2 :: M.Y +x2 = "wrong" diff --git a/tests/purs/failing/TypeQualification2/Lib1.purs b/tests/purs/failing/TypeQualification2/Lib1.purs new file mode 100644 index 0000000000..93b3eb1a96 --- /dev/null +++ b/tests/purs/failing/TypeQualification2/Lib1.purs @@ -0,0 +1,4 @@ +module Lib1 where + +data X +data Y diff --git a/tests/purs/failing/TypeQualification2/Lib2.purs b/tests/purs/failing/TypeQualification2/Lib2.purs new file mode 100644 index 0000000000..25bae92a24 --- /dev/null +++ b/tests/purs/failing/TypeQualification2/Lib2.purs @@ -0,0 +1,4 @@ +module Lib2 where + +data X +data Y diff --git a/tests/purs/failing/TypeQualification2/Lib3.purs b/tests/purs/failing/TypeQualification2/Lib3.purs new file mode 100644 index 0000000000..90bbf0439f --- /dev/null +++ b/tests/purs/failing/TypeQualification2/Lib3.purs @@ -0,0 +1,5 @@ +module Lib3 where + +data X +data Y +data Z diff --git a/tests/purs/failing/TypeQualification3.out b/tests/purs/failing/TypeQualification3.out new file mode 100644 index 0000000000..41ca500c6f --- /dev/null +++ b/tests/purs/failing/TypeQualification3.out @@ -0,0 +1,24 @@ +Error found: +in module Main +at tests/purs/failing/TypeQualification3.purs:10:6 - 10:13 (line 10, column 6 - line 10, column 13) + + Could not match type +   +  String +   + (defined in module Prim) + with type +   +  L.Z +   + (defined in module Lib3) + +while checking that type String + is at least as general as type Z +while checking that expression "wrong" + has type Z +in value declaration x3 + +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, +or to contribute content related to this error. + diff --git a/tests/purs/failing/TypeQualification3.purs b/tests/purs/failing/TypeQualification3.purs new file mode 100644 index 0000000000..3eda153039 --- /dev/null +++ b/tests/purs/failing/TypeQualification3.purs @@ -0,0 +1,10 @@ +-- @shouldFailWith TypeConstructorsDoNotUnify +module Main where + +import Lib1 as L +import Lib1 as L1 +import Lib2 as M +import Lib3 as L + +x3 :: L.Z +x3 = "wrong" diff --git a/tests/purs/failing/TypeQualification3/Lib1.purs b/tests/purs/failing/TypeQualification3/Lib1.purs new file mode 100644 index 0000000000..93b3eb1a96 --- /dev/null +++ b/tests/purs/failing/TypeQualification3/Lib1.purs @@ -0,0 +1,4 @@ +module Lib1 where + +data X +data Y diff --git a/tests/purs/failing/TypeQualification3/Lib2.purs b/tests/purs/failing/TypeQualification3/Lib2.purs new file mode 100644 index 0000000000..25bae92a24 --- /dev/null +++ b/tests/purs/failing/TypeQualification3/Lib2.purs @@ -0,0 +1,4 @@ +module Lib2 where + +data X +data Y diff --git a/tests/purs/failing/TypeQualification3/Lib3.purs b/tests/purs/failing/TypeQualification3/Lib3.purs new file mode 100644 index 0000000000..90bbf0439f --- /dev/null +++ b/tests/purs/failing/TypeQualification3/Lib3.purs @@ -0,0 +1,5 @@ +module Lib3 where + +data X +data Y +data Z diff --git a/tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.out b/tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.out index d510bad034..8feebc15b4 100644 --- a/tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.out +++ b/tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.out @@ -9,8 +9,8 @@ at tests/purs/failing/TypeSynonymsOverlappingUnnamedInstance.purs:14:1 - 15:16 (   The following instances were found: - instance in module Main with type Convert String String (line 11, column 1 - line 12, column 16) - instance in module Main with type Convert String String (line 14, column 1 - line 15, column 16) + instance in module Main with type Main.Convert String String (line 11, column 1 - line 12, column 16) + instance in module Main with type Main.Convert String String (line 14, column 1 - line 15, column 16) in type class instance diff --git a/tests/purs/failing/TypedBinders2.out b/tests/purs/failing/TypedBinders2.out index ca46c046b8..ae49d55b48 100644 --- a/tests/purs/failing/TypedBinders2.out +++ b/tests/purs/failing/TypedBinders2.out @@ -3,13 +3,15 @@ in module Main at tests/purs/failing/TypedBinders2.purs:8:3 - 8:14 (line 8, column 3 - line 8, column 14) Could not match type -   -  Unit -   +   +  Data.Unit.Unit +   + (defined in module Data.Unit) with type    String   + (defined in module Prim) while checking that expression case $0 of   s -> log "Done" @@ -25,6 +27,6 @@ where t1 is an unknown type t0 is an unknown type t2 is an unknown type -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/TypedBinders2.purs b/tests/purs/failing/TypedBinders2.purs index 7262441163..a5de3d0f28 100644 --- a/tests/purs/failing/TypedBinders2.purs +++ b/tests/purs/failing/TypedBinders2.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prelude diff --git a/tests/purs/failing/TypedBinders3.out b/tests/purs/failing/TypedBinders3.out index 0d061f3555..5b4b0aba42 100644 --- a/tests/purs/failing/TypedBinders3.out +++ b/tests/purs/failing/TypedBinders3.out @@ -6,16 +6,18 @@ at tests/purs/failing/TypedBinders3.purs:8:4 - 8:15 (line 8, column 4 - line 8,    Int   + (defined in module Prim) with type    String   + (defined in module Prim) while inferring the type of case 1 of   0 -> true   _ -> false in value declaration test -See https://github.com/purescript/documentation/blob/master/errors/TypesDoNotUnify.md for more information, +See https://github.com/purescript/documentation/blob/master/errors/TypeConstructorsDoNotUnify.md for more information, or to contribute content related to this error. diff --git a/tests/purs/failing/TypedBinders3.purs b/tests/purs/failing/TypedBinders3.purs index 3edcfd9404..af2dd9605b 100644 --- a/tests/purs/failing/TypedBinders3.purs +++ b/tests/purs/failing/TypedBinders3.purs @@ -1,4 +1,4 @@ --- @shouldFailWith TypesDoNotUnify +-- @shouldFailWith TypeConstructorsDoNotUnify module Main where import Prelude diff --git a/tests/purs/failing/TypedHole.out b/tests/purs/failing/TypedHole.out index 9153ca38fc..11b78627e8 100644 --- a/tests/purs/failing/TypedHole.out +++ b/tests/purs/failing/TypedHole.out @@ -3,16 +3,16 @@ in module Main at tests/purs/failing/TypedHole.purs:8:8 - 8:13 (line 8, column 8 - line 8, column 13) Hole 'ummm' has the inferred type -   -  Effect Unit -   +   +  Effect Data.Unit.Unit +   You could substitute the hole with one of these values: -   -  Data.Monoid.mempty :: forall m. Monoid m => m  -  Effect.Class.Console.clear :: forall m. MonadEffect m => m Unit -  Effect.Console.clear :: Effect Unit  -  Main.main :: Effect Unit  -   +   +  Data.Monoid.mempty :: forall m. Monoid m => m  +  Effect.Class.Console.clear :: forall m. MonadEffect m => m Data.Unit.Unit +  Effect.Console.clear :: Effect Data.Unit.Unit  +  Main.main :: Effect Data.Unit.Unit  +   in value declaration main diff --git a/tests/purs/failing/TypedHole2.out b/tests/purs/failing/TypedHole2.out index e8ef3673df..acafbac557 100644 --- a/tests/purs/failing/TypedHole2.out +++ b/tests/purs/failing/TypedHole2.out @@ -3,9 +3,9 @@ in module Main at tests/purs/failing/TypedHole2.purs:7:16 - 7:21 (line 7, column 16 - line 7, column 21) Hole 'ummm' has the inferred type -   -  Unit -   +   +  Data.Unit.Unit +   in value declaration main diff --git a/tests/purs/failing/TypedHole3.out b/tests/purs/failing/TypedHole3.out index db08ba593b..b609f32a0e 100644 --- a/tests/purs/failing/TypedHole3.out +++ b/tests/purs/failing/TypedHole3.out @@ -7,23 +7,23 @@ at tests/purs/failing/TypedHole3.purs:4:10 - 4:15 (line 4, column 10 - line 4, c  t0   You could substitute the hole with one of these values: -   -  Control.Alt.alt :: forall f a. Alt f => f a -> f a -> f a  -  Control.Alternative.guard :: forall m. Alternative m => Boolean -> m Unit  -  Control.Applicative.liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f b  -  Control.Applicative.pure :: forall f a. Applicative f => a -> f a  -  Control.Applicative.unless :: forall m. Applicative m => Boolean -> m Unit -> m Unit  -  Control.Applicative.when :: forall m. Applicative m => Boolean -> m Unit -> m Unit  -  Control.Apply.apply :: forall f a b. Apply f => f (a -> b) -> f a -> f b  -  Control.Apply.applyFirst :: forall a b f. Apply f => f a -> f b -> f a  -  Control.Apply.applySecond :: forall a b f. Apply f => f a -> f b -> f b  -  Control.Apply.lift2 :: forall a b c f. Apply f => (a -> b -> c) -> f a -> ... -> ...  -  Control.Apply.lift3 :: forall a b c d f. Apply f => (a -> b -> ...) -> f a -> ... -> ...  -  Control.Apply.lift4 :: forall a b c d e f. Apply f => (a -> b -> ...) -> f a -> ... -> ...  -  Control.Apply.lift5 :: forall a b c d e f g. Apply f => (a -> b -> ...) -> f a -> ... -> ... -  Control.Biapplicative.bipure :: forall w a b. Biapplicative w => a -> b -> w a b  -  Control.Biapply.biapply :: forall w a b c d. Biapply w => w (a -> b) (c -> d) -> w a c -> w b d  -   +   +  Control.Alt.alt :: forall f a. Alt f => f a -> f a -> f a  +  Control.Alternative.guard :: forall m. Alternative m => Boolean -> m Data.Unit.Unit  +  Control.Applicative.liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f b  +  Control.Applicative.pure :: forall f a. Applicative f => a -> f a  +  Control.Applicative.unless :: forall m. Applicative m => Boolean -> m Data.Unit.Unit -> m Data.Unit.Unit +  Control.Applicative.when :: forall m. Applicative m => Boolean -> m Data.Unit.Unit -> m Data.Unit.Unit +  Control.Apply.apply :: forall f a b. Apply f => f (a -> b) -> f a -> f b  +  Control.Apply.applyFirst :: forall a b f. Apply f => f a -> f b -> f a  +  Control.Apply.applySecond :: forall a b f. Apply f => f a -> f b -> f b  +  Control.Apply.lift2 :: forall a b c f. Apply f => (a -> b -> c) -> f a -> ... -> ...  +  Control.Apply.lift3 :: forall a b c d f. Apply f => (a -> b -> ...) -> f a -> ... -> ...  +  Control.Apply.lift4 :: forall a b c d e f. Apply f => (a -> b -> ...) -> f a -> ... -> ...  +  Control.Apply.lift5 :: forall a b c d e f g. Apply f => (a -> b -> ...) -> f a -> ... -> ...  +  Control.Biapplicative.bipure :: forall w a b. Biapplicative w => a -> b -> w a b  +  Control.Biapply.biapply :: forall w a b c d. Biapply w => w (a -> b) (c -> d) -> w a c -> w b d  +   in value declaration fn diff --git a/tests/purs/failing/UnsupportedTypeInKind.out b/tests/purs/failing/UnsupportedTypeInKind.out index b811914f36..ef04f30d2d 100644 --- a/tests/purs/failing/UnsupportedTypeInKind.out +++ b/tests/purs/failing/UnsupportedTypeInKind.out @@ -4,7 +4,7 @@ at tests/purs/failing/UnsupportedTypeInKind.purs:7:28 - 7:38 (line 7, column 28 The type: - Ok => Type + Ok => Prim.Type is not supported in kinds. diff --git a/tests/purs/warning/2542.out b/tests/purs/warning/2542.out index 1b0cef80a1..1f8f4e5d87 100644 --- a/tests/purs/warning/2542.out +++ b/tests/purs/warning/2542.out @@ -5,9 +5,9 @@ at tests/purs/warning/2542.purs:16:1 - 16:18 (line 16, column 1 - line 16, colum No type declaration was provided for the top-level declaration of main. It is good practice to provide type declarations as a form of documentation. The inferred type of main was: -   -  Effect Unit -   +   +  Effect.Effect Data.Unit.Unit +   in value declaration main diff --git a/tests/purs/warning/4256.out b/tests/purs/warning/4256.out index cbf4467e21..2c4b7e4c26 100644 --- a/tests/purs/warning/4256.out +++ b/tests/purs/warning/4256.out @@ -23,9 +23,9 @@ Warning 2 of 2: No type declaration was provided for the top-level declaration of addNumberSuffix'. It is good practice to provide type declarations as a form of documentation. The inferred type of addNumberSuffix' was: -   -  forall b34 c35 d36. b34 -> c35 -> d36 -> Int -   +   +  forall b34 c35 d36. b34 -> c35 -> d36 -> Prim.Int +   in value declaration addNumberSuffix' diff --git a/tests/purs/warning/4308.out b/tests/purs/warning/4308.out index 37057ac6fe..d6e2520f7d 100644 --- a/tests/purs/warning/4308.out +++ b/tests/purs/warning/4308.out @@ -4,9 +4,9 @@ Warning 1 of 3: at tests/purs/warning/4308.purs:13:6 - 13:7 (line 13, column 6 - line 13, column 7) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in value declaration g @@ -19,9 +19,9 @@ Warning 2 of 3: at tests/purs/warning/4308.purs:14:13 - 14:14 (line 14, column 13 - line 14, column 14) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in value declaration g @@ -34,9 +34,9 @@ Warning 3 of 3: at tests/purs/warning/4308.purs:14:25 - 14:26 (line 14, column 25 - line 14, column 26) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in the following context: y :: Int diff --git a/tests/purs/warning/MissingKindDeclaration.out b/tests/purs/warning/MissingKindDeclaration.out index 5174fcff24..304f8e832f 100644 --- a/tests/purs/warning/MissingKindDeclaration.out +++ b/tests/purs/warning/MissingKindDeclaration.out @@ -5,9 +5,9 @@ Warning 1 of 4: The inferred kind for the data declaration Proxy contains polymorphic kinds. Consider adding a top-level kind signature as a form of documentation. -   -  data Proxy :: forall k. k -> Type -   +   +  data Proxy :: forall k. k -> Prim.Type +   in type constructor Proxy @@ -21,9 +21,9 @@ Warning 2 of 4: The inferred kind for the type declaration Natural contains polymorphic kinds. Consider adding a top-level kind signature as a form of documentation. -   -  type Natural :: forall k. (k -> Type) -> (k -> Type) -> Type -   +   +  type Natural :: forall k. (k -> Prim.Type) -> (k -> Prim.Type) -> Prim.Type +   in type synonym Natural @@ -37,9 +37,9 @@ Warning 3 of 4: The inferred kind for the newtype declaration F contains polymorphic kinds. Consider adding a top-level kind signature as a form of documentation. -   -  newtype F :: forall k. k -> Type -> Type -   +   +  newtype F :: forall k. k -> Prim.Type -> Prim.Type +   in type constructor F @@ -53,9 +53,9 @@ Warning 4 of 4: The inferred kind for the class declaration Clazz contains polymorphic kinds. Consider adding a top-level kind signature as a form of documentation. -   -  class Clazz :: forall k1 k2 k3. k1 -> k2 -> k3 -> Constraint -   +   +  class Clazz :: forall k1 k2 k3. k1 -> k2 -> k3 -> Prim.Constraint +   in type class declaration for Clazz diff --git a/tests/purs/warning/MissingTypeDeclaration.out b/tests/purs/warning/MissingTypeDeclaration.out index add92fa0c7..2e9f3b611b 100644 --- a/tests/purs/warning/MissingTypeDeclaration.out +++ b/tests/purs/warning/MissingTypeDeclaration.out @@ -5,9 +5,9 @@ at tests/purs/warning/MissingTypeDeclaration.purs:4:1 - 4:6 (line 4, column 1 - No type declaration was provided for the top-level declaration of x. It is good practice to provide type declarations as a form of documentation. The inferred type of x was: -   -  Int -   +   +  Prim.Int +   in value declaration x diff --git a/tests/purs/warning/NewtypeInstance.out b/tests/purs/warning/NewtypeInstance.out index b6dd688801..b537ec22f8 100644 --- a/tests/purs/warning/NewtypeInstance.out +++ b/tests/purs/warning/NewtypeInstance.out @@ -3,9 +3,9 @@ in module Main at tests/purs/warning/NewtypeInstance.purs:8:1 - 8:38 (line 8, column 1 - line 8, column 38) The derived newtype instance for -   -  Data.Ord.Ord X -   +   +  Data.Ord.Ord Main.X +   does not include a derived superclass instance for Data.Eq.Eq. in value declaration ordX diff --git a/tests/purs/warning/NewtypeInstance2.out b/tests/purs/warning/NewtypeInstance2.out index e9afcb3d74..7087aa812b 100644 --- a/tests/purs/warning/NewtypeInstance2.out +++ b/tests/purs/warning/NewtypeInstance2.out @@ -3,10 +3,10 @@ in module Main at tests/purs/warning/NewtypeInstance2.purs:15:1 - 15:86 (line 15, column 1 - line 15, column 86) The derived newtype instance for -   -  Main.MonadWriter w0  -  (MyWriter w0) -   +   +  Main.MonadWriter w0  +  (Main.MyWriter w0) +   does not include a derived superclass instance for Control.Monad.Monad. in value declaration monadWriterMyWriter diff --git a/tests/purs/warning/NewtypeInstance3.out b/tests/purs/warning/NewtypeInstance3.out index bb3e96b4db..919fdd78af 100644 --- a/tests/purs/warning/NewtypeInstance3.out +++ b/tests/purs/warning/NewtypeInstance3.out @@ -3,10 +3,10 @@ in module Main at tests/purs/warning/NewtypeInstance3.purs:21:1 - 21:86 (line 21, column 1 - line 21, column 86) The derived newtype instance for -   -  Main.MonadWriter w0  -  (MyWriter w0) -   +   +  Main.MonadWriter w0  +  (Main.MyWriter w0) +   does not include a derived superclass instance for Main.MonadTell. in value declaration monadWriterMyWriter diff --git a/tests/purs/warning/NewtypeInstance4.out b/tests/purs/warning/NewtypeInstance4.out index 2d81d13624..29066f2b0e 100644 --- a/tests/purs/warning/NewtypeInstance4.out +++ b/tests/purs/warning/NewtypeInstance4.out @@ -3,10 +3,10 @@ in module Main at tests/purs/warning/NewtypeInstance4.purs:23:1 - 23:86 (line 23, column 1 - line 23, column 86) The derived newtype instance for -   -  Main.MonadWriter w0  -  (MyWriter w0) -   +   +  Main.MonadWriter w0  +  (Main.MyWriter w0) +   implies an superclass instance for Main.MonadTell which could not be verified. in value declaration monadWriterMyWriter diff --git a/tests/purs/warning/UnambiguousQuantifiedKind.out b/tests/purs/warning/UnambiguousQuantifiedKind.out index d3b70ea42e..ae569e730f 100644 --- a/tests/purs/warning/UnambiguousQuantifiedKind.out +++ b/tests/purs/warning/UnambiguousQuantifiedKind.out @@ -5,9 +5,9 @@ at tests/purs/warning/UnambiguousQuantifiedKind.purs:12:1 - 12:11 (line 12, colu No type declaration was provided for the top-level declaration of test2. It is good practice to provide type declarations as a form of documentation. The inferred type of test2 was: -   -  Int -   +   +  Prim.Int +   in value declaration test2 diff --git a/tests/purs/warning/WildcardInferredType.out b/tests/purs/warning/WildcardInferredType.out index 91aabf9a1e..50f64ee2f9 100644 --- a/tests/purs/warning/WildcardInferredType.out +++ b/tests/purs/warning/WildcardInferredType.out @@ -4,9 +4,9 @@ Warning 1 of 2: at tests/purs/warning/WildcardInferredType.purs:7:6 - 7:7 (line 7, column 6 - line 7, column 7) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in value declaration y @@ -19,9 +19,9 @@ Warning 2 of 2: at tests/purs/warning/WildcardInferredType.purs:5:10 - 5:11 (line 5, column 10 - line 5, column 11) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in value declaration x diff --git a/tests/purs/warning/WildcardInferredType2.out b/tests/purs/warning/WildcardInferredType2.out index 52cbc66ce7..83ff0e9dc0 100644 --- a/tests/purs/warning/WildcardInferredType2.out +++ b/tests/purs/warning/WildcardInferredType2.out @@ -4,9 +4,9 @@ Warning 1 of 5: at tests/purs/warning/WildcardInferredType2.purs:10:6 - 10:7 (line 10, column 6 - line 10, column 7) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in value declaration x @@ -19,9 +19,9 @@ Warning 2 of 5: at tests/purs/warning/WildcardInferredType2.purs:51:9 - 51:10 (line 51, column 9 - line 51, column 10) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in binding group foxtrot, echo @@ -34,9 +34,9 @@ Warning 3 of 5: at tests/purs/warning/WildcardInferredType2.purs:54:8 - 54:9 (line 54, column 8 - line 54, column 9) Wildcard type definition has the inferred type -   -  Int -   +   +  Prim.Int +   in the following context: m :: Int @@ -55,9 +55,9 @@ Warning 4 of 5: No type declaration was provided for the top-level declaration of delta. It is good practice to provide type declarations as a form of documentation. The inferred type of delta was: -   -  Int -> Int -   +   +  Prim.Int -> Prim.Int +   in binding group delta, charlie @@ -72,9 +72,9 @@ Warning 5 of 5: No type declaration was provided for the top-level declaration of alpha. It is good practice to provide type declarations as a form of documentation. The inferred type of alpha was: -   -  Int -   +   +  Prim.Int +   in value declaration alpha