Skip to content

Commit 3c6425c

Browse files
committed
Extend test to cover related bug.
1 parent b6f0593 commit 3c6425c

File tree

6 files changed

+32
-21
lines changed

6 files changed

+32
-21
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
type Copyable[Self] = { // This loops forever due to parameter name self
2-
copy(self: Self) : Self
1+
// Using reserved keyword in parameter and type parameter should result in errors.
2+
type Copyable[Self] = {
3+
copy(type: Self) : Self
34
} & (Self < Copyable[Self])

testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ parse
1717
(ident 4:copy)
1818
(paren
1919
(group
20-
(ident 4:self)
20+
(typealias
21+
{})
2122
(colon)
2223
(Self)))
2324
(colon)

testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ modules
2626
(ident 4:copy)
2727
(paren
2828
(group
29-
(ident 4:self)
29+
(typealias
30+
{})
3031
(type
3132
(Self))))
3233
(type

testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste

+8-7
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,19 @@ structure
3939
(ident 7:trait$0)
4040
(classbody
4141
(function
42-
{
43-
self = param}
42+
{}
4443
(explicit)
4544
(rhs)
4645
(ident 4:copy)
4746
(typeparams)
4847
(params
49-
(param
50-
(ident 4:self)
51-
(type
52-
(Self))
53-
(dontcare)))
48+
(error
49+
(errormsg 20:Expected a parameter)
50+
(group
51+
(typealias
52+
{})
53+
(type
54+
(Self)))))
5455
(type
5556
(Self))
5657
(dontcare)

testsuite/verona_nostdlib/issues/651/651_out/ast

+8-7
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,19 @@ structure
3939
(ident 7:trait$0)
4040
(classbody
4141
(function
42-
{
43-
self = param}
42+
{}
4443
(explicit)
4544
(rhs)
4645
(ident 4:copy)
4746
(typeparams)
4847
(params
49-
(param
50-
(ident 4:self)
51-
(type
52-
(Self))
53-
(dontcare)))
48+
(error
49+
(errormsg 20:Expected a parameter)
50+
(group
51+
(typealias
52+
{})
53+
(type
54+
(Self)))))
5455
(type
5556
(Self))
5657
(dontcare)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
Errors:
22
Expected a type parameter or a value parameter
3-
-- 651.verona:1:15
4-
type Copyable[Self] = { // This loops forever due to parameter name self
3+
-- 651.verona:2:15
4+
type Copyable[Self] = {
55
~~~~
66

7-
Pass structure failed with 1 error!
7+
----------------
8+
Expected a parameter
9+
-- 651.verona:3:8
10+
copy(type: Self) : Self
11+
~~~~~~~~~~
12+
13+
Pass structure failed with 2 errors!
814

0 commit comments

Comments
 (0)