Skip to content

Commit 950adde

Browse files
committed
Give normative references for operator precedence
I verified the links use correct Dottydoc syntax.
1 parent ad52531 commit 950adde

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/src/dotty/tools/dotc/parsing/package.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import core.NameOps._
77

88
package object parsing {
99

10+
/**
11+
* Compute the precedence of infix operator `operator` according to the SLS [§ 6.12.3][SLS].
12+
* We implement [SIP-33][SIP-33] and give type operators the same precedence as term operators.
13+
*
14+
* [SLS]: https://www.scala-lang.org/files/archive/spec/2.13/06-expressions.html#infix-operations
15+
* [SIP-33]: https://docs.scala-lang.org/sips/priority-based-infix-type-precedence.html
16+
*/
1017
def precedence(operator: Name): Int =
1118
if (operator eq nme.ERROR) -1
1219
else {

0 commit comments

Comments
 (0)