Skip to content

Commit 80a7e56

Browse files
Merge pull request #2530 from ninioArtillero/name-resolution-tests
Test of the qualified import of type alises
2 parents 69b6010 + a09eede commit 80a7e56

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

tests/names/neg/Nat1.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Nat1 where
2+
3+
{-@ type INat = {v:Int | v >= 0} @-}

tests/names/neg/Nat2.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Nat2 where
2+
3+
import Data.Int (Int32)
4+
5+
{-@ type INat = {v:Int32 | v >= 0}@-}

tests/names/neg/QualifiedAliases.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{-@ LIQUID "--expect-error-containing=Multiple definitions of Type Alias" @-}
2+
3+
-- | This is an instance of LiquidHaskell having a flat import namespace
4+
-- for logic names. Here, both Nat modules export the same type alias 'INat',
5+
-- producing an error even though we explicitly qualify it to avoid ambiguity.
6+
module QualifiedAliases where
7+
8+
import qualified Nat1 as N
9+
import Nat2
10+
11+
{-@ llength :: [a] -> Nat @-}
12+
llength :: [a] -> Int
13+
llength [] = 0
14+
llength (x : xs) = 1 + length xs

tests/tests.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,9 @@ executable names-neg
781781
, Capture01
782782
, DuplicatedAliases
783783
, Local00
784+
, Nat1
785+
, Nat2
786+
, QualifiedAliases
784787
, Set00
785788
, Set01
786789
, Set02

0 commit comments

Comments
 (0)