You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When defining in mydsl.langium file an interface named Reference, the generated ast.ts does not compile.
Langium version: 3.1
Package name: langium
Steps To Reproduce
define an interface named 'Reference' in mydsl.langium
interface Reference {
name:string
}
Build the project
The current behavior
The project fails to build due to a conflict with imported types from langium in src/language/generated/ast.ts: import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
The expected behavior
Definition of interfaces like AstNode, Reference, ReferenceInfo or TypeMetaData in langium file should not collide with imports.
The text was updated successfully, but these errors were encountered:
We have a validation for protecting against name collisions with the JavaScript runtime. See here. We would need a separate list for reserved names of the Langium imports.
Another alternative would be to import types with a specific prefix (e.g. _langium_) and to prohibit rule names in the grammar from starting with this prefix ?
e.g:
import type { AstNode as _langium_AstNode,
Reference as _langium_Reference,
ReferenceInfo as _langium_ReferenceInfo,
TypeMetaData as _langium_TypeMetaData } from 'langium';
I don't know if this concept would be valid for other reserved keywords.
When defining in mydsl.langium file an interface named Reference, the generated ast.ts does not compile.
Langium version: 3.1
Package name: langium
Steps To Reproduce
define an interface named 'Reference' in mydsl.langium
Build the project
The current behavior
The project fails to build due to a conflict with imported types from langium in src/language/generated/ast.ts:
import type { AstNode, Reference, ReferenceInfo, TypeMetaData } from 'langium';
The expected behavior
Definition of interfaces like AstNode, Reference, ReferenceInfo or TypeMetaData in langium file should not collide with imports.
The text was updated successfully, but these errors were encountered: