Skip to content

Commit

Permalink
Fix language server check skipping when explicit module decl exists. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
csyonghe authored Dec 12, 2024
1 parent 626e814 commit 772c48a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/slang/slang-check-decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,8 @@ bool SemanticsVisitor::shouldSkipChecking(Decl* decl, DeclCheckState state)
auto& assistInfo = getLinkage()->contentAssistInfo;
// If this func is not defined in the primary module, skip checking its body.
auto moduleDecl = getModuleDecl(decl);
if (moduleDecl && moduleDecl->getName() != assistInfo.primaryModuleName)
if (moduleDecl && moduleDecl->module->getNameObj() != assistInfo.primaryModuleName &&
moduleDecl->getName() != assistInfo.primaryModuleName)
return true;
if (funcDecl->body)
{
Expand Down
2 changes: 2 additions & 0 deletions source/slang/slang-compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,8 @@ class Module : public ComponentType, public slang::IModule

void setName(String name);
void setName(Name* name) { m_name = name; }
Name* getNameObj() { return m_name; }

void setPathInfo(PathInfo pathInfo) { m_pathInfo = pathInfo; }

/// Set the IR for this module.
Expand Down
16 changes: 16 additions & 0 deletions tests/language-server/check-skip-module.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//TEST:LANG_SERVER(filecheck=CHECK):
module module_A;
struct A {
int x;
int y;
};

[numthreads(1,1,1)]
void main()
{
//HOVER:12,5
A a;
a.x = 2;
}

// CHECK: struct A

0 comments on commit 772c48a

Please sign in to comment.