Skip to content

Commit 10a5868

Browse files
committed
ExplicitNonNullaryApply when methods are overridden
1 parent 4208398 commit 10a5868

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
rule = fix.scala213.ExplicitNonNullaryApply
3+
*/
4+
package fix.scala213
5+
6+
class ExplicitNonNullaryApplyOver {
7+
class Meth { def d() = "" }
8+
class Prop { def d = "" }
9+
10+
class Meth2Prop extends Meth { override def d = "" }
11+
class Prop2Meth extends Prop { override def d() = "" }
12+
13+
val meth2prop = new Meth2Prop
14+
val prop2meth = new Prop2Meth
15+
16+
meth2prop.d()
17+
meth2prop.d // <- should call with parens
18+
prop2meth.d()
19+
prop2meth.d // <- should call with parens
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package fix.scala213
2+
3+
class ExplicitNonNullaryApplyOver {
4+
class Meth { def d() = "" }
5+
class Prop { def d = "" }
6+
7+
class Meth2Prop extends Meth { override def d = "" }
8+
class Prop2Meth extends Prop { override def d() = "" }
9+
10+
val meth2prop = new Meth2Prop
11+
val prop2meth = new Prop2Meth
12+
13+
meth2prop.d()
14+
meth2prop.d() // <- should call with parens
15+
prop2meth.d()
16+
prop2meth.d() // <- should call with parens
17+
}

0 commit comments

Comments
 (0)