Skip to content

Symbols' owner are not always up to date #518

Closed
@smarter

Description

@smarter

For example:

class Meter(val underlying: Int) extends AnyVal

class Test {
  val x: Int = new Meter(3).hashCode() 
}

new Meter(3).hashCode() should be replaced by Meter.hashCode$extension(3) in phase VCInline but it isn't because isMethodWithExtension returns false for hashCode because its owner is Any. This is incorrect because the phase SyntheticMethods will add an hashCode method to Meter. For value classes this problem can only happen with hashCode and equals (and a few other methods if the value class is also a case class), so I could work around it by hardcoding these methods into isMethodWithExtension, but maybe it's worth solving the underlying problem, I don't know what consequences it could have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions