diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 781a3a237f..8030bcf974 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -7861,6 +7861,13 @@ namespace Slang if (semantics) semantics->ensureDecl(genericTypeConstraintDecl, DeclCheckState::ReadyForReference); auto constraintDeclRef = astBuilder->getDirectDeclRef(genericTypeConstraintDecl); + auto supType = getSup(astBuilder, constraintDeclRef); + if (!supType) + { + args.add(astBuilder->getErrorType()); + shouldCache = false; + continue; + } auto witness = astBuilder->getDeclaredSubtypeWitness( getSub(astBuilder, constraintDeclRef), diff --git a/tests/language-server/robustness-8.slang b/tests/language-server/robustness-8.slang new file mode 100644 index 0000000000..84d6c8945a --- /dev/null +++ b/tests/language-server/robustness-8.slang @@ -0,0 +1,8 @@ +//TEST:LANG_SERVER(filecheck=CHECK): +// +__generic < T : struct> extension T +{ +// CHECK: null +//HOVER:7,32 + __init(StructuredBuffer) {} +} \ No newline at end of file