Skip to content

Commit

Permalink
Fix language server crash. (shader-slang#5395)
Browse files Browse the repository at this point in the history
  • Loading branch information
csyonghe authored Oct 24, 2024
1 parent 61aa670 commit ee709cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/slang/slang-check-decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7861,6 +7861,13 @@ namespace Slang
if (semantics)
semantics->ensureDecl(genericTypeConstraintDecl, DeclCheckState::ReadyForReference);
auto constraintDeclRef = astBuilder->getDirectDeclRef<GenericTypeConstraintDecl>(genericTypeConstraintDecl);
auto supType = getSup(astBuilder, constraintDeclRef);
if (!supType)
{
args.add(astBuilder->getErrorType());
shouldCache = false;
continue;
}
auto witness =
astBuilder->getDeclaredSubtypeWitness(
getSub(astBuilder, constraintDeclRef),
Expand Down
8 changes: 8 additions & 0 deletions tests/language-server/robustness-8.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//TEST:LANG_SERVER(filecheck=CHECK):
//
__generic < T : struct> extension T
{
// CHECK: null
//HOVER:7,32
__init(StructuredBuffer<T>) {}
}

0 comments on commit ee709cf

Please sign in to comment.