-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix joins for row likes with incompatible kinds (#139)
* Revert "Temporary hack for bug in Row_like join (#137)" This reverts commit c9591dc. * Prevent joins between products of different kinds. Row likes now have an assumption on fields kinds related to tags * Add test for the problematic join
- Loading branch information
Showing
8 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
middle_end/flambda2/tests/mlexamples/product_join_with_mixed_kinds.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
type float_rec = { a : float; b : float; } | ||
type (_, _) c = | ||
| F : (float_rec, unit) c | ||
| B : (int * int, int * int) c | ||
|
||
let f (type x) (type y) (b : (x, y) c) w x (y:y) : x * unit = | ||
let x : x = | ||
match b with | ||
| F -> | ||
{ a = w; b = x } | ||
| B -> | ||
let (u, v) = y in | ||
(* This creates a row_like of type Other ( value, value ) *) | ||
let _ = Sys.opaque_identity (u + v) in | ||
y | ||
in | ||
(* Here happens the join of | ||
Tag_254 ( float, float ) with Other ( value, value ) | ||
If nothing was done to prevent it, there would be a join between | ||
products with different kinds, which is prohibited *) | ||
x, () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,3 +214,5 @@ let map_closure_types | |
closure_types; | ||
closure_var_types; | ||
}) | ||
|
||
let fields_kind _ = Flambda_kind.value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters