This repository has been archived by the owner on Oct 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix module-related scoping issues in errors (#218)
* Qualify names when leaving a module And, indeed, unqualify names when leaving a module. In practice, this means that the entire TC scope consists of types that are writable, as printed, in the scope they are referring to. * Keep names qualified when resolving
- Loading branch information
matheus
committed
Nov 10, 2019
1 parent
03d1112
commit 741f59c
Showing
12 changed files
with
141 additions
and
25 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
has_sing : Req{'k : type}. constraint | ||
sing_t : Req{'k : type}. 'k -> type | ||
sint : int -> type | ||
SInt : Spec{'i : int}. known_int 'i => sint 'i | ||
SInt : Spec{'i : int}. Amc.known_int 'i => sint 'i | ||
sing : sing_t int 123 |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
foo : Req{'a : type}. constraint | ||
foo_it : Spec{'a : type}. foo 'a => 'a -> unit | ||
Foo.foo : Req{'a : type}. constraint | ||
Foo.foo_it : Spec{'a : type}. Foo.foo 'a => 'a -> Foo.unit |
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,19 @@ | ||
external val (+) : int -> int -> int = | ||
"function(x, y) return x + y end" | ||
|
||
module X = begin | ||
type t = T | ||
let x = T | ||
end | ||
|
||
let _ = | ||
let _ = X.x + 1 | ||
(* local opens unqualify *) | ||
let _ = | ||
let open X | ||
x + 1 | ||
let _ = X.( x + 1 ) | ||
|
||
(* make sure that the unqualified scope doesn't leak *) | ||
let _ = X.x + 1 | ||
() |
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,24 @@ | ||
scope.ml[10:11 ..10:13]: error (E2001) | ||
│ | ||
10 │ let _ = X.x + 1 | ||
│ ^^^ | ||
Couldn't match actual type X.t | ||
with the type expected by the context, int | ||
scope.ml[14:5 ..14:5]: error (E2001) | ||
│ | ||
14 │ x + 1 | ||
│ ^ | ||
Couldn't match actual type t | ||
with the type expected by the context, int | ||
scope.ml[15:15 ..15:15]: error (E2001) | ||
│ | ||
15 │ let _ = X.( x + 1 ) | ||
│ ^ | ||
Couldn't match actual type t | ||
with the type expected by the context, int | ||
scope.ml[18:11 ..18:13]: error (E2001) | ||
│ | ||
18 │ let _ = X.x + 1 | ||
│ ^^^ | ||
Couldn't match actual type X.t | ||
with the type expected by the context, int |