aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/src/dotty/tools/dotc/ast/TreeInfo.scala15
-rw-r--r--tests/tasty/default-param-interface.scala3
2 files changed, 13 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
index e48b1039b..dd890dc50 100644
--- a/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
+++ b/compiler/src/dotty/tools/dotc/ast/TreeInfo.scala
@@ -31,11 +31,16 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
* Does tree contain an initialization part when seen as a member of a class or trait?
*/
def defKind(tree: Tree): FlagSet = unsplice(tree) match {
- case EmptyTree | _: Import => NoInitsInterface
- case tree: TypeDef => if (tree.isClassDef) NoInits else NoInitsInterface
- case tree: DefDef => if (tree.unforcedRhs == EmptyTree) NoInitsInterface else NoInits
- case tree: ValDef => if (tree.unforcedRhs == EmptyTree) NoInitsInterface else EmptyFlags
- case _ => EmptyFlags
+ case EmptyTree | _: Import =>
+ NoInitsInterface
+ case tree: TypeDef =>
+ if (tree.isClassDef) NoInits else NoInitsInterface
+ case tree: DefDef =>
+ if (tree.unforcedRhs == EmptyTree && tree.vparamss.forall(_.forall(_.unforcedRhs == EmptyTree))) NoInitsInterface else NoInits
+ case tree: ValDef =>
+ if (tree.unforcedRhs == EmptyTree) NoInitsInterface else EmptyFlags
+ case _ =>
+ EmptyFlags
}
def isOpAssign(tree: Tree) = unsplice(tree) match {
diff --git a/tests/tasty/default-param-interface.scala b/tests/tasty/default-param-interface.scala
new file mode 100644
index 000000000..919f4b627
--- /dev/null
+++ b/tests/tasty/default-param-interface.scala
@@ -0,0 +1,3 @@
+trait Foo {
+ def newName(prefix: String = "foo"): String
+}