diff options
Diffstat (limited to 'testsuite')
5 files changed, 100 insertions, 0 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/T16152.hs b/testsuite/tests/partial-sigs/should_compile/T16152.hs new file mode 100644 index 0000000000..a679833dfe --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T16152.hs @@ -0,0 +1,8 @@ +{-# Language PartialTypeSignatures #-} +{-# Language PolyKinds #-} +{-# Language ScopedTypeVariables #-} + +module T16152 where + +top :: forall f. _ +top = undefined diff --git a/testsuite/tests/partial-sigs/should_compile/T16152.stderr b/testsuite/tests/partial-sigs/should_compile/T16152.stderr new file mode 100644 index 0000000000..554cf04766 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T16152.stderr @@ -0,0 +1,7 @@ + +T16152.hs:7:18: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ standing for ‘w’ + Where: ‘w’ is a rigid type variable bound by + the inferred type of top :: w + at T16152.hs:8:1-15 + • In the type signature: top :: forall f. _ diff --git a/testsuite/tests/partial-sigs/should_compile/T22065.hs b/testsuite/tests/partial-sigs/should_compile/T22065.hs new file mode 100644 index 0000000000..b74fb76510 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T22065.hs @@ -0,0 +1,30 @@ +{-# Options_GHC -dcore-lint #-} +{-# Language PartialTypeSignatures #-} + +module T22065 where + +data Foo where + Apply :: (x -> Int) -> x -> Foo + +foo :: Foo +foo = Apply f x :: forall a. _ where + + f :: [_] -> Int + f = length @[] @_ + + x :: [_] + x = mempty @[_] + +{- +Smaller version I used when debuggging + +apply :: (x->Int) -> x -> Bool +apply = apply + +foo :: Bool +foo = apply f x :: forall a. _ + where + f = length @[] + x = mempty + +-} diff --git a/testsuite/tests/partial-sigs/should_compile/T22065.stderr b/testsuite/tests/partial-sigs/should_compile/T22065.stderr new file mode 100644 index 0000000000..42cde6935d --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T22065.stderr @@ -0,0 +1,53 @@ + +T22065.hs:10:30: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ standing for ‘Foo’ + • In an expression type signature: forall a. _ + In the expression: Apply f x :: forall a. _ + In an equation for ‘foo’: + foo + = Apply f x :: forall a. _ + where + f :: [_] -> Int + f = length @[] @_ + x :: [_] + x = mempty @[_] + • Relevant bindings include + f :: forall {w}. [w] -> Int (bound at T22065.hs:13:3) + x :: forall {w}. [w] (bound at T22065.hs:16:3) + foo :: Foo (bound at T22065.hs:10:1) + +T22065.hs:12:9: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ standing for ‘w’ + Where: ‘w’ is a rigid type variable bound by + the inferred type of f :: [w] -> Int + at T22065.hs:13:3-19 + • In the type ‘[_] -> Int’ + In the type signature: f :: [_] -> Int + In an equation for ‘foo’: + foo + = Apply f x :: forall a. _ + where + f :: [_] -> Int + f = length @[] @_ + x :: [_] + x = mempty @[_] + • Relevant bindings include + x :: forall {w}. [w] (bound at T22065.hs:16:3) + foo :: Foo (bound at T22065.hs:10:1) + +T22065.hs:15:9: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ standing for ‘w’ + Where: ‘w’ is a rigid type variable bound by + the inferred type of x :: [w] + at T22065.hs:16:3-17 + • In the type ‘[_]’ + In the type signature: x :: [_] + In an equation for ‘foo’: + foo + = Apply f x :: forall a. _ + where + f :: [_] -> Int + f = length @[] @_ + x :: [_] + x = mempty @[_] + • Relevant bindings include foo :: Foo (bound at T22065.hs:10:1) diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index 3a7e9355a0..935d62231c 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -105,3 +105,5 @@ test('T20921', normal, compile, ['']) test('T21719', normal, compile, ['']) test('InstanceGivenOverlap3', expect_broken(20076), compile, ['']) test('T21667', normal, compile, ['']) +test('T22065', normal, compile, ['']) +test('T16152', normal, compile, ['']) |