diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 5654ac7a6..e5e8e8acc 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -8246,7 +8246,12 @@ namespace Slang if (auto targetDeclRefType = as<DeclRefType>(decl->targetType)) { // Attach our extension to that type as a candidate... - if (auto aggTypeDeclRef = targetDeclRefType->getDeclRef().as<AggTypeDecl>()) + if (targetDeclRefType->getDeclRef().as<InterfaceDecl>()) + { + getSink()->diagnose(decl->targetType.exp, Diagnostics::invalidExtensionOnInterface, decl->targetType); + return; + } + else if (auto aggTypeDeclRef = targetDeclRefType->getDeclRef().as<AggTypeDecl>()) { auto aggTypeDecl = aggTypeDeclRef.getDecl(); @@ -8303,6 +8308,7 @@ namespace Slang // to extend. // decl->targetType = CheckProperType(decl->targetType); + _validateExtensionDeclTargetType(decl); _validateExtensionDeclMembers(decl); @@ -9188,13 +9194,13 @@ namespace Slang // look up extensions based on what would be visible to that // module. // - // We need to consider the extensions declared in the module itself, + // Extensions declared in the module itself should have already + // been registered when we check them, but we still need to bring // along with everything the module imported. // // Note: there is an implicit assumption here that the `importedModules` // member on the `SharedSemanticsContext` is accurate in this case. // - _addCandidateExtensionsFromModule(m_module->getModuleDecl()); for( auto moduleDecl : this->importedModulesList ) { _addCandidateExtensionsFromModule(moduleDecl); |
