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

Make sure we try destructure the right thing. #720

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

gdotdesign
Copy link
Member

Currently, if we have a type and a module with the same name and try to match on a value of the type will find the module first, which can lead to errors:

module App.Page {
  fun test {
    ""
  }
}

enum App.Page {
  Settings
  Page
}

component Main {
  fun render : Html {
    case App.Page.Settings {
      App.Page.Settings => <div></div>
      App.Page.Page => <div></div>
    }
  }
}

It would App.Page.Settings would resolve the App.Page module instead of the type it errors out since there is no Settings in the module.

This PR fixes that by checking if there is a type and a variant before checking the module and it's entities.

@gdotdesign gdotdesign added the bug Something isn't working label Nov 27, 2024
@gdotdesign gdotdesign added this to the 0.21.0 milestone Nov 27, 2024
@gdotdesign gdotdesign requested a review from Sija November 27, 2024 13:12
@gdotdesign gdotdesign self-assigned this Nov 27, 2024
@gdotdesign gdotdesign merged commit 0fdf2f8 into master Dec 3, 2024
3 checks passed
@gdotdesign gdotdesign deleted the destrcuture-type-fix branch December 3, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants