Skip to content

Commit 4c0ce97

Browse files
committed
Fix test
1 parent 40fda63 commit 4c0ce97

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Got name
22
Got age
33
Got city
4+
city = Paris
45
Guy

tests/run/runNamedPatternMatching.scala

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ object Test:
55
//TODO: Test this
66
object UserEx:
77
class UserExtractor(user: User) extends Product:
8-
def _1 = println("Got name"); user.name
9-
def _2 = println("Got age"); user.age
10-
def _3 = println("Got city"); user.city
8+
def _1: String =
9+
println("Got name")
10+
return user.name
11+
def _2: Int =
12+
println("Got age")
13+
user.age
14+
def _3: String =
15+
println("Got city")
16+
user.city
1117

1218
type Names = ("name", "age", "city")
1319

@@ -34,7 +40,8 @@ object Test:
3440
("name", user.name) +:: ("age", user.age) +:: ("city", user.city) +:: empty
3541

3642
def main(args: Array[String]): Unit =
37-
val UserEx(city = _, name = _) = User("Guy", 25, "Paris")
43+
val UserEx(city = c, name = _) = User("Guy", 25, "Paris")
44+
println("city = " + c: String)
3845
val UserEx2(city = _, name = n) = User("Guy", 25, "Paris")
3946

4047
println(n)

0 commit comments

Comments
 (0)