diff options
| author | Gangzheng Tong <tonggangzheng@gmail.com> | 2025-07-25 10:56:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-25 17:56:50 +0000 |
| commit | c0726e1d571f7f319a244ee6a6ba1ed2c361e079 (patch) | |
| tree | ad6c5c3872b67a3b147aca285098862925b6f63e /source/slang | |
| parent | c5091f0ae3a8b816af893e84ef289f745acf39dc (diff) | |
Fix for Generic Function Redefinition Error (#7891)
* emit literal values in getTypeNameHint for bool, str etc.
* add test for specializing generics with bool literals
* fix build error
* add specializing with Enum type test
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/slang-ir-util.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index a1d043dff..9b852b803 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -719,6 +719,30 @@ void getTypeNameHint(StringBuilder& sb, IRInst* type) case kIROp_IntLit: sb << as<IRIntLit>(type)->getValue(); break; + case kIROp_BoolLit: + sb << (as<IRBoolLit>(type)->getValue() ? "true" : "false"); + break; + case kIROp_FloatLit: + sb << as<IRFloatLit>(type)->getValue(); + break; + case kIROp_StringLit: + { + auto stringLit = as<IRStringLit>(type); + sb << "\""; + sb << stringLit->getStringSlice(); + sb << "\""; + } + break; + case kIROp_VoidLit: + sb << "void"; + break; + case kIROp_PtrLit: + { + auto ptrLit = as<IRPtrLit>(type); + sb << "ptr_"; + sb << (UInt64)ptrLit->getValue(); + } + break; default: if (auto decor = type->findDecoration<IRNameHintDecoration>()) sb << decor->getName(); |
