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 type checker support for spread operator in list-constructor-expr #35601

Conversation

lochana-chathura
Copy link
Member

Purpose

$subject.

Fixes subtask: Implement type checker changes of #35178
Fixes: #34990

Approach

N/A

Samples

N/A

Remarks

N/A

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@lochana-chathura lochana-chathura added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Mar 28, 2022
@codecov
Copy link

codecov bot commented Mar 29, 2022

Codecov Report

Merging #35601 (ab9f63b) into spread-operator (3a254e5) will increase coverage by 0.02%.
The diff coverage is 95.81%.

@@                  Coverage Diff                  @@
##             spread-operator   #35601      +/-   ##
=====================================================
+ Coverage              74.25%   74.28%   +0.02%     
- Complexity             46721    46781      +60     
=====================================================
  Files                   3145     3145              
  Lines                 181591   181774     +183     
  Branches               23482    23527      +45     
=====================================================
+ Hits                  134845   135035     +190     
+ Misses                 38919    38917       -2     
+ Partials                7827     7822       -5     
Impacted Files Coverage Δ
...ballerinalang/compiler/tree/BLangNodeAnalyzer.java 100.00% <ø> (ø)
...lerinalang/compiler/tree/BLangNodeTransformer.java 0.46% <0.00%> (-0.01%) ⬇️
.../ballerinalang/compiler/tree/BLangNodeVisitor.java 0.45% <0.00%> (-0.01%) ⬇️
...inalang/compiler/tree/SimpleBLangNodeAnalyzer.java 8.69% <0.00%> (-0.04%) ⬇️
...ler/tree/expressions/BLangListConstructorExpr.java 83.67% <60.00%> (-6.08%) ⬇️
...in/java/org/ballerinalang/model/tree/NodeKind.java 100.00% <100.00%> (ø)
...erinalang/util/diagnostic/DiagnosticErrorCode.java 99.82% <100.00%> (+<0.01%) ⬆️
...allerinalang/compiler/parser/BLangNodeBuilder.java 93.69% <100.00%> (+0.01%) ⬆️
...wso2/ballerinalang/compiler/parser/NodeCloner.java 93.57% <100.00%> (+0.02%) ⬆️
.../compiler/semantics/analyzer/SemanticAnalyzer.java 85.97% <100.00%> (+0.01%) ⬆️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a254e5...ab9f63b. Read the comment docs.

@@ -61,10 +61,12 @@ public void diagnosticsTest() {
"inferred for '[1, p]'", 38, 35);
BAssertUtil.validateError(resultNegative, i++, "invalid list constructor expression: types cannot be " +
"inferred for '[a, 4]'", 41, 23);
BAssertUtil.validateError(resultNegative, i++, "tuple and expression size does not match",
BAssertUtil.validateError(resultNegative, i++,
Copy link
Member

Choose a reason for hiding this comment

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

In cases like

type Rec record {
  int a;
};

function foo() {
  [Rec1, int] a = []; //this should not throw no filler value error AFIU. 
}

There seems to be already this bug. The only difference is now we are getting this new error.
Created #35712

Copy link
Contributor

@gimantha gimantha left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants