summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-09-20 21:32:32 -0700
committerGitHub <noreply@github.com>2022-09-20 21:32:32 -0700
commita6fcb3b0ed2b185723afde750bd4491b5b4113eb (patch)
treeeef3ff3bc5616432a47e6a78ae0d76f662c6b701 /source
parenta95fe92dafbd2a2e718bb4aac090a7156a46e79b (diff)
Fix regression in check-overload. (#2407)
* Fix regression in check-overload. * Make sure language server supports partiallyAppliedGenericExpr. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ast-expr.h2
-rw-r--r--source/slang/slang-ast-iterator.h4
-rw-r--r--source/slang/slang-check-overload.cpp7
-rw-r--r--source/slang/slang-language-server-ast-lookup.cpp4
4 files changed, 15 insertions, 2 deletions
diff --git a/source/slang/slang-ast-expr.h b/source/slang/slang-ast-expr.h
index 1e4440042..13d687da0 100644
--- a/source/slang/slang-ast-expr.h
+++ b/source/slang/slang-ast-expr.h
@@ -494,6 +494,8 @@ class PartiallyAppliedGenericExpr : public Expr
SLANG_AST_CLASS(PartiallyAppliedGenericExpr);
public:
+ Expr* originalExpr = nullptr;
+
/// The generic being applied
DeclRef<GenericDecl> baseGenericDeclRef;
diff --git a/source/slang/slang-ast-iterator.h b/source/slang/slang-ast-iterator.h
index 4d37b68e7..a145d759b 100644
--- a/source/slang/slang-ast-iterator.h
+++ b/source/slang/slang-ast-iterator.h
@@ -258,6 +258,10 @@ struct ASTIterator
dispatchIfNotNull(expr->value);
dispatchIfNotNull(expr->typeExpr);
}
+ void visitPartiallyAppliedGenericExpr(PartiallyAppliedGenericExpr* expr)
+ {
+ dispatchIfNotNull(expr->originalExpr);
+ }
};
struct ASTIteratorStmtVisitor : public StmtVisitor<ASTIteratorStmtVisitor>
diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp
index 57c9c1199..7dba3986a 100644
--- a/source/slang/slang-check-overload.cpp
+++ b/source/slang/slang-check-overload.cpp
@@ -729,7 +729,7 @@ namespace Slang
{
auto expr = m_astBuilder->create<PartiallyAppliedGenericExpr>();
expr->loc = context.loc;
-
+ expr->originalExpr = originalAppExpr;
expr->baseGenericDeclRef = as<DeclRefExpr>(baseExpr)->declRef.as<GenericDecl>();
expr->substWithKnownGenericArgs = (GenericSubstitution*)candidate.subst;
return expr;
@@ -1418,7 +1418,10 @@ namespace Slang
}
else if (auto genericDeclRef = item.declRef.as<GenericDecl>())
{
- addOverloadCandidatesForCallToGeneric(LookupResultItem(genericDeclRef), context);
+ LookupResultItem innerItem;
+ innerItem.breadcrumbs = item.breadcrumbs;
+ innerItem.declRef = genericDeclRef;
+ addOverloadCandidatesForCallToGeneric(innerItem, context);
}
else if( auto typeDefDeclRef = item.declRef.as<TypeDefDecl>() )
{
diff --git a/source/slang/slang-language-server-ast-lookup.cpp b/source/slang/slang-language-server-ast-lookup.cpp
index 9a42f86f3..a44c7a7d9 100644
--- a/source/slang/slang-language-server-ast-lookup.cpp
+++ b/source/slang/slang-language-server-ast-lookup.cpp
@@ -402,6 +402,10 @@ public:
return true;
return dispatchIfNotNull(expr->value);
}
+ bool visitPartiallyAppliedGenericExpr(PartiallyAppliedGenericExpr* expr)
+ {
+ return dispatchIfNotNull(expr->originalExpr);
+ }
bool visitModifiedTypeExpr(ModifiedTypeExpr* expr) { return dispatchIfNotNull(expr->base.exp); }
bool visitTryExpr(TryExpr* expr) { return dispatchIfNotNull(expr->base); }