From 497f5fc3f21e8230675ff81cc163b6078e2f4503 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 24 Apr 2024 10:16:57 +0100 Subject: [PATCH] Fixes #651 (#667) * Make verona testsuite directory dump passes. * Add test case for issue #651 * Extend test to cover related bug. --- testsuite/verona.cmake | 2 +- .../verona_nostdlib/issues/651/651.verona | 4 ++ .../issues/651/651_out/00_parse.trieste | 34 +++++++++ .../issues/651/651_out/01_modules.trieste | 43 +++++++++++ .../issues/651/651_out/02_structure.trieste | 71 +++++++++++++++++++ .../verona_nostdlib/issues/651/651_out/ast | 71 +++++++++++++++++++ .../issues/651/651_out/exit_code.txt | 1 + .../issues/651/651_out/stderr.txt | 0 .../issues/651/651_out/stdout.txt | 14 ++++ 9 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 testsuite/verona_nostdlib/issues/651/651.verona create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/ast create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/exit_code.txt create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/stderr.txt create mode 100644 testsuite/verona_nostdlib/issues/651/651_out/stdout.txt diff --git a/testsuite/verona.cmake b/testsuite/verona.cmake index 59cbb4820..3ed536418 100644 --- a/testsuite/verona.cmake +++ b/testsuite/verona.cmake @@ -1,6 +1,6 @@ # Arguments for testing verona-parser macro(toolinvoke ARGS local_dist testfile outputdir) - set(${ARGS} "${local_dist}/verona/verona${CMAKE_EXECUTABLE_SUFFIX}" build ${testfile} -w -o ${outputdir}/ast) + set(${ARGS} "${local_dist}/verona/verona${CMAKE_EXECUTABLE_SUFFIX}" build ${testfile} -w -o ${outputdir}/ast --dump_passes ${outputdir}) endmacro() # Set extension for verona tests diff --git a/testsuite/verona_nostdlib/issues/651/651.verona b/testsuite/verona_nostdlib/issues/651/651.verona new file mode 100644 index 000000000..17143e561 --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651.verona @@ -0,0 +1,4 @@ +// 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 new file mode 100644 index 000000000..f03035788 --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste @@ -0,0 +1,34 @@ +Verona +parse +(top + {} + (file + (equals + (group + (typealias + {}) + (ident 8:Copyable) + (square + (group + (Self)))) + (group + (brace + (group + (ident 4:copy) + (paren + (group + (typealias + {}) + (colon) + (Self))) + (colon) + (Self))) + (symbol 1:&) + (paren + (group + (Self) + (symbol 1:<) + (ident 8:Copyable) + (square + (group + (Self))))))))) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste b/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste new file mode 100644 index 000000000..72eb5ca43 --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste @@ -0,0 +1,43 @@ +Verona +modules +(top + {} + (group + (class + {}) + (ident 3:651) + (brace + (group + (use) + (ident 3:std) + (doublecolon) + (ident 7:builtin)) + (equals + (group + (typealias + {}) + (ident 8:Copyable) + (square + (group + (Self)))) + (group + (brace + (group + (ident 4:copy) + (paren + (group + (typealias + {}) + (type + (Self)))) + (type + (Self)))) + (symbol 1:&) + (paren + (group + (Self) + (symbol 1:<) + (ident 8:Copyable) + (square + (group + (Self)))))))))) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste b/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste new file mode 100644 index 000000000..65833e561 --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste @@ -0,0 +1,71 @@ +Verona +structure +(top + { + 651 = class} + (class + { + Copyable = typealias + include 651} + (ident 3:651) + (typeparams) + (inherit + (dontcare)) + (typepred + (type + (typetrue))) + (classbody + (use + (type + (ident 3:std) + (doublecolon) + (ident 7:builtin))) + (typealias + { + trait$0 = typetrait} + (ident 8:Copyable) + (typeparams + (error + (errormsg 46:Expected a type parameter or a value parameter) + (group + (Self)))) + (typepred + (type + (typetrue))) + (type + (typetrait + { + copy = function} + (ident 7:trait$0) + (classbody + (function + {} + (explicit) + (rhs) + (ident 4:copy) + (typeparams) + (params + (error + (errormsg 20:Expected a parameter) + (group + (typealias + {}) + (type + (Self))))) + (type + (Self)) + (dontcare) + (typepred + (type + (typetrue))) + (dontcare)))) + (symbol 1:&) + (type + (typetuple + (type + (Self) + (symbol 1:<) + (ident 8:Copyable) + (typeargs + (type + (Self))))))))))) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/ast b/testsuite/verona_nostdlib/issues/651/651_out/ast new file mode 100644 index 000000000..65833e561 --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651_out/ast @@ -0,0 +1,71 @@ +Verona +structure +(top + { + 651 = class} + (class + { + Copyable = typealias + include 651} + (ident 3:651) + (typeparams) + (inherit + (dontcare)) + (typepred + (type + (typetrue))) + (classbody + (use + (type + (ident 3:std) + (doublecolon) + (ident 7:builtin))) + (typealias + { + trait$0 = typetrait} + (ident 8:Copyable) + (typeparams + (error + (errormsg 46:Expected a type parameter or a value parameter) + (group + (Self)))) + (typepred + (type + (typetrue))) + (type + (typetrait + { + copy = function} + (ident 7:trait$0) + (classbody + (function + {} + (explicit) + (rhs) + (ident 4:copy) + (typeparams) + (params + (error + (errormsg 20:Expected a parameter) + (group + (typealias + {}) + (type + (Self))))) + (type + (Self)) + (dontcare) + (typepred + (type + (typetrue))) + (dontcare)))) + (symbol 1:&) + (type + (typetuple + (type + (Self) + (symbol 1:<) + (ident 8:Copyable) + (typeargs + (type + (Self))))))))))) diff --git a/testsuite/verona_nostdlib/issues/651/651_out/exit_code.txt b/testsuite/verona_nostdlib/issues/651/651_out/exit_code.txt new file mode 100644 index 000000000..56a6051ca --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651_out/exit_code.txt @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/testsuite/verona_nostdlib/issues/651/651_out/stderr.txt b/testsuite/verona_nostdlib/issues/651/651_out/stderr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt b/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt new file mode 100644 index 000000000..2fe34c1e8 --- /dev/null +++ b/testsuite/verona_nostdlib/issues/651/651_out/stdout.txt @@ -0,0 +1,14 @@ +Errors: +Expected a type parameter or a value parameter +-- 651.verona:2:15 +type Copyable[Self] = { + ~~~~ + +---------------- +Expected a parameter +-- 651.verona:3:8 + copy(type: Self) : Self + ~~~~~~~~~~ + +Pass structure failed with 2 errors! +