Show that cheating is caught master
authorJoachim Breitner <mail@joachim-breitner.de>
Thu, 11 Jul 2013 14:19:37 +0000 (16:19 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Thu, 11 Jul 2013 14:19:37 +0000 (16:19 +0200)
tests/failing/LiftAbstractCheat.err [new file with mode: 0644]
tests/failing/LiftAbstractCheat.hs [new file with mode: 0644]
tests/failing/LiftAbstractCheat.out [new file with mode: 0644]
tests/failing/LiftAbstractCheat.run [new file with mode: 0644]

diff --git a/tests/failing/LiftAbstractCheat.err b/tests/failing/LiftAbstractCheat.err
new file mode 100644 (file)
index 0000000..470b0f5
--- /dev/null
@@ -0,0 +1 @@
+LiftAbstractCheat: You caught me cheating!
diff --git a/tests/failing/LiftAbstractCheat.hs b/tests/failing/LiftAbstractCheat.hs
new file mode 100644 (file)
index 0000000..bda5821
--- /dev/null
@@ -0,0 +1,23 @@
+{-# OPTIONS_GHC -fplugin GHC.NT.Plugin #-}
+
+module LiftAbstractCheat where
+
+import GHC.NT
+import Newtype hiding (main)
+import Abstract
+
+data WrappedAbstract a = WrappedAbstract (Abs1 a) deriving Show
+
+wrappedAbstactNTRaw :: NT a b -> NT (Abs1 a) (Abs1 b) -> NT (WrappedAbstract a) (WrappedAbstract b)
+wrappedAbstactNTRaw = deriveThisNT
+
+wrappedAbstactNT :: NT a b -> NT (WrappedAbstract a) (WrappedAbstract b)
+wrappedAbstactNT nt = wrappedAbstactNTRaw nt (error "You caught me cheating!")
+
+
+main = do
+    let n = WrappedAbstract abs1
+    let a = coerce (sym (wrappedAbstactNT ageNT)) n
+    print n
+    print a
+
diff --git a/tests/failing/LiftAbstractCheat.out b/tests/failing/LiftAbstractCheat.out
new file mode 100644 (file)
index 0000000..1aaee51
--- /dev/null
@@ -0,0 +1 @@
+WrappedAbstract (Abs1 1)
diff --git a/tests/failing/LiftAbstractCheat.run b/tests/failing/LiftAbstractCheat.run
new file mode 100644 (file)
index 0000000..bca086f
--- /dev/null
@@ -0,0 +1,2 @@
+ghc -dcore-lint -package ghc -itests --make tests/failing/LiftAbstractCheat.hs -main-is LiftAbstractCheat >/dev/null &&
+tests/failing/LiftAbstractCheat