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

Parser: semantic highlighting is wrong (?) #7642

Closed
magnus-madsen opened this issue Apr 27, 2024 · 1 comment · Fixed by #7775
Closed

Parser: semantic highlighting is wrong (?) #7642

magnus-madsen opened this issue Apr 27, 2024 · 1 comment · Fixed by #7775
Assignees
Labels
bug Something isn't working high priority Requires immediate attention

Comments

@magnus-madsen
Copy link
Member

/// Polymorphically extends the record `r` with an `age` label.
/// Preserves (retains) all other labels polymorphically.
def withAge(r: {| a}, v: Int32): {age = Int32 | a} =
    { +age = v | r }

/// Polymorphically restricts (removes) the `age` label from `r`.
/// Preserves (retains) all other labels polymorphically.
def withoutAge(r: {age = Int32 | a}): {| a} = {-age | r}

/// Construct several records and extend them with an age.
def main(): Unit \ IO =
    let r1 = withAge({fstName = "Julius", lstName = "Caesar"}, 55);
    let r2 = withAge({monument = "Flavian Amphitheatre"}, 2019 - 80);
    let r3 = withAge({country = "United States"}, 2019 - 1776);
    (r1.age + r2.age + r3.age) |> println

image

@magnus-madsen magnus-madsen added the bug Something isn't working label Apr 27, 2024
@magnus-madsen magnus-madsen added the high priority Requires immediate attention label May 15, 2024
@magnus-madsen
Copy link
Member Author

@herluf-ba I have upgraded this to high priority because it could indicate the some source locations are wrong which could make other compiler errors appear in wrong places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Requires immediate attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants