diff options
Diffstat (limited to 'source/slang/slang-syntax.cpp')
| -rw-r--r-- | source/slang/slang-syntax.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index c4152d78c..e41e5517c 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -2021,7 +2021,15 @@ void Type::accept(IValVisitor* visitor, void* extra) RefPtr<Decl> decl, RefPtr<MagicTypeModifier> modifier) { - session->magicDecls[modifier->name] = decl.Ptr(); + // In some cases the modifier will have been applied to the + // "inner" declaration of a `GenericDecl`, but what we + // actually want to register is the generic itself. + // + auto declToRegister = decl; + if(auto genericDecl = as<GenericDecl>(decl->ParentDecl)) + declToRegister = genericDecl; + + session->magicDecls[modifier->name] = declToRegister.Ptr(); } RefPtr<Decl> findMagicDecl( |
