diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2020-02-06 16:44:51 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-12 01:58:11 -0500 |
commit | 31fc332191a6298e2643261482e9b43a4b38241b (patch) | |
tree | f654ad2de6dc2af3b1ee783362eb76f107d5a80f /testsuite | |
parent | 04f51297e3d7bcf7be0dc7db4673cc3e6f9156ea (diff) | |
download | haskell-31fc332191a6298e2643261482e9b43a4b38241b.tar.gz |
Add regression test for #12926
Closes #12926
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T12926.hs | 36 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 |
2 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T12926.hs b/testsuite/tests/typecheck/should_compile/T12926.hs new file mode 100644 index 0000000000..a642e67053 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12926.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiParamTypeClasses #-} + +module A where + +import GHC.Base +import qualified Data.Vector.Unboxed.Base +import qualified Data.Vector.Generic.Base +import Data.Vector.Generic.Mutable +import qualified Data.Vector.Generic.Mutable.Base +import Data.Vector.Generic (fromList) + +data A = A Int Int Int + +instance Data.Vector.Unboxed.Base.Unbox A + +newtype instance Data.Vector.Unboxed.Base.MVector s_a4iX A + = MV_A (Data.Vector.Unboxed.Base.MVector s_a4iX (Int, Int, Int)) + +instance MVector Data.Vector.Unboxed.Base.MVector A where + basicLength (MV_A v) = + basicLength v + basicUnsafeSlice idx len (MV_A v) = + MV_A (basicUnsafeSlice idx len v) + basicUnsafeNew len = + MV_A `liftM` (basicUnsafeNew len) + basicUnsafeWrite (MV_A v) idx val_a4iW = + basicUnsafeWrite v idx ((\ (A a_a4iT b_a4iU c_a4iV) -> (a_a4iT, b_a4iU, c_a4iV)) val_a4iW) + +newtype instance Data.Vector.Unboxed.Base.Vector A = + V_A (Data.Vector.Unboxed.Base.Vector (Int, Int, Int)) + +instance Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector A where + +mkA :: Data.Vector.Unboxed.Base.Vector A +mkA = fromList [] diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index e80a82fc98..d143251f9b 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -696,3 +696,4 @@ test('T17343', exit_code(1), compile_and_run, ['']) test('T17566', [extra_files(['T17566a.hs'])], makefile_test, []) test('T12760', unless(compiler_debugged(), skip), compile, ['-O']) test('T13142', normal, compile, ['-O2']) +test('T12926', reqlib('vector'), compile, ['-O2']) |