-
Notifications
You must be signed in to change notification settings - Fork 691
feat: move nil check to call sites #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
2a615d2
65eca1e
89c8a5b
6355e48
fd4cf87
77cb9b8
2dc87d8
8723013
d9286ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -295,7 +295,7 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has | |||||
parent := node.Parent | ||||||
|
||||||
if node.Kind == ast.KindTypeParameter { | ||||||
if !(ast.IsFunctionLikeDeclaration(parent) || ast.IsClassLike(parent) || | ||||||
if !((parent != nil && ast.IsFunctionLikeDeclaration(parent)) || ast.IsClassLike(parent) || | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nil check is only applied to the first condition in the OR expression. The call to Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
ast.IsFunctionTypeNode(parent) || ast.IsConstructorTypeNode(parent) || | ||||||
ast.IsCallSignatureDeclaration(parent) || ast.IsConstructSignatureDeclaration(parent) || | ||||||
ast.IsMethodSignatureDeclaration(parent)) { | ||||||
|
@@ -2069,7 +2069,7 @@ func (c *Checker) checkGrammarStatementInAmbientContext(node *ast.Node) bool { | |||||
if node.Flags&ast.NodeFlagsAmbient != 0 { | ||||||
// Find containing block which is either Block, ModuleBlock, SourceFile | ||||||
links := c.nodeLinks.Get(node) | ||||||
if !links.hasReportedStatementInAmbientContext && (ast.IsFunctionLike(node.Parent) || ast.IsAccessor(node.Parent)) { | ||||||
if !links.hasReportedStatementInAmbientContext && (node.Parent != nil && ast.IsFunctionLike(node.Parent) || ast.IsAccessor(node.Parent)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The nil check is only applied to the first condition in the OR expression. The call to
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
links.hasReportedStatementInAmbientContext = c.grammarErrorOnFirstToken(node, diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts) | ||||||
return links.hasReportedStatementInAmbientContext | ||||||
} | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.