diff options
Diffstat (limited to 'source/slang/slang-check-conformance.cpp')
| -rw-r--r-- | source/slang/slang-check-conformance.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/slang/slang-check-conformance.cpp b/source/slang/slang-check-conformance.cpp index 6a397e8b6..174d4be89 100644 --- a/source/slang/slang-check-conformance.cpp +++ b/source/slang/slang-check-conformance.cpp @@ -429,6 +429,24 @@ namespace Slang } } } + else if( auto andType = as<AndType>(sup) ) + { + // A type `T` is a subtype of `A & B` if `T` is a + // subtype of `A` and `T` is a subtype of `B`. + // + auto leftWitness = tryGetSubtypeWitness(sub, andType->left); + if(!leftWitness) return nullptr; + + auto rightWitness = tryGetSubtypeWitness(sub, andType->right); + if(!rightWitness) return nullptr; + + ConjunctionSubtypeWitness* w = m_astBuilder->create<ConjunctionSubtypeWitness>(); + w->leftWitness = leftWitness; + w->rightWitness = rightWitness; + w->sub = sub; + w->sup = sup; + return w; + } return nullptr; } |
