Specifically this test case now WORKS:
// test for type/expr lookup split
begin
typedef hhhh = int;
begin
fun hhhh (x:int) => 2 * x;
var x : hhhh = hhhh 1;
println$ "x=" + x.str;
end
end
begin
fun hhhh (x:int) => 2 * x;
begin
typedef hhhh = int;
var x : hhhh = hhhh 1;
println$ "x=" + x.str;
end
end
We have a type and a function named hhhh. In the first case the type is in the
outer scope and the function in the inner. In the second case the locations are swapped.
The type is found correctly using the filter I added. However the function is found
correctly due to a secondary test:
FIRST CASE
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set {64455}
[lookup_name_in_table_dirs] hhhh TypeSym
[lookup_name_in_table_dirs] hhhh TypeSym
[lookup_name_in_table_dirs] hhhh TypeSym
Found entry set 64452
SECOND CASE
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh AnySym
Found entry set 64468
[lookup_name_in_table_dirs] hhhh TypeSym
[lookup_name_in_table_dirs] hhhh TypeSym
Found entry set 64468
x=2
x=2
note sure how the second case succeeds. All the lookups are finding the type
because it is most local, but the function is still found somehow, probably using
a routine that doesn’t call the core lookup I modified.
The code splits function and other symbols anyhow.
So we must try now with a variable instead of a function.
// type variable split
begin
typedef hhhh = int;
begin
var hhhh = 2;
var x : hhhh = hhhh;
println$ "x=" + x.str;
end
end
begin
var hhhh = 2;
begin
typedef hhhh = int;
var x : hhhh = hhhh;
println$ "x=" + x.str;
end
end
The first case works but the second fails badly:
Flx_lookup:inner_bind_expression: unknown exception File "src/compiler/flx_bind/
flx_btype_of_bsym.ml", line 32, characters 37-43: Assertion failed
Error at:
/Users/skaller/felix/tt.flx: line 34, cols 20 to 24
33: typedef hhhh = int;
34: var x : hhhh = hhhh;
*****
35: println$ "x=" + x.str;
This is an artefact of a hack!
let btype_of_bsym state bsym_table sr bt bid bsym =
match Flx_bsym.bbdcl bsym with
| BBDCL_label _ -> btyp_label ()
| BBDCL_invalid -> assert false
| BBDCL_nominal_type_alias _ -> assert false
| BBDCL_structural_type_alias _ -> assert false
A structural type alias is found and crashes the system.
This isn’t supposed to happen. The function is only supposed the called on
symbols that HAVE a type, not symbols that ARE a type.
—
John Skaller
ska...@internode.on.net