Skip to content
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

Don't drop a coercion in handling symbol projections #562

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

lukemaurer
Copy link

When resolving a symbol projection to some simple s, we then
recursively try and resolve s as a symbol projection. If s carries a
coercion, we need to apply that coercion to the final result.

Unfortunately, I don't have a test case for this, because I'm not sure
it's currently possible to trip it: one would need a symbol that gets
set to a recursive occurrence, and yet that recursive occurrence needs
to be an alias to some other symbol projection. You'd want to do
something like

let foo = Sys.opaque_identity 42

let rec waste b = if b then waste false else bar [@@inline]
and bar = foo

but the and bar = foo part is not valid OCaml.

At any rate, I ran tests with the shortcut in
create_coerced_singleton_let removed, so the basic functionality of
wrapping a Named.t in a coercion is working.

@lukemaurer lukemaurer force-pushed the coercions-in-symbol-projections branch 2 times, most recently from 656703f to 326faad Compare July 16, 2021 13:45
middle_end/flambda/simplify/expr_builder.ml Show resolved Hide resolved
middle_end/flambda/simplify/expr_builder.ml Outdated Show resolved Hide resolved
middle_end/flambda/simplify/expr_builder.ml Outdated Show resolved Hide resolved
When resolving a symbol projection to some simple `s`, we then
recursively try and resolve `s` as a symbol projection. If `s` carries a
coercion, we need to apply that coercion to the final result.

Unfortunately, I don't have a test case for this, because I'm not sure
it's currently possible to trip it: one would need a symbol that gets
set to a recursive occurrence, and yet that recursive occurrence needs
to be an alias to some other symbol projection. You'd want to do
something like

    let foo = Sys.opaque_identity 42

    let rec waste b = if b then waste false else bar [@@inline]
    and bar = foo

but the `and bar = foo` part is not valid OCaml.

At any rate, I ran tests with the shortcut in
`create_coerced_singleton_let` removed, so the basic functionality of
wrapping a `Named.t` in a coercion is working.
@lukemaurer lukemaurer force-pushed the coercions-in-symbol-projections branch from 326faad to df93636 Compare July 16, 2021 15:31
@mshinwell mshinwell merged commit ce6725c into flambda2.0-stable Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants