-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add access control mechanism to typing contexts
This commit adds a feature that allows for typechecking using only a subset of objects (functions/types/registers etc) in the global typing context. Each `env_item` is extended with an identifier, and the local typing context contains a set of 'in scope' such identifiers. All functions accessing objects in the typing context will either raise Err_not_in_scope (if accessing a single object) or return a filtered set of objects based on the set of in-scope identifiers. Note that this commit is effectively a no-op. While it adds the mechanism, it does not add any way to use it other than a magic directive `unscope#` which kicks an object out of the current scope (this is guarded by the -dmagic_hash flag), which is used to test that simple cases have reasonable error messages.
- Loading branch information
Showing
17 changed files
with
235 additions
and
36 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
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
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
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 @@ | ||
[93mType error[0m: | ||
[96mfail/unscope_enum.sail[0m:14.10-11: | ||
14[96m |[0m let _ = A; | ||
[91m |[0m [91m^[0m | ||
[91m |[0m Enumeration E containing A is not in scope | ||
[91m |[0m Try bringing the following definition into scope: | ||
[91m |[0m [96mfail/unscope_enum.sail[0m:7.5-6: | ||
[91m |[0m 7[96m |[0menum E = A | B | C | ||
[91m |[0m [91m |[0m [91m^[0m [91mdefinition here[0m |
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,16 @@ | ||
$option -dmagic_hash | ||
|
||
default Order dec | ||
|
||
$include <prelude.sail> | ||
|
||
enum E = A | B | C | ||
|
||
$unscope# enum E | ||
|
||
val bar : unit -> unit | ||
|
||
function bar() = { | ||
let _ = A; | ||
() | ||
} |
Oops, something went wrong.