Skip to content

Commit 9104783

Browse files
committed
Add tests of named type queries after '?'
Signed-off-by: Danila Fedorin <[email protected]>
1 parent 0825138 commit 9104783

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

frontend/test/resolution/testTypeQueries.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,28 @@ static void test28() {
975975
ensureParamInt(vars.at("x"), 64);
976976
}
977977

978+
static void test29() {
979+
printf("%s\n", __FUNCTION__);
980+
auto context = buildStdContext();
981+
ErrorGuard guard(context);
982+
983+
auto vars = resolveTypesOfVariables(context,
984+
R""""(
985+
record pair { type first; type second; }
986+
proc foo(x: pair(?, first=?t)) param do return t : string;
987+
proc bar(x: pair(?, second=?t)) param do return t : string;
988+
param x = foo(new pair(int, real));
989+
param y = foo(new pair(real, int));
990+
param z = bar(new pair(int, real));
991+
param w = bar(new pair(real, int));
992+
)"""", {"x", "y", "z", "w"});
993+
994+
ensureParamString(vars.at("x"), "int(64)");
995+
ensureParamString(vars.at("y"), "real(64)");
996+
ensureParamString(vars.at("z"), "real(64)");
997+
ensureParamString(vars.at("w"), "int(64)");
998+
}
999+
9781000
int main() {
9791001
test1();
9801002
test2();
@@ -1011,6 +1033,7 @@ int main() {
10111033
test26();
10121034
test27();
10131035
test28();
1036+
test29();
10141037

10151038
return 0;
10161039
}

0 commit comments

Comments
 (0)