diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-23 17:53:19 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2016-03-26 22:55:13 -0700 |
commit | aa972dc100544179beecde48b52dfdb847162001 (patch) | |
tree | dc6c57fd7c1c97d6ce104797994dbf92637e86ae /spec | |
parent | 608ac2c2b9e3f6f46489e20830d8949ee7d506cf (diff) | |
download | scala-aa972dc100544179beecde48b52dfdb847162001.tar.gz scala-aa972dc100544179beecde48b52dfdb847162001.tar.bz2 scala-aa972dc100544179beecde48b52dfdb847162001.zip |
SAM conversion precedes implicit view application (as in dotty).
This reflects the majority vote on the PR.
DSLs that need their implicit conversions to kick in instead of
SAM conversion, will have to make their target types not be SAM
types (e.g., by adding a second abstract method to them).
Diffstat (limited to 'spec')
-rw-r--r-- | spec/06-expressions.md | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/06-expressions.md b/spec/06-expressions.md index bf1a6acf9a..30ad73a3cd 100644 --- a/spec/06-expressions.md +++ b/spec/06-expressions.md @@ -1345,17 +1345,6 @@ If $e$ has some value type and the expected type is `Unit`, $e$ is converted to the expected type by embedding it in the term `{ $e$; () }`. -###### View Application -If none of the previous conversions applies, and $e$'s type -does not conform to the expected type $\mathit{pt}$, it is attempted to convert -$e$ to the expected type with a [view](07-implicits.html#views). - -###### Selection on `Dynamic` -If none of the previous conversions applies, and $e$ is a prefix -of a selection $e.x$, and $e$'s type conforms to class `scala.Dynamic`, -then the selection is rewritten according to the rules for -[dynamic member selection](#dynamic-member-selection). - ###### SAM conversion An expression `(p1, ..., pN) => body` of function type `(T1, ..., TN) => T` is sam-convertible to the expected type `S` if the following holds: - the class `C` of `S` declares an abstract method `m` with signature `(p1: A1, ..., pN: AN): R`; @@ -1379,6 +1368,17 @@ Finally, we impose some implementation restrictions (these may be lifted in futu - `C` must not declare a self type (this simplifies type inference); - `C` must not be `@specialized`. +###### View Application +If none of the previous conversions applies, and $e$'s type +does not conform to the expected type $\mathit{pt}$, it is attempted to convert +$e$ to the expected type with a [view](07-implicits.html#views). + +###### Selection on `Dynamic` +If none of the previous conversions applies, and $e$ is a prefix +of a selection $e.x$, and $e$'s type conforms to class `scala.Dynamic`, +then the selection is rewritten according to the rules for +[dynamic member selection](#dynamic-member-selection). + ### Method Conversions The following four implicit conversions can be applied to methods |