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: 7159 Reporter:@alainfrisch Assigned to:@garrigue Status: acknowledged (set by @garrigue on 2016-03-02T00:43:12Z) Resolution: open Priority: low Severity: feature Target version: undecided Category: typing Monitored by:@hcarty
Bug description
Compare:
# (("abc", 42) : (int * int));;
Characters 2-7:
(("abc", 42) : (int * int));;
^^^^^
Error: This expression has type string but an expression was expected of type
int
and
# (object method x = "abc" method y = 42 end : <x: int; y: int>);;
Characters 1-42:
(object method x = "abc" method y = 42 end : <x: int; y: int>);;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This expression has type < x : string; y : int >
but an expression was expected of type < x : int; y : int >
Types for method x are incompatible
It could be useful (for error messages and type-based selection) to propagate types from the context to the method bodies for an object literal.
In case of an immediate annotation on the object literal, one can already put the constraint on "this":
# object(_ : <x: int; y:int>) method x = "abc" method y = 42 end;;
Characters 39-44:
object(_ : <x: int; y:int>) method x = "abc" method y = 42 end;;
^^^^^
Error: This expression has type string but an expression was expected of type
int
The text was updated successfully, but these errors were encountered:
I see your point.
As you point out, it shouldn't be that difficult, since one should just propagate the expected type to the internal self-type.
However, code in typeclass is really hairy, so don't hold your breath.
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
Original bug ID: 7159
Reporter: @alainfrisch
Assigned to: @garrigue
Status: acknowledged (set by @garrigue on 2016-03-02T00:43:12Z)
Resolution: open
Priority: low
Severity: feature
Target version: undecided
Category: typing
Monitored by: @hcarty
Bug description
Compare:
and
It could be useful (for error messages and type-based selection) to propagate types from the context to the method bodies for an object literal.
In case of an immediate annotation on the object literal, one can already put the constraint on "this":
The text was updated successfully, but these errors were encountered: