diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index a7cd768b1..b18e1c4da 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -5226,9 +5226,17 @@ namespace Slang constraints.loc = extDecl->loc; constraints.genericDecl = extGenericDecl; + // Inside the body of an extension declaration, we may end up trying to apply that + // extension to its own target type. + // If we see that we are in that case, we can apply the extension declaration as - is, + // without any additional substitutions. + if (extDecl->targetType->equals(type)) + { + return extDeclRef; + } + if (!TryUnifyTypes(constraints, extDecl->targetType.Ptr(), type)) return DeclRef<ExtensionDecl>(); - auto constraintSubst = trySolveConstraintSystem(&constraints, DeclRef<Decl>(extGenericDecl, nullptr).as<GenericDecl>()); if (!constraintSubst) { |
