summaryrefslogtreecommitdiff
path: root/testsuite/tests/linear/should_compile/List.hs
blob: 4d87dba896d874c2944169118a04aefadc639e74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE NoImplicitPrelude #-}
module List where
{-
inplace/bin/ghc-stage1 -O2 -dcore-lint

See Cabal:Distribution.Types.VersionRange:556
-}

import GHC.Base

data J = J ()

j :: () -> J
j = J

tup = (j, J)
tup2 = (J, j)

tup3 = [j, J]
tup4 = [J, j]

{-

[1 of 1] Compiling List             ( linear-tests/List.hs, linear-tests/List.o )

linear-tests/List.hs:17:12: error:
    • Couldn't match expected type ‘() -> J’ with actual type ‘() ⊸ J’
    • In the expression: J
      In the expression: [j, J]
      In an equation for ‘tup3’: tup3 = [j, J]
   |
17 | tup3 = [j, J]
   |            ^

linear-tests/List.hs:18:12: error:
    • Couldn't match expected type ‘() ⊸ J’ with actual type ‘() -> J’
    • In the expression: j
      In the expression: [J, j]
      In an equation for ‘tup4’: tup4 = [J, j]
   |
18 | tup4 = [J, j]
   |            ^

-}