Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue 668 #669

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ option(VERONA_GENERATE_LAUNCH_JSON "Generate a launch.json file for debugging in
FetchContent_Declare(
trieste
GIT_REPOSITORY https://github.com/microsoft/trieste
GIT_TAG 1e1448ca9e4ac158492bf8dbbd86b407c452fc0c
GIT_TAG f63eda3dddedaf65def0f237b566fa7e239e6a1c
GIT_SHALLOW FALSE
)

Expand Down
10 changes: 5 additions & 5 deletions src/passes/defaultargs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ namespace verona
{
if (has_default)
{
params->replace(
new_params << err(
param,
err(
param,
"Can't put a parameter with no default value after a "
"parameter with one"));
"Can't put a parameter with no default value after a "
"parameter with one");
// Do not process further to prevent duplicate errors.
break;
}
}
else
Expand Down
40 changes: 40 additions & 0 deletions testsuite/verona_nostdlib/issues/668/668.verona
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Default args need to be later arguments
class None0
{
test(x : None0, y : None0) : None0
{
x
}
}

class None1
{
test(x : None1 = None1, y : None1) : None1
{
x
}
}

class None2
{
test(x : None2, y : None2 = None2) : None2
{
x
}
}

class None3
{
test(x : None3 = None3, y : None3 = None3) : None3
{
x
}
}

class None4
{
test(x : None4 = None4, y : None4, z : None4 = None4) : None4
{
x
}
}
137 changes: 137 additions & 0 deletions testsuite/verona_nostdlib/issues/668/668_out/00_parse.trieste
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
Verona
parse
(top
{}
(file
(group
(class
{})
(ident 5:None0)
(brace
(group
(ident 4:test)
(paren
(list
(group
(ident 1:x)
(colon)
(ident 5:None0))
(group
(ident 1:y)
(colon)
(ident 5:None0))))
(colon)
(ident 5:None0)
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None1)
(brace
(group
(ident 4:test)
(paren
(list
(equals
(group
(ident 1:x)
(colon)
(ident 5:None1))
(group
(ident 5:None1)))
(group
(ident 1:y)
(colon)
(ident 5:None1))))
(colon)
(ident 5:None1)
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None2)
(brace
(group
(ident 4:test)
(paren
(list
(group
(ident 1:x)
(colon)
(ident 5:None2))
(equals
(group
(ident 1:y)
(colon)
(ident 5:None2))
(group
(ident 5:None2)))))
(colon)
(ident 5:None2)
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None3)
(brace
(group
(ident 4:test)
(paren
(list
(equals
(group
(ident 1:x)
(colon)
(ident 5:None3))
(group
(ident 5:None3)))
(equals
(group
(ident 1:y)
(colon)
(ident 5:None3))
(group
(ident 5:None3)))))
(colon)
(ident 5:None3)
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None4)
(brace
(group
(ident 4:test)
(paren
(list
(equals
(group
(ident 1:x)
(colon)
(ident 5:None4))
(group
(ident 5:None4)))
(group
(ident 1:y)
(colon)
(ident 5:None4))
(equals
(group
(ident 1:z)
(colon)
(ident 5:None4))
(group
(ident 5:None4)))))
(colon)
(ident 5:None4)
(brace
(group
(ident 1:x))))))))
146 changes: 146 additions & 0 deletions testsuite/verona_nostdlib/issues/668/668_out/01_modules.trieste
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
Verona
modules
(top
{}
(group
(class
{})
(ident 3:668)
(brace
(group
(use)
(ident 3:std)
(doublecolon)
(ident 7:builtin))
(group
(class
{})
(ident 5:None0)
(brace
(group
(ident 4:test)
(paren
(list
(group
(ident 1:x)
(type
(ident 5:None0)))
(group
(ident 1:y)
(type
(ident 5:None0)))))
(type
(ident 5:None0))
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None1)
(brace
(group
(ident 4:test)
(paren
(list
(equals
(group
(ident 1:x)
(type
(ident 5:None1)))
(group
(ident 5:None1)))
(group
(ident 1:y)
(type
(ident 5:None1)))))
(type
(ident 5:None1))
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None2)
(brace
(group
(ident 4:test)
(paren
(list
(group
(ident 1:x)
(type
(ident 5:None2)))
(equals
(group
(ident 1:y)
(type
(ident 5:None2)))
(group
(ident 5:None2)))))
(type
(ident 5:None2))
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None3)
(brace
(group
(ident 4:test)
(paren
(list
(equals
(group
(ident 1:x)
(type
(ident 5:None3)))
(group
(ident 5:None3)))
(equals
(group
(ident 1:y)
(type
(ident 5:None3)))
(group
(ident 5:None3)))))
(type
(ident 5:None3))
(brace
(group
(ident 1:x))))))
(group
(class
{})
(ident 5:None4)
(brace
(group
(ident 4:test)
(paren
(list
(equals
(group
(ident 1:x)
(type
(ident 5:None4)))
(group
(ident 5:None4)))
(group
(ident 1:y)
(type
(ident 5:None4)))
(equals
(group
(ident 1:z)
(type
(ident 5:None4)))
(group
(ident 5:None4)))))
(type
(ident 5:None4))
(brace
(group
(ident 1:x)))))))))
Loading
Loading