Skip to content

Commit cd9e7e1

Browse files
committed
Address review comments
1 parent 78d8aa2 commit cd9e7e1

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

compiler/src/dotty/tools/dotc/config/Config.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ object Config {
161161
final val showCompletions = false
162162

163163
/** If set, enables tracing */
164-
final val tracingEnabled = true
164+
final val tracingEnabled = false
165165

166166
/** Initial capacity of uniques HashMap.
167167
* Note: This MUST BE a power of two to work with util.HashSet

docs/docs/reference/changed-features/overload-resolution.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,13 @@ is determined as followed:
7272
of `E` is `(S_1, ..., S_n) => ?`, where each `S_i` is the type of parameter `p_i` if it is given, or `?`
7373
otherwise. Here `?` stands for a _wildcard type_ that is compatible with every other type.
7474
- Otherwise the known type of `E` is the result of typing `E` with an undefined expected type.
75+
76+
A pattern matching closure
77+
```scala
78+
{ case P1 => B1 ... case P_n => B_n }
79+
````
80+
is treated as if it was expanded to the function value
81+
```scala
82+
x => x match { case P1 => B1 ... case P_n => B_n }
83+
```
84+
and is therefore also approximated with a `? => ?` type.

tests/run/overloads.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ ok: M1.f(3) = 11
1515
ok: M2.f(3) = 22
1616
ok: M3.f("abc", _.reverse) = cba
1717
ok: M3.f(2, _ + 2) = 4
18+
ok: f("abc", { case s: String => s}) = abc

tests/run/overloads.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ object overloads {
8787
check("M3.f(\"abc\", _.reverse)", M3.f("abc", _.reverse), "cba")
8888
check("M3.f(2, _ + 2)", M3.f(2, _ + 2), 4)
8989

90+
check("f(\"abc\", { case s: String => s})", M3.f("abc", { case s: String => s}), "abc")
9091
}
91-
9292
}
9393

9494
//############################################################################

0 commit comments

Comments
 (0)