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.

Pattern matching in val statements is not supported

See original GitHub issue

In 0.13.7+,

val (a, b) = (0, 1)

results in the error.

Pattern matching in val statements is not supported

This worked in 0.13.6. (Probably related to #1661.)

Anyway, it would be great if this worked.

My personal use case was sbt-cross.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:4
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
dottacommented, Apr 13, 2016

I’ve just hit this, and the main problem form me was that the error error was not helpful at all

[lagom/build.sbt]:0: Pattern matching in val statements is not supported

Also, it turns out that in my case the reason was that I’ve defined an invalid identifier

lazy val play-json = (project in file("play-json"))

I simply forgot to surround the name with backticks.

2reactions
SethTisuecommented, Apr 13, 2016

That sounds like a bug on our part

arguably not, lazy val play-json = ... is syntactically a pattern match:

scala> object - { def unapply(x: Any) = Some((x, x)) }
defined object $minus

scala> val play-json = 3
play: Any = 3
json: Any = 3
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to use pattern matching in build.sbt?
Is there a way to use a match statement in the build.sbt file at all? The error says that it's not supported in...
Read more >
How to safely cast by using pattern matching and the is and as ...
The pattern matching is statement doesn't allow a nullable value type, such as int? or Nullable<int> , but you can test for any...
Read more >
Pattern Matching | Tour of Scala - Scala Documentation
Pattern matching is a mechanism for checking a value against a pattern. A successful match can also deconstruct a value into its constituent...
Read more >
4. Pattern Matching - Programming Scala, 2nd Edition [Book]
It looks just like a C-style case statement. As an experiment, try commenting out the second case false clause and run the script...
Read more >
13. Structural Pattern Matching (Python 3.10+) - GitHub Pages
Sadly, guards are still not allowed on normal loops for consistency with comprehensions and now case s, or on arbitrary statements (like in...
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