diff options
author | Aaron Allen <aaron@flipstone.com> | 2023-02-16 18:06:35 -0600 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-02-24 21:30:10 -0500 |
commit | 69fb0b13abe14af4537f3828ef08f9841e34e630 (patch) | |
tree | 20019510cf441b5946dd7562cd2914b1b6abdfcb /testsuite | |
parent | fdc89a8d77622038944231ac3244ec88bdfc2c0f (diff) | |
download | haskell-69fb0b13abe14af4537f3828ef08f9841e34e630.tar.gz |
Fix ParallelListComp out of scope suggestion
This patch makes it so vars from one block of a parallel list
comprehension are not in scope in a subsequent block during type
checking. This was causing GHC to emit a faulty suggestion when an out
of scope variable shared the occ name of a var from a different block.
Fixes #22940
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T22940.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/T22940.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/all.T | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T22940.hs b/testsuite/tests/typecheck/should_fail/T22940.hs new file mode 100644 index 0000000000..d5512a06b7 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T22940.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE ParallelListComp #-} + +x :: [(Int, Char)] +x = [ (a, b) | a <- [0 ..] | b <- "abcd", even a ] diff --git a/testsuite/tests/typecheck/should_fail/T22940.stderr b/testsuite/tests/typecheck/should_fail/T22940.stderr new file mode 100644 index 0000000000..650e8fe7d6 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T22940.stderr @@ -0,0 +1,3 @@ + +T22940.hs:4:48: error: [GHC-88464] + Variable not in scope: a diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 0dea0f43e0..430e8f409c 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -669,4 +669,4 @@ test('T20666', normal, compile, ['']) # To become compile_fail after migration test('T20666a', normal, compile, ['']) # To become compile_fail after migration period (see #22912) test('T22924a', normal, compile_fail, ['']) test('T22924b', normal, compile_fail, ['']) - +test('T22940', normal, compile_fail, ['']) |