* Make verona testsuite directory dump passes.

* Add test case for issue #651

* Extend test to cover related bug.
This commit is contained in:
Matthew Parkinson 2024-04-24 10:16:57 +01:00 коммит произвёл GitHub
Родитель cf81a493de
Коммит 497f5fc3f2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
9 изменённых файлов: 239 добавлений и 1 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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])

Просмотреть файл

@ -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)))))))))

Просмотреть файл

@ -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))))))))))

Просмотреть файл

@ -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)))))))))))

Просмотреть файл

@ -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)))))))))))

Просмотреть файл

@ -0,0 +1 @@
1

Просмотреть файл

Просмотреть файл

@ -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!