diff options
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
| -rw-r--r-- | source/slang/slang-ast-builder.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp index faf15470f..3a2b2933d 100644 --- a/source/slang/slang-ast-builder.cpp +++ b/source/slang/slang-ast-builder.cpp @@ -525,7 +525,19 @@ FuncType* ASTBuilder::getFuncType(ArrayView<Type*> parameters, Type* result, Typ TupleType* ASTBuilder::getTupleType(List<Type*>& types) { - return getOrCreate<TupleType>(types.getArrayView()); + // The canonical form of a tuple type is always a DeclRefType(GenAppDeclRef(TupleDecl, ConcreteTypePack(types...))). + // If `types` is already a single ConcreteTypePack, then we can use that directly. + if (types.getCount() == 1) + { + if (isTypePack(types[0])) + { + return as<TupleType>(getSpecializedBuiltinType(types[0], "TupleType")); + } + } + + // Otherwise, we need to create a ConcreteTypePack to hold the types. + auto typePack = getTypePack(types.getArrayView()); + return as<TupleType>(getSpecializedBuiltinType(typePack, "TupleType")); } TypeType* ASTBuilder::getTypeType(Type* type) |
