roc/crates/compiler/test_gen/src
Ayaz Hafiz a53da2bc24
Make sure late specializations of opaques inherit Inspect as needed
A "late specialization" of a type is an ability specialization that
is not visible or needed until after type-specialization; i.e. during
monomorphization.

The `Inspect.toInspector` ability is special-cased for opaques that do
not claim or explicitly implement `Inspect`. In such cases, they are
treated as structural types, and given the immediate specialization of
`Inpect.inspectOpaque`.

However, prior to this commit, that special-casing would only be applied
during early specialiation (i.e. specializations visible during
generalized type inference). This commit applies the special case to
late specialization as well - the specialization decision for an opaque
type is always the specialization of the opaque type in the late case,
but now, when we go to look up the ambient lambda set of the
specialization, if it does not exist and corresponds to
`Inspect.toInspector`, we fall back to the immediate.

One concern I have here is that in a case like

```
Op := {}

x =
    dbg (@Op {})
```

the specialization of `Inspect.toInspector` for `Op` should be known
early. Indeed, the program

```
Op := {}

x =
    Inspect.toInspector (@Op {}) |> Inspect.apply (Inspect.init {}) |> Inspect.toDbgStr
```

Compiles fine without this change. This makes me suspect there is an
issue with the implementation of `dbg`'s desugaring. If possible, this
should be addressed sooner rather than later.

Closes #6127
2023-11-30 22:25:08 -06:00
..
helpers update zig and rust platforms to have correct roc_panic and roc_dbg 2023-11-29 21:49:34 -08:00
gen_abilities.rs Make sure late specializations of opaques inherit Inspect as needed 2023-11-30 22:25:08 -06:00
gen_compare.rs Fix compare for big structs 2023-06-16 10:30:41 -05:00
gen_definitions.rs Test closure definition with parens around 2023-07-04 10:24:09 +02:00
gen_dict.rs fix one more wrong float 2023-09-14 00:21:52 +02:00
gen_erased.rs clippy 2023-09-26 15:08:30 +02:00
gen_list.rs add currently broken test case for list .. as rest 2023-11-20 21:09:11 -08:00
gen_num.rs disable test with bad rounding 2023-10-23 13:50:31 -07:00
gen_panic.rs enable dev backend panic tests 2023-09-14 11:51:12 +02:00
gen_primitives.rs in record fields give a forced imported thunk a unique symbol 2023-11-28 23:47:53 +01:00
gen_records.rs fix argument passing for systemv 2023-10-09 15:24:35 +02:00
gen_refcount.rs clippy 2023-09-26 15:08:30 +02:00
gen_result.rs enable all gen_result tests for the dev backend 2023-10-09 15:24:32 +02:00
gen_set.rs clippy 2023-09-26 15:08:30 +02:00
gen_str.rs add Str.contains to builtins 2023-10-14 14:56:51 -05:00
gen_tags.rs fix memory reading bug in test 2023-10-23 13:50:34 -07:00
gen_tuples.rs clippy 2023-09-26 15:08:30 +02:00
tests.rs Add erasure llvm test 2023-07-12 14:43:25 -05:00
wasm_linking.rs Ignore ordering of function names in Wasm linking test 2023-10-23 13:50:35 -07:00
wasm_str.rs clippy 2023-09-26 15:08:30 +02:00