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

Conversation

rdulmina
Copy link
Contributor

@rdulmina rdulmina commented Jan 6, 2025

Purpose

$title

Fixes #43286

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.41%. Comparing base (66f7b52) to head (8eed105).
Report is 475 commits behind head on master.

Files with missing lines Patch % Lines
...lang/compiler/semantics/analyzer/CodeAnalyzer.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #43733      +/-   ##
============================================
- Coverage     77.55%   77.41%   -0.15%     
+ Complexity    58722    58616     -106     
============================================
  Files          3447     3445       -2     
  Lines        219658   219173     -485     
  Branches      28915    28969      +54     
============================================
- Hits         170365   169663     -702     
- Misses        39892    40081     +189     
- Partials       9401     9429      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +2807 to +2808
if (cIExpr.userDefinedType != null && type.tsymbol != null &&
Symbols.isFlagOn(type.tsymbol.flags, Flags.DEPRECATED)) {
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?

@@ -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.

@rdulmina rdulmina closed this Jan 21, 2025
@rdulmina
Copy link
Contributor Author

Closing this as this is not the correct fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Compiler crashed when running bal build
3 participants