-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prohibit user-defined parametric sorts (#3878)
This PR adds a check to error on any non-`MInt` parametric sorts. We already assume `MInt` is the only parametric sort internally, so this check just makes that explicit to the user: https://github.com/runtimeverification/k/blob/0b4353c62f018a46736dc6b512414b77ab81523d/kernel/src/main/java/org/kframework/parser/inner/RuleGrammarGenerator.java#L419 The check has to be done in `Module.checkSorts` so that we error early enough, e.g., before computing the subsort `POSet`.
- Loading branch information
1 parent
5c7ea35
commit 322f223
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
k-distribution/tests/regression-new/checks/checkParametricSort.k
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,8 @@ | ||
// Copyright (c) Runtime Verification, Inc. All Rights Reserved. | ||
module CHECKPARAMETRICSORT | ||
imports MINT | ||
imports INT | ||
|
||
syntax MInt{6} | ||
syntax {S} Foo{S} | ||
endmodule |
5 changes: 5 additions & 0 deletions
5
k-distribution/tests/regression-new/checks/checkParametricSort.k.out
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,5 @@ | ||
[Error] Compiler: User-defined parametric sorts are currently unsupported: Foo{S} | ||
Source(checkParametricSort.k) | ||
Location(7,1,7,18) | ||
7 | syntax {S} Foo{S} | ||
. ^~~~~~~~~~~~~~~~~ |
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