diff options
| author | Yong He <yonghe@outlook.com> | 2022-11-08 10:07:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-08 10:07:57 -0800 |
| commit | bf67309454032b4f92d0bc9735b608e56b16882f (patch) | |
| tree | a321fe7db0b49fa67608b935c1389354a020f59c /source/slang/slang-lower-to-ir.cpp | |
| parent | ca882a1ef46a5a8bbff50e3a1a6f973e16358634 (diff) | |
Make `__BuiltinFloatingPointType` conform to `IDifferentiable`. (#2499)
Diffstat (limited to 'source/slang/slang-lower-to-ir.cpp')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index f8d8282d8..12a9f73e6 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -1349,6 +1349,7 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower // The base (subToMid) will turn into a value with // witness-table type. IRInst* baseWitnessTable = lowerSimpleVal(context, val->subToMid); + IRInst* midToSup = nullptr; // The next step should map to an interface requirement // that is itself an interface conformance, so the result @@ -1366,7 +1367,6 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower // produce transitive witnesses in shapes that will cuase us // problems here. // - IRInst* midToSup = lowerSimpleVal(context, val->midToSup); if (!baseWitnessTable) { @@ -1380,6 +1380,15 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower return LoweredValInfo::simple(midToSup); } + if (auto declaredMidToSup = as<DeclaredSubtypeWitness>(val->midToSup)) + { + midToSup = getInterfaceRequirementKey(context, declaredMidToSup->declRef.decl); + } + else + { + midToSup = lowerSimpleVal(context, val->midToSup); + } + return LoweredValInfo::simple(getBuilder()->emitLookupInterfaceMethodInst( getBuilder()->getWitnessTableType(lowerType(context, val->sup)), baseWitnessTable, |
