File tree Expand file tree Collapse file tree 2 files changed +2
-25
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 2 files changed +2
-25
lines changed Original file line number Diff line number Diff line change @@ -2323,7 +2323,7 @@ object Parsers {
2323
2323
val templ = templateClauseOpt(constr, bodyRequired = true )
2324
2324
def checkDef (tree : Tree ) = tree match {
2325
2325
case _ : DefDef | EmptyValDef => // ok
2326
- case _ => syntaxError(" `def` expected" , tree.pos.startPos)
2326
+ case _ => syntaxError(" `def` expected" , tree.pos.startPos.orElse(templ.pos.startPos) )
2327
2327
}
2328
2328
checkDef(templ.self)
2329
2329
templ.body.foreach(checkDef)
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ object extensions {
28
28
def area = this .radius * this .radius * math.Pi
29
29
}
30
30
31
- extend Circle2 extends HasArea {} // error: `implements` or `{` expected
31
+ extend Circle2 extends HasArea {} // error: `implements` or `{` expected // error: `def` expected
32
32
33
33
extend Circle implements HasAreaClass {
34
34
def area = this .radius * this .radius * math.Pi
@@ -69,31 +69,8 @@ object extensions {
69
69
extend (type T ) {
70
70
def ~ [U ](that : U ): (T , U ) = (this , that)
71
71
}
72
-
73
- // Conditional generic extensions
74
-
75
- trait HasEql [T ] {
76
- def === (that : T ): Boolean
77
- }
78
-
79
- extend (type T : Eql ) implements HasEql [T ] {
80
- def === (that : T ): Boolean = implicitly[Eql [T ]].eql(this , that)
81
- }
82
-
83
- extend Rectangle [type T : Eql ] implements HasEql [Rectangle [T ]] {
84
- def === (that : Rectangle [T ]) =
85
- this .x === that.x &&
86
- this .y === that.y &&
87
- this .width == that.width &&
88
- this .height == that.height
89
- }
90
-
91
- extend List [List [type U ]] {
92
- def flattened : List [U ] = (this :\ (Nil : List [U ]))(_ ++ _)
93
- }
94
72
}
95
73
96
-
97
74
object extensions1 {
98
75
extend List [List [type T ]] {
99
76
def flattened : List [T ] = (this :\ (Nil : List [T ]))(_ ++ _)
You can’t perform that action at this time.
0 commit comments