-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record type spread follow up questions #6158
Comments
In order to test the current status and address the questions and concerns raised in the conversation, I recommend taking the following steps:
By following these steps, you will be able to test the current status effectively and make informed decisions about the handling of unboxed records, spreading, and type coercion in the codebase. |
@unboxed
type t1 = {x:int}
type t2 = {...t1}
let three:t2 = {x:3}
type t3 = {x:int}
@unboxed
type t4 = {...t3}
let seven:t4 = {x:7} gives: var three = {
x: 3
};
var seven = 7; @zth what do you think? |
For type coercion an unboxed, it is indeed problematic at the moment. This compiles: @unboxed
type t1 = {x:int}
type t2 = {x:int}
let toT2 = (v:t1) => (v :> t2)
let toT1 = (v:t1) => (v :> t2)
let v1:t1 = {x:42}
let v2 = toT2(v1)
let r = v2.x and produces var r = (42).x;
var v1 = 42;
var v2 = 42; |
Type coercion and This compiles: type t1 = {@as("xx") x:int}
type t2 = {@as("xxxxx") x:int}
let toT2 = (v:t1) => (v :> t2)
let v1:t1 = {x:42}
let v2 = toT2(v1)
let eq = v2 == {x:42} and produces: var v1 = {
xx: 42
};
var eq = Caml_obj.equal(v1, {
xxxxx: 42
});
var v2 = v1; |
Spread and |
The unboxed type coercion is fixed here: c0bd807 (went directly into master by mistake) |
With the fixes, I think this is all done. |
Link to original conversation: #6154 (comment)
So, questions are (and my personal thoughts next to them):
@as
, I assume we'd have to account for them in coercion as well, as in@as
must exactly match between types for them to be considered equivalent.My thoughts, cc @cristianoc
The text was updated successfully, but these errors were encountered: