-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: do not emit cases in pattern match as enum cases
- Loading branch information
1 parent
5fefeff
commit 0660721
Showing
72 changed files
with
1,035 additions
and
71 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
1 change: 1 addition & 0 deletions
1
tests/unit/src/test/resources/toplevel-with-inner-scala3/EmptyPackage.scala
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 @@ | ||
class EmptyPackage/*_empty_.EmptyPackage#*/ |
4 changes: 4 additions & 0 deletions
4
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/AbstractGiven.scala
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,4 @@ | ||
package example | ||
|
||
abstract class AbstractGiven/*example.AbstractGiven#*/: | ||
given int: Int |
8 changes: 8 additions & 0 deletions
8
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/AndOrType.scala
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 @@ | ||
package example | ||
|
||
trait Cancelable/*example.Cancelable#*/ | ||
trait Movable/*example.Movable#*/ | ||
|
||
type/*example.AndOrType$package.*/ Y = (Cancelable & Movable) | ||
|
||
type X = String | Int |
3 changes: 3 additions & 0 deletions
3
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/AnonymousClasses.scala
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 @@ | ||
package example | ||
|
||
class AnonymousClasses/*example.AnonymousClasses#*/ {} |
6 changes: 6 additions & 0 deletions
6
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/ColorEnum.scala
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,6 @@ | ||
package example | ||
|
||
enum Color/*example.Color#*/(val rgb: Int): | ||
case Red/*example.Color.Red.*/ extends Color(0xff0000) | ||
case Green/*example.Color.Green.*/ extends Color(0x00ff00) | ||
case Blue/*example.Color.Blue.*/ extends Color(0x0000ff) |
9 changes: 9 additions & 0 deletions
9
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/Comments.scala
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,9 @@ | ||
package example | ||
|
||
class /* comment */ Comments/*example.Comments#*/ { | ||
object /* comment */ A/*example.Comments#A.*/ | ||
trait /* comment */ A/*example.Comments#A#*/ | ||
val /* comment */ a = 1 | ||
def /* comment */ b = 1 | ||
var /* comment */ c = 1 | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/Companion.scala
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,5 @@ | ||
package example | ||
|
||
abstract class Companion/*example.Companion#*/() extends Object() {} | ||
|
||
object Companion/*example.Companion.*/ {} |
5 changes: 5 additions & 0 deletions
5
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/EtaExpansion.scala
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,5 @@ | ||
package example | ||
|
||
class EtaExpansion/*example.EtaExpansion#*/ { | ||
List(1).map(identity) | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/Extension.scala
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,11 @@ | ||
package example | ||
|
||
extension/*example.Extension$package.*/ (i: Int) def asString: String = i.toString | ||
|
||
extension (s: String) | ||
def asInt: Int = s.toInt | ||
def double: String = s * 2 | ||
|
||
trait AbstractExtension/*example.AbstractExtension#*/: | ||
extension (d: Double) | ||
def abc: String |
5 changes: 5 additions & 0 deletions
5
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/FooEnum.scala
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,5 @@ | ||
package example | ||
|
||
enum FooEnum/*example.FooEnum#*/: | ||
case Bar/*example.FooEnum.Bar.*/, Baz/*example.FooEnum.Baz.*/ | ||
object FooEnum/*example.FooEnum.*/ |
40 changes: 40 additions & 0 deletions
40
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/ForComprehensions.scala
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,40 @@ | ||
package example | ||
|
||
class ForComprehensions/*example.ForComprehensions#*/ { | ||
for { | ||
a <- List(1) | ||
b <- List(a) | ||
if ( | ||
a, | ||
b, | ||
) == (1, 2) | ||
( | ||
c, | ||
d, | ||
) <- List((a, b)) | ||
if ( | ||
a, | ||
b, | ||
c, | ||
d, | ||
) == (1, 2, 3, 4) | ||
e = ( | ||
a, | ||
b, | ||
c, | ||
d, | ||
) | ||
if e == (1, 2, 3, 4) | ||
f <- List(e) | ||
} yield { | ||
( | ||
a, | ||
b, | ||
c, | ||
d, | ||
e, | ||
f, | ||
) | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/GivenAlias.scala
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 @@ | ||
package example | ||
|
||
given/*example.GivenAlias$package.*/ intValue: Int = 4 | ||
given String = "str" | ||
given (using i: Int): Double = 4.0 | ||
given [T]: List[T] = Nil | ||
given given_Char: Char = '?' | ||
given `given_Float`: Float = 3.0 | ||
given `* *` : Long = 5 | ||
|
||
def method(using Int) = "" | ||
|
||
object X/*example.X.*/: | ||
given Double = 4.0 | ||
val double = given_Double | ||
|
||
given of[A]: Option[A] = ??? | ||
|
||
trait Xg/*example.Xg#*/: | ||
def doX: Int | ||
|
||
trait Yg/*example.Yg#*/: | ||
def doY: String | ||
|
||
trait Zg/*example.Zg#*/[T]: | ||
def doZ: List[T] | ||
|
||
given Xg with | ||
def doX = 7 | ||
|
||
given (using Xg): Yg with | ||
def doY = "7" | ||
|
||
given [T]: Zg[T] with | ||
def doZ: List[T] = Nil | ||
|
||
val a = intValue | ||
val b = given_String | ||
val c = X.given_Double | ||
val d = given_List_T[Int] | ||
val e = given_Char | ||
val f = given_Float | ||
val g = `* *` | ||
val i = X.of[Int] | ||
val x = given_Xg | ||
val y = given_Yg | ||
val z = given_Zg_T[String] |
10 changes: 10 additions & 0 deletions
10
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/ImplicitClasses.scala
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,10 @@ | ||
package example | ||
|
||
object ImplicitClasses/*example.ImplicitClasses.*/ { | ||
implicit class Xtension/*example.ImplicitClasses.Xtension#*/(number: Int) { | ||
def increment: Int = number + 1 | ||
} | ||
implicit class XtensionAnyVal/*example.ImplicitClasses.XtensionAnyVal#*/(private val number: Int) extends AnyVal { | ||
def double: Int = number * 2 | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/Imports.scala
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,10 @@ | ||
package example | ||
|
||
import util.{Failure => NotGood} | ||
import math.{floor => _, _} | ||
|
||
class Imports/*example.Imports#*/ { | ||
// rename reference | ||
NotGood(null) | ||
max(1, 2) | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/unit/src/test/resources/toplevel-with-inner-scala3/example/JavaThenScala.scala
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,5 @@ | ||
package example | ||
|
||
class JavaThenScala/*example.JavaThenScala#*/ { | ||
new JavaClass(42) | ||
} |
Oops, something went wrong.