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

[Bug]: Required field is not detected with computed-name-field #41619

Closed
KavinduZoysa opened this issue Nov 1, 2023 · 2 comments · Fixed by #41678
Closed

[Bug]: Required field is not detected with computed-name-field #41619

KavinduZoysa opened this issue Nov 1, 2023 · 2 comments · Fixed by #41678
Assignees
Labels
Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Milestone

Comments

@KavinduZoysa
Copy link
Contributor

Description

Please check the following code. Inside the select clause, the record should be identified as Ry, and the missing default field y should be identified.

Steps to Reproduce

type Rx record {|
    int i;
    string x;
|};

type Ry record {|
    int j;
    string y;
|};

type R1 record {|
    int i1;
    Rx[] rx;
|};

type R2 record {|
    int i2;
    Ry[] ry;
|};

function baz(R1 r1, R2 r2) returns R2 => {
    ...r2,
    ["ry"]: from var rx in r1.rx
                select {
                    j: rx.i
                    // y: rx.x
                }
};

Affected Version(s)

8.2

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@KavinduZoysa KavinduZoysa added Type/Bug Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Nov 1, 2023
@KavinduZoysa KavinduZoysa changed the title [Bug]: Required field is not detected with compound assignment [Bug]: Required field is not detected with computed-name-field Nov 1, 2023
@MaryamZi
Copy link
Member

MaryamZi commented Nov 2, 2023

Looks more like a query issue. Doesn't have to have computed keys.

type Foo record {|
    int i;
    string x;
|};

type Bar record {|
    int j;
    string y;
|};

type Baz record {|
    Foo[] fooArr;
|};

function fn(Baz baz) {
    int|Bar[] _ = from var foo in baz.fooArr
        select { // no compilation error
            j: foo.i
            // y: foo.x
        };

    Foo foo = baz.fooArr[0];
    int|Bar[] _ = [ // compilation error as expected
        {
            j: foo.i
            // y: foo.x
        }
    ];
}

Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@gimantha gimantha added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label Nov 29, 2023
@poorna2152 poorna2152 added this to the 2201.9.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants