mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 16:01:05 +01:00
Add test coverage for a trailing comma in the alternatives list, and empty parentheses in an alternative declaration. (#305)
This commit is contained in:
+7
@@ -30,3 +30,10 @@ fn main() -> Int {
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
// Test some alternate syntaxes
|
||||
choice MoreInts {
|
||||
None(),
|
||||
One(Int),
|
||||
Two(Int,Int),
|
||||
}
|
||||
|
||||
+12
@@ -26,6 +26,11 @@ n = 5;
|
||||
}
|
||||
return n;
|
||||
|
||||
}
|
||||
choice MoreInts {
|
||||
alt None ();
|
||||
alt One Int;
|
||||
alt Two (0 = Int, 1 = Int);
|
||||
}
|
||||
********** type checking **********
|
||||
--- step exp () --->
|
||||
@@ -36,6 +41,13 @@ return n;
|
||||
--- step exp Int --->
|
||||
--- handle value Int with (0 = Int, 1 = Int)<2>(Int,Int,) --->
|
||||
--- step exp Int --->
|
||||
--- step exp () --->
|
||||
--- step exp Int --->
|
||||
--- step exp (0 = Int, 1 = Int) --->
|
||||
--- step exp Int --->
|
||||
--- handle value Int with (0 = Int, 1 = Int)<1>(Int,) --->
|
||||
--- step exp Int --->
|
||||
--- handle value Int with (0 = Int, 1 = Int)<2>(Int,Int,) --->
|
||||
--- step exp Int --->
|
||||
--- step exp auto --->
|
||||
13: type error in call
|
||||
|
||||
Reference in New Issue
Block a user