question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possibly spurious warning on type test

See original GitHub issue

Compiler version

3.0.0

Minimized code

sealed trait Action[Page]
case class Renderer[Page, Props]() extends Action[Page]
sealed trait Redirect[Page] extends Action[Page]

final class RouterLogic[Page, Props] {

  def hmm1(a: Action[Page]): Int =
    a match {
      case r: Renderer[Page, Props] => 1
      case _                        => 2
    }

  def hmm2(a: Action[Page]): Int =
    a match {
      case r: Redirect[Page] => 2
      case _                 => 1
    }
}

Output

[warn] 9 |      case r: Renderer[Page, Props] => 1
[warn]   |           ^^^^^^^^^^^^^^^^^^^^^^^^
[warn]   |      the type test for Renderer[Page, Props] cannot be checked at runtime
[warn] one warning found

Expectation

No warnings. (Scala 2.13.6 emits no warnings.)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
som-snyttcommented, Jun 3, 2021

Scala 2 has received a bunch of improvements around pattern checks. This will be on the top of pile where someone might notice it.

0reactions
japgollycommented, Jun 3, 2021

Fantastic! Very glad to hear that Scala 2 will keep getting love and care for a while yet 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Possibly spurious solutions. [solvelib::checkSolutions]
I am trying to solve four algebraic equations in a for loop. It is giving a warning 'Possibly spurious solutions ...
Read more >
86647 – Test on constant expression (unsigned) -Wtype-limits warning
The consequence of this bug is that the following macro used to detect signed integer types #define SIGNED(T) ((T) -1 < 0) triggers...
Read more >
Common issues and solutions - mypy 0.991 documentation
Spurious errors and locally silencing the checker​​ You can add a # type: ignore comment to tell mypy to ignore this error: import...
Read more >
solve function solution issues: spurious solutions - MathWorks
Warning : Possibly spurious solutions. > In symengine. In mupadengine/evalin (line 123). In mupadengine/feval (line 182). In solve (line 293).
Read more >
Spurious Regression - RATS 10.0
2 or even lower. The Engle-Granger test (@EGTEST) tests for cointegration by running a (potentially) spurious regression and testing the residuals for a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found