From 3c6425c04c12b499b135c1d4c8a1440fb794bcef Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Thu, 18 Apr 2024 11:44:49 +0100 Subject: [PATCH] Extend test to cover related bug. --- testsuite/verona_nostdlib/issues/651/651.verona | 5 +++-- .../issues/651/651_out/00_parse.trieste | 3 ++- .../issues/651/651_out/01_modules.trieste | 3 ++- .../issues/651/651_out/02_structure.trieste | 15 ++++++++------- testsuite/verona_nostdlib/issues/651/651_out/ast | 15 ++++++++------- .../verona_nostdlib/issues/651/651_out/stdout.txt | 12 +++++++++--- 6 files changed, 32 insertions(+), 21 deletions(-) diff --git a/testsuite/verona_nostdlib/issues/651/651.verona b/testsuite/verona_nostdlib/issues/651/651.verona index cc9c60a3f..17143e561 100644 --- a/testsuite/verona_nostdlib/issues/651/651.verona +++ b/testsuite/verona_nostdlib/issues/651/651.verona @@ -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]) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste b/testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste index 635e98963..f03035788 100644 --- a/testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste +++ b/testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste @@ -17,7 +17,8 @@ parse (ident 4:copy) (paren (group - (ident 4:self) + (typealias + {}) (colon) (Self))) (colon) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste b/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste index df97497ec..72eb5ca43 100644 --- a/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste +++ b/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste @@ -26,7 +26,8 @@ modules (ident 4:copy) (paren (group - (ident 4:self) + (typealias + {}) (type (Self)))) (type diff --git a/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste b/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste index 1837e7d1a..65833e561 100644 --- a/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste +++ b/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste @@ -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) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/ast b/testsuite/verona_nostdlib/issues/651/651_out/ast index 1837e7d1a..65833e561 100644 --- a/testsuite/verona_nostdlib/issues/651/651_out/ast +++ b/testsuite/verona_nostdlib/issues/651/651_out/ast @@ -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) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt b/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt index 0bb53356b..2fe34c1e8 100644 --- a/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt +++ b/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt @@ -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!