diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2020-09-10 14:41:25 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-29 00:32:05 -0400 |
commit | 5830a12c46e7227c276a8a71213057595ee4fc04 (patch) | |
tree | 70eacf5713115640af3ef83cb393e6f1a19d5096 /testsuite/tests | |
parent | b31a3360e2ef12f3ec7eaf66b3600247c1eb36c3 (diff) | |
download | haskell-5830a12c46e7227c276a8a71213057595ee4fc04.tar.gz |
New linear types syntax: a %p -> b (#18459)
Implements GHC Proposal #356
Updates the haddock submodule.
Diffstat (limited to 'testsuite/tests')
53 files changed, 110 insertions, 93 deletions
diff --git a/testsuite/tests/linear/should_compile/Linear1Rule.hs b/testsuite/tests/linear/should_compile/Linear1Rule.hs index 0553c61e84..4a1984c3a0 100644 --- a/testsuite/tests/linear/should_compile/Linear1Rule.hs +++ b/testsuite/tests/linear/should_compile/Linear1Rule.hs @@ -2,8 +2,8 @@ module Linear1Rule where -- Test the 1 <= p rule -f :: a #-> b +f :: a %1 -> b f = f -g :: a # p -> b +g :: a %p -> b g x = f x diff --git a/testsuite/tests/linear/should_compile/LinearConstructors.hs b/testsuite/tests/linear/should_compile/LinearConstructors.hs index 0e0f1b547e..59886a216b 100644 --- a/testsuite/tests/linear/should_compile/LinearConstructors.hs +++ b/testsuite/tests/linear/should_compile/LinearConstructors.hs @@ -4,26 +4,26 @@ module LinearConstructors where data T a b = MkT a b -f1 :: a #-> b #-> T a b +f1 :: a %1 -> b %1 -> T a b f1 = MkT -f2 :: a #-> b -> T a b +f2 :: a %1 -> b -> T a b f2 = MkT -f3 :: a -> b #-> T a b +f3 :: a -> b %1 -> T a b f3 = MkT f4 :: a -> b -> T a b f4 = MkT -- tuple sections -g1 :: a #-> b #-> (a, b, Int) +g1 :: a %1 -> b %1 -> (a, b, Int) g1 = (,,0) -g2 :: a #-> b -> (a, b, Int) +g2 :: a %1 -> b -> (a, b, Int) g2 = (,,0) -g3 :: a -> b #-> (a, b, Int) +g3 :: a -> b %1 -> (a, b, Int) g3 = (,,0) g4 :: a -> b -> (a, b, Int) diff --git a/testsuite/tests/linear/should_compile/LinearEmptyCase.hs b/testsuite/tests/linear/should_compile/LinearEmptyCase.hs index daa1918b56..63bfd017fd 100644 --- a/testsuite/tests/linear/should_compile/LinearEmptyCase.hs +++ b/testsuite/tests/linear/should_compile/LinearEmptyCase.hs @@ -4,5 +4,5 @@ module LinearEmptyCase where data Void -f :: a #-> Void -> b +f :: a %1 -> Void -> b f x y = case y of {} diff --git a/testsuite/tests/linear/should_compile/LinearGuards.hs b/testsuite/tests/linear/should_compile/LinearGuards.hs index fae1208176..3ae3f039a5 100644 --- a/testsuite/tests/linear/should_compile/LinearGuards.hs +++ b/testsuite/tests/linear/should_compile/LinearGuards.hs @@ -1,6 +1,6 @@ {-# LANGUAGE LinearTypes #-} module LinearGuards where -f :: Bool -> a #-> a +f :: Bool -> a %1 -> a f b a | b = a | True = a diff --git a/testsuite/tests/linear/should_compile/LinearHole.hs b/testsuite/tests/linear/should_compile/LinearHole.hs index e4c5181d9e..e3016339d1 100644 --- a/testsuite/tests/linear/should_compile/LinearHole.hs +++ b/testsuite/tests/linear/should_compile/LinearHole.hs @@ -3,5 +3,5 @@ module LinearHole where -- #18491 -f :: Int #-> Bool #-> Char +f :: Int %1 -> Bool %1 -> Char f x y = _1 diff --git a/testsuite/tests/linear/should_compile/LinearTH2.hs b/testsuite/tests/linear/should_compile/LinearTH2.hs index a35f9a1c7e..8d3a251c76 100644 --- a/testsuite/tests/linear/should_compile/LinearTH2.hs +++ b/testsuite/tests/linear/should_compile/LinearTH2.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE LinearTypes, TemplateHaskell, RankNTypes #-} +{-# LANGUAGE LinearTypes, TemplateHaskell, RankNTypes, NoMonomorphismRestriction #-} module LinearTH2 where -x1 = [t|forall p. Int # p -> Int|] +x1 = [t|forall p. Int %p -> Int|] diff --git a/testsuite/tests/linear/should_compile/MultConstructor.hs b/testsuite/tests/linear/should_compile/MultConstructor.hs index 6e631774ba..780c906099 100644 --- a/testsuite/tests/linear/should_compile/MultConstructor.hs +++ b/testsuite/tests/linear/should_compile/MultConstructor.hs @@ -4,10 +4,10 @@ module MultConstructor where import GHC.Types data T p a where - MkT :: a # p -> T p a + MkT :: a %p -> T p a {- this currently fails -g :: forall (b :: Type). T 'Many b #-> (b,b) +g :: forall (b :: Type). T 'Many b %1 -> (b,b) g (MkT x) = (x,x) -} diff --git a/testsuite/tests/linear/should_compile/OldList.hs b/testsuite/tests/linear/should_compile/OldList.hs index 2ed7b8aaf2..e84b5bb927 100644 --- a/testsuite/tests/linear/should_compile/OldList.hs +++ b/testsuite/tests/linear/should_compile/OldList.hs @@ -24,11 +24,11 @@ sortBy cmp = [] | a `cmp` b == GT = descending b (a:as) bs descending a as bs = (a:as): sequences bs - ascending :: a -> (forall i . [a] # i -> [a]) -> [a] -> [[a]] + ascending :: a -> (forall i . [a] %i -> [a]) -> [a] -> [[a]] ascending a as (b:bs) | a `cmp` b /= GT = ascending b foo bs where - foo :: [a] # k -> [a] + foo :: [a] %k -> [a] foo ys = as (a:ys) ascending a as bs = let !x = as [a] in x : sequences bs diff --git a/testsuite/tests/linear/should_compile/Pr110.hs b/testsuite/tests/linear/should_compile/Pr110.hs index a3311cb7b8..1bce24895f 100644 --- a/testsuite/tests/linear/should_compile/Pr110.hs +++ b/testsuite/tests/linear/should_compile/Pr110.hs @@ -3,8 +3,8 @@ module Pr110 where data Bloop = Bloop Bool -g :: Bloop #-> Bool +g :: Bloop %1 -> Bool g (Bloop x) = x -h :: Bool #-> Bloop +h :: Bool %1 -> Bloop h x = Bloop x diff --git a/testsuite/tests/linear/should_compile/T18731.hs b/testsuite/tests/linear/should_compile/T18731.hs index c7899efb54..44a8e8d282 100644 --- a/testsuite/tests/linear/should_compile/T18731.hs +++ b/testsuite/tests/linear/should_compile/T18731.hs @@ -1,5 +1,5 @@ {-# LANGUAGE LinearTypes #-} module T18731 where -f :: a #-> b +f :: a %1 -> b f x = undefined x diff --git a/testsuite/tests/linear/should_compile/all.T b/testsuite/tests/linear/should_compile/all.T index d624a337ba..0fa5750794 100644 --- a/testsuite/tests/linear/should_compile/all.T +++ b/testsuite/tests/linear/should_compile/all.T @@ -1,5 +1,3 @@ -broken_multiplicity_syntax = 94 # https://github.com/tweag/ghc/issues/94 - test('anf', normal, compile, ['']) test('Arity2', normal, compile, ['']) test('Branches', normal, compile, ['']) @@ -10,7 +8,7 @@ test('DollarTest', normal, compile, ['']) test('Foldr', normal, compile, ['']) test('Iden', normal, compile, ['']) test('List', normal, compile, ['']) -test('OldList', expect_broken(broken_multiplicity_syntax), compile, ['']) +test('OldList', normal, compile, ['']) test('Op', normal, compile, ['']) test('RankN', normal, compile, ['']) test('T1735Min', normal, compile, ['']) @@ -28,12 +26,12 @@ test('Linear8', normal, compile, ['']) test('LinearGuards', normal, compile, ['']) test('LinearPolyDollar', normal, compile, ['']) test('LinearConstructors', normal, compile, ['']) -test('Linear1Rule', expect_broken(broken_multiplicity_syntax), compile, ['']) +test('Linear1Rule', normal, compile, ['']) test('LinearEmptyCase', normal, compile, ['']) test('Tunboxer', normal, compile, ['']) -test('MultConstructor', expect_broken(broken_multiplicity_syntax), compile, ['']) +test('MultConstructor', normal, compile, ['']) test('LinearLetRec', expect_broken(405), compile, ['-O -dlinear-core-lint']) test('LinearTH1', normal, compile, ['']) -test('LinearTH2', expect_broken(broken_multiplicity_syntax), compile, ['']) +test('LinearTH2', normal, compile, ['']) test('LinearHole', normal, compile, ['']) test('T18731', normal, compile, ['']) diff --git a/testsuite/tests/linear/should_fail/Linear13.hs b/testsuite/tests/linear/should_fail/Linear13.hs index 7b9e09c52b..7d36a33570 100644 --- a/testsuite/tests/linear/should_fail/Linear13.hs +++ b/testsuite/tests/linear/should_fail/Linear13.hs @@ -5,7 +5,7 @@ module Linear13 where incorrectLet :: a ⊸ () incorrectLet a = let x = a in () -incorrectLetWithSignature :: (Bool->Bool) #-> () +incorrectLetWithSignature :: (Bool->Bool) %1 -> () incorrectLetWithSignature x = let y :: Bool->Bool; y = x in () incorrectLazyMatch :: (a,b) ⊸ b diff --git a/testsuite/tests/linear/should_fail/LinearAsPat.hs b/testsuite/tests/linear/should_fail/LinearAsPat.hs index e756f4369f..86b557c66b 100644 --- a/testsuite/tests/linear/should_fail/LinearAsPat.hs +++ b/testsuite/tests/linear/should_fail/LinearAsPat.hs @@ -2,5 +2,5 @@ module LinearAsPat where -shouldFail :: Bool #-> Bool +shouldFail :: Bool %1 -> Bool shouldFail x@True = x diff --git a/testsuite/tests/linear/should_fail/LinearBottomMult.hs b/testsuite/tests/linear/should_fail/LinearBottomMult.hs index 03bf8731a7..b3d00069fe 100644 --- a/testsuite/tests/linear/should_fail/LinearBottomMult.hs +++ b/testsuite/tests/linear/should_fail/LinearBottomMult.hs @@ -6,8 +6,8 @@ module LinearBottomMult where data Void data U a where U :: a -> U a -elim :: U a #-> () +elim :: U a %1 -> () elim (U _) = () -f :: a #-> () +f :: a %1 -> () f x = elim (U (\(a :: Void) -> case a of {})) diff --git a/testsuite/tests/linear/should_fail/LinearConfusedDollar.hs b/testsuite/tests/linear/should_fail/LinearConfusedDollar.hs index 2cd1628eeb..a679a50431 100644 --- a/testsuite/tests/linear/should_fail/LinearConfusedDollar.hs +++ b/testsuite/tests/linear/should_fail/LinearConfusedDollar.hs @@ -5,8 +5,8 @@ module LinearConfusedDollar where -- hold anymore. But, as it stands, it produces untyped desugared code, hence -- must be rejected. -f :: a #-> a +f :: a %1 -> a f x = x -g :: a #-> a +g :: a %1 -> a g x = f $ x diff --git a/testsuite/tests/linear/should_fail/LinearConfusedDollar.stderr b/testsuite/tests/linear/should_fail/LinearConfusedDollar.stderr index 61d7aa2f45..51dc7cdd91 100644 --- a/testsuite/tests/linear/should_fail/LinearConfusedDollar.stderr +++ b/testsuite/tests/linear/should_fail/LinearConfusedDollar.stderr @@ -2,7 +2,7 @@ LinearConfusedDollar.hs:12:7: error: • Couldn't match type ‘'One’ with ‘'Many’ Expected: a -> a - Actual: a #-> a + Actual: a %1 -> a • In the first argument of ‘($)’, namely ‘f’ In the expression: f $ x In an equation for ‘g’: g x = f $ x diff --git a/testsuite/tests/linear/should_fail/LinearErrOrigin.hs b/testsuite/tests/linear/should_fail/LinearErrOrigin.hs index 1eeb149959..3368c723b2 100644 --- a/testsuite/tests/linear/should_fail/LinearErrOrigin.hs +++ b/testsuite/tests/linear/should_fail/LinearErrOrigin.hs @@ -3,5 +3,5 @@ module LinearErrOrigin where -- The error message should mention "arising from multiplicity of x". -foo :: (a # p -> b) -> a # q -> b +foo :: (a %p -> b) -> a %q -> b foo f x = f x diff --git a/testsuite/tests/linear/should_fail/LinearErrOrigin.stderr b/testsuite/tests/linear/should_fail/LinearErrOrigin.stderr index 10b889a9a8..02dc7216db 100644 --- a/testsuite/tests/linear/should_fail/LinearErrOrigin.stderr +++ b/testsuite/tests/linear/should_fail/LinearErrOrigin.stderr @@ -3,14 +3,17 @@ LinearErrOrigin.hs:7:7: error: • Couldn't match type ‘p’ with ‘q’ arising from multiplicity of ‘x’ ‘p’ is a rigid type variable bound by the type signature for: - foo :: forall a b. (a -> b) -> a -> b - at LinearErrOrigin.hs:6:1-35 + foo :: forall a b (p :: GHC.Types.Multiplicity) + (q :: GHC.Types.Multiplicity). + (a # p -> b) -> a # q -> b + at LinearErrOrigin.hs:6:1-31 ‘q’ is a rigid type variable bound by the type signature for: - foo :: forall a b. (a -> b) -> a -> b - at LinearErrOrigin.hs:6:1-35 + foo :: forall a b (p :: GHC.Types.Multiplicity) + (q :: GHC.Types.Multiplicity). + (a # p -> b) -> a # q -> b + at LinearErrOrigin.hs:6:1-31 • In an equation for ‘foo’: foo f x = f x • Relevant bindings include f :: a # p -> b (bound at LinearErrOrigin.hs:7:5) - foo :: (a # p -> b) -> a # q -> b - (bound at LinearErrOrigin.hs:7:1) + foo :: (a # p -> b) -> a # q -> b (bound at LinearErrOrigin.hs:7:1) diff --git a/testsuite/tests/linear/should_fail/LinearFFI.hs b/testsuite/tests/linear/should_fail/LinearFFI.hs index 6c6e1c562a..4c58c9eecd 100644 --- a/testsuite/tests/linear/should_fail/LinearFFI.hs +++ b/testsuite/tests/linear/should_fail/LinearFFI.hs @@ -3,6 +3,6 @@ module LinearFFI where -- #18472 import Foreign.Ptr -foreign import ccall "exp" c_exp :: Double #-> Double -foreign import stdcall "dynamic" d8 :: FunPtr (IO Int) #-> IO Int -foreign import ccall "wrapper" mkF :: IO () #-> IO (FunPtr (IO ())) +foreign import ccall "exp" c_exp :: Double %1 -> Double +foreign import stdcall "dynamic" d8 :: FunPtr (IO Int) %1 -> IO Int +foreign import ccall "wrapper" mkF :: IO () %1 -> IO (FunPtr (IO ())) diff --git a/testsuite/tests/linear/should_fail/LinearFFI.stderr b/testsuite/tests/linear/should_fail/LinearFFI.stderr index 41dd5e66a7..6d0707252e 100644 --- a/testsuite/tests/linear/should_fail/LinearFFI.stderr +++ b/testsuite/tests/linear/should_fail/LinearFFI.stderr @@ -3,18 +3,18 @@ LinearFFI.hs:6:1: error: • Unacceptable argument type in foreign declaration: Linear types are not supported in FFI declarations, see #18472 • When checking declaration: - foreign import ccall safe "exp" c_exp :: Double #-> Double + foreign import ccall safe "exp" c_exp :: Double %1 -> Double LinearFFI.hs:7:1: error: • Unacceptable argument type in foreign declaration: Linear types are not supported in FFI declarations, see #18472 • When checking declaration: foreign import stdcall safe "dynamic" d8 - :: FunPtr (IO Int) #-> IO Int + :: FunPtr (IO Int) %1 -> IO Int LinearFFI.hs:8:1: error: • Unacceptable argument type in foreign declaration: Linear types are not supported in FFI declarations, see #18472 • When checking declaration: foreign import ccall safe "wrapper" mkF - :: IO () #-> IO (FunPtr (IO ())) + :: IO () %1 -> IO (FunPtr (IO ())) diff --git a/testsuite/tests/linear/should_fail/LinearIf.hs b/testsuite/tests/linear/should_fail/LinearIf.hs index b19873120c..9ddd5ce50b 100644 --- a/testsuite/tests/linear/should_fail/LinearIf.hs +++ b/testsuite/tests/linear/should_fail/LinearIf.hs @@ -9,7 +9,7 @@ ifThenElse :: Bool -> a -> a -> a ifThenElse True x _ = x ifThenElse False _ y = y -f :: Bool #-> Char #-> Char #-> Char +f :: Bool %1 -> Char %1 -> Char %1 -> Char f b x y = if b then x else y -- 'f' ought to be unrestricted in all three arguments because it desugars to -- > ifThenElse b x y diff --git a/testsuite/tests/linear/should_fail/LinearKind.hs b/testsuite/tests/linear/should_fail/LinearKind.hs index a60554a7a7..6455249c6c 100644 --- a/testsuite/tests/linear/should_fail/LinearKind.hs +++ b/testsuite/tests/linear/should_fail/LinearKind.hs @@ -1,4 +1,4 @@ {-# LANGUAGE LinearTypes, KindSignatures #-} module LinearKind where -data A :: * #-> * +data A :: * %1 -> * diff --git a/testsuite/tests/linear/should_fail/LinearKind.stderr b/testsuite/tests/linear/should_fail/LinearKind.stderr index 5ac2825b21..9ba3f744cf 100644 --- a/testsuite/tests/linear/should_fail/LinearKind.stderr +++ b/testsuite/tests/linear/should_fail/LinearKind.stderr @@ -1,5 +1,5 @@ LinearKind.hs:4:11: error: - • Linear arrows disallowed in kinds: * #-> * - • In the kind ‘* #-> *’ + • Linear arrows disallowed in kinds: * %1 -> * + • In the kind ‘* %1 -> *’ In the data type declaration for ‘A’ diff --git a/testsuite/tests/linear/should_fail/LinearLazyPat.hs b/testsuite/tests/linear/should_fail/LinearLazyPat.hs index 8ed4024c40..be87629cc9 100644 --- a/testsuite/tests/linear/should_fail/LinearLazyPat.hs +++ b/testsuite/tests/linear/should_fail/LinearLazyPat.hs @@ -1,5 +1,5 @@ {-# LANGUAGE LinearTypes #-} module LinearLazyPat where -f :: (a,b) #-> (b,a) +f :: (a,b) %1 -> (b,a) f ~(x,y) = (y,x) diff --git a/testsuite/tests/linear/should_fail/LinearLet.hs b/testsuite/tests/linear/should_fail/LinearLet.hs index bf822a8a6e..9ad7f4932f 100644 --- a/testsuite/tests/linear/should_fail/LinearLet.hs +++ b/testsuite/tests/linear/should_fail/LinearLet.hs @@ -1,5 +1,5 @@ {-# LANGUAGE LinearTypes #-} module LinearLet where -f :: a #-> (a,a) +f :: a %1 -> (a,a) f x = let y = x in (y,y) diff --git a/testsuite/tests/linear/should_fail/LinearNoExt.hs b/testsuite/tests/linear/should_fail/LinearNoExt.hs index 2671246f21..47c3ea85f9 100644 --- a/testsuite/tests/linear/should_fail/LinearNoExt.hs +++ b/testsuite/tests/linear/should_fail/LinearNoExt.hs @@ -1,3 +1,3 @@ module LinearNoExt where -type T = a #-> a +type T a = a %1 -> a diff --git a/testsuite/tests/linear/should_fail/LinearNoExt.stderr b/testsuite/tests/linear/should_fail/LinearNoExt.stderr index 452409586d..9277e29ea5 100644 --- a/testsuite/tests/linear/should_fail/LinearNoExt.stderr +++ b/testsuite/tests/linear/should_fail/LinearNoExt.stderr @@ -1,3 +1,10 @@ -LinearNoExt.hs:3:12: error: - Enable LinearTypes to allow linear functions +LinearNoExt.hs:3:14: error: + Not in scope: type constructor or class ‘%’ + +LinearNoExt.hs:3:14: error: + Illegal operator ‘%’ in type ‘a % 1’ + Use TypeOperators to allow operators in types + +LinearNoExt.hs:3:15: error: + Illegal type: ‘1’ Perhaps you intended to use DataKinds diff --git a/testsuite/tests/linear/should_fail/LinearNoExtU.hs b/testsuite/tests/linear/should_fail/LinearNoExtU.hs new file mode 100644 index 0000000000..1e7ffad4e8 --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearNoExtU.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE UnicodeSyntax #-} +module LinearNoExtU where + +type T a = a ⊸ a diff --git a/testsuite/tests/linear/should_fail/LinearNoExtU.stderr b/testsuite/tests/linear/should_fail/LinearNoExtU.stderr new file mode 100644 index 0000000000..ac187aee4a --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearNoExtU.stderr @@ -0,0 +1,3 @@ + +LinearNoExtU.hs:4:14: error: + Enable LinearTypes to allow linear functions diff --git a/testsuite/tests/linear/should_fail/LinearPartialSig.hs b/testsuite/tests/linear/should_fail/LinearPartialSig.hs index 01dbeddfba..cbda746317 100644 --- a/testsuite/tests/linear/should_fail/LinearPartialSig.hs +++ b/testsuite/tests/linear/should_fail/LinearPartialSig.hs @@ -2,5 +2,5 @@ module LinearPartialSig where -- We should suggest that _ :: Multiplicity -f :: a # _ -> a +f :: a %_ -> a f x = x diff --git a/testsuite/tests/linear/should_fail/LinearPartialSig.stderr b/testsuite/tests/linear/should_fail/LinearPartialSig.stderr index 4d25260bf2..704fcb258c 100644 --- a/testsuite/tests/linear/should_fail/LinearPartialSig.stderr +++ b/testsuite/tests/linear/should_fail/LinearPartialSig.stderr @@ -1,5 +1,5 @@ -LinearPartialSig.hs:5:13: error: +LinearPartialSig.hs:5:9: error: • Found type wildcard ‘_’ standing for ‘'Many :: GHC.Types.Multiplicity’ To use the inferred type, enable PartialTypeSignatures diff --git a/testsuite/tests/linear/should_fail/LinearPatSyn.hs b/testsuite/tests/linear/should_fail/LinearPatSyn.hs index 3e947dba2e..3e87bfc078 100644 --- a/testsuite/tests/linear/should_fail/LinearPatSyn.hs +++ b/testsuite/tests/linear/should_fail/LinearPatSyn.hs @@ -7,8 +7,8 @@ module LinearPatSyn where -- seems to require changes to the desugarer. So currently pattern synonyms are -- disallowed in linear patterns. -pattern P :: b #-> a #-> (a, b) +pattern P :: b %1 -> a %1 -> (a, b) pattern P y x = (x, y) -s :: (a, b) #-> (b, a) +s :: (a, b) %1 -> (b, a) s (P y x) = (y, x) diff --git a/testsuite/tests/linear/should_fail/LinearPatternGuardWildcard.hs b/testsuite/tests/linear/should_fail/LinearPatternGuardWildcard.hs index be837fd80b..de04b28f49 100644 --- a/testsuite/tests/linear/should_fail/LinearPatternGuardWildcard.hs +++ b/testsuite/tests/linear/should_fail/LinearPatternGuardWildcard.hs @@ -3,5 +3,5 @@ module LinearPatternGuardWildcard where -- See #18439 -unsafeConsume :: a #-> () +unsafeConsume :: a %1 -> () unsafeConsume x | _ <- x = () diff --git a/testsuite/tests/linear/should_fail/LinearPolyType.hs b/testsuite/tests/linear/should_fail/LinearPolyType.hs index bcf46eed9f..21c09247b5 100644 --- a/testsuite/tests/linear/should_fail/LinearPolyType.hs +++ b/testsuite/tests/linear/should_fail/LinearPolyType.hs @@ -11,6 +11,6 @@ type family If b t f where If True t _ = t If False _ f = f -dep :: SBool b -> Int # If b One Many -> Int +dep :: SBool b -> Int %(If b One Many) -> Int dep STrue x = x dep SFalse _ = 0 diff --git a/testsuite/tests/linear/should_fail/LinearPolyType.stderr b/testsuite/tests/linear/should_fail/LinearPolyType.stderr index fab6dfcc9b..884b8991fb 100644 --- a/testsuite/tests/linear/should_fail/LinearPolyType.stderr +++ b/testsuite/tests/linear/should_fail/LinearPolyType.stderr @@ -1,3 +1,6 @@ LinearPolyType.hs:15:1: error: Multiplicity coercions are currently not supported + +LinearPolyType.hs:15:1: error: + Multiplicity coercions are currently not supported diff --git a/testsuite/tests/linear/should_fail/LinearRecordUpdate.hs b/testsuite/tests/linear/should_fail/LinearRecordUpdate.hs index e143dbd604..c9df293624 100644 --- a/testsuite/tests/linear/should_fail/LinearRecordUpdate.hs +++ b/testsuite/tests/linear/should_fail/LinearRecordUpdate.hs @@ -4,5 +4,5 @@ module LinearRecordUpdate where data R = R { x :: Int, y :: Bool } -shouldFail :: R #-> R +shouldFail :: R %1 -> R shouldFail r = r { y = False } diff --git a/testsuite/tests/linear/should_fail/LinearSeq.hs b/testsuite/tests/linear/should_fail/LinearSeq.hs index 0f2ed39c93..efe102c510 100644 --- a/testsuite/tests/linear/should_fail/LinearSeq.hs +++ b/testsuite/tests/linear/should_fail/LinearSeq.hs @@ -2,5 +2,5 @@ module LinearSeq where -bad :: a #-> () +bad :: a %1 -> () bad x = seq x () diff --git a/testsuite/tests/linear/should_fail/LinearSequenceExpr.hs b/testsuite/tests/linear/should_fail/LinearSequenceExpr.hs index ff3ac9cedb..2643c78252 100644 --- a/testsuite/tests/linear/should_fail/LinearSequenceExpr.hs +++ b/testsuite/tests/linear/should_fail/LinearSequenceExpr.hs @@ -3,6 +3,6 @@ module LinearSequenceExpr where -f :: Char #-> Char #-> [Char] +f :: Char %1 -> Char %1 -> [Char] f x y = [x .. y] -- This ought to fail, because `fromList` in base, is unrestricted diff --git a/testsuite/tests/linear/should_fail/LinearVar.hs b/testsuite/tests/linear/should_fail/LinearVar.hs index 7b4cde3647..9a3abb8c89 100644 --- a/testsuite/tests/linear/should_fail/LinearVar.hs +++ b/testsuite/tests/linear/should_fail/LinearVar.hs @@ -1,5 +1,5 @@ {-# LANGUAGE LinearTypes #-} module LinearVar where -f :: a # m -> b +f :: a %m -> b f = undefined :: a -> b diff --git a/testsuite/tests/linear/should_fail/LinearVar.stderr b/testsuite/tests/linear/should_fail/LinearVar.stderr index 04014ce79b..cdbb4de1c9 100644 --- a/testsuite/tests/linear/should_fail/LinearVar.stderr +++ b/testsuite/tests/linear/should_fail/LinearVar.stderr @@ -1,12 +1,12 @@ LinearVar.hs:5:5: error: • Couldn't match type ‘m’ with ‘'Many’ + Expected: a # m -> b + Actual: a -> b ‘m’ is a rigid type variable bound by the type signature for: - f :: forall a b. a -> b - at LinearVar.hs:4:1-16 - Expected type: a # m -> b - Actual type: a -> b + f :: forall a b (m :: GHC.Types.Multiplicity). a # m -> b + at LinearVar.hs:4:1-14 • In the expression: undefined :: a -> b In an equation for ‘f’: f = undefined :: a -> b • Relevant bindings include diff --git a/testsuite/tests/linear/should_fail/LinearViewPattern.hs b/testsuite/tests/linear/should_fail/LinearViewPattern.hs index 737393911b..55058e4263 100644 --- a/testsuite/tests/linear/should_fail/LinearViewPattern.hs +++ b/testsuite/tests/linear/should_fail/LinearViewPattern.hs @@ -7,5 +7,5 @@ module LinearViewPattern where -- incorrect Core being emitted by the desugarer. When we understand linear view -- pattern better, we will probably want to remove this test. -f :: Bool #-> Bool +f :: Bool %1 -> Bool f (not -> True) = True diff --git a/testsuite/tests/linear/should_fail/all.T b/testsuite/tests/linear/should_fail/all.T index 5a79b031b6..bcba344268 100644 --- a/testsuite/tests/linear/should_fail/all.T +++ b/testsuite/tests/linear/should_fail/all.T @@ -1,5 +1,3 @@ -broken_multiplicity_syntax = 94 # https://github.com/tweag/ghc/issues/94 - test('TypeClass', normal, compile_fail, ['']) test('Linear11', normal, compile_fail, ['']) test('Linear13', normal, compile_fail, ['']) @@ -10,6 +8,7 @@ test('Linear5', normal, compile_fail, ['']) test('Linear7', normal, compile_fail, ['']) test('Linear9', normal, compile_fail, ['']) test('LinearNoExt', normal, compile_fail, ['']) +test('LinearNoExtU', normal, compile_fail, ['']) test('LinearAsPat', normal, compile_fail, ['']) test('LinearLet', normal, compile_fail, ['']) test('LinearLazyPat', normal, compile_fail, ['']) @@ -19,11 +18,11 @@ test('LinearViewPattern', normal, compile_fail, ['']) test('LinearConfusedDollar', normal, compile_fail, ['']) test('LinearPatSyn', normal, compile_fail, ['']) test('LinearGADTNewtype', normal, compile_fail, ['']) -test('LinearPartialSig', expect_broken(broken_multiplicity_syntax), compile_fail, ['']) +test('LinearPartialSig', normal, compile_fail, ['']) test('LinearKind', normal, compile_fail, ['']) -test('LinearVar', expect_broken(broken_multiplicity_syntax), compile_fail, ['']) -test('LinearErrOrigin', expect_broken(broken_multiplicity_syntax), compile_fail, ['']) -test('LinearPolyType', expect_broken([436, broken_multiplicity_syntax]), compile_fail, ['']) # not supported yet (#354) +test('LinearVar', normal, compile_fail, ['-XLinearTypes']) +test('LinearErrOrigin', normal, compile_fail, ['-XLinearTypes']) +test('LinearPolyType', normal, compile_fail, ['']) # not supported yet (#390) test('LinearBottomMult', normal, compile_fail, ['']) test('LinearSequenceExpr', normal, compile_fail, ['']) test('LinearIf', normal, compile_fail, ['']) diff --git a/testsuite/tests/linear/should_run/LinearGhci.script b/testsuite/tests/linear/should_run/LinearGhci.script index cd55fe73bd..b8fa13a4ca 100644 --- a/testsuite/tests/linear/should_run/LinearGhci.script +++ b/testsuite/tests/linear/should_run/LinearGhci.script @@ -3,7 +3,7 @@ data T a = MkT a :set -XLinearTypes :type MkT :set -XGADTs -data T a where MkT :: a #-> a -> T a +data T a where MkT :: a %1 -> a -> T a :info T data T a b m n r = MkT a b m n r :set -fprint-explicit-foralls diff --git a/testsuite/tests/linear/should_run/LinearGhci.stdout b/testsuite/tests/linear/should_run/LinearGhci.stdout index ed5c9cfe64..29cfa88b11 100644 --- a/testsuite/tests/linear/should_run/LinearGhci.stdout +++ b/testsuite/tests/linear/should_run/LinearGhci.stdout @@ -2,6 +2,6 @@ MkT :: a -> T a MkT :: a -> T a type T :: * -> * data T a where - MkT :: a #-> a -> T a + MkT :: a %1 -> a -> T a -- Defined at <interactive>:6:1 MkT :: forall a b m n r. a -> b -> m -> n -> r -> T a b m n r diff --git a/testsuite/tests/linear/should_run/LinearTypeable.hs b/testsuite/tests/linear/should_run/LinearTypeable.hs index 69772f7b33..f22d6c445a 100644 --- a/testsuite/tests/linear/should_run/LinearTypeable.hs +++ b/testsuite/tests/linear/should_run/LinearTypeable.hs @@ -4,7 +4,7 @@ module Main (main) where import Data.Typeable import Data.Maybe -x :: Maybe ((Int -> Int) :~: (Int #-> Int)) +x :: Maybe ((Int -> Int) :~: (Int %1 -> Int)) x = eqT main = print (isJust x) diff --git a/testsuite/tests/qualifieddo/should_run/Monad/Linear.hs b/testsuite/tests/qualifieddo/should_run/Monad/Linear.hs index df7f2775c8..05eadd3d04 100644 --- a/testsuite/tests/qualifieddo/should_run/Monad/Linear.hs +++ b/testsuite/tests/qualifieddo/should_run/Monad/Linear.hs @@ -8,10 +8,10 @@ data T where T :: Int -> T data TM a = TM a class Monad m where - return :: a #-> m a - (>>=) :: m a #-> (a #-> m b) #-> m b + return :: a %1 -> m a + (>>=) :: m a %1 -> (a %1 -> m b) %1 -> m b -(>>) :: Monad m => m () #-> m b #-> m b +(>>) :: Monad m => m () %1 -> m b %1 -> m b m1 >> m2 = m1 >>= \() -> m2 instance Monad TM where @@ -27,11 +27,11 @@ runTM (TM (Unrestricted a)) = a newT :: TM T newT = return (T 0) -increaseT :: T #-> TM T +increaseT :: T %1 -> TM T increaseT (T i) = return (T (i+1)) -extractT :: T #-> TM (T, Unrestricted Int) +extractT :: T %1 -> TM (T, Unrestricted Int) extractT (T i) = return (T i, Unrestricted i) -deleteT :: T #-> TM () +deleteT :: T %1 -> TM () deleteT (T _) = return () diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr index ccf2147977..6958eceeca 100644 --- a/testsuite/tests/simplCore/should_compile/T7360.stderr +++ b/testsuite/tests/simplCore/should_compile/T7360.stderr @@ -4,7 +4,7 @@ Result size of Tidy Core = {terms: 106, types: 47, coercions: 0, joins: 0/0} -- RHS size: {terms: 6, types: 3, coercions: 0, joins: 0/0} -T7360.$WFoo3 [InlPrag=INLINE[final] CONLIKE] :: Int #-> Foo +T7360.$WFoo3 [InlPrag=INLINE[final] CONLIKE] :: Int %1 -> Foo [GblId[DataConWrapper], Arity=1, Caf=NoCafRefs, diff --git a/testsuite/tests/stranal/should_compile/T16029.stdout b/testsuite/tests/stranal/should_compile/T16029.stdout index 5b3a03a603..59507ee4ce 100644 --- a/testsuite/tests/stranal/should_compile/T16029.stdout +++ b/testsuite/tests/stranal/should_compile/T16029.stdout @@ -1,4 +1,4 @@ -T16029.$WMkT [InlPrag=INLINE[final] CONLIKE] :: Int #-> Int #-> T + :: Int %1 -> Int %1 -> T Tmpl= \ (dt [Occ=Once1!] :: Int) (dt [Occ=Once1!] :: Int) -> = \ (dt [Occ=Once1!] :: Int) (dt [Occ=Once1!] :: Int) -> :: GHC.Prim.Int# -> GHC.Prim.Int# diff --git a/testsuite/tests/th/T10019.stdout b/testsuite/tests/th/T10019.stdout index 6acec6d98f..85510c1af1 100644 --- a/testsuite/tests/th/T10019.stdout +++ b/testsuite/tests/th/T10019.stdout @@ -1 +1 @@ -"Constructor from Ghci1.Option: Ghci1.Some :: forall (a_0 :: *) .\n a_0 #-> Ghci1.Option a_0" +"Constructor from Ghci1.Option: Ghci1.Some :: forall (a_0 :: *) .\n a_0 %1 -> Ghci1.Option a_0" diff --git a/testsuite/tests/th/T11345.stdout b/testsuite/tests/th/T11345.stdout index f710d847c8..782005a4fb 100644 --- a/testsuite/tests/th/T11345.stdout +++ b/testsuite/tests/th/T11345.stdout @@ -3,8 +3,8 @@ data Main.GADT (a_0 :: *) where GHC.Types.Int -> Main.GADT GHC.Types.Int (Main.:***:) :: GHC.Types.Int -> GHC.Types.Int -> Main.GADT GHC.Types.Int -Constructor from Main.GADT: (Main.:***:) :: GHC.Types.Int #-> - GHC.Types.Int #-> Main.GADT GHC.Types.Int +Constructor from Main.GADT: (Main.:***:) :: GHC.Types.Int %1 -> + GHC.Types.Int %1 -> Main.GADT GHC.Types.Int Nothing Just (Fixity 7 InfixR) 1 :****: 4 diff --git a/testsuite/tests/th/TH_reifyLinear.hs b/testsuite/tests/th/TH_reifyLinear.hs index c551ad9235..3a99dc79a6 100644 --- a/testsuite/tests/th/TH_reifyLinear.hs +++ b/testsuite/tests/th/TH_reifyLinear.hs @@ -4,7 +4,7 @@ module TH_reifyLinear where import Language.Haskell.TH import System.IO -type T = Int #-> Int +type T = Int %1 -> Int $( do x <- reify ''T diff --git a/testsuite/tests/th/TH_reifyLinear.stderr b/testsuite/tests/th/TH_reifyLinear.stderr index ed7866bfa8..5f2cceb12a 100644 --- a/testsuite/tests/th/TH_reifyLinear.stderr +++ b/testsuite/tests/th/TH_reifyLinear.stderr @@ -1 +1 @@ -type TH_reifyLinear.T = GHC.Types.Int #-> GHC.Types.Int +type TH_reifyLinear.T = GHC.Types.Int %1 -> GHC.Types.Int diff --git a/testsuite/tests/typecheck/should_fail/T15807.stderr b/testsuite/tests/typecheck/should_fail/T15807.stderr index bac4b5596e..8589ec1268 100644 --- a/testsuite/tests/typecheck/should_fail/T15807.stderr +++ b/testsuite/tests/typecheck/should_fail/T15807.stderr @@ -2,7 +2,7 @@ T15807.hs:12:3: error: • Cannot generalise type; skolem ‘f’ would escape its scope if I tried to quantify (f0 :: f -> *) in this type: - forall f (a :: f). f a #-> App @f @f0 a + forall f (a :: f). f a %1 -> App @f @f0 a (Indeed, I sometimes struggle even printing this correctly, due to its ill-scoped nature.) • In the definition of data constructor ‘MkApp’ |