Skip to content

Nested similar lambdas result in duplicate method in ClassDef #20460

Open
@jypma

Description

@jypma

Compiler version

3.3.3, 3.4.2

3.4.2 slightly changes the error message to duplicate static method

Minimized code

Only full code is available. The bug is found by ScalaJS' validity checker of ClassDef. It can be reproduced as follows:

git checkout https://github.com/jypma/lazagna.git
cd lazagna
git checkout 88e946e # currently this is master
sbt
project client
fullLinkJS

Output

[info] Full optimizing /home/jan/workspace/lazagna/draw-client/target/scala-3.3.3/client-opt
[error] file:/home/jan/workspace/lazagna/draw-client/src/main/scala/draw/client/tools/SelectTool.scala(206:26:MethodDef): duplicate method 'draw$client$tools$SelectTool$$$$$$anonfun$$anonfun$1(draw.client.render.RenderedObject)draw.data.ObjectState'
[error] There were 1 ClassDef checking errors.
[error] (Compile / fullLinkJS) There were 1 ClassDef checking errors.

Expectation

The code compiles (and runs in scalaJS) fine. The cause is the .map(_.state) on line 202 of SelectTool.scala. If I replace that with a named function, the error goes away. There's on other .map(_.state) on line 219, I'm not sure if that's the one resulting in a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions