Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #273 from diml/get-extension-slot
Get extension slot
- Loading branch information
Showing
28 changed files
with
184 additions
and
33 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,15 @@ | ||
######################################################################### | ||
# # | ||
# OCaml # | ||
# # | ||
# Xavier Clerc, SED, INRIA Rocquencourt # | ||
# # | ||
# Copyright 2010 Institut National de Recherche en Informatique et # | ||
# en Automatique. All rights reserved. This file is distributed # | ||
# under the terms of the Q Public License version 1.0. # | ||
# # | ||
######################################################################### | ||
|
||
BASEDIR=../.. | ||
include $(BASEDIR)/makefiles/Makefile.several | ||
include $(BASEDIR)/makefiles/Makefile.common |
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,29 @@ | ||
(***********************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Jeremie Dimino, Jane Street Europe *) | ||
(* *) | ||
(* Copyright 2015 Institut National de Recherche en Informatique et *) | ||
(* en Automatique. All rights reserved. This file is distributed *) | ||
(* under the terms of the Q Public License version 1.0. *) | ||
(* *) | ||
(***********************************************************************) | ||
|
||
type t = .. | ||
|
||
module M = struct | ||
type t += A | ||
type t += B of int | ||
end | ||
|
||
type t += C | ||
type t += D of int * string | ||
|
||
let () = | ||
assert (Obj.extension_constructor M.A == [%extension_constructor M.A]); | ||
assert (Obj.extension_constructor (M.B 42) == [%extension_constructor M.B]); | ||
assert (Obj.extension_constructor C == [%extension_constructor C ]); | ||
assert (Obj.extension_constructor (D (42, "")) == [%extension_constructor D ]) | ||
|
||
let () = print_endline "OK" |
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 @@ | ||
OK |
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,15 @@ | ||
######################################################################### | ||
# # | ||
# OCaml # | ||
# # | ||
# Xavier Clerc, SED, INRIA Rocquencourt # | ||
# # | ||
# Copyright 2010 Institut National de Recherche en Informatique et # | ||
# en Automatique. All rights reserved. This file is distributed # | ||
# under the terms of the Q Public License version 1.0. # | ||
# # | ||
######################################################################### | ||
|
||
BASEDIR=../.. | ||
include $(BASEDIR)/makefiles/Makefile.toplevel | ||
include $(BASEDIR)/makefiles/Makefile.common |
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,21 @@ | ||
(***********************************************************************) | ||
(* *) | ||
(* OCaml *) | ||
(* *) | ||
(* Jeremie Dimino, Jane Street Europe *) | ||
(* *) | ||
(* Copyright 2015 Institut National de Recherche en Informatique et *) | ||
(* en Automatique. All rights reserved. This file is distributed *) | ||
(* under the terms of the Q Public License version 1.0. *) | ||
(* *) | ||
(***********************************************************************) | ||
|
||
type t = ..;; | ||
type t += A;; | ||
|
||
[%extension_constructor A];; | ||
([%extension_constructor A] : extension_constructor);; | ||
|
||
type extension_constructor = int;; | ||
|
||
([%extension_constructor A] : extension_constructor);; |
13 changes: 13 additions & 0 deletions
13
testsuite/tests/typing-extension-constructor/test.ml.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,13 @@ | ||
|
||
# type t = .. | ||
# type t += A | ||
# - : extension_constructor = <abstr> | ||
# - : extension_constructor = <abstr> | ||
# type extension_constructor = int | ||
# Characters 2-28: | ||
([%extension_constructor A] : extension_constructor);; | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error: This expression has type extension_constructor/16 | ||
but an expression was expected of type | ||
extension_constructor/1214 = int | ||
# |
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
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
Oops, something went wrong.