You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disallow inline given aliases with functions as RHS
```scala
inline given a: Conversion[String, Item] = Item(_) // error
```
will now produce this error:
```
5 | inline given a: Conversion[String, Item] = Item(_) // error
| ^^^^^^^
|inline given alias cannot have a function value as right-hand side.
|Either drop `inline` or rewrite the given with an explicit `apply` method.
|-----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| A function value on the right-hand side of an inline given alias would expand to
| an anonymous class. Each application of the inline given would then create a
| fresh copy of that class, which can increase code size in surprising ways.
| For that reason, functions are disallowed as right hand sides of inline given aliases.
| You should either drop `inline` or rewrite to an explicit `apply` method. E.g.
|
| inline given Conversion[A, B] = x => x.toB // error
|
| should be re-formulated as
|
| inline given Conversion[A, B] with
| def apply(x: A) = x.toB
|
```
Fixesscala#16497
0 commit comments