Commit 6b9ac4dd authored by Kenton Varda's avatar Kenton Varda

Fixes #233

parent e50f9571
......@@ -1056,7 +1056,10 @@ private:
kj::str(
" if (which() != ", scope, upperCase, ") return false;\n"),
kj::str(
" KJ_IREQUIRE(which() == ", scope, upperCase, ",\n"
// Extra parens around the condition are needed for when we're compiling a multi-arg
// generic type, which will have a comma, which would otherwise mess up the macro.
// Ah, C++.
" KJ_IREQUIRE((which() == ", scope, upperCase, "),\n"
" \"Must check which() before get()ing a union member.\");\n"),
kj::str(
" _builder.setDataField<", scope, "Which>(\n"
......
......@@ -587,6 +587,15 @@ interface TestImplicitMethodParamsInGeneric(V) {
call @0 [T, U] (foo :T, bar :U) -> TestGenerics(T, U);
}
struct TestGenericsUnion(Foo, Bar) {
# At one point this failed to compile.
union {
foo @0 :Foo;
bar @1 :Bar;
}
}
struct TestUseGenerics $TestGenerics(Text, Data).ann("foo") {
basic @0 :TestGenerics(TestAllTypes, TestAnyPointer);
inner @1 :TestGenerics(TestAllTypes, TestAnyPointer).Inner;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment