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

Misleading type compatibility validation error #1256

Open
dhuebner opened this issue Nov 2, 2023 · 0 comments · May be fixed by #1478
Open

Misleading type compatibility validation error #1256

dhuebner opened this issue Nov 2, 2023 · 0 comments · May be fixed by #1478
Labels
bug Something isn't working types Types related issue validation Validation related issue

Comments

@dhuebner
Copy link
Contributor

dhuebner commented Nov 2, 2023

Langium version: 2.0.1
Package name: langium

Steps To Reproduce

grammar Foo

interface RuleType { prop : string };

entry Rule returns RuleType: 
     // Error at prop: The assigned type 'MyDataType' is not compatible with the declared property 'prop' of type 'string'.
    prop = MyDataType 
;

MyDataType returns string:
    INT
;

terminal INT returns number: /[0-9]+/;

The current behavior

In the example above an error is reported because MyDataType uses a number typed terminal rule. Even thought the rule defines the return type string.

The expected behavior

Because the datatype rule defines its return type as string the error should not be created.

@dhuebner dhuebner added bug Something isn't working validation Validation related issue types Types related issue labels Nov 2, 2023
@msujew msujew linked a pull request Apr 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working types Types related issue validation Validation related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant