Permalink
Browse files

fix PR#5835

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13163 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent b0a238e commit 2ab017241e0400d7209ab348c7fe54c248f9696c garrigue committed Dec 27, 2012
View
@@ -40,6 +40,8 @@ Bug fixes:
- PR#5821: Wrong record field is reported as duplicate
- PR#5824: Generate more efficient code for immediate right shifts.
- PR#5825: Add a toplevel primitive to use source file wrapped with the coresponding module
+- PR#5835: nonoptional labeled arguments can be passed with '?'
+- PR#5865: assert failure when reporting undefined field label
Internals:
- Moved debugger/envaux.ml to typing/envaux.ml to publish env_of_only_summary
@@ -72,7 +74,6 @@ Bug fixes:
- PR#5806: ensure that backtrace tests are always run (testsuite)
- PR#5810: error in switch printing when using -dclambda
- PR#5858: Assert failure during typing of class
-- PR#5865: assert failure when reporting undefined field label
OCaml 4.00.1:
-------------
@@ -0,0 +1,4 @@
+(* PR#5835 *)
+
+let f ~x = x + 1;;
+f ?x:0;;
@@ -0,0 +1,8 @@
+
+# val f : x:int -> int = <fun>
+# Characters 5-6:
+ f ?x:0;;
+ ^
+Error: The function applied to this argument has type x:int -> int
+This argument cannot be applied with label ?x
+#
@@ -0,0 +1,8 @@
+
+# val f : x:int -> int = <fun>
+# Characters 5-6:
+ f ?x:0;;
+ ^
+Error: The function applied to this argument has type x:int -> int
+This argument cannot be applied with label ?x
+#
View
@@ -2899,7 +2899,9 @@ and type_application env funct sargs =
(l', sarg0, sargs @ sargs1, sargs2)
in
sargs, more_sargs,
- if optional = Required || is_optional l' then
+ if optional = Required && is_optional l' then
+ raise(Error(sarg0.pexp_loc, Apply_wrong_label(l', ty_fun')))
+ else if optional = Required || is_optional l' then
Some (fun () -> type_argument env sarg0 ty ty0)
else begin
may_warn sarg0.pexp_loc

0 comments on commit 2ab0172

Please sign in to comment.