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

Inconsistent error messages when the type does not have a filler value #34990

Closed
lochana-chathura opened this issue Feb 9, 2022 · 1 comment
Assignees
Labels
Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Improvement

Comments

@lochana-chathura
Copy link
Member

lochana-chathura commented Feb 9, 2022

Description:
$subject.

public function main() {
    (int|string)[4] _ = [1, 2]; // @error invalid usage of list constructor: type '(int|string)[4]' does not have a filler value

    [int,boolean|string] _ = [1]; // @error tuple and expression size does not match
}

In both cases, the error is due to no filler value for the type. Can we give the same error for the second case also?

@lochana-chathura lochana-chathura added Type/Improvement Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler labels Feb 9, 2022
@MaryamZi MaryamZi changed the title Inconsistence error messages when the type does not have a filler value Inconsistent error messages when the type does not have a filler value Mar 3, 2022
@lochana-chathura lochana-chathura self-assigned this Mar 24, 2022
lochana-chathura added a commit to lochana-chathura/ballerina-lang that referenced this issue Mar 28, 2022
@lochana-chathura
Copy link
Member Author

Fixed in #35759 via #35601

Update 2201.8.1 gives the following diagnostics.

invalid usage of list constructor: type '(int|string)[4]' does not have a filler value
invalid usage of list constructor: type '(boolean|string)' does not have a filler value

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

No branches or pull requests

1 participant