eclipse-langium / langium

Next-gen language engineering / DSL framework
https://langium.org/
MIT License
663 stars 61 forks source link

Respect declared type of data type rules #1478

Closed msujew closed 3 weeks ago

msujew commented 2 months ago

Closes https://github.com/eclipse-langium/langium/issues/1256

In the issue, the MyDataType rule infers a number type (due to its content) instead of the declared string type. This change first checks whether the declared type can be assigned directly to the expected type. Only if that fails will the validation attempt to use the computed type for checking.