Skip to content
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

Add null check before accessing type.tsymbol in CodeAnalyzer #43733

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2804,7 +2804,8 @@ public void visit(BLangTypeInit cIExpr, AnalyzerData data) {
analyzeExprs(cIExpr.argsExpr, data);
analyzeExpr(cIExpr.initInvocation, data);
BType type = cIExpr.getBType();
if (cIExpr.userDefinedType != null && Symbols.isFlagOn(type.tsymbol.flags, Flags.DEPRECATED)) {
if (cIExpr.userDefinedType != null && type.tsymbol != null &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we make this a draft PR? I wouldn't introduce this change without getting the issue reproduced.

Symbols.isFlagOn(type.tsymbol.flags, Flags.DEPRECATED)) {
Comment on lines +2807 to +2808
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we need to check whether the DEPRECATED flag is present in the symbol of the userDefinedType (BLangUserDefinedType), isn't it?

logDeprecatedWaring(((BLangUserDefinedType) cIExpr.userDefinedType).typeName.toString(), type.tsymbol,
cIExpr.pos);
}
Expand Down
Loading