-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: warn if experimental language features are used (#624)
Closes #108 ### Summary of Changes Warn if experimental language features are used. For the moment, this is only indexed accesses. --------- Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
- Loading branch information
1 parent
d7ff0e2
commit 090fcc3
Showing
5 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { SdsIndexedAccess } from '../generated/ast.js'; | ||
import { ValidationAcceptor } from 'langium'; | ||
|
||
export const CODE_EXPERIMENTAL_LANGUAGE_FEATURE = 'experimental/language-feature'; | ||
|
||
export const indexedAccessesShouldBeUsedWithCaution = (node: SdsIndexedAccess, accept: ValidationAcceptor): void => { | ||
accept('warning', 'Indexed accesses are experimental and may change without prior notice.', { | ||
node, | ||
code: CODE_EXPERIMENTAL_LANGUAGE_FEATURE, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/resources/validation/experimental language feature/indexed access/main.sdstest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package tests.validation.experimentalLanguageFeature.indexedAccess | ||
|
||
pipeline myPipeline { | ||
// $TEST$ warning "Indexed accesses are experimental and may change without prior notice." | ||
»[1, 2][1]«; | ||
|
||
// $TEST$ warning "Indexed accesses are experimental and may change without prior notice." | ||
»{"a": "b"}["a"]«; | ||
} |