File tree Expand file tree Collapse file tree 4 files changed +66
-1
lines changed Expand file tree Collapse file tree 4 files changed +66
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : doc-page
3
+ title : " Changes in Implicit Resolution"
4
+ ---
5
+
6
+ Implicit resolution uses a new algorithm which caches implicit results
7
+ more aggressively for perforance. There are also some changes that
8
+ affect implicits on the language level.
9
+
10
+ 1 . Types of implicit values and result types of implicit methods
11
+ must be explicitly declared. Excepted are only values in local blocks
12
+ where the type may still be inferred:
13
+
14
+ class C {
15
+
16
+ val ctx: Context = ... // ok
17
+
18
+ /*!*/ implicit val x = ... // error: type must be given explicitly
19
+
20
+ /*!*/ next(): Context = ... // error: type must be given explicitly
21
+
22
+ val y = {
23
+ implicit val ctx = this.ctx // ok
24
+ ...
25
+ }
26
+
27
+ 2 . Implicit parameters may not have singleton types.
28
+
29
+ /*!*/ def f(implicit x: y.type) // error `y.type` not allowed as type of implicit
30
+
31
+ 3 . Nesting is now taken into account for selecting an implicit.
32
+ Consider for instance the following scenario
33
+
34
+ def f(implicit i: C) = {
35
+ def g(implicit j: C) = {
36
+ implicitly[C]
37
+ }
38
+ }
39
+
40
+ This will now resolve the ` implicitly ` call to ` j ` , because ` j ` is nested
41
+ more deeply than ` i ` . Previously, this would have resulted in an
42
+ ambiguity error.
43
+
44
+ [ //] # todo: expand with precise rules
45
+
46
+
Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : doc-page
3
+ title : " Changes in Type Checking"
4
+ ---
5
+
6
+ [ //] # todo: fill in
Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : doc-page
3
+ title : " Changes in Type Inference"
4
+ ---
5
+
6
+ [ //] # todo: fill in
7
+
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ sidebar:
27
27
url : docs/reference/multiversal-equality.html
28
28
- title : Inline
29
29
url : docs/reference/inline.html
30
- - title : Smaller Changes
30
+ - title : Smaller Additions
31
31
subsection :
32
32
- title : By-Name Implicits
33
33
url : docs/reference/implicit-by-name-parameters.html
@@ -41,6 +41,12 @@ sidebar:
41
41
url : docs/reference/changed/lazy-vals.md
42
42
- title : Structural Types
43
43
url : docs/reference/changed/structural-types.md
44
+ - title : Type Checking
45
+ url : docs/reference/changed/type-checking.md
46
+ - title : Type Inference
47
+ url : docs/reference/changed/type-inference.md
48
+ - title : Implicit Resolution
49
+ url : docs/reference/changed/implicit-resolution.md
44
50
- title : Dropped Features
45
51
subsection :
46
52
- title : DelayedInit
You can’t perform that action at this time.
0 commit comments