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.

Prevent Pattern Match Exhaustivity Warning for `transparent`

See original GitHub issue

Hi, I believe that pattern match exhaustivity warnings should not be emitted for top-level pattern match statements in transparent methods, given that the pattern match is checked and expanded at compile-time anyway.

I noticed these warnings are emitted when matching over a sealed trait/class in a transparent method body.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Blaisorbladecommented, Jul 31, 2018

(which is not so much the case currently with implicits in Scala).

That should be addressed by @implicitNotFound (not sure Dotty implements it yet but we should). And @compileTimeOnly is indeed designed for this goal, tho it honestly seems more roundabout.

Is there a nice way currently to implement compileError? As a side note, I think that having this compileError functionality would be great because it also allows to produce nice and interpretable errors (which is not so much the case currently with implicits in Scala).

Sorry for the ambiguity, I did mean “I don’t know but we should have it one way or the other”.

0reactions
Blaisorbladecommented, Sep 4, 2018

This topic came out today on Gitter, and there’s a WIP implementation in #4964 (currently in https://github.com/lampepfl/dotty/pull/4964/commits/2710e2b9165e94d74350ff91d5c1c4f55d01b87b).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to suppress "match is not exhaustive!" warning in Scala
Here are several options: You can match against Seq instead of List , since Seq doesn't have the exhaustiveness checking (this will fail,...
Read more >
No non-exhaustive pattern match warning given for empty ...
I would expect GHC to warn of a non-exhaustive pattern match at compile-time when faced with this,
Read more >
Match Exhaustiveness Testing Ignores Guard Statements #5365
For example, the following code will compile without "warning: match is not exhaustive!", even though calling it with a value of 1 will...
Read more >
Match may not be exhaustive warning, is this a big deal?
Is there a use case where I should exhaustively pattern match or is it fine to ignore it and use this as an...
Read more >
Common Error Messages · OCaml Tutorials
This page gives a list of quick explanations for some error or warning ... OCaml's pattern matching can check whether a set of...
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