summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/T23308.stderr
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2023-05-11 13:08:14 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-05-12 06:10:57 -0400
commitc176ad1835ccfe55e2bde875b4a35e9d226ff657 (patch)
tree585897cd4bdbb5babd5c86eaed88aa26a8a42595 /testsuite/tests/typecheck/should_fail/T23308.stderr
parenta856d98eb13401b78fa7eba9a54ea4c501ebb0a2 (diff)
downloadhaskell-c176ad1835ccfe55e2bde875b4a35e9d226ff657.tar.gz
Don't panic in mkNewTyConRhs
This function could come across invalid newtype constructors, as we only perform validity checking of newtypes once we are outside the knot-tied typechecking loop. This patch changes this function to fake up a stub type in the case of an invalid newtype, instead of panicking. This patch also changes "checkNewDataCon" so that it reports as many errors as possible at once. Fixes #23308
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/T23308.stderr')
-rw-r--r--testsuite/tests/typecheck/should_fail/T23308.stderr50
1 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T23308.stderr b/testsuite/tests/typecheck/should_fail/T23308.stderr
new file mode 100644
index 0000000000..299876def4
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T23308.stderr
@@ -0,0 +1,50 @@
+
+T23308.hs:12:14: error: [GHC-23517]
+ • A newtype constructor must have exactly one field
+ but ‘B1’ has two
+ B1 :: C1 -> C1 -> B1
+ • In the definition of data constructor ‘B1’
+ In the newtype declaration for ‘B1’
+
+T23308.hs:17:20: error: [GHC-07525]
+ • A newtype constructor must not have existential type variables
+ B2 :: forall (x :: C2). Proxy x -> B2
+ • In the definition of data constructor ‘B2’
+ In the newtype declaration for ‘B2’
+
+T23308.hs:23:21: error: [GHC-07525]
+ • A newtype constructor must not have existential type variables
+ B2' :: forall (x :: C2'). F2' x -> B2'
+ • In the definition of data constructor ‘B2'’
+ In the newtype declaration for ‘B2'’
+
+T23308.hs:28:20: error: [GHC-45219]
+ • Data constructor ‘B3’ returns type ‘B2’
+ instead of an instance of its parent type ‘B3’
+ • In the definition of data constructor ‘B3’
+ In the newtype declaration for ‘B3’
+
+T23308.hs:33:22: error: [GHC-89498]
+ • A newtype must not be a GADT
+ B4 :: C4 -> B4 Int
+ • In the definition of data constructor ‘B4’
+ In the newtype declaration for ‘B4’
+
+T23308.hs:38:22: error: [GHC-17440]
+ • A newtype constructor must not have a context in its type
+ B5 :: forall a. Num a => B5 (a, a)
+ • In the definition of data constructor ‘B5’
+ In the newtype declaration for ‘B5’
+
+T23308.hs:38:22: error: [GHC-89498]
+ • A newtype must not be a GADT
+ B5 :: forall a. Num a => B5 (a, a)
+ • In the definition of data constructor ‘B5’
+ In the newtype declaration for ‘B5’
+
+T23308.hs:38:22: error: [GHC-23517]
+ • A newtype constructor must have exactly one field
+ but ‘B5’ has none
+ B5 :: forall a. Num a => B5 (a, a)
+ • In the definition of data constructor ‘B5’
+ In the newtype declaration for ‘B5’