You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_spec/03-types.md
+3-13Lines changed: 3 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ StableId ::= id
63
63
| [id ‘.’] ‘super’ [ClassQualifier] ‘.’ id
64
64
ClassQualifier ::= ‘[’ id ‘]’
65
65
```
66
-
66
+
<!-- TODO: Clarify paragraph -->
67
67
Paths are not types themselves, but they can be a part of named types and in that function form a central role in Scala's type system.
68
68
69
69
A path is one of the following.
@@ -388,6 +388,7 @@ Method types associate to the right: ´(\mathit{Ps}\_1)(\mathit{Ps}\_2)U´ is tr
388
388
A special case are types of methods without any parameters.
389
389
They are written here `=> T`. Parameterless methods name expressions that are re-evaluated each time the parameterless method name is referenced.
390
390
391
+
<!-- TODO: replace by reference to eta-expansion instead -->
391
392
Method types do not exist as types of values.
392
393
If a method name is used as a value, its type is [implicitly converted](06-expressions.html#implicit-conversions) to a corresponding function type.
393
394
@@ -642,20 +643,9 @@ A _weak least upper bound_ is a least upper bound with respect to weak conforman
642
643
A type ´T´ is _compatible_ to a type ´U´ if ´T´ (or its corresponding function type) [weakly conforms](#weak-conformance) to ´U´ after applying [eta-expansion](06-expressions.html#eta-expansion).
643
644
If ´T´ is a method type, it's converted to the corresponding function type.
644
645
If the types do not weakly conform, the following alternatives are checked in order:
645
-
-[view application](07-implicits.html#views): there's an implicit view from ´T´ to ´U´;
646
646
- dropping by-name modifiers: if ´U´ is of the shape `´=> U'´` (and ´T´ is not), `´T <:_w U'´`;
647
647
- SAM conversion: if ´T´ corresponds to a function type, and ´U´ declares a single abstract method whose type [corresponds](06-expressions.html#sam-conversion) to the function type ´U'´, `´T <:_w U'´`.
648
-
649
-
<!--- TODO: include other implicit conversions in addition to view application?
650
-
651
-
trait Proc { def go(x: Any): Unit }
652
-
653
-
def foo(x: Any => Unit): Unit = ???
654
-
def foo(x: Proc): Unit = ???
655
-
656
-
foo((x: Any) => 1) // works when you drop either foo overload since value discarding is applied
657
-
658
-
-->
648
+
-[implicit conversion](07-implicits.html#views): there's an implicit conversion from ´T´ to ´U´ in scope;
0 commit comments