Skip to content

Suspicious always-false comparison in TailRec related to super calls #5163

Closed
@sjrd

Description

@sjrd

TailRec has a suspicious comparison (method.name eq sym) at
https://github.com/lampepfl/dotty/blob/561c06a4c93e713ba7c7892e92cd9e5fa964ed9b/compiler/src/dotty/tools/dotc/transform/TailRec.scala#L275
which should always be false because it compares a Name to a Symbol. This suggests that the test is bogus, and should be investigated.

There's supposed to be a test for this in tests/neg-tailcall/tailrec-2.scala, as evidenced by its check file. However, this source file fails to parse:

sbt:dotty> dotc tests/neg-tailcall/tailrec-2.scala
[info] Compiling 1 Scala source to /localhome/doeraene/projects/dotty/compiler/t                                   arget/scala-2.12/classes ...
[info] Done compiling.
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Packaging /localhome/doeraene/projects/dotty/compiler/target/scala-2.12/dotty-compiler_2.12-0.10.0-bin-SNAPSHOT-nonbootstrapped.jar ...
[info] Done packaging.
[info] Running (fork) dotty.tools.dotc.Main -classpath /home/doeraene/.sbt/boot/scala-2.12.6/lib/scala-library.jar:/localhome/doeraene/projects/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.10/dotty-library_0.10-0.10.0-bin-SNAPSHOT.jar tests/neg-tailcall/tailrec-2.scala
-- [E040] Syntax Error: tests/neg-tailcall/tailrec-2.scala:16:72 ---------------
16 |  @annotation.tailrec final def f[B](mem: List[B]): List[B] = (???: Bop3.type).f(mem) // error // error
   |                                                                        ^^^^
   |                                             ')' expected, but '.' found
-- [E006] Unbound Identifier Error: tests/neg-tailcall/tailrec-2.scala:16:63 ---
16 |  @annotation.tailrec final def f[B](mem: List[B]): List[B] = (???: Bop3.type).f(mem) // error // error
   |                                                               ^^^^
   |                                                         not found: ???:

longer explanation available when compiling with `-explain`
two errors found
[error] Nonzero exit code returned from runner: 1
[error] (dotty-compiler / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 7 s, completed Sep 25, 2018 9:37:08 PM

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions