diff options
| author | Yong He <yonghe@outlook.com> | 2020-08-21 01:10:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-21 01:10:45 -0700 |
| commit | a8bc5983eae60ca37e853041e989a654c1247876 (patch) | |
| tree | 330cae10c2c24ba14ca726b61c576d9f362f5b8e /source/slang/slang-check-expr.cpp | |
| parent | 11748a75e66c2bd3fa7ef7635fd35363465f599c (diff) | |
Allow calling a generic function with an existential value (dynamic dispatch) (#1508)
* Allow calling a generic function with an existential value (dynamic dispatch).
* Fixes per review comments.
* Clean up implementation by having `openExistential` return `ExtractExistentialType` instead of a DeclRef to the interface with a `ThisTypeSubstitution`.
* More cleanups
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 63367fa97..0cc3a55c5 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -116,11 +116,11 @@ namespace Slang openedThisType->witness = openedWitness; DeclRef<InterfaceDecl> substDeclRef = DeclRef<InterfaceDecl>(interfaceDecl, openedThisType); - auto substDeclRefType = DeclRefType::create(m_astBuilder, substDeclRef); + openedType->interfaceDeclRef = substDeclRef; ExtractExistentialValueExpr* openedValue = m_astBuilder->create<ExtractExistentialValueExpr>(); openedValue->declRef = varDeclRef; - openedValue->type = QualType(substDeclRefType); + openedValue->type = QualType(openedType); return openedValue; }); |
