Skip to content

Commit

Permalink
Fixes #651 (#667)
Browse files Browse the repository at this point in the history
* Make verona testsuite directory dump passes.

* Add test case for issue #651

* Extend test to cover related bug.
  • Loading branch information
mjp41 authored Apr 24, 2024
1 parent cf81a49 commit 497f5fc
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testsuite/verona.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions testsuite/verona_nostdlib/issues/651/651.verona
Original file line number Diff line number Diff line change
@@ -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])
34 changes: 34 additions & 0 deletions testsuite/verona_nostdlib/issues/651/651_out/00_parse.trieste
Original file line number Diff line number Diff line change
@@ -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)))))))))
43 changes: 43 additions & 0 deletions testsuite/verona_nostdlib/issues/651/651_out/01_modules.trieste
Original file line number Diff line number Diff line change
@@ -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))))))))))
71 changes: 71 additions & 0 deletions testsuite/verona_nostdlib/issues/651/651_out/02_structure.trieste
Original file line number Diff line number Diff line change
@@ -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)))))))))))
71 changes: 71 additions & 0 deletions testsuite/verona_nostdlib/issues/651/651_out/ast
Original file line number Diff line number Diff line change
@@ -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)))))))))))
1 change: 1 addition & 0 deletions testsuite/verona_nostdlib/issues/651/651_out/exit_code.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Empty file.
14 changes: 14 additions & 0 deletions testsuite/verona_nostdlib/issues/651/651_out/stdout.txt
Original file line number Diff line number Diff line change
@@ -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!

0 comments on commit 497f5fc

Please sign in to comment.