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
@@ -47,7 +49,7 @@ The `@alpha` annotation serves a dual purpose:
47
49
5. Definitions with names in backticks that are not legal host platform names
48
50
should have an `@alpha` annotation. Lack of such an annotation will raise a deprecation warning.
49
51
50
-
6.@alpha annotations must agree: If two definitions are members of an object or class with the same name and matching types, then either none of them has an `@alpha` annotation, or both have `@alpha` annotations with the same name.
52
+
6.`@alpha` annotations must agree: If two definitions are members of an object or class with the same name and matching types, then either none of them has an `@alpha` annotation, or both have `@alpha` annotations with the same name.
51
53
52
54
7. There must be a one-to-one relationship between external and internal names:
53
55
If two definitions are members of an object or class with matching types and both have `@alpha` annotations with the same external name, then their internal method names must also be the same.
@@ -56,6 +58,8 @@ The `@alpha` annotation serves a dual purpose:
56
58
57
59
An `@infix` annotation on a method definition allows using the method as an infix operation. Example:
58
60
```scala
61
+
importscala.annotation.alpha
62
+
59
63
traitMultiSet[T] {
60
64
61
65
@infix
@@ -70,13 +74,15 @@ trait MultiSet[T] {
70
74
vals1, s2:MultiSet[Int]
71
75
72
76
s1 union s2 // OK
77
+
s1 `union` s2 // also OK but unusual
73
78
s1.union(s2) // also OK
74
79
75
80
s1.difference(s2) // OK
76
81
s1 `difference` s2 // OK
77
82
s1 difference s2 // gives a deprecation warning
78
83
79
84
s1 * s2 // OK
85
+
s1 `*` s2 // also OK, but unusual
80
86
s1.*(s2) // also OK, but unusual
81
87
```
82
88
Infix operations involving alphanumeric operators are deprecated, unless
@@ -118,7 +124,7 @@ The purpose of the `@infix` annotation is to achieve consistency across a code b
118
124
@infix def (x: A) op (y1: B, y2: B):R// error: two parameters
119
125
```
120
126
121
-
4. @infix annotations can also be giventotype, traitorclassdefinitions that have exactly two typeparameters. Aninfixtypelike
127
+
4. `@infix` annotations can also be giventotype, traitorclassdefinitions that have exactly two typeparameters. Aninfixtypelike
0 commit comments