Skip to content

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

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

Closed
sjrd opened this issue Sep 25, 2018 · 1 comment
Closed

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

sjrd opened this issue Sep 25, 2018 · 1 comment

Comments

@sjrd
Copy link
Member

sjrd commented Sep 25, 2018

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
@allanrenucci allanrenucci self-assigned this Sep 26, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Sep 26, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Sep 26, 2018
@sir-wabbit
Copy link

Was also reported in #4459

allanrenucci added a commit to dotty-staging/dotty that referenced this issue Oct 1, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Oct 1, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Oct 5, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Oct 8, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 6, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 6, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 7, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 8, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 8, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 8, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 8, 2018
allanrenucci added a commit to dotty-staging/dotty that referenced this issue Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants