-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix case where parser drops attributes in packed module types. (#3262)
* Demonstrate dropped attributes in test. Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com> * Syntax error on misplaced attribute in packed module types. Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com> --------- Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>
- Loading branch information
1 parent
fe97beb
commit 8b99545
Showing
6 changed files
with
38 additions
and
1 deletion.
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
10 changes: 10 additions & 0 deletions
10
testsuite/tests/parsing/dropped_attribute_ptyp_package.compilers.reference
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,10 @@ | ||
module type T = sig type t end | ||
Line 3, characters 22-29: | ||
3 | val foo : (module T [@attr] with type t = 'a) -> unit | ||
^^^^^^^ | ||
Error: invalid package type: an attribute cannot go here | ||
Line 3, characters 33-40: | ||
3 | let foo (type a) (module M : T [@attr] with type t = a) = () | ||
^^^^^^^ | ||
Error: invalid package type: an attribute cannot go here | ||
|
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,18 @@ | ||
(* TEST | ||
toplevel; | ||
*) | ||
|
||
(* There is no place for the following attributes to attach to; the compiler should error | ||
rather than silently dropping them (as it used to do). *) | ||
|
||
module type T = sig | ||
type t | ||
end;; | ||
|
||
module type U = sig | ||
val foo : (module T [@attr] with type t = 'a) -> unit | ||
end;; | ||
|
||
module U : U = struct | ||
let foo (type a) (module M : T [@attr] with type t = a) = () | ||
end;; |