Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9008 from martijnhoekstra/SI8831
- Loading branch information
Showing
11 changed files
with
742 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1 | ||
1 | ||
Some(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
case class WhyNot(`^$#`: Int) | ||
object Test extends App { | ||
val wn = WhyNot(1) | ||
println(wn.`^$#`) | ||
val WhyNot(i) = wn | ||
println(i) | ||
println(WhyNot.unapply(wn)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Right5(1,2,3,4,5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
case class Right(a: Int, `a b`: Int) | ||
case class VeryRight(a: Int, `a b`: String) | ||
|
||
case class Wrong(`a b`: Int, a: Int) | ||
case class VeryWrong(`a b`: Int, a: String) | ||
case class WrongDollar(a$: Int, a: Int) | ||
case class VeryWrongDollar(a$: Int, a: String) | ||
case class WrongQuotedDollar(`a$`: Int, a: Int) | ||
case class WrongHyphenated(val `foo-bar`: Int, `foo`: Int) | ||
case class VeryWrongHyphenated(val `foo-bar`: Int, `foo`: String) | ||
case class WrongPlus(a_+ : Int, a_ : Int) | ||
case class VeryWrongPlus(a_+ : Int, a_ : String) | ||
|
||
case class Right5(b: Int, `a b`: Int, a: Int, `a `: Int, `a b c`: Int) | ||
|
||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val r = Right(1, 2) | ||
val w = Wrong(1, 2) | ||
val wd = WrongDollar(1, 2) | ||
val wh = WrongHyphenated(1, 2) | ||
val wp = WrongPlus(1, 2) | ||
assert(r.a == w.`a b`) | ||
assert(r.a == wd.a$) | ||
assert(r.a == wh.`foo-bar`) | ||
assert(r.a == wp.a_+) | ||
assert(r.`a b` == w.a) | ||
assert(r.`a b` == wd.a) | ||
assert(r.`a b` == wh.foo) | ||
assert(r.`a b` == wp.a_) | ||
|
||
val vr = VeryRight(1, "one") | ||
val vw = VeryWrong(1, "one") | ||
val vwd = VeryWrongDollar(1, "one") | ||
val vwh = VeryWrongHyphenated(1, "one") | ||
val vwp = VeryWrongPlus(1, "one") | ||
assert(vr.a == vw.`a b`) | ||
assert(vr.a == vwd.a$) | ||
assert(vr.a == vwh.`foo-bar`) | ||
assert(vr.a == vwp.a_+) | ||
assert(vr.`a b` == vw.a) | ||
assert(vr.`a b` == vwd.a) | ||
assert(vr.`a b` == vwh.foo) | ||
assert(vr.`a b` == vwp.a_) | ||
println(Right5(1, 2, 3, 4, 5).toString()) | ||
} | ||
} |
Oops, something went wrong.