Skip to content

Commit

Permalink
Extend test to cover related bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjp41 committed Apr 18, 2024
1 parent b6f0593 commit 3c6425c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
5 changes: 3 additions & 2 deletions testsuite/verona_nostdlib/issues/651/651.verona
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
type Copyable[Self] = { // This loops forever due to parameter name self
copy(self: Self) : Self
// Using reserved keyword in parameter and type parameter should result in errors.
type Copyable[Self] = {
copy(type: Self) : Self
} & (Self < Copyable[Self])
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ parse
(ident 4:copy)
(paren
(group
(ident 4:self)
(typealias
{})
(colon)
(Self)))
(colon)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ modules
(ident 4:copy)
(paren
(group
(ident 4:self)
(typealias
{})
(type
(Self))))
(type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ structure
(ident 7:trait$0)
(classbody
(function
{
self = param}
{}
(explicit)
(rhs)
(ident 4:copy)
(typeparams)
(params
(param
(ident 4:self)
(type
(Self))
(dontcare)))
(error
(errormsg 20:Expected a parameter)
(group
(typealias
{})
(type
(Self)))))
(type
(Self))
(dontcare)
Expand Down
15 changes: 8 additions & 7 deletions testsuite/verona_nostdlib/issues/651/651_out/ast
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ structure
(ident 7:trait$0)
(classbody
(function
{
self = param}
{}
(explicit)
(rhs)
(ident 4:copy)
(typeparams)
(params
(param
(ident 4:self)
(type
(Self))
(dontcare)))
(error
(errormsg 20:Expected a parameter)
(group
(typealias
{})
(type
(Self)))))
(type
(Self))
(dontcare)
Expand Down
12 changes: 9 additions & 3 deletions testsuite/verona_nostdlib/issues/651/651_out/stdout.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
Errors:
Expected a type parameter or a value parameter
-- 651.verona:1:15
type Copyable[Self] = { // This loops forever due to parameter name self
-- 651.verona:2:15
type Copyable[Self] = {
~~~~

Pass structure failed with 1 error!
----------------
Expected a parameter
-- 651.verona:3:8
copy(type: Self) : Self
~~~~~~~~~~

Pass structure failed with 2 errors!

0 comments on commit 3c6425c

Please sign in to comment.