File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
src/compiler/scala/tools/nsc/transform Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -523,7 +523,10 @@ abstract class Constructors extends Transform with ast.TreeDSL {
523523
524524 /** Return a pair consisting of (all statements up to and including superclass and trait constr calls, rest) */
525525 def splitAtSuper (stats : List [Tree ]) = {
526- def isConstr (tree : Tree ) = (tree.symbol ne null ) && tree.symbol.isConstructor
526+ def isConstr (tree : Tree ): Boolean = tree match {
527+ case Block (_, expr) => isConstr(expr) // SI-6481 account for named argument blocks
528+ case _ => (tree.symbol ne null ) && tree.symbol.isConstructor
529+ }
527530 val (pre, rest0) = stats span (! isConstr(_))
528531 val (supercalls, rest) = rest0 span (isConstr(_))
529532 (pre ::: supercalls, rest)
Original file line number Diff line number Diff line change 1+ delayed init
2+ new foo(1, 2)
3+ delayed init
4+ new foo(b = 2, a = 1)
Original file line number Diff line number Diff line change 1+ abstract class foo (a : Int , b : Int ) extends scala.DelayedInit {
2+ def delayedInit (x : => Unit ) {
3+ println(" delayed init" );
4+ x
5+ }
6+ }
7+
8+ object Test {
9+ def main (args : Array [String ]) {
10+ new foo(1 , 2 ) { println(" new foo(1, 2)" ) }
11+ new foo(b = 2 , a = 1 ) { println(" new foo(b = 2, a = 1)" ) }
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments