[project @ 1998-06-11 10:32:06 by sof]
authorsof <unknown>
Thu, 11 Jun 1998 10:32:10 +0000 (10:32 +0000)
committersof <unknown>
Thu, 11 Jun 1998 10:32:10 +0000 (10:32 +0000)
Testing the illegal use of pattern syntax in expressions (and vice versa)

ghc/tests/reader/should_fail/read003.stderr
ghc/tests/reader/should_fail/read006.hs [new file with mode: 0644]
ghc/tests/reader/should_fail/read006.stderr [new file with mode: 0644]
ghc/tests/reader/should_fail/read007.hs [new file with mode: 0644]
ghc/tests/reader/should_fail/read007.stderr [new file with mode: 0644]

index 690ebe4..706a4e1 100644 (file)
@@ -14,9 +14,9 @@ module Read003 where
  
 read003.hs:8:
     Occurs check: cannot construct the infinite type:
-           aMm = (aMm, aMp, aMs)
-    Expected: (aMm, [aMA], aMs)
-    Inferred: aMm
+           aKy = (aKy, aKB, aKE)
+    Expected: (aKy, [aKM], aKE)
+    Inferred: aKy
     In a pattern binding:
        ~(a, b, c)
            | nullity b = a
diff --git a/ghc/tests/reader/should_fail/read006.hs b/ghc/tests/reader/should_fail/read006.hs
new file mode 100644 (file)
index 0000000..feae50f
--- /dev/null
@@ -0,0 +1,9 @@
+--!!! Using pattern syntax on RHS
+module ShouldFail where
+
+f :: Int -> Int
+f x = _
+
+g :: Int -> Int
+g x = 2 + 2@_
+
diff --git a/ghc/tests/reader/should_fail/read006.stderr b/ghc/tests/reader/should_fail/read006.stderr
new file mode 100644 (file)
index 0000000..d7814a4
--- /dev/null
@@ -0,0 +1 @@
+read006.hs:5:7: pattern syntax used in expression on input: "_"
diff --git a/ghc/tests/reader/should_fail/read007.hs b/ghc/tests/reader/should_fail/read007.hs
new file mode 100644 (file)
index 0000000..bb9e658
--- /dev/null
@@ -0,0 +1,8 @@
+--!!! Expressions as patterns inside do stmt blocks
+module ShouldFail where
+
+f :: Int -> IO Int
+f x = do
+  (2+2) <- 2
+  return x
+
diff --git a/ghc/tests/reader/should_fail/read007.stderr b/ghc/tests/reader/should_fail/read007.stderr
new file mode 100644 (file)
index 0000000..2afd40e
--- /dev/null
@@ -0,0 +1 @@
+read007.hs:7:3: variable application in pattern on input: "return"