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: 6476 Reporter:@lpw25 Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:28:09Z) Resolution: fixed Priority: normal Severity: minor Target version: 4.02.0+dev Fixed in version: 4.02.0+dev Category: ~DO NOT USE (was: OCaml general) Tags: patch
Bug description
Currently, attributes and extensions are allowed for class types but not class signatures. For example:
# class type c = object end [@foo];;
Characters 26-28:
class type c = object end [@foo];;
^^
Error: Syntax error
# class type c = [%foo];;
Characters 15-17:
class type c = [%foo];;
^^
Error: Syntax error
Thanks, well spotted. I've integrated your patch to the 4.02 branch.
Neither the previous version nor the new one supports putting attributes on "arrow" class_types, as in:
module type S = sig class c : (int -> object end) [@foo] end;;
Adding an "LPAREN class_type RPAREN attribute" production to class_type introduces conflicts. This is certainly not critical, but if you have a nice suggestion on how to address that, let me know!
Adding an "LPAREN class_type RPAREN attribute" production to class_type introduces conflicts. This is certainly not critical, but if you have a nice suggestion on how to address that, let me know!
I had a look at this when writing the patch, but it seems like it would be very difficult to support parentheses there. Some of the conflicts are easy to fix, but the conflict which appears in code like:
((foo -> bar)) vs. ((foo -> bar) -> baz)
is pretty awkward since foo should reduce to a class argument in the first but not the second, and we can only tell which it is when we see the second closing parenthesis.
Original bug ID: 6476
Reporter: @lpw25
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:28:09Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: ~DO NOT USE (was: OCaml general)
Tags: patch
Bug description
Currently, attributes and extensions are allowed for class types but not class signatures. For example:
The attached patch fixes this.
File attachments
The text was updated successfully, but these errors were encountered: