Commit 6f87f90
Use wildcard type instead of whitebox cast in IsoFields
Replace the `whitebox` cast (`asInstanceOf[Expr[Iso[S, Tuple]]]`) with a
proper wildcard return type using `PIso[S, S, ? <: Tuple, ? <: Tuple]`.
Since `IsoFields.apply` is a `transparent inline` method, the compiler
still infers the precise tuple type at call sites. This avoids the unsafe
cast and prepares for potential stricter macro type checking in future
Scala versions.
The motivation is to prepare for future stricter checks in the Scala 3
compiler. The current implementation exploits a missing check to generate
an unsound cast.
Note: we use `PIso` (a trait) directly instead of the `Iso` type alias
(defined as `type Iso[S, A] = PIso[S, S, A, A]`) because Scala 3 cannot
reduce higher-kinded type aliases applied to wildcard arguments.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 5f9f17b commit 6f87f90
2 files changed
Lines changed: 6 additions & 11 deletions
File tree
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 14 | + | |
19 | 15 | | |
20 | 16 | | |
21 | | - | |
| 17 | + | |
22 | 18 | | |
23 | 19 | | |
24 | 20 | | |
25 | | - | |
| 21 | + | |
26 | 22 | | |
27 | | - | |
28 | 23 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments