You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6820 Reporter:@Drup Status: closed (set by @alainfrisch on 2015-03-26T09:16:33Z) Resolution: won't fix Priority: normal Severity: minor Category: typing
Bug description
Currently, only a longident can be placed after the "new" keyword. This kind of restriction has been relaxed for several other piece of syntaxes (+ a check before typechecking). It would be useful to allow expressions there.
I would find this quite natural if the longident after "new" would indeed be resolved as expression path, but it's not the case. Why would we allow (syntactically) an expression after "new" and not, for instance, a type expression?
I don't see how it could be a type expression. Classes are not types and you can't define them in a signature alone. When a class is defined, a class type of the same name is also defined (and in a different namespace!) but that's a completely different thing. If you define the class type alone, it doesn't give you a class.
[%js.new expr]
Sure, this is what I will do, but I figured I could ask.
Actually, after re-reading your comment, I see what you meant. You are right, class names are not in the expression namespace, so it doesn't make sense to have a Pexp_ident there.
Original bug ID: 6820
Reporter: @Drup
Status: closed (set by @alainfrisch on 2015-03-26T09:16:33Z)
Resolution: won't fix
Priority: normal
Severity: minor
Category: typing
Bug description
Currently, only a longident can be placed after the "new" keyword. This kind of restriction has been relaxed for several other piece of syntaxes (+ a check before typechecking). It would be useful to allow expressions there.
Initial motivation can be found here: ocsigen/js_of_ocaml#239 (comment)
(I just realized there is no "OCaml syntax/parser" category in mantis)
The text was updated successfully, but these errors were encountered: