Skip to content

Conversation

mhsdesign
Copy link
Contributor

While implementing an accessType resolver i noticed that my other pr: #9 "Enums ensure that match is complete" can be implemented cleaner, so its contents have been copied into this pr and #9 is now obsolete.

  • enum static will be converted to enum instance in ComponentScope, but enum static is the imported type
  • Remove global ButtonType hack in the tests and import it correctly in the Match.afx
  • ModuleScope::lookupTypeFor didnt work for imported enums (IdentifierResolver Failed)

Match related:

  • multiple default arms -> throws
  • if there is no default arm and not all enum members are listed -> throws
  • if enum members are listed twice -> throws
  • if enum is matched against non enum member -> throws
  • if enum is matched against other enum -> throws

- fail if enum doesnt have this property
- resolve property value type
- reimplement #9 cleaner
- enum static will be converted to enum instance in ComponentScope, but enum static is the imported type
- Remove global ButtonType hack in the tests and import it correctly in the Match.afx
- ModuleScope::lookupTypeFor didnt work for imported enums (IdentifierResolver Failed)

Match related:
- multiple default arms -> throws
- if there is no default arm and not all enum members are listed -> throws
- if enum members are listed twice -> throws
- if enum is matched against non enum member -> throws
- if enum is matched against other enum -> throws
…o account

previously enums where only compared by name and not import path (module id)
this modeling is imo correct, as this will allow this in the future

```
Enum.A.value
```

`Enum.A` is an EnumInstanceType (which knows that its name is "A") while Enum is just an EnumStaticType

if an enum is referenced like

`enum: Enum`

an unspecific instance (without known MemberName) will be used
@mhsdesign mhsdesign force-pushed the feature/typedEnumAccessAndStrictEnumMatches branch from 6ae7f1c to 5a33cc5 Compare April 9, 2023 13:11
Copy link
Member

@grebaldi grebaldi left a comment

Choose a reason for hiding this comment

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

Thanks a lot @mhsdesign!

(And sorry again for the long delay 😅)

@grebaldi grebaldi merged commit 1b0aeb3 into main Aug 5, 2023
@grebaldi grebaldi deleted the feature/typedEnumAccessAndStrictEnumMatches branch August 5, 2023 16:23
@mhsdesign
Copy link
Contributor Author

No thanks ❤️ @grebaldi for still merging this, and taking the time to merge it into your big refactoring: #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants