Skip to content

Commit 173ea5b

Browse files
committed
Update expected outputs and add targeted test
1 parent 628c9d9 commit 173ea5b

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package LexPos where
1+
package LexPos_NumLit where
22

33
x :: Integer
44
x = 5 + 9 + "foo"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package LexPos_Task where
2+
3+
-- Both 'f' and 'g' should have a type error at column 14
4+
-- as the reference to 'x' is at the same column in both
5+
6+
f :: Bool -> Action
7+
f x = $fwrite x
8+
9+
g :: Bool -> Action
10+
g x = dfwrite x
11+
12+
dfwrite :: File -> Action
13+
dfwrite x = $fwrite x

testsuite/bsc.syntax/bh/bh.exp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,26 @@ compile_pass_bug EmptyDo_Braces.bs
112112
# Confirm that the failure was due to an internal error
113113
find_regexp [make_bsc_output_name EmptyDo_Braces.bs] {Internal.*Error}
114114

115+
# -----
116+
# Test lexer positions
117+
118+
proc check_lex_pos { srcname linepos colpos {errtag T0020} {count 1}} {
119+
set str "Error: \"$srcname\", line $linepos, column $colpos: ($errtag)"
120+
find_n_strings [make_bsc_output_name $srcname] $str $count
121+
}
122+
115123
# Fix position after numeric literals with prefixes
116124
# (fixes Google issue #77395569)
117-
compile_fail LexPos.bs
118-
find_n_strings LexPos.bs.bsc-out {Error: "LexPos.bs", line 4, column 12: (T0020)} 1
119-
find_n_strings LexPos.bs.bsc-out {Error: "LexPos.bs", line 7, column 16: (T0020)} 1
125+
compile_fail LexPos_NumLit.bs
126+
check_lex_pos LexPos_NumLit.bs 4 12
127+
check_lex_pos LexPos_NumLit.bs 7 16
128+
129+
# Fix position after system task names (prefixed with dollarsign)
130+
compile_fail LexPos_Task.bs
131+
check_lex_pos LexPos_Task.bs 7 14
132+
check_lex_pos LexPos_Task.bs 10 14
133+
134+
# -----
120135

121136
# Allow _ in numeric literals
122137
# (fixes Google issue #67326190)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
checking package dependencies
22
compiling NotDisplayable.bs
3-
Error: "NotDisplayable.bs", line 6, column 14: (T0031)
3+
Error: "NotDisplayable.bs", line 6, column 15: (T0031)
44
The contexts for this expression could not be resolved because there are no
55
instances of the form:
66
Prelude.Bits NotDisplayable.Test a__
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
checking package dependencies
22
compiling NotListDisplay.bs
3-
Error: "NotListDisplay.bs", line 6, column 17: (T0031)
3+
Error: "NotListDisplay.bs", line 6, column 18: (T0031)
44
The contexts for this expression could not be resolved because there are no
55
instances of the form:
66
Prelude.Bits (Prelude.List a) a__

0 commit comments

Comments
 (0)