-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exported inline does not generate inline accessors to exported path #14131
Comments
Minimized class Dog:
inline def bark: String = "bark: Woof!"
class Wolf:
private val dog: Dog = Dog()
export dog.bark
def test = Wolf().bark |
We are missing the generation of an inline accessor for class Wolf:
private val dog: Dog = Dog()
export dog.bark after typer is
but we want the equivalent of class Wolf:
private val dog: Dog = Dog()
inline def bark: String = dog.bark which after typer is
We are probably missing a call to |
If we change the following code it example compiles but does not pass Ycheck because the inline accessor is not properly added to the class. - PrepareInlineable.registerInlineInfo(forwarder, ddef.rhs)
+ PrepareInlineable.registerInlineInfo(forwarder, ddef.rhs)(using ctx.withOwner(forwarder)) |
* Fix context owner of `PrepareInlineable.registerInlineInfo`. It should have as owner the inline method (`forwarder` in this case). * Eagerly compute the inlinable RHS. Because we create the forwarder already typed, we do not evaluate/force in typer the `LazyBodyAnnotation` which is what triggers the computation of the inline accessors. This happened in posttyper which was too late. There might be a cleaner solution to this problem, maybe forcing the annotation explicitly. Fixes #14131 Fixes #16469
Compiler Version
3.1.2-bin-SNAPSHOT @ b3ab102
Minimised Example
Output
Expectation
no error
Originally posted by @bishabosha in #14051 (comment)
The text was updated successfully, but these errors were encountered: