Skip to content

Loading…

Delegate to Java's implementation of signum for Long and Int. #23

Merged
merged 1 commit into from

2 participants

@ijuma

The Java implementation is faster as it doesn't have branches.

java.lang.Math includes implementations of signum for Double and Float,
but I didn't change the ones in scala.math because there is a difference
on how negative zero is handled.

@ijuma ijuma Delegate to Java's implementation of signum for Long and Int.
The Java implementation is faster as it doesn't have branches.

java.lang.Math includes implementations of signum for Double and Float,
but I didn't change the ones in scala.math because there is a difference
on how negative zero is handled.
771f5ca
@paulp paulp merged commit 771f5ca into scala:master
@ijuma

Thanks!

@paulp paulp added a commit that referenced this pull request
@paulp paulp SI-6546 InnerClasses attribute refers to absent class
At issue is that the optimizer would eliminate closure classes
completely, then neglect to eliminate those classes from the
container's InnerClasses attribute. This breaks tooling which
expects those entries to correspond to real classes.

The code changes are by mgarcia - I only added the test case,
which verifies that after being compiled under -optimise, there
are no inner classes. Before/after:

  7,8d6
  <   InnerClasses:
  <        public final #22; //class A_1$$anonfun$f$1
  37,45c35,40
  <   #21 = Utf8               A_1$$anonfun$f$1
  <   #22 = Class              #21            //  A_1$$anonfun$f$1
  <   #23 = Utf8               Code
  ---
  >   #21 = Utf8               Code
2c6e57f
@paulp paulp added a commit that referenced this pull request
@paulp paulp SI-6546 InnerClasses attribute refers to absent class
At issue is that the optimizer would eliminate closure classes
completely, then neglect to eliminate those classes from the
container's InnerClasses attribute. This breaks tooling which
expects those entries to correspond to real classes.

The code change is essentially mgarcia's - I minimized it and
put the caches in perRunCaches, and added the test case which
verifies that after being compiled under -optimise, there are
no inner classes. Before/after:

  7,8d6
  <   InnerClasses:
  <        public final #22; //class A_1$$anonfun$f$1
  37,45c35,40
  <   #21 = Utf8               A_1$$anonfun$f$1
  <   #22 = Class              #21            //  A_1$$anonfun$f$1
  <   #23 = Utf8               Code
  ---
  >   #21 = Utf8               Code
075f6f2
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  a) adapt the arguments to `Object`
  b) wrap the repeated parameters in an array
  c) adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

# starting 1 test in run
.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

# starting 1 test in run
.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

# starting 1 test in run
.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Thu Nov 20 23:26:16 2014 +1000
#
# On branch ticket/7965
# Your branch is up-to-date with 'retronym/ticket/7965'.
#
# Changes to be committed:
#	modified:   src/compiler/scala/tools/nsc/typechecker/Typers.scala
#	modified:   src/reflect/scala/reflect/internal/Definitions.scala
#	modified:   src/reflect/scala/reflect/internal/StdNames.scala
#	new file:   test/files/run/t7965.scala
#
# Untracked files:
#	pack/
#
c6910a8
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  a. adapt the arguments to `Object`
  b. wrap the repeated parameters in an array
  c. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```
28e725e
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Thu Nov 20 23:26:16 2014 +1000
#
# On branch ticket/7965
# Your branch is up-to-date with 'retronym/ticket/7965'.
#
# Changes to be committed:
#	modified:   src/compiler/scala/tools/nsc/typechecker/Typers.scala
#	modified:   src/reflect/scala/reflect/internal/Definitions.scala
#	modified:   src/reflect/scala/reflect/internal/StdNames.scala
#	new file:   test/files/run/t7965.scala
#
# Untracked files:
#	pack/
#
5f3f857
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Thu Nov 20 23:26:16 2014 +1000
#
# On branch ticket/7965
# Your branch is up-to-date with 'retronym/ticket/7965'.
#
# Changes to be committed:
#	modified:   src/compiler/scala/tools/nsc/typechecker/Typers.scala
#	modified:   src/reflect/scala/reflect/internal/Definitions.scala
#	modified:   src/reflect/scala/reflect/internal/StdNames.scala
#	new file:   test/files/run/t7965.scala
#
# Untracked files:
#	pack/
#
e599c80
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Thu Nov 20 23:26:16 2014 +1000
#
# On branch ticket/7965
# Your branch is up-to-date with 'retronym/ticket/7965'.
#
# Changes to be committed:
#	modified:   src/compiler/scala/tools/nsc/typechecker/Typers.scala
#	modified:   src/reflect/scala/reflect/internal/Definitions.scala
#	modified:   src/reflect/scala/reflect/internal/StdNames.scala
#	new file:   test/files/run/t7965.scala
#
# Untracked files:
#	pack/
#
902db4e
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Thu Nov 20 23:26:16 2014 +1000
#
# On branch ticket/7965
# Your branch is up-to-date with 'retronym/ticket/7965'.
#
# Changes to be committed:
#	modified:   src/compiler/scala/tools/nsc/typechecker/Typers.scala
#	modified:   src/reflect/scala/reflect/internal/Definitions.scala
#	modified:   src/reflect/scala/reflect/internal/StdNames.scala
#	new file:   test/files/run/t7965.scala
#
# Untracked files:
#	pack/
#
9cf83ed
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```
612db05
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object` if the enclosing expression
     is a cast or if the application appears in the statement position
     of a block.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult = lookupBar.invokeExact(O, 42).asInstanceOf[Int]
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```
cbd5bb3
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
These methods are "signature polymorphic", which means that compiler
should not:
  1. adapt the arguments to `Object`
  2. wrap the repeated parameters in an array
  3. adapt the result type to `Object`, but instead treat it as it
     it already conforms to the expected type.

Dispiritingly, my initial attempt to implement this touched the type
checker, uncurry, erasure, and the backend.

However, I realized we could centralize handling of this in the typer
if at each application we substituted the signature polymorphic
symbol with a clone that carried its implied signature, which is
derived from the types of the arguments (typechecked without an
expected type) and position within and enclosing cast or block.

The test case requires Java 7+ to compile so is currently embedded
in a conditionally compiled block of code in a run test.

We ought to create a partest category for modern JVMs so we can
write such tests in a more natural style.

Here's how this looks in bytecode. Note the `bipush` / `istore`
before/after the invocation of `invokeExact`, and the descriptor
`(LO$;I)I`.

```
% cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala
import java.lang.invoke._

object O {
  def bar(x: Int): Int = -x
}

object Test {
  def main(args: Array[String]): Unit = {
    def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = {
      val lookup = java.lang.invoke.MethodHandles.lookup
      val mt = MethodType.methodType(ret, params)
      lookup.findVirtual(O.getClass, name, mt)
    }
    def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int])

    val barResult: Int = lookupBar.invokeExact(O, 42)
    ()
  }
}

scala> :javap Test$#main
  public void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=2
         0: aload_0
         1: invokespecial #18                 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle;
         4: getstatic     #23                 // Field O$.MODULE$:LO$;
         7: bipush        42
         9: invokevirtual #29                 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I
        12: istore_2
        13: return
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      14     0  this   LTest$;
            0      14     1  args   [Ljava/lang/String;
           13       0     2 barResult   I
      LineNumberTable:
        line 16: 0
}
```

I've run this test across our active JVMs:

```
% for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:02)
Test Run PASSED
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:07)
Test Run PASSED
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Selected 1 tests drawn from specified tests

.

1/1 passed (elapsed time: 00:00:05)
Test Run PASSED
```
c1d092a
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym Make FunctionN into be a functional interface
And do the same for the specialized variants.

Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.

Here's how the interfaces look now:

```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
  public abstract R apply(T1);

  public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #18                 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #24                 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public abstract java.lang.String toString();

  public int apply$mcII$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  #110                // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
       5: ireturn

  public long apply$mcJI$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  #115                // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
       5: lreturn
    ...
}

% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
  public java.lang.Object apply(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #16                 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
       5: invokeinterface #19,  2           // InterfaceMethod apply:(I)I
      10: invokestatic  #23                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
      13: areturn

  public abstract int apply$mcII$sp(int);

  public int apply(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface #30,  2           // InterfaceMethod apply$mcII$sp:(I)I
       7: ireturn
}
```
29c7c33
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym Make FunctionN into be a functional interface
And do the same for the specialized variants.

Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.

Here's how the interfaces look now:

```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
  public abstract R apply(T1);

  public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #18                 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #24                 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public abstract java.lang.String toString();

  public int apply$mcII$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  #110                // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
       5: ireturn

  public long apply$mcJI$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  #115                // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
       5: lreturn
    ...
}

% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
  public java.lang.Object apply(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #16                 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
       5: invokeinterface #19,  2           // InterfaceMethod apply:(I)I
      10: invokestatic  #23                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
      13: areturn

  public abstract int apply$mcII$sp(int);

  public int apply(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface #30,  2           // InterfaceMethod apply$mcII$sp:(I)I
       7: ireturn
}
```
9844818
@adriaanm adriaanm referenced this pull request in adriaanm/scala
@retronym retronym Make FunctionN into be a functional interface
And do the same for the specialized variants.

Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.

Here's how the interfaces look now:

```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
  public abstract R apply(T1);

  public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #18                 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #24                 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public abstract java.lang.String toString();

  public int apply$mcII$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  #110                // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
       5: ireturn

  public long apply$mcJI$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  #115                // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
       5: lreturn
    ...
}

% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
  public java.lang.Object apply(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #16                 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
       5: invokeinterface #19,  2           // InterfaceMethod apply:(I)I
      10: invokestatic  #23                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
      13: areturn

  public abstract int apply$mcII$sp(int);

  public int apply(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface #30,  2           // InterfaceMethod apply$mcII$sp:(I)I
       7: ireturn
}
```
a5e9c86
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

poking around ASF v memberInfo

using lazy type completer to only do ASF when synth symbol should be there

it seems symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
d2b292f
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
must replace old trait accessor symbols by mixed in symbols
in the infos of the mixed in symbols

```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
7eddfcb
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
must replace old trait accessor symbols by mixed in symbols
in the infos of the mixed in symbols

```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
a060fc1
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
must replace old trait accessor symbols by mixed in symbols
in the infos of the mixed in symbols

```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
878832c
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
must replace old trait accessor symbols by mixed in symbols
in the infos of the mixed in symbols

```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
3774802
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
must replace old trait accessor symbols by mixed in symbols
in the infos of the mixed in symbols

```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
06e6e61
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm incoherent cyclic references between synthesized members
must replace old trait accessor symbols by mixed in symbols
in the infos of the mixed in symbols

```
trait T { val a: String ; val b: a.type }
class C extends T {
  // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
}
```

symbols occurring in types of synthesized members
do not get rebound to other synthesized symbols

package <empty>#4 {
  abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
    <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
    <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
    N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
    <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
    N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
  };
  abstract class M#7353 extends scala#22.AnyRef#2378 {
    <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
      M#7353.super.<init>#2719();
      ()
    };
    <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
    <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
  };
  class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
    <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
    <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
    <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
    <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
    <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
    <method> def <init>#14997(): <empty>#3.this.C#7354 = {
      C#7354.super.<init>#13465();
      ()
    }
  }
}

[running phase pickler on dependent_rebind.scala]
[running phase refchecks on dependent_rebind.scala]
test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
 value n #15017 has incompatible type;
 found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
 required: => N#7352.this.self#7442.type
class C extends M with N
      ^
728e71e
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm WIP: Tests for new trait encoding,
and past commit messages:

commit abae762 (adriaanm/traits-late-fields)
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 hours ago

    bootstrapped compiler needs new partest

commit 81d7c25
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   5 hours ago

    update test to reflect useless constant fields are now dropped

commit 5f8fe87
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    Reduce flagbit usage, remove some stale comments

commit 9368256
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    annotations cleanup/fix for slitting between fields and getter annotation targets

commit 4336eb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    fix printerstest

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

commit 822913e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   9 days ago

    refactor accessor/field derivation

    in preparation of moving to compute-method style
    which in turn hopefully will be more manageable for specialization

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 675f937
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    docs

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit 874f48b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    one fewer warning: can't currently distinguish getter and setter in unused defs in traits

commit 7d21968
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems again...

commit 20165ea
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    test/files/neg/t5455.scala: trait lazy val needs field

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit 2b916f4
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems in check file for neg/t6829.scala

commit 3ac6aad
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    wip: neg/t6276.scala

    vals no longer have rhs after fields,
    so must check the assign node it was lifted out to

commit 892e13c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    detect trait vals

    see neg/delayed-init-ref.scala and neg/t562.scala

commit 536b978
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    error on concrete val in universal trait

    see neg/anytrait.scala

commit d7c1de8
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor field memoization logic -- wip

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

commit 8405e72
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    benign checkfile updates

commit 3dbcd57
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    Revert "broken tests -- for check file diffing ease"

    This reverts commit 631b636,
    at least the part that masked actual breakage

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit 08cbc35
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    fix nondeterminism in printerstest???

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

    Selected 34 tests drawn from specified tests

    !! 1 - pos/t6780.scala                           [compilation failed]

    ok  1 - neg/anytrait.scala
    ok  2 - neg/t1960.scala
    ok  3 - neg/t562.scala
    ok  4 - neg/t2796.scala
    ok  5 - neg/t5455.scala
    ok  6 - neg/delayed-init-ref.scala
    ok  7 - neg/t6446-show-phases.scala
    ok  8 - neg/t6446-missing
    ok  9 - neg/t6276.scala
    ok 10 - neg/t6829.scala
    ok 11 - neg/t6446-additional
    ok 12 - neg/t7494-no-options

    !!  1 - run/bugs.scala                            [output differs]
    !!  2 - run/inner-obj-auto.scala                  [non-zero exit code]
    ok  3 - run/delambdafy_t6555.scala
    ok  4 - run/delambdafy_t6028.scala
    ok  5 - run/preinits.scala
    ok  6 - run/lazy-locals.scala
    ok  7 - run/analyzerPlugins.scala
    ok  8 - run/t0936.scala
    ok  9 - run/programmatic-main.scala
    !! 10 - run/showraw_mods.scala                    [output differs]
    ok 11 - run/t4426.scala
    ok 12 - run/t5938.scala
    ok 13 - run/t6733.scala
    !! 14 - run/t7406.scala                           [non-zero exit code]
    ok 15 - run/t6555.scala
    ok 16 - run/t6028.scala
    ok 17 - run/t8002.scala
    ok 18 - run/t7533.scala
    ok 19 - run/t7569.scala

    ok 1 - jvm/t7006
    !! 2 - jvm/innerClassAttribute                   [non-zero exit code]

    test/partest --update-check \
      /Users/adriaan/git/scala/test/files/pos/t6780.scala \
      /Users/adriaan/git/scala/test/files/run/bugs.scala \
      /Users/adriaan/git/scala/test/files/run/inner-obj-auto.scala \
      /Users/adriaan/git/scala/test/files/run/showraw_mods.scala \
      /Users/adriaan/git/scala/test/files/run/t7406.scala \
      /Users/adriaan/git/scala/test/files/jvm/innerClassAttribute

commit c4694d9
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor

commit e676a2a
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanups

commit a3bc708
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    centralize fields flag juggling

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 255cc06
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check files sensitive to <subsynth> modifier being printed

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 33ac5e0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    flag simplification, but double def errors in in strap.comp

    Compiling 327 files to /Users/adriaan/git/scala/build/strap/classes/compiler
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Constructors.scala:170: warning: postfix operator toMap should be enabled
    by making the implicit value scala.language.postfixOps visible.
    This can be achieved by adding the import clause 'import scala.language.postfixOps'
    or by setting the compiler option -language:postfixOps.
    See the Scala docs for value scala.language.postfixOps for a discussion
    why the feature should be explicitly enabled.
            lazy val bodyOfOuterAccessor = defs collect { case dd: DefDef if omittableOuterAcc(dd.symbol) => dd.symbol -> dd.rhs } toMap
                                                                                                                                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Fields.scala:193: warning: postfix operator nonEmpty should be enabled
    by making the implicit value scala.language.postfixOps visible.
            if (newSetters nonEmpty) {
                           ^
    /Users/adriaan/git/scala/src/compiler/scala/reflect/macros/contexts/Context.scala:6: error: double definition:
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6 and
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6
    have same type
    abstract class Context extends scala.reflect.macros.blackbox.Context
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Global.scala:1155: error: double definition:
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155 and
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155
    have same type
      class Run extends RunContextApi with RunReporting with RunParsing {
            ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Properties.scala:10: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10
    have same type
    object Properties extends scala.util.PropertiesTrait {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala:224: error: double definition:
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224 and
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224
    have same type
      abstract class OuterPathTransformer(unit: CompilationUnit) extends TypingTransformer(unit) with UnderConstructionTransformer {
                     ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/UnCurry.scala:48: error: double definition:
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48 and
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48
    have same type
    abstract class UnCurry extends InfoTransform
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala:279: error: double definition:
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279 and
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279
    have same type
        object precheck extends TreeStackTraverser {
               ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/util/ShowPickled.scala:18: error: double definition:
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18 and
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18
    have same type
    object ShowPickled extends Names {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/ReflectGlobal.scala:13: error: double definition:
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13 and
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13
    have same type
    class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader)
          ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/WrappedProperties.scala:42: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42
    have same type
      object AccessControl extends WrappedProperties {
             ^
    two warnings found
    9 errors found

commit ae34ac7
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update skolem ids in check file

commit 8672bb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanup, no intended functional change

commit 319d3d2
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    clarify: all trait vals receive accessors

    those that wouldn't are synthesized later anyway -- right?

commit ab16f32
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    backwards compat: leave final?

    maybe we can save a few flag bits by using DEFERRED | FINAL
    instead of SYNTHESIZE_IMPL_IN_SUBCLASS, as a deferred final
    member must necessarily receive an implementation automatically
    to meet the constraints implied by this keyword combo

commit ccb8363
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    non-unit-typed lazy vals in traits still get field -- see neg/t5455.scala

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 631b636
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    broken tests -- for check file diffing ease

commit 9ff7869
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    benign, though rough check file updates

commit 90af847
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    unexplained updates to check files in printers test

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

commit ec2283e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    pos/t9111-inliner-workaround

commit 115e880
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    mark synthesized protected member as notPROTECTED,

    TODO: this doesn't work because protected[this] is supposed to be a
    variance checking escape hatch, and making these notPROTECTED here will trigger errors in refchecks

    so that it stays in overriding relation with the trait member in later phases

    make notPROTECTED a bit later?

    protected local variance bla

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

commit ed7625f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    finality for trait setters, annotations

    traitsetter annot for all concrete trait-owned setters

    stumble towards juggling annotations correctly

commit 492aa60
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant fold in forwarder for backwards compat

commit b8a7aa0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant-typed final val in trait should yield impl method

commit 1655d1b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    bean{setter,getter} delegates to setter/getter

commit 968fc30
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 months ago

    Fields phase

    Constructors: simplify transform loop

    Also encapsulate mixin ctor creation in `newMixinConstructor`

    Constructors: emit mixin-super constructor calls

    This was previously done by AddInterfaces, whose days are numbered.

    wip: trait fields 1

    wip: drop stuff from constructors

    lazyGetterBody

    wippythewipwip

    constructors transforminfo

    wip for unit-typed getters, delay trait setters until constructors, mix in accessors and fields there as well

    bare bones info transform is "working"

    ```
    trait OneConcreteVal[T] {
      val x = 1 // : T = ???
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    /*
    old decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit
    }
    new decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit;
      def $init$(): Unit
    }
    old decls for trait trait OneConcreteVal: Scope{
      val x(): Int
    }
    new decls for trait trait OneConcreteVal: Scope{
      val x(): Int;
      def $init$(): Unit;
      private[this] def x_=(x$1: Int): Unit
    }
    old decls for class C: Scope{
      def <init>(): C
    }
    mixing in List(method y, method y_=, value x, method x_=) from List(trait OneOtherConcreteVal, trait OneConcreteVal)
    new decls for class C: Scope{
      def <init>(): C;
      def y(): Object;
      private[this] var y: Object;
      def y_=(x$1: Object): Unit;
      val x(): Int;
      private[this] val x: Int;
      private[this] def x_=(x$1: Int): Unit
    }
    */

    getting there: need to avoid MIXEDIN/lateDEFERRED so as not to confuse mixins?

    temporarily using ARTIFACT instead of MIXEDIN to not confuse mixin

    kinda working...

    impl classes get accessors until mixin,
    so that constructors acts on them there,
    and produced the init method in the required spot (the impl class)

    the info-transformed of constructors:
      - traits receive trait-setters for vals
      - classes receive fields & accessors for mixed in traits

    Constructors tree transformer
      - makes trees for decls added during above info transform
        (TODO: decide on the right flag to communicate this)
      - adds mixin super calls to the primary constructor

    Later, mixins will drop all accessors in the impl class,
    retaining only the init method.
    Selects of setters/getters (in that init method)
    are rewritten to refer to the getters/setters in the interface (TODO)

    TODO (among many other things)
      - no constructor in trait
      - trait setter for val isn't found when rewriting accessors in impl classes
      - annotations
      - privacy

    ```
    trait OneConcreteVal[T] {
      var x = 1 // : T = ???
      def foo = x
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    ```
    [[syntax trees at end of              constructors]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def <init>(): C = {
          C.super.<init>();
          C.this./*OneConcreteVal$class*/$init$();
          C.this./*OneOtherConcreteVal$class*/$init$();
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends Object with OneConcreteVal {
        def /*OneConcreteVal$class*/$init$(): Unit = {
          OneConcreteVal$class.this.x_=(1);
          ()
        };
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int = OneConcreteVal$class.this.x()
      };
      abstract trait OneOtherConcreteVal$class extends Object with OneOtherConcreteVal {
        def /*OneOtherConcreteVal$class*/$init$(): Unit = {
          OneOtherConcreteVal$class.this.y_=(scala.this.Predef.???());
          ()
        };
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      }
    }
    ```

    ```
    [[syntax trees at end of                     mixin]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def foo(): Int = OneConcreteVal$class.foo(C.this);
        def <init>(): C = {
          C.super.<init>();
          OneConcreteVal$class./*OneConcreteVal$class*/$init$(C.this);
          OneOtherConcreteVal$class./*OneOtherConcreteVal$class*/$init$(C.this);
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends  {
        def /*OneConcreteVal$class*/$init$($this: OneConcreteVal): Unit = {
          $this.x_=(1);
          ()
        };
        def foo($this: OneConcreteVal): Int = $this.x()
      };
      abstract trait OneOtherConcreteVal$class extends  {
        def /*OneOtherConcreteVal$class*/$init$($this: OneOtherConcreteVal): Unit = {
          $this.y_=(scala.this.Predef.???());
          ()
        }
      }
    }
    ```

    emit trait setters, target interface for setter

    don't emit trait constructors yet, don't mess with mixin class ctors

    hack to explore where to keep annotations on trait fields

    we don't have a field -- only a getter -- so,
    where will we keep non-getter but-field annotations?

    restore mixins

    reduce OOification re: annotation derivation

      - replace virtual dispatch on sealed traits by matches
      - rename `keepClean` to `defaultRetention`
      - allow multiple categories in annotationFilter (for trait fields)

    mixin only deals with lazy accessors/vals

    do not used referenced to correlate getter/setter

    it messes with paramaccessor's usage, and we don't really need it

    annotations

    typo

    poking around overriding and unit-typed vars

    detect unit correctly

    setter should be considered deferred, just like getter and val

    fixup constructor triaging

    introduce constructor's very own flag

    stop using referenced entirely

    refactor

    add Fields phase

    meh

    mehmeh

    meeeeeh

    Fields phase is kind of working. Yay.

    emit synthetic setter for trait val

    make sure to clone info's, so we don't share symbols for method args
    this manifests itself as an exception in lambdalift, finding proxies

    ```
    trait OneAbstractVar[T] {
      val x: Int = 123
    }

    class ConcVar extends OneAbstractVar[Int]
    ```

    compiles to the following (as desired!):

    ```
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/ConcVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import OneAbstractVar;
    import OneAbstractVar$class;
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u00112A!\u0001\u0002\u0001\u000b\t91i\u001c8d-\u0006\u0014(\"A\u0002\u0002\u000fq*W\u000e\u001d;z}\r\u00011c\u0001\u0001\u0007\u0019A\u0011qAC\u0007\u0002\u0011)\t\u0011\"A\u0003tG\u0006d\u0017-\u0003\u0002\f\u0011\t1\u0011I\\=SK\u001a\u00042!\u0004\b\u0011\u001b\u0005\u0011\u0011BA\b\u0003\u00059ye.Z!cgR\u0014\u0018m\u0019;WCJ\u0004\"aB\t\n\u0005IA!aA%oi\")A\u0003\u0001C\u0001+\u00051A(\u001b8jiz\"\u0012A\u0006\t\u0003\u001b\u0001A\u0011\u0002\u0007\u0001A\u0002\u000b\u0007I\u0011A\r\u0002\u0003a,\u0012\u0001\u0005\u0005\n7\u0001\u0001\r\u0011!Q\u0001\nA\t!\u0001\u001f\u0011\t\u0013u\u0001\u0001\u0019aa\u0001J\u0003q\u0012!H(oK\u0006\u00137\u000f\u001e:bGR4\u0016M\u001d\u0013`g\u0016$H/\u001a:`Ia|F%Z9\u0015\u0005}\u0011\u0003CA\u0004!\u0013\t\t\u0003B\u0001\u0003V]&$\bbB\u0012\u001d\u0003\u0003\u0005\r\u0001E\u0001\u0004q\u0012\n\u0004")
    public class ConcVar
    implements OneAbstractVar<Object> {
        private final int x;

        public ConcVar() {
            OneAbstractVar$class.$init$(this);
        }

        @Override
        public int x() {
            return this.x;
        }

        @Override
        public void OneAbstractVar$_setter_$x_$eq(int x$1) {
            this.x = x$1;
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar\$class.class
    /*
     * Decompiled with CFR 0_102.
     */
    import OneAbstractVar;

    public abstract class OneAbstractVar$class {
        public static void $init$(OneAbstractVar $this) {
            $this.OneAbstractVar$_setter_$x_$eq(123);
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u001d2q!\u0001\u0002\u0011\u0002\u0007\u0005QA\u0001\bP]\u0016\f%m\u001d;sC\u000e$h+\u0019:\u000b\u0003\r\tq\u0001P3naRLhh\u0001\u0001\u0016\u0005\u0019q2C\u0001\u0001\b!\tA1\"D\u0001\n\u0015\u0005Q\u0011!B:dC2\f\u0017B\u0001\u0007\n\u0005\u0019\te.\u001f*fM\")a\u0002\u0001C\u0001\u001f\u00051A%\u001b8ji\u0012\"\u0012\u0001\u0005\t\u0003\u0011EI!AE\u0005\u0003\tUs\u0017\u000e\u001e\u0005\b)\u0001\u0011\rQ\"\u0001\u0016\u0003\u0005AX#\u0001\f\u0011\u0005!9\u0012B\u0001\r\n\u0005\rIe\u000e\u001e\u0005\n5\u0001\u0001\r11A'\u0002m\tQd\u00148f\u0003\n\u001cHO]1diZ\u000b'\u000fJ0tKR$XM]0%q~#S-\u001d\u000b\u0003!qAq!H\r\u0002\u0002\u0003\u0007a#A\u0002yIE\"Qa\b\u0001C\u0002\u0001\u0012\u0011\u0001V\t\u0003C\u0011\u0002\"\u0001\u0003\u0012\n\u0005\rJ!a\u0002(pi\"Lgn\u001a\t\u0003\u0011\u0015J!AJ\u0005\u0003\u0007\u0005s\u0017\u0010")
    public interface OneAbstractVar<T> {
        public void OneAbstractVar$_setter_$x_$eq(int var1);

        public int x();
    }
    ```

    cleanup

    TODO: overriding accessors

    don't mix in accessors if conflicting member exists

    getting closer to bootstrap

    exclude lazy vals, don't makeNotPrivate

    lazy accessors and presupers require old treatment

    constructors should leave strict valdefs alone

    restore constructors to minimal diff compared to #4723

    revert more gratuitous stuff

    revert more in mixins

    trying to get to bootstrap.. currently failing in scala.util.Properties

    reduction of bootstrap failures

    on a bed of TODOs, with a hint of minimalism

    use primary constructor as owner for stats in template?

    fix pattern match in infotransform, remove mutation

    deferred setter does need impl in subclass

    remove SYNTHESIZE_IMPL_IN_SUBCLASS

    Use NEEDS_TREES for all comms between InfoTransform and tree transform

    We can now compile the library again, though the bytecode diff
    is not empty yet :-)

    TODO:
      - Weirdly, scala signatures are not emitted?
      - Fields are no longer emitted for constants
        (an improvement, but should not do this until next milestone)
      - the volatile annotation is not preserved
      - App, Enumeration compiled differently
      - Owner chain changes due to lifting of rhs affects:
        --> anonymous function in Iterator, PartialFunction, scala/collection/immutable/HashMap
      - traitsetter name mangling differences
      - abortflag accessors duplicated in scala/collection/generic/VolatileAbort.class
      - ...

    yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

    distinguish accessors that should be mixed into subclass,
    and those that simply need to be implemented in tree transform,
    after info transform added the decl

    emit const vals for now to minimize bytecode diff

    TODO: still some bytecode diffs with constants remain (Enumeration)

    correct owner for stats in template

    closing in on boostrap

    strap.done:
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] Compiling 584 files to /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] /Users/adriaan/git/scala/src/library/scala/collection/convert/WrapAsScala.scala:173: warning: abstract type A in type pattern scala.collection.convert.Wrappers.ConcurrentMapWrapper[A,B] is unchecked since it is eliminated by erasure
    [strap.library]     case cmw: ConcurrentMapWrapper[A, B]  => cmw.underlying
    [strap.library]               ^
    [strap.library] warning: there were 111 deprecation warnings; re-run with -deprecation for details
    [strap.library] two warnings found
        [javac] Compiling 165 source files to /Users/adriaan/git/scala/build/strap/classes/library
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
    [propertyfile] Creating new property file: /Users/adriaan/git/scala/build/strap/classes/library/library.properties
         [copy] Copying 1 file to /Users/adriaan/git/scala/build/strap/classes/library
    [stopwatch] [strap.library.timer: 1:31.668 sec]
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] Compiling 157 files to /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/JavaUniverse.scala:16: error: overriding variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[JavaUniverse.this.Type];
    [strap.reflect]  value uniques needs `override' modifier
    [strap.reflect] class JavaUniverse extends InternalSymbolTable with JavaUniverseForce with ReflectSetup with RuntimeSymbolTable { self =>
    [strap.reflect]       ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedOps.scala:6: error: overriding variable uniques in trait SynchronizedTypes of type scala.collection.mutable.WeakHashMap[SynchronizedOps.this.Type,java.lang.ref.WeakReference[SynchronizedOps.this.Type]];
    [strap.reflect]  variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[SynchronizedOps.this.Type] needs to be a stable, immutable value
    [strap.reflect] private[reflect] trait SynchronizedOps extends internal.SymbolTable
    [strap.reflect]                        ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala:16: error: overriding variable _recursionTable in trait Symbols of type scala.collection.immutable.Map[SynchronizedSymbols.this.Symbol,Int];
    [strap.reflect]  lazy value _recursionTable has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _recursionTable = mkThreadLocalStorage(immutable.Map.empty[Symbol, Int])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:43: error: overriding variable _skolemizationLevel in trait Types of type Int;
    [strap.reflect]  lazy value _skolemizationLevel has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _skolemizationLevel = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:50: error: overriding variable _intersectionWitness in trait Types of type scala.collection.mutable.WeakHashMap[List[SynchronizedTypes.this.Type],scala.ref.WeakReference[SynchronizedTypes.this.Type]];
    [strap.reflect]  lazy value _intersectionWitness has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _intersectionWitness = mkThreadLocalStorage(perRunCaches.newWeakMap[List[Type], sWeakRef[Type]]())
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:53: error: overriding variable _subsametypeRecursions in trait TypeComparers of type Int;
    [strap.reflect]  lazy value _subsametypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _subsametypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:57: error: overriding variable _pendingSubTypes in trait TypeComparers of type scala.collection.mutable.HashSet[SynchronizedTypes.this.SubTypePair];
    [strap.reflect]  lazy value _pendingSubTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingSubTypes = mkThreadLocalStorage(new mutable.HashSet[SubTypePair])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:60: error: overriding variable _basetypeRecursions in trait Types of type Int;
    [strap.reflect]  lazy value _basetypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _basetypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:64: error: overriding variable _pendingBaseTypes in trait Types of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _pendingBaseTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingBaseTypes = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:67: error: overriding variable _lubResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _lubResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _lubResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:70: error: overriding variable _glbResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _glbResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _glbResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:73: error: overriding variable _indent in trait Types of type String;
    [strap.reflect]  lazy value _indent has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _indent = mkThreadLocalStorage("")
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:77: error: overriding variable _toStringRecursions in trait TypeToStrings of type Int;
    [strap.reflect]  lazy value _toStringRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:81: error: overriding variable _toStringSubjects in trait TypeToStrings of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _toStringSubjects has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringSubjects = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:21: error: overriding variable uniques in trait Types of type scala.reflect.internal.util.WeakHashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  variable uniques has incompatible type
    [strap.reflect]   private val uniques = mutable.WeakHashMap[Type, jWeakRef[Type]]()
    [strap.reflect]               ^
    [strap.reflect] 15 errors found

    make private vals in traits not-private

    TODO: refine

    only look at strict accessors

    don't widen type for getter -- wtf

    current TODO: overriding vals

    mor compact accessor synth

    major cleanup

    compiles library & reflect, but not compiler:

    [strap.compiler] /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/CompileServer.scala:40: error: object creation impossible, since:
    [strap.compiler] it has 151 unimplemented members.

    last error flag pickling issue?

    info mangling, traitsetter

    remove hacks from other files

    trait fields stuff
b9e02bd
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm WIP: Tests for new trait encoding,
and past commit messages:

commit abae762 (adriaanm/traits-late-fields)
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 hours ago

    bootstrapped compiler needs new partest

commit 81d7c25
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   5 hours ago

    update test to reflect useless constant fields are now dropped

commit 5f8fe87
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    Reduce flagbit usage, remove some stale comments

commit 9368256
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    annotations cleanup/fix for slitting between fields and getter annotation targets

commit 4336eb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    fix printerstest

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

commit 822913e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   9 days ago

    refactor accessor/field derivation

    in preparation of moving to compute-method style
    which in turn hopefully will be more manageable for specialization

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 675f937
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    docs

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit 874f48b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    one fewer warning: can't currently distinguish getter and setter in unused defs in traits

commit 7d21968
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems again...

commit 20165ea
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    test/files/neg/t5455.scala: trait lazy val needs field

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit 2b916f4
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems in check file for neg/t6829.scala

commit 3ac6aad
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    wip: neg/t6276.scala

    vals no longer have rhs after fields,
    so must check the assign node it was lifted out to

commit 892e13c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    detect trait vals

    see neg/delayed-init-ref.scala and neg/t562.scala

commit 536b978
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    error on concrete val in universal trait

    see neg/anytrait.scala

commit d7c1de8
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor field memoization logic -- wip

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

commit 8405e72
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    benign checkfile updates

commit 3dbcd57
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    Revert "broken tests -- for check file diffing ease"

    This reverts commit 631b636,
    at least the part that masked actual breakage

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit 08cbc35
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    fix nondeterminism in printerstest???

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

    Selected 34 tests drawn from specified tests

    !! 1 - pos/t6780.scala                           [compilation failed]

    ok  1 - neg/anytrait.scala
    ok  2 - neg/t1960.scala
    ok  3 - neg/t562.scala
    ok  4 - neg/t2796.scala
    ok  5 - neg/t5455.scala
    ok  6 - neg/delayed-init-ref.scala
    ok  7 - neg/t6446-show-phases.scala
    ok  8 - neg/t6446-missing
    ok  9 - neg/t6276.scala
    ok 10 - neg/t6829.scala
    ok 11 - neg/t6446-additional
    ok 12 - neg/t7494-no-options

    !!  1 - run/bugs.scala                            [output differs]
    !!  2 - run/inner-obj-auto.scala                  [non-zero exit code]
    ok  3 - run/delambdafy_t6555.scala
    ok  4 - run/delambdafy_t6028.scala
    ok  5 - run/preinits.scala
    ok  6 - run/lazy-locals.scala
    ok  7 - run/analyzerPlugins.scala
    ok  8 - run/t0936.scala
    ok  9 - run/programmatic-main.scala
    !! 10 - run/showraw_mods.scala                    [output differs]
    ok 11 - run/t4426.scala
    ok 12 - run/t5938.scala
    ok 13 - run/t6733.scala
    !! 14 - run/t7406.scala                           [non-zero exit code]
    ok 15 - run/t6555.scala
    ok 16 - run/t6028.scala
    ok 17 - run/t8002.scala
    ok 18 - run/t7533.scala
    ok 19 - run/t7569.scala

    ok 1 - jvm/t7006
    !! 2 - jvm/innerClassAttribute                   [non-zero exit code]

    test/partest --update-check \
      /Users/adriaan/git/scala/test/files/pos/t6780.scala \
      /Users/adriaan/git/scala/test/files/run/bugs.scala \
      /Users/adriaan/git/scala/test/files/run/inner-obj-auto.scala \
      /Users/adriaan/git/scala/test/files/run/showraw_mods.scala \
      /Users/adriaan/git/scala/test/files/run/t7406.scala \
      /Users/adriaan/git/scala/test/files/jvm/innerClassAttribute

commit c4694d9
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor

commit e676a2a
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanups

commit a3bc708
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    centralize fields flag juggling

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 255cc06
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check files sensitive to <subsynth> modifier being printed

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 33ac5e0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    flag simplification, but double def errors in in strap.comp

    Compiling 327 files to /Users/adriaan/git/scala/build/strap/classes/compiler
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Constructors.scala:170: warning: postfix operator toMap should be enabled
    by making the implicit value scala.language.postfixOps visible.
    This can be achieved by adding the import clause 'import scala.language.postfixOps'
    or by setting the compiler option -language:postfixOps.
    See the Scala docs for value scala.language.postfixOps for a discussion
    why the feature should be explicitly enabled.
            lazy val bodyOfOuterAccessor = defs collect { case dd: DefDef if omittableOuterAcc(dd.symbol) => dd.symbol -> dd.rhs } toMap
                                                                                                                                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Fields.scala:193: warning: postfix operator nonEmpty should be enabled
    by making the implicit value scala.language.postfixOps visible.
            if (newSetters nonEmpty) {
                           ^
    /Users/adriaan/git/scala/src/compiler/scala/reflect/macros/contexts/Context.scala:6: error: double definition:
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6 and
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6
    have same type
    abstract class Context extends scala.reflect.macros.blackbox.Context
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Global.scala:1155: error: double definition:
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155 and
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155
    have same type
      class Run extends RunContextApi with RunReporting with RunParsing {
            ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Properties.scala:10: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10
    have same type
    object Properties extends scala.util.PropertiesTrait {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala:224: error: double definition:
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224 and
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224
    have same type
      abstract class OuterPathTransformer(unit: CompilationUnit) extends TypingTransformer(unit) with UnderConstructionTransformer {
                     ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/UnCurry.scala:48: error: double definition:
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48 and
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48
    have same type
    abstract class UnCurry extends InfoTransform
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala:279: error: double definition:
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279 and
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279
    have same type
        object precheck extends TreeStackTraverser {
               ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/util/ShowPickled.scala:18: error: double definition:
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18 and
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18
    have same type
    object ShowPickled extends Names {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/ReflectGlobal.scala:13: error: double definition:
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13 and
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13
    have same type
    class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader)
          ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/WrappedProperties.scala:42: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42
    have same type
      object AccessControl extends WrappedProperties {
             ^
    two warnings found
    9 errors found

commit ae34ac7
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update skolem ids in check file

commit 8672bb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanup, no intended functional change

commit 319d3d2
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    clarify: all trait vals receive accessors

    those that wouldn't are synthesized later anyway -- right?

commit ab16f32
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    backwards compat: leave final?

    maybe we can save a few flag bits by using DEFERRED | FINAL
    instead of SYNTHESIZE_IMPL_IN_SUBCLASS, as a deferred final
    member must necessarily receive an implementation automatically
    to meet the constraints implied by this keyword combo

commit ccb8363
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    non-unit-typed lazy vals in traits still get field -- see neg/t5455.scala

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 631b636
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    broken tests -- for check file diffing ease

commit 9ff7869
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    benign, though rough check file updates

commit 90af847
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    unexplained updates to check files in printers test

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

commit ec2283e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    pos/t9111-inliner-workaround

commit 115e880
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    mark synthesized protected member as notPROTECTED,

    TODO: this doesn't work because protected[this] is supposed to be a
    variance checking escape hatch, and making these notPROTECTED here will trigger errors in refchecks

    so that it stays in overriding relation with the trait member in later phases

    make notPROTECTED a bit later?

    protected local variance bla

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

commit ed7625f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    finality for trait setters, annotations

    traitsetter annot for all concrete trait-owned setters

    stumble towards juggling annotations correctly

commit 492aa60
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant fold in forwarder for backwards compat

commit b8a7aa0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant-typed final val in trait should yield impl method

commit 1655d1b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    bean{setter,getter} delegates to setter/getter

commit 968fc30
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 months ago

    Fields phase

    Constructors: simplify transform loop

    Also encapsulate mixin ctor creation in `newMixinConstructor`

    Constructors: emit mixin-super constructor calls

    This was previously done by AddInterfaces, whose days are numbered.

    wip: trait fields 1

    wip: drop stuff from constructors

    lazyGetterBody

    wippythewipwip

    constructors transforminfo

    wip for unit-typed getters, delay trait setters until constructors, mix in accessors and fields there as well

    bare bones info transform is "working"

    ```
    trait OneConcreteVal[T] {
      val x = 1 // : T = ???
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    /*
    old decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit
    }
    new decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit;
      def $init$(): Unit
    }
    old decls for trait trait OneConcreteVal: Scope{
      val x(): Int
    }
    new decls for trait trait OneConcreteVal: Scope{
      val x(): Int;
      def $init$(): Unit;
      private[this] def x_=(x$1: Int): Unit
    }
    old decls for class C: Scope{
      def <init>(): C
    }
    mixing in List(method y, method y_=, value x, method x_=) from List(trait OneOtherConcreteVal, trait OneConcreteVal)
    new decls for class C: Scope{
      def <init>(): C;
      def y(): Object;
      private[this] var y: Object;
      def y_=(x$1: Object): Unit;
      val x(): Int;
      private[this] val x: Int;
      private[this] def x_=(x$1: Int): Unit
    }
    */

    getting there: need to avoid MIXEDIN/lateDEFERRED so as not to confuse mixins?

    temporarily using ARTIFACT instead of MIXEDIN to not confuse mixin

    kinda working...

    impl classes get accessors until mixin,
    so that constructors acts on them there,
    and produced the init method in the required spot (the impl class)

    the info-transformed of constructors:
      - traits receive trait-setters for vals
      - classes receive fields & accessors for mixed in traits

    Constructors tree transformer
      - makes trees for decls added during above info transform
        (TODO: decide on the right flag to communicate this)
      - adds mixin super calls to the primary constructor

    Later, mixins will drop all accessors in the impl class,
    retaining only the init method.
    Selects of setters/getters (in that init method)
    are rewritten to refer to the getters/setters in the interface (TODO)

    TODO (among many other things)
      - no constructor in trait
      - trait setter for val isn't found when rewriting accessors in impl classes
      - annotations
      - privacy

    ```
    trait OneConcreteVal[T] {
      var x = 1 // : T = ???
      def foo = x
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    ```
    [[syntax trees at end of              constructors]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def <init>(): C = {
          C.super.<init>();
          C.this./*OneConcreteVal$class*/$init$();
          C.this./*OneOtherConcreteVal$class*/$init$();
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends Object with OneConcreteVal {
        def /*OneConcreteVal$class*/$init$(): Unit = {
          OneConcreteVal$class.this.x_=(1);
          ()
        };
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int = OneConcreteVal$class.this.x()
      };
      abstract trait OneOtherConcreteVal$class extends Object with OneOtherConcreteVal {
        def /*OneOtherConcreteVal$class*/$init$(): Unit = {
          OneOtherConcreteVal$class.this.y_=(scala.this.Predef.???());
          ()
        };
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      }
    }
    ```

    ```
    [[syntax trees at end of                     mixin]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def foo(): Int = OneConcreteVal$class.foo(C.this);
        def <init>(): C = {
          C.super.<init>();
          OneConcreteVal$class./*OneConcreteVal$class*/$init$(C.this);
          OneOtherConcreteVal$class./*OneOtherConcreteVal$class*/$init$(C.this);
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends  {
        def /*OneConcreteVal$class*/$init$($this: OneConcreteVal): Unit = {
          $this.x_=(1);
          ()
        };
        def foo($this: OneConcreteVal): Int = $this.x()
      };
      abstract trait OneOtherConcreteVal$class extends  {
        def /*OneOtherConcreteVal$class*/$init$($this: OneOtherConcreteVal): Unit = {
          $this.y_=(scala.this.Predef.???());
          ()
        }
      }
    }
    ```

    emit trait setters, target interface for setter

    don't emit trait constructors yet, don't mess with mixin class ctors

    hack to explore where to keep annotations on trait fields

    we don't have a field -- only a getter -- so,
    where will we keep non-getter but-field annotations?

    restore mixins

    reduce OOification re: annotation derivation

      - replace virtual dispatch on sealed traits by matches
      - rename `keepClean` to `defaultRetention`
      - allow multiple categories in annotationFilter (for trait fields)

    mixin only deals with lazy accessors/vals

    do not used referenced to correlate getter/setter

    it messes with paramaccessor's usage, and we don't really need it

    annotations

    typo

    poking around overriding and unit-typed vars

    detect unit correctly

    setter should be considered deferred, just like getter and val

    fixup constructor triaging

    introduce constructor's very own flag

    stop using referenced entirely

    refactor

    add Fields phase

    meh

    mehmeh

    meeeeeh

    Fields phase is kind of working. Yay.

    emit synthetic setter for trait val

    make sure to clone info's, so we don't share symbols for method args
    this manifests itself as an exception in lambdalift, finding proxies

    ```
    trait OneAbstractVar[T] {
      val x: Int = 123
    }

    class ConcVar extends OneAbstractVar[Int]
    ```

    compiles to the following (as desired!):

    ```
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/ConcVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import OneAbstractVar;
    import OneAbstractVar$class;
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u00112A!\u0001\u0002\u0001\u000b\t91i\u001c8d-\u0006\u0014(\"A\u0002\u0002\u000fq*W\u000e\u001d;z}\r\u00011c\u0001\u0001\u0007\u0019A\u0011qAC\u0007\u0002\u0011)\t\u0011\"A\u0003tG\u0006d\u0017-\u0003\u0002\f\u0011\t1\u0011I\\=SK\u001a\u00042!\u0004\b\u0011\u001b\u0005\u0011\u0011BA\b\u0003\u00059ye.Z!cgR\u0014\u0018m\u0019;WCJ\u0004\"aB\t\n\u0005IA!aA%oi\")A\u0003\u0001C\u0001+\u00051A(\u001b8jiz\"\u0012A\u0006\t\u0003\u001b\u0001A\u0011\u0002\u0007\u0001A\u0002\u000b\u0007I\u0011A\r\u0002\u0003a,\u0012\u0001\u0005\u0005\n7\u0001\u0001\r\u0011!Q\u0001\nA\t!\u0001\u001f\u0011\t\u0013u\u0001\u0001\u0019aa\u0001J\u0003q\u0012!H(oK\u0006\u00137\u000f\u001e:bGR4\u0016M\u001d\u0013`g\u0016$H/\u001a:`Ia|F%Z9\u0015\u0005}\u0011\u0003CA\u0004!\u0013\t\t\u0003B\u0001\u0003V]&$\bbB\u0012\u001d\u0003\u0003\u0005\r\u0001E\u0001\u0004q\u0012\n\u0004")
    public class ConcVar
    implements OneAbstractVar<Object> {
        private final int x;

        public ConcVar() {
            OneAbstractVar$class.$init$(this);
        }

        @Override
        public int x() {
            return this.x;
        }

        @Override
        public void OneAbstractVar$_setter_$x_$eq(int x$1) {
            this.x = x$1;
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar\$class.class
    /*
     * Decompiled with CFR 0_102.
     */
    import OneAbstractVar;

    public abstract class OneAbstractVar$class {
        public static void $init$(OneAbstractVar $this) {
            $this.OneAbstractVar$_setter_$x_$eq(123);
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u001d2q!\u0001\u0002\u0011\u0002\u0007\u0005QA\u0001\bP]\u0016\f%m\u001d;sC\u000e$h+\u0019:\u000b\u0003\r\tq\u0001P3naRLhh\u0001\u0001\u0016\u0005\u0019q2C\u0001\u0001\b!\tA1\"D\u0001\n\u0015\u0005Q\u0011!B:dC2\f\u0017B\u0001\u0007\n\u0005\u0019\te.\u001f*fM\")a\u0002\u0001C\u0001\u001f\u00051A%\u001b8ji\u0012\"\u0012\u0001\u0005\t\u0003\u0011EI!AE\u0005\u0003\tUs\u0017\u000e\u001e\u0005\b)\u0001\u0011\rQ\"\u0001\u0016\u0003\u0005AX#\u0001\f\u0011\u0005!9\u0012B\u0001\r\n\u0005\rIe\u000e\u001e\u0005\n5\u0001\u0001\r11A'\u0002m\tQd\u00148f\u0003\n\u001cHO]1diZ\u000b'\u000fJ0tKR$XM]0%q~#S-\u001d\u000b\u0003!qAq!H\r\u0002\u0002\u0003\u0007a#A\u0002yIE\"Qa\b\u0001C\u0002\u0001\u0012\u0011\u0001V\t\u0003C\u0011\u0002\"\u0001\u0003\u0012\n\u0005\rJ!a\u0002(pi\"Lgn\u001a\t\u0003\u0011\u0015J!AJ\u0005\u0003\u0007\u0005s\u0017\u0010")
    public interface OneAbstractVar<T> {
        public void OneAbstractVar$_setter_$x_$eq(int var1);

        public int x();
    }
    ```

    cleanup

    TODO: overriding accessors

    don't mix in accessors if conflicting member exists

    getting closer to bootstrap

    exclude lazy vals, don't makeNotPrivate

    lazy accessors and presupers require old treatment

    constructors should leave strict valdefs alone

    restore constructors to minimal diff compared to #4723

    revert more gratuitous stuff

    revert more in mixins

    trying to get to bootstrap.. currently failing in scala.util.Properties

    reduction of bootstrap failures

    on a bed of TODOs, with a hint of minimalism

    use primary constructor as owner for stats in template?

    fix pattern match in infotransform, remove mutation

    deferred setter does need impl in subclass

    remove SYNTHESIZE_IMPL_IN_SUBCLASS

    Use NEEDS_TREES for all comms between InfoTransform and tree transform

    We can now compile the library again, though the bytecode diff
    is not empty yet :-)

    TODO:
      - Weirdly, scala signatures are not emitted?
      - Fields are no longer emitted for constants
        (an improvement, but should not do this until next milestone)
      - the volatile annotation is not preserved
      - App, Enumeration compiled differently
      - Owner chain changes due to lifting of rhs affects:
        --> anonymous function in Iterator, PartialFunction, scala/collection/immutable/HashMap
      - traitsetter name mangling differences
      - abortflag accessors duplicated in scala/collection/generic/VolatileAbort.class
      - ...

    yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

    distinguish accessors that should be mixed into subclass,
    and those that simply need to be implemented in tree transform,
    after info transform added the decl

    emit const vals for now to minimize bytecode diff

    TODO: still some bytecode diffs with constants remain (Enumeration)

    correct owner for stats in template

    closing in on boostrap

    strap.done:
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] Compiling 584 files to /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] /Users/adriaan/git/scala/src/library/scala/collection/convert/WrapAsScala.scala:173: warning: abstract type A in type pattern scala.collection.convert.Wrappers.ConcurrentMapWrapper[A,B] is unchecked since it is eliminated by erasure
    [strap.library]     case cmw: ConcurrentMapWrapper[A, B]  => cmw.underlying
    [strap.library]               ^
    [strap.library] warning: there were 111 deprecation warnings; re-run with -deprecation for details
    [strap.library] two warnings found
        [javac] Compiling 165 source files to /Users/adriaan/git/scala/build/strap/classes/library
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
    [propertyfile] Creating new property file: /Users/adriaan/git/scala/build/strap/classes/library/library.properties
         [copy] Copying 1 file to /Users/adriaan/git/scala/build/strap/classes/library
    [stopwatch] [strap.library.timer: 1:31.668 sec]
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] Compiling 157 files to /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/JavaUniverse.scala:16: error: overriding variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[JavaUniverse.this.Type];
    [strap.reflect]  value uniques needs `override' modifier
    [strap.reflect] class JavaUniverse extends InternalSymbolTable with JavaUniverseForce with ReflectSetup with RuntimeSymbolTable { self =>
    [strap.reflect]       ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedOps.scala:6: error: overriding variable uniques in trait SynchronizedTypes of type scala.collection.mutable.WeakHashMap[SynchronizedOps.this.Type,java.lang.ref.WeakReference[SynchronizedOps.this.Type]];
    [strap.reflect]  variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[SynchronizedOps.this.Type] needs to be a stable, immutable value
    [strap.reflect] private[reflect] trait SynchronizedOps extends internal.SymbolTable
    [strap.reflect]                        ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala:16: error: overriding variable _recursionTable in trait Symbols of type scala.collection.immutable.Map[SynchronizedSymbols.this.Symbol,Int];
    [strap.reflect]  lazy value _recursionTable has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _recursionTable = mkThreadLocalStorage(immutable.Map.empty[Symbol, Int])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:43: error: overriding variable _skolemizationLevel in trait Types of type Int;
    [strap.reflect]  lazy value _skolemizationLevel has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _skolemizationLevel = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:50: error: overriding variable _intersectionWitness in trait Types of type scala.collection.mutable.WeakHashMap[List[SynchronizedTypes.this.Type],scala.ref.WeakReference[SynchronizedTypes.this.Type]];
    [strap.reflect]  lazy value _intersectionWitness has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _intersectionWitness = mkThreadLocalStorage(perRunCaches.newWeakMap[List[Type], sWeakRef[Type]]())
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:53: error: overriding variable _subsametypeRecursions in trait TypeComparers of type Int;
    [strap.reflect]  lazy value _subsametypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _subsametypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:57: error: overriding variable _pendingSubTypes in trait TypeComparers of type scala.collection.mutable.HashSet[SynchronizedTypes.this.SubTypePair];
    [strap.reflect]  lazy value _pendingSubTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingSubTypes = mkThreadLocalStorage(new mutable.HashSet[SubTypePair])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:60: error: overriding variable _basetypeRecursions in trait Types of type Int;
    [strap.reflect]  lazy value _basetypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _basetypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:64: error: overriding variable _pendingBaseTypes in trait Types of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _pendingBaseTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingBaseTypes = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:67: error: overriding variable _lubResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _lubResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _lubResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:70: error: overriding variable _glbResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _glbResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _glbResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:73: error: overriding variable _indent in trait Types of type String;
    [strap.reflect]  lazy value _indent has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _indent = mkThreadLocalStorage("")
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:77: error: overriding variable _toStringRecursions in trait TypeToStrings of type Int;
    [strap.reflect]  lazy value _toStringRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:81: error: overriding variable _toStringSubjects in trait TypeToStrings of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _toStringSubjects has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringSubjects = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:21: error: overriding variable uniques in trait Types of type scala.reflect.internal.util.WeakHashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  variable uniques has incompatible type
    [strap.reflect]   private val uniques = mutable.WeakHashMap[Type, jWeakRef[Type]]()
    [strap.reflect]               ^
    [strap.reflect] 15 errors found

    make private vals in traits not-private

    TODO: refine

    only look at strict accessors

    don't widen type for getter -- wtf

    current TODO: overriding vals

    mor compact accessor synth

    major cleanup

    compiles library & reflect, but not compiler:

    [strap.compiler] /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/CompileServer.scala:40: error: object creation impossible, since:
    [strap.compiler] it has 151 unimplemented members.

    last error flag pickling issue?

    info mangling, traitsetter

    remove hacks from other files

    trait fields stuff
9dc82b6
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm WIP: Tests for new trait encoding,
and past commit messages:

commit abae762 (adriaanm/traits-late-fields)
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 hours ago

    bootstrapped compiler needs new partest

commit 81d7c25
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   5 hours ago

    update test to reflect useless constant fields are now dropped

commit 5f8fe87
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    Reduce flagbit usage, remove some stale comments

commit 9368256
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    annotations cleanup/fix for slitting between fields and getter annotation targets

commit 4336eb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    fix printerstest

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

commit 822913e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   9 days ago

    refactor accessor/field derivation

    in preparation of moving to compute-method style
    which in turn hopefully will be more manageable for specialization

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 675f937
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    docs

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit 874f48b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    one fewer warning: can't currently distinguish getter and setter in unused defs in traits

commit 7d21968
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems again...

commit 20165ea
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    test/files/neg/t5455.scala: trait lazy val needs field

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit 2b916f4
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems in check file for neg/t6829.scala

commit 3ac6aad
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    wip: neg/t6276.scala

    vals no longer have rhs after fields,
    so must check the assign node it was lifted out to

commit 892e13c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    detect trait vals

    see neg/delayed-init-ref.scala and neg/t562.scala

commit 536b978
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    error on concrete val in universal trait

    see neg/anytrait.scala

commit d7c1de8
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor field memoization logic -- wip

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

commit 8405e72
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    benign checkfile updates

commit 3dbcd57
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    Revert "broken tests -- for check file diffing ease"

    This reverts commit 631b636,
    at least the part that masked actual breakage

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit 08cbc35
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    fix nondeterminism in printerstest???

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

    Selected 34 tests drawn from specified tests

    !! 1 - pos/t6780.scala                           [compilation failed]

    ok  1 - neg/anytrait.scala
    ok  2 - neg/t1960.scala
    ok  3 - neg/t562.scala
    ok  4 - neg/t2796.scala
    ok  5 - neg/t5455.scala
    ok  6 - neg/delayed-init-ref.scala
    ok  7 - neg/t6446-show-phases.scala
    ok  8 - neg/t6446-missing
    ok  9 - neg/t6276.scala
    ok 10 - neg/t6829.scala
    ok 11 - neg/t6446-additional
    ok 12 - neg/t7494-no-options

    !!  1 - run/bugs.scala                            [output differs]
    !!  2 - run/inner-obj-auto.scala                  [non-zero exit code]
    ok  3 - run/delambdafy_t6555.scala
    ok  4 - run/delambdafy_t6028.scala
    ok  5 - run/preinits.scala
    ok  6 - run/lazy-locals.scala
    ok  7 - run/analyzerPlugins.scala
    ok  8 - run/t0936.scala
    ok  9 - run/programmatic-main.scala
    !! 10 - run/showraw_mods.scala                    [output differs]
    ok 11 - run/t4426.scala
    ok 12 - run/t5938.scala
    ok 13 - run/t6733.scala
    !! 14 - run/t7406.scala                           [non-zero exit code]
    ok 15 - run/t6555.scala
    ok 16 - run/t6028.scala
    ok 17 - run/t8002.scala
    ok 18 - run/t7533.scala
    ok 19 - run/t7569.scala

    ok 1 - jvm/t7006
    !! 2 - jvm/innerClassAttribute                   [non-zero exit code]

    test/partest --update-check \
      /Users/adriaan/git/scala/test/files/pos/t6780.scala \
      /Users/adriaan/git/scala/test/files/run/bugs.scala \
      /Users/adriaan/git/scala/test/files/run/inner-obj-auto.scala \
      /Users/adriaan/git/scala/test/files/run/showraw_mods.scala \
      /Users/adriaan/git/scala/test/files/run/t7406.scala \
      /Users/adriaan/git/scala/test/files/jvm/innerClassAttribute

commit c4694d9
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor

commit e676a2a
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanups

commit a3bc708
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    centralize fields flag juggling

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 255cc06
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check files sensitive to <subsynth> modifier being printed

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 33ac5e0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    flag simplification, but double def errors in in strap.comp

    Compiling 327 files to /Users/adriaan/git/scala/build/strap/classes/compiler
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Constructors.scala:170: warning: postfix operator toMap should be enabled
    by making the implicit value scala.language.postfixOps visible.
    This can be achieved by adding the import clause 'import scala.language.postfixOps'
    or by setting the compiler option -language:postfixOps.
    See the Scala docs for value scala.language.postfixOps for a discussion
    why the feature should be explicitly enabled.
            lazy val bodyOfOuterAccessor = defs collect { case dd: DefDef if omittableOuterAcc(dd.symbol) => dd.symbol -> dd.rhs } toMap
                                                                                                                                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Fields.scala:193: warning: postfix operator nonEmpty should be enabled
    by making the implicit value scala.language.postfixOps visible.
            if (newSetters nonEmpty) {
                           ^
    /Users/adriaan/git/scala/src/compiler/scala/reflect/macros/contexts/Context.scala:6: error: double definition:
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6 and
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6
    have same type
    abstract class Context extends scala.reflect.macros.blackbox.Context
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Global.scala:1155: error: double definition:
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155 and
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155
    have same type
      class Run extends RunContextApi with RunReporting with RunParsing {
            ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Properties.scala:10: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10
    have same type
    object Properties extends scala.util.PropertiesTrait {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala:224: error: double definition:
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224 and
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224
    have same type
      abstract class OuterPathTransformer(unit: CompilationUnit) extends TypingTransformer(unit) with UnderConstructionTransformer {
                     ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/UnCurry.scala:48: error: double definition:
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48 and
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48
    have same type
    abstract class UnCurry extends InfoTransform
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala:279: error: double definition:
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279 and
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279
    have same type
        object precheck extends TreeStackTraverser {
               ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/util/ShowPickled.scala:18: error: double definition:
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18 and
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18
    have same type
    object ShowPickled extends Names {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/ReflectGlobal.scala:13: error: double definition:
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13 and
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13
    have same type
    class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader)
          ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/WrappedProperties.scala:42: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42
    have same type
      object AccessControl extends WrappedProperties {
             ^
    two warnings found
    9 errors found

commit ae34ac7
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update skolem ids in check file

commit 8672bb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanup, no intended functional change

commit 319d3d2
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    clarify: all trait vals receive accessors

    those that wouldn't are synthesized later anyway -- right?

commit ab16f32
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    backwards compat: leave final?

    maybe we can save a few flag bits by using DEFERRED | FINAL
    instead of SYNTHESIZE_IMPL_IN_SUBCLASS, as a deferred final
    member must necessarily receive an implementation automatically
    to meet the constraints implied by this keyword combo

commit ccb8363
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    non-unit-typed lazy vals in traits still get field -- see neg/t5455.scala

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 631b636
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    broken tests -- for check file diffing ease

commit 9ff7869
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    benign, though rough check file updates

commit 90af847
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    unexplained updates to check files in printers test

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

commit ec2283e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    pos/t9111-inliner-workaround

commit 115e880
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    mark synthesized protected member as notPROTECTED,

    TODO: this doesn't work because protected[this] is supposed to be a
    variance checking escape hatch, and making these notPROTECTED here will trigger errors in refchecks

    so that it stays in overriding relation with the trait member in later phases

    make notPROTECTED a bit later?

    protected local variance bla

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

commit ed7625f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    finality for trait setters, annotations

    traitsetter annot for all concrete trait-owned setters

    stumble towards juggling annotations correctly

commit 492aa60
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant fold in forwarder for backwards compat

commit b8a7aa0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant-typed final val in trait should yield impl method

commit 1655d1b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    bean{setter,getter} delegates to setter/getter

commit 968fc30
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 months ago

    Fields phase

    Constructors: simplify transform loop

    Also encapsulate mixin ctor creation in `newMixinConstructor`

    Constructors: emit mixin-super constructor calls

    This was previously done by AddInterfaces, whose days are numbered.

    wip: trait fields 1

    wip: drop stuff from constructors

    lazyGetterBody

    wippythewipwip

    constructors transforminfo

    wip for unit-typed getters, delay trait setters until constructors, mix in accessors and fields there as well

    bare bones info transform is "working"

    ```
    trait OneConcreteVal[T] {
      val x = 1 // : T = ???
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    /*
    old decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit
    }
    new decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit;
      def $init$(): Unit
    }
    old decls for trait trait OneConcreteVal: Scope{
      val x(): Int
    }
    new decls for trait trait OneConcreteVal: Scope{
      val x(): Int;
      def $init$(): Unit;
      private[this] def x_=(x$1: Int): Unit
    }
    old decls for class C: Scope{
      def <init>(): C
    }
    mixing in List(method y, method y_=, value x, method x_=) from List(trait OneOtherConcreteVal, trait OneConcreteVal)
    new decls for class C: Scope{
      def <init>(): C;
      def y(): Object;
      private[this] var y: Object;
      def y_=(x$1: Object): Unit;
      val x(): Int;
      private[this] val x: Int;
      private[this] def x_=(x$1: Int): Unit
    }
    */

    getting there: need to avoid MIXEDIN/lateDEFERRED so as not to confuse mixins?

    temporarily using ARTIFACT instead of MIXEDIN to not confuse mixin

    kinda working...

    impl classes get accessors until mixin,
    so that constructors acts on them there,
    and produced the init method in the required spot (the impl class)

    the info-transformed of constructors:
      - traits receive trait-setters for vals
      - classes receive fields & accessors for mixed in traits

    Constructors tree transformer
      - makes trees for decls added during above info transform
        (TODO: decide on the right flag to communicate this)
      - adds mixin super calls to the primary constructor

    Later, mixins will drop all accessors in the impl class,
    retaining only the init method.
    Selects of setters/getters (in that init method)
    are rewritten to refer to the getters/setters in the interface (TODO)

    TODO (among many other things)
      - no constructor in trait
      - trait setter for val isn't found when rewriting accessors in impl classes
      - annotations
      - privacy

    ```
    trait OneConcreteVal[T] {
      var x = 1 // : T = ???
      def foo = x
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    ```
    [[syntax trees at end of              constructors]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def <init>(): C = {
          C.super.<init>();
          C.this./*OneConcreteVal$class*/$init$();
          C.this./*OneOtherConcreteVal$class*/$init$();
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends Object with OneConcreteVal {
        def /*OneConcreteVal$class*/$init$(): Unit = {
          OneConcreteVal$class.this.x_=(1);
          ()
        };
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int = OneConcreteVal$class.this.x()
      };
      abstract trait OneOtherConcreteVal$class extends Object with OneOtherConcreteVal {
        def /*OneOtherConcreteVal$class*/$init$(): Unit = {
          OneOtherConcreteVal$class.this.y_=(scala.this.Predef.???());
          ()
        };
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      }
    }
    ```

    ```
    [[syntax trees at end of                     mixin]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def foo(): Int = OneConcreteVal$class.foo(C.this);
        def <init>(): C = {
          C.super.<init>();
          OneConcreteVal$class./*OneConcreteVal$class*/$init$(C.this);
          OneOtherConcreteVal$class./*OneOtherConcreteVal$class*/$init$(C.this);
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends  {
        def /*OneConcreteVal$class*/$init$($this: OneConcreteVal): Unit = {
          $this.x_=(1);
          ()
        };
        def foo($this: OneConcreteVal): Int = $this.x()
      };
      abstract trait OneOtherConcreteVal$class extends  {
        def /*OneOtherConcreteVal$class*/$init$($this: OneOtherConcreteVal): Unit = {
          $this.y_=(scala.this.Predef.???());
          ()
        }
      }
    }
    ```

    emit trait setters, target interface for setter

    don't emit trait constructors yet, don't mess with mixin class ctors

    hack to explore where to keep annotations on trait fields

    we don't have a field -- only a getter -- so,
    where will we keep non-getter but-field annotations?

    restore mixins

    reduce OOification re: annotation derivation

      - replace virtual dispatch on sealed traits by matches
      - rename `keepClean` to `defaultRetention`
      - allow multiple categories in annotationFilter (for trait fields)

    mixin only deals with lazy accessors/vals

    do not used referenced to correlate getter/setter

    it messes with paramaccessor's usage, and we don't really need it

    annotations

    typo

    poking around overriding and unit-typed vars

    detect unit correctly

    setter should be considered deferred, just like getter and val

    fixup constructor triaging

    introduce constructor's very own flag

    stop using referenced entirely

    refactor

    add Fields phase

    meh

    mehmeh

    meeeeeh

    Fields phase is kind of working. Yay.

    emit synthetic setter for trait val

    make sure to clone info's, so we don't share symbols for method args
    this manifests itself as an exception in lambdalift, finding proxies

    ```
    trait OneAbstractVar[T] {
      val x: Int = 123
    }

    class ConcVar extends OneAbstractVar[Int]
    ```

    compiles to the following (as desired!):

    ```
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/ConcVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import OneAbstractVar;
    import OneAbstractVar$class;
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u00112A!\u0001\u0002\u0001\u000b\t91i\u001c8d-\u0006\u0014(\"A\u0002\u0002\u000fq*W\u000e\u001d;z}\r\u00011c\u0001\u0001\u0007\u0019A\u0011qAC\u0007\u0002\u0011)\t\u0011\"A\u0003tG\u0006d\u0017-\u0003\u0002\f\u0011\t1\u0011I\\=SK\u001a\u00042!\u0004\b\u0011\u001b\u0005\u0011\u0011BA\b\u0003\u00059ye.Z!cgR\u0014\u0018m\u0019;WCJ\u0004\"aB\t\n\u0005IA!aA%oi\")A\u0003\u0001C\u0001+\u00051A(\u001b8jiz\"\u0012A\u0006\t\u0003\u001b\u0001A\u0011\u0002\u0007\u0001A\u0002\u000b\u0007I\u0011A\r\u0002\u0003a,\u0012\u0001\u0005\u0005\n7\u0001\u0001\r\u0011!Q\u0001\nA\t!\u0001\u001f\u0011\t\u0013u\u0001\u0001\u0019aa\u0001J\u0003q\u0012!H(oK\u0006\u00137\u000f\u001e:bGR4\u0016M\u001d\u0013`g\u0016$H/\u001a:`Ia|F%Z9\u0015\u0005}\u0011\u0003CA\u0004!\u0013\t\t\u0003B\u0001\u0003V]&$\bbB\u0012\u001d\u0003\u0003\u0005\r\u0001E\u0001\u0004q\u0012\n\u0004")
    public class ConcVar
    implements OneAbstractVar<Object> {
        private final int x;

        public ConcVar() {
            OneAbstractVar$class.$init$(this);
        }

        @Override
        public int x() {
            return this.x;
        }

        @Override
        public void OneAbstractVar$_setter_$x_$eq(int x$1) {
            this.x = x$1;
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar\$class.class
    /*
     * Decompiled with CFR 0_102.
     */
    import OneAbstractVar;

    public abstract class OneAbstractVar$class {
        public static void $init$(OneAbstractVar $this) {
            $this.OneAbstractVar$_setter_$x_$eq(123);
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u001d2q!\u0001\u0002\u0011\u0002\u0007\u0005QA\u0001\bP]\u0016\f%m\u001d;sC\u000e$h+\u0019:\u000b\u0003\r\tq\u0001P3naRLhh\u0001\u0001\u0016\u0005\u0019q2C\u0001\u0001\b!\tA1\"D\u0001\n\u0015\u0005Q\u0011!B:dC2\f\u0017B\u0001\u0007\n\u0005\u0019\te.\u001f*fM\")a\u0002\u0001C\u0001\u001f\u00051A%\u001b8ji\u0012\"\u0012\u0001\u0005\t\u0003\u0011EI!AE\u0005\u0003\tUs\u0017\u000e\u001e\u0005\b)\u0001\u0011\rQ\"\u0001\u0016\u0003\u0005AX#\u0001\f\u0011\u0005!9\u0012B\u0001\r\n\u0005\rIe\u000e\u001e\u0005\n5\u0001\u0001\r11A'\u0002m\tQd\u00148f\u0003\n\u001cHO]1diZ\u000b'\u000fJ0tKR$XM]0%q~#S-\u001d\u000b\u0003!qAq!H\r\u0002\u0002\u0003\u0007a#A\u0002yIE\"Qa\b\u0001C\u0002\u0001\u0012\u0011\u0001V\t\u0003C\u0011\u0002\"\u0001\u0003\u0012\n\u0005\rJ!a\u0002(pi\"Lgn\u001a\t\u0003\u0011\u0015J!AJ\u0005\u0003\u0007\u0005s\u0017\u0010")
    public interface OneAbstractVar<T> {
        public void OneAbstractVar$_setter_$x_$eq(int var1);

        public int x();
    }
    ```

    cleanup

    TODO: overriding accessors

    don't mix in accessors if conflicting member exists

    getting closer to bootstrap

    exclude lazy vals, don't makeNotPrivate

    lazy accessors and presupers require old treatment

    constructors should leave strict valdefs alone

    restore constructors to minimal diff compared to #4723

    revert more gratuitous stuff

    revert more in mixins

    trying to get to bootstrap.. currently failing in scala.util.Properties

    reduction of bootstrap failures

    on a bed of TODOs, with a hint of minimalism

    use primary constructor as owner for stats in template?

    fix pattern match in infotransform, remove mutation

    deferred setter does need impl in subclass

    remove SYNTHESIZE_IMPL_IN_SUBCLASS

    Use NEEDS_TREES for all comms between InfoTransform and tree transform

    We can now compile the library again, though the bytecode diff
    is not empty yet :-)

    TODO:
      - Weirdly, scala signatures are not emitted?
      - Fields are no longer emitted for constants
        (an improvement, but should not do this until next milestone)
      - the volatile annotation is not preserved
      - App, Enumeration compiled differently
      - Owner chain changes due to lifting of rhs affects:
        --> anonymous function in Iterator, PartialFunction, scala/collection/immutable/HashMap
      - traitsetter name mangling differences
      - abortflag accessors duplicated in scala/collection/generic/VolatileAbort.class
      - ...

    yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

    distinguish accessors that should be mixed into subclass,
    and those that simply need to be implemented in tree transform,
    after info transform added the decl

    emit const vals for now to minimize bytecode diff

    TODO: still some bytecode diffs with constants remain (Enumeration)

    correct owner for stats in template

    closing in on boostrap

    strap.done:
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] Compiling 584 files to /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] /Users/adriaan/git/scala/src/library/scala/collection/convert/WrapAsScala.scala:173: warning: abstract type A in type pattern scala.collection.convert.Wrappers.ConcurrentMapWrapper[A,B] is unchecked since it is eliminated by erasure
    [strap.library]     case cmw: ConcurrentMapWrapper[A, B]  => cmw.underlying
    [strap.library]               ^
    [strap.library] warning: there were 111 deprecation warnings; re-run with -deprecation for details
    [strap.library] two warnings found
        [javac] Compiling 165 source files to /Users/adriaan/git/scala/build/strap/classes/library
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
    [propertyfile] Creating new property file: /Users/adriaan/git/scala/build/strap/classes/library/library.properties
         [copy] Copying 1 file to /Users/adriaan/git/scala/build/strap/classes/library
    [stopwatch] [strap.library.timer: 1:31.668 sec]
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] Compiling 157 files to /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/JavaUniverse.scala:16: error: overriding variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[JavaUniverse.this.Type];
    [strap.reflect]  value uniques needs `override' modifier
    [strap.reflect] class JavaUniverse extends InternalSymbolTable with JavaUniverseForce with ReflectSetup with RuntimeSymbolTable { self =>
    [strap.reflect]       ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedOps.scala:6: error: overriding variable uniques in trait SynchronizedTypes of type scala.collection.mutable.WeakHashMap[SynchronizedOps.this.Type,java.lang.ref.WeakReference[SynchronizedOps.this.Type]];
    [strap.reflect]  variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[SynchronizedOps.this.Type] needs to be a stable, immutable value
    [strap.reflect] private[reflect] trait SynchronizedOps extends internal.SymbolTable
    [strap.reflect]                        ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala:16: error: overriding variable _recursionTable in trait Symbols of type scala.collection.immutable.Map[SynchronizedSymbols.this.Symbol,Int];
    [strap.reflect]  lazy value _recursionTable has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _recursionTable = mkThreadLocalStorage(immutable.Map.empty[Symbol, Int])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:43: error: overriding variable _skolemizationLevel in trait Types of type Int;
    [strap.reflect]  lazy value _skolemizationLevel has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _skolemizationLevel = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:50: error: overriding variable _intersectionWitness in trait Types of type scala.collection.mutable.WeakHashMap[List[SynchronizedTypes.this.Type],scala.ref.WeakReference[SynchronizedTypes.this.Type]];
    [strap.reflect]  lazy value _intersectionWitness has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _intersectionWitness = mkThreadLocalStorage(perRunCaches.newWeakMap[List[Type], sWeakRef[Type]]())
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:53: error: overriding variable _subsametypeRecursions in trait TypeComparers of type Int;
    [strap.reflect]  lazy value _subsametypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _subsametypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:57: error: overriding variable _pendingSubTypes in trait TypeComparers of type scala.collection.mutable.HashSet[SynchronizedTypes.this.SubTypePair];
    [strap.reflect]  lazy value _pendingSubTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingSubTypes = mkThreadLocalStorage(new mutable.HashSet[SubTypePair])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:60: error: overriding variable _basetypeRecursions in trait Types of type Int;
    [strap.reflect]  lazy value _basetypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _basetypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:64: error: overriding variable _pendingBaseTypes in trait Types of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _pendingBaseTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingBaseTypes = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:67: error: overriding variable _lubResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _lubResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _lubResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:70: error: overriding variable _glbResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _glbResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _glbResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:73: error: overriding variable _indent in trait Types of type String;
    [strap.reflect]  lazy value _indent has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _indent = mkThreadLocalStorage("")
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:77: error: overriding variable _toStringRecursions in trait TypeToStrings of type Int;
    [strap.reflect]  lazy value _toStringRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:81: error: overriding variable _toStringSubjects in trait TypeToStrings of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _toStringSubjects has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringSubjects = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:21: error: overriding variable uniques in trait Types of type scala.reflect.internal.util.WeakHashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  variable uniques has incompatible type
    [strap.reflect]   private val uniques = mutable.WeakHashMap[Type, jWeakRef[Type]]()
    [strap.reflect]               ^
    [strap.reflect] 15 errors found

    make private vals in traits not-private

    TODO: refine

    only look at strict accessors

    don't widen type for getter -- wtf

    current TODO: overriding vals

    mor compact accessor synth

    major cleanup

    compiles library & reflect, but not compiler:

    [strap.compiler] /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/CompileServer.scala:40: error: object creation impossible, since:
    [strap.compiler] it has 151 unimplemented members.

    last error flag pickling issue?

    info mangling, traitsetter

    remove hacks from other files

    trait fields stuff
12f93f4
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm WIP: Tests for new trait encoding,
and past commit messages:

commit abae762 (adriaanm/traits-late-fields)
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 hours ago

    bootstrapped compiler needs new partest

commit 81d7c25
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   5 hours ago

    update test to reflect useless constant fields are now dropped

commit 5f8fe87
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    Reduce flagbit usage, remove some stale comments

commit 9368256
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   16 hours ago

    annotations cleanup/fix for slitting between fields and getter annotation targets

commit 4336eb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    fix printerstest

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

commit 822913e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   9 days ago

    refactor accessor/field derivation

    in preparation of moving to compute-method style
    which in turn hopefully will be more manageable for specialization

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 675f937
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    docs

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit 874f48b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    one fewer warning: can't currently distinguish getter and setter in unused defs in traits

commit 7d21968
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems again...

commit 20165ea
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    test/files/neg/t5455.scala: trait lazy val needs field

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit 2b916f4
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    update skolems in check file for neg/t6829.scala

commit 3ac6aad
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    wip: neg/t6276.scala

    vals no longer have rhs after fields,
    so must check the assign node it was lifted out to

commit 892e13c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    detect trait vals

    see neg/delayed-init-ref.scala and neg/t562.scala

commit 536b978
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    error on concrete val in universal trait

    see neg/anytrait.scala

commit d7c1de8
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor field memoization logic -- wip

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

commit 8405e72
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    benign checkfile updates

commit 3dbcd57
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    Revert "broken tests -- for check file diffing ease"

    This reverts commit 631b636,
    at least the part that masked actual breakage

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit 08cbc35
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    fix nondeterminism in printerstest???

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

    Selected 34 tests drawn from specified tests

    !! 1 - pos/t6780.scala                           [compilation failed]

    ok  1 - neg/anytrait.scala
    ok  2 - neg/t1960.scala
    ok  3 - neg/t562.scala
    ok  4 - neg/t2796.scala
    ok  5 - neg/t5455.scala
    ok  6 - neg/delayed-init-ref.scala
    ok  7 - neg/t6446-show-phases.scala
    ok  8 - neg/t6446-missing
    ok  9 - neg/t6276.scala
    ok 10 - neg/t6829.scala
    ok 11 - neg/t6446-additional
    ok 12 - neg/t7494-no-options

    !!  1 - run/bugs.scala                            [output differs]
    !!  2 - run/inner-obj-auto.scala                  [non-zero exit code]
    ok  3 - run/delambdafy_t6555.scala
    ok  4 - run/delambdafy_t6028.scala
    ok  5 - run/preinits.scala
    ok  6 - run/lazy-locals.scala
    ok  7 - run/analyzerPlugins.scala
    ok  8 - run/t0936.scala
    ok  9 - run/programmatic-main.scala
    !! 10 - run/showraw_mods.scala                    [output differs]
    ok 11 - run/t4426.scala
    ok 12 - run/t5938.scala
    ok 13 - run/t6733.scala
    !! 14 - run/t7406.scala                           [non-zero exit code]
    ok 15 - run/t6555.scala
    ok 16 - run/t6028.scala
    ok 17 - run/t8002.scala
    ok 18 - run/t7533.scala
    ok 19 - run/t7569.scala

    ok 1 - jvm/t7006
    !! 2 - jvm/innerClassAttribute                   [non-zero exit code]

    test/partest --update-check \
      /Users/adriaan/git/scala/test/files/pos/t6780.scala \
      /Users/adriaan/git/scala/test/files/run/bugs.scala \
      /Users/adriaan/git/scala/test/files/run/inner-obj-auto.scala \
      /Users/adriaan/git/scala/test/files/run/showraw_mods.scala \
      /Users/adriaan/git/scala/test/files/run/t7406.scala \
      /Users/adriaan/git/scala/test/files/jvm/innerClassAttribute

commit c4694d9
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    refactor

commit e676a2a
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanups

commit a3bc708
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    centralize fields flag juggling

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 255cc06
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check files sensitive to <subsynth> modifier being printed

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 33ac5e0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    flag simplification, but double def errors in in strap.comp

    Compiling 327 files to /Users/adriaan/git/scala/build/strap/classes/compiler
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Constructors.scala:170: warning: postfix operator toMap should be enabled
    by making the implicit value scala.language.postfixOps visible.
    This can be achieved by adding the import clause 'import scala.language.postfixOps'
    or by setting the compiler option -language:postfixOps.
    See the Scala docs for value scala.language.postfixOps for a discussion
    why the feature should be explicitly enabled.
            lazy val bodyOfOuterAccessor = defs collect { case dd: DefDef if omittableOuterAcc(dd.symbol) => dd.symbol -> dd.rhs } toMap
                                                                                                                                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/Fields.scala:193: warning: postfix operator nonEmpty should be enabled
    by making the implicit value scala.language.postfixOps visible.
            if (newSetters nonEmpty) {
                           ^
    /Users/adriaan/git/scala/src/compiler/scala/reflect/macros/contexts/Context.scala:6: error: double definition:
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6 and
    def scala$reflect$macros$Aliases$_setter_$TypeTag_=(x$1: Context.this.universe.TypeTag.type): Unit at line 6
    have same type
    abstract class Context extends scala.reflect.macros.blackbox.Context
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Global.scala:1155: error: double definition:
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155 and
    def scala$reflect$internal$Reporting$RunReporting$_setter_$reporting_=(x$1: Global.this.PerRunReporting): Unit at line 1155
    have same type
      class Run extends RunContextApi with RunReporting with RunParsing {
            ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/Properties.scala:10: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 10
    have same type
    object Properties extends scala.util.PropertiesTrait {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala:224: error: double definition:
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224 and
    def selfOrSuperCalls_=(x$1: scala.collection.mutable.Stack[ExplicitOuter.this.global.Symbol]): Unit at line 224
    have same type
      abstract class OuterPathTransformer(unit: CompilationUnit) extends TypingTransformer(unit) with UnderConstructionTransformer {
                     ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/transform/UnCurry.scala:48: error: double definition:
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48 and
    def uncurryType_=(x$1: UnCurry.this.global.TypeMap): Unit at line 48
    have same type
    abstract class UnCurry extends InfoTransform
                   ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/typechecker/TreeCheckers.scala:279: error: double definition:
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279 and
    def scala$reflect$internal$Trees$TreeStackTraverser$_setter_$path_=(x$1: scala.collection.mutable.Stack[TreeCheckers.this.global.Tree]): Unit at line 279
    have same type
        object precheck extends TreeStackTraverser {
               ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/util/ShowPickled.scala:18: error: double definition:
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18 and
    def scala$reflect$internal$Names$_setter_$TypeNameTag_=(x$1: scala.reflect.ClassTag[scala.tools.nsc.util.ShowPickled.TypeName]): Unit at line 18
    have same type
    object ShowPickled extends Names {
           ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/ReflectGlobal.scala:13: error: double definition:
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13 and
    def scala$reflect$api$JavaUniverse$_setter_$RuntimeClassTag_=(x$1: scala.reflect.ClassTag[ReflectGlobal.this.RuntimeClass]): Unit at line 13
    have same type
    class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader)
          ^
    /Users/adriaan/git/scala/src/compiler/scala/tools/reflect/WrappedProperties.scala:42: error: double definition:
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42 and
    def scala$util$PropertiesTrait$_setter_$copyrightString_=(x$1: String): Unit at line 42
    have same type
      object AccessControl extends WrappedProperties {
             ^
    two warnings found
    9 errors found

commit ae34ac7
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update skolem ids in check file

commit 8672bb1
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    cleanup, no intended functional change

commit 319d3d2
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    clarify: all trait vals receive accessors

    those that wouldn't are synthesized later anyway -- right?

commit ab16f32
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    backwards compat: leave final?

    maybe we can save a few flag bits by using DEFERRED | FINAL
    instead of SYNTHESIZE_IMPL_IN_SUBCLASS, as a deferred final
    member must necessarily receive an implementation automatically
    to meet the constraints implied by this keyword combo

commit ccb8363
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    non-unit-typed lazy vals in traits still get field -- see neg/t5455.scala

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 631b636
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    broken tests -- for check file diffing ease

commit 9ff7869
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    benign, though rough check file updates

commit 90af847
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    unexplained updates to check files in printers test

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

commit ec2283e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    pos/t9111-inliner-workaround

commit 115e880
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    mark synthesized protected member as notPROTECTED,

    TODO: this doesn't work because protected[this] is supposed to be a
    variance checking escape hatch, and making these notPROTECTED here will trigger errors in refchecks

    so that it stays in overriding relation with the trait member in later phases

    make notPROTECTED a bit later?

    protected local variance bla

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

commit ed7625f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    finality for trait setters, annotations

    traitsetter annot for all concrete trait-owned setters

    stumble towards juggling annotations correctly

commit 492aa60
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant fold in forwarder for backwards compat

commit b8a7aa0
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    constant-typed final val in trait should yield impl method

commit 1655d1b
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    bean{setter,getter} delegates to setter/getter

commit 968fc30
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   2 months ago

    Fields phase

    Constructors: simplify transform loop

    Also encapsulate mixin ctor creation in `newMixinConstructor`

    Constructors: emit mixin-super constructor calls

    This was previously done by AddInterfaces, whose days are numbered.

    wip: trait fields 1

    wip: drop stuff from constructors

    lazyGetterBody

    wippythewipwip

    constructors transforminfo

    wip for unit-typed getters, delay trait setters until constructors, mix in accessors and fields there as well

    bare bones info transform is "working"

    ```
    trait OneConcreteVal[T] {
      val x = 1 // : T = ???
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    /*
    old decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit
    }
    new decls for trait trait OneOtherConcreteVal: Scope{
      def y(): Object;
      def y_=(x$1: Object): Unit;
      def $init$(): Unit
    }
    old decls for trait trait OneConcreteVal: Scope{
      val x(): Int
    }
    new decls for trait trait OneConcreteVal: Scope{
      val x(): Int;
      def $init$(): Unit;
      private[this] def x_=(x$1: Int): Unit
    }
    old decls for class C: Scope{
      def <init>(): C
    }
    mixing in List(method y, method y_=, value x, method x_=) from List(trait OneOtherConcreteVal, trait OneConcreteVal)
    new decls for class C: Scope{
      def <init>(): C;
      def y(): Object;
      private[this] var y: Object;
      def y_=(x$1: Object): Unit;
      val x(): Int;
      private[this] val x: Int;
      private[this] def x_=(x$1: Int): Unit
    }
    */

    getting there: need to avoid MIXEDIN/lateDEFERRED so as not to confuse mixins?

    temporarily using ARTIFACT instead of MIXEDIN to not confuse mixin

    kinda working...

    impl classes get accessors until mixin,
    so that constructors acts on them there,
    and produced the init method in the required spot (the impl class)

    the info-transformed of constructors:
      - traits receive trait-setters for vals
      - classes receive fields & accessors for mixed in traits

    Constructors tree transformer
      - makes trees for decls added during above info transform
        (TODO: decide on the right flag to communicate this)
      - adds mixin super calls to the primary constructor

    Later, mixins will drop all accessors in the impl class,
    retaining only the init method.
    Selects of setters/getters (in that init method)
    are rewritten to refer to the getters/setters in the interface (TODO)

    TODO (among many other things)
      - no constructor in trait
      - trait setter for val isn't found when rewriting accessors in impl classes
      - annotations
      - privacy

    ```
    trait OneConcreteVal[T] {
      var x = 1 // : T = ???
      def foo = x
    }

    trait OneOtherConcreteVal[T] {
      var y: T = ???
    }

    class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
    ```

    ```
    [[syntax trees at end of              constructors]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <empty>; // <-- TODO
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def <init>(): C = {
          C.super.<init>();
          C.this./*OneConcreteVal$class*/$init$();
          C.this./*OneOtherConcreteVal$class*/$init$();
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends Object with OneConcreteVal {
        def /*OneConcreteVal$class*/$init$(): Unit = {
          OneConcreteVal$class.this.x_=(1);
          ()
        };
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int = OneConcreteVal$class.this.x()
      };
      abstract trait OneOtherConcreteVal$class extends Object with OneOtherConcreteVal {
        def /*OneOtherConcreteVal$class*/$init$(): Unit = {
          OneOtherConcreteVal$class.this.y_=(scala.this.Predef.???());
          ()
        };
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      }
    }
    ```

    ```
    [[syntax trees at end of                     mixin]] // fields.scala
    package <empty> {
      abstract trait OneConcreteVal extends Object {
        <accessor> def x(): Int;
        @scala.runtime.TraitSetter <accessor> def x_=(x$1: Int): Unit;
        def foo(): Int
      };
      abstract trait OneOtherConcreteVal extends Object {
        <accessor> def y(): Object;
        @scala.runtime.TraitSetter <accessor> def y_=(x$1: Object): Unit
      };
      class C extends Object with OneConcreteVal with OneOtherConcreteVal {
        def foo(): Int = OneConcreteVal$class.foo(C.this);
        def <init>(): C = {
          C.super.<init>();
          OneConcreteVal$class./*OneConcreteVal$class*/$init$(C.this);
          OneOtherConcreteVal$class./*OneOtherConcreteVal$class*/$init$(C.this);
          ()
        };
        <accessor> <artifact> def y(): Object = C.this.y;
        <artifact> private[this] var y: Object = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def y_=(x$1: Object): Unit = C.this.y = x$1;
        <accessor> <artifact> def x(): Int = C.this.x;
        <artifact> private[this] var x: Int = _;
        @scala.runtime.TraitSetter <accessor> <artifact> def x_=(x$1: Int): Unit = C.this.x = x$1
      };
      abstract trait OneConcreteVal$class extends  {
        def /*OneConcreteVal$class*/$init$($this: OneConcreteVal): Unit = {
          $this.x_=(1);
          ()
        };
        def foo($this: OneConcreteVal): Int = $this.x()
      };
      abstract trait OneOtherConcreteVal$class extends  {
        def /*OneOtherConcreteVal$class*/$init$($this: OneOtherConcreteVal): Unit = {
          $this.y_=(scala.this.Predef.???());
          ()
        }
      }
    }
    ```

    emit trait setters, target interface for setter

    don't emit trait constructors yet, don't mess with mixin class ctors

    hack to explore where to keep annotations on trait fields

    we don't have a field -- only a getter -- so,
    where will we keep non-getter but-field annotations?

    restore mixins

    reduce OOification re: annotation derivation

      - replace virtual dispatch on sealed traits by matches
      - rename `keepClean` to `defaultRetention`
      - allow multiple categories in annotationFilter (for trait fields)

    mixin only deals with lazy accessors/vals

    do not used referenced to correlate getter/setter

    it messes with paramaccessor's usage, and we don't really need it

    annotations

    typo

    poking around overriding and unit-typed vars

    detect unit correctly

    setter should be considered deferred, just like getter and val

    fixup constructor triaging

    introduce constructor's very own flag

    stop using referenced entirely

    refactor

    add Fields phase

    meh

    mehmeh

    meeeeeh

    Fields phase is kind of working. Yay.

    emit synthetic setter for trait val

    make sure to clone info's, so we don't share symbols for method args
    this manifests itself as an exception in lambdalift, finding proxies

    ```
    trait OneAbstractVar[T] {
      val x: Int = 123
    }

    class ConcVar extends OneAbstractVar[Int]
    ```

    compiles to the following (as desired!):

    ```
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/ConcVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import OneAbstractVar;
    import OneAbstractVar$class;
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u00112A!\u0001\u0002\u0001\u000b\t91i\u001c8d-\u0006\u0014(\"A\u0002\u0002\u000fq*W\u000e\u001d;z}\r\u00011c\u0001\u0001\u0007\u0019A\u0011qAC\u0007\u0002\u0011)\t\u0011\"A\u0003tG\u0006d\u0017-\u0003\u0002\f\u0011\t1\u0011I\\=SK\u001a\u00042!\u0004\b\u0011\u001b\u0005\u0011\u0011BA\b\u0003\u00059ye.Z!cgR\u0014\u0018m\u0019;WCJ\u0004\"aB\t\n\u0005IA!aA%oi\")A\u0003\u0001C\u0001+\u00051A(\u001b8jiz\"\u0012A\u0006\t\u0003\u001b\u0001A\u0011\u0002\u0007\u0001A\u0002\u000b\u0007I\u0011A\r\u0002\u0003a,\u0012\u0001\u0005\u0005\n7\u0001\u0001\r\u0011!Q\u0001\nA\t!\u0001\u001f\u0011\t\u0013u\u0001\u0001\u0019aa\u0001J\u0003q\u0012!H(oK\u0006\u00137\u000f\u001e:bGR4\u0016M\u001d\u0013`g\u0016$H/\u001a:`Ia|F%Z9\u0015\u0005}\u0011\u0003CA\u0004!\u0013\t\t\u0003B\u0001\u0003V]&$\bbB\u0012\u001d\u0003\u0003\u0005\r\u0001E\u0001\u0004q\u0012\n\u0004")
    public class ConcVar
    implements OneAbstractVar<Object> {
        private final int x;

        public ConcVar() {
            OneAbstractVar$class.$init$(this);
        }

        @Override
        public int x() {
            return this.x;
        }

        @Override
        public void OneAbstractVar$_setter_$x_$eq(int x$1) {
            this.x = x$1;
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar\$class.class
    /*
     * Decompiled with CFR 0_102.
     */
    import OneAbstractVar;

    public abstract class OneAbstractVar$class {
        public static void $init$(OneAbstractVar $this) {
            $this.OneAbstractVar$_setter_$x_$eq(123);
        }
    }
    ➜  scala git:(traits-late-fields) ✗ cfr /tmp/OneAbstractVar.class
    /*
     * Decompiled with CFR 0_102.
     *
     * Could not load the following classes:
     *  scala.reflect.ScalaSignature
     */
    import scala.reflect.ScalaSignature;

    @ScalaSignature(bytes="\u0006\u0001\u001d2q!\u0001\u0002\u0011\u0002\u0007\u0005QA\u0001\bP]\u0016\f%m\u001d;sC\u000e$h+\u0019:\u000b\u0003\r\tq\u0001P3naRLhh\u0001\u0001\u0016\u0005\u0019q2C\u0001\u0001\b!\tA1\"D\u0001\n\u0015\u0005Q\u0011!B:dC2\f\u0017B\u0001\u0007\n\u0005\u0019\te.\u001f*fM\")a\u0002\u0001C\u0001\u001f\u00051A%\u001b8ji\u0012\"\u0012\u0001\u0005\t\u0003\u0011EI!AE\u0005\u0003\tUs\u0017\u000e\u001e\u0005\b)\u0001\u0011\rQ\"\u0001\u0016\u0003\u0005AX#\u0001\f\u0011\u0005!9\u0012B\u0001\r\n\u0005\rIe\u000e\u001e\u0005\n5\u0001\u0001\r11A'\u0002m\tQd\u00148f\u0003\n\u001cHO]1diZ\u000b'\u000fJ0tKR$XM]0%q~#S-\u001d\u000b\u0003!qAq!H\r\u0002\u0002\u0003\u0007a#A\u0002yIE\"Qa\b\u0001C\u0002\u0001\u0012\u0011\u0001V\t\u0003C\u0011\u0002\"\u0001\u0003\u0012\n\u0005\rJ!a\u0002(pi\"Lgn\u001a\t\u0003\u0011\u0015J!AJ\u0005\u0003\u0007\u0005s\u0017\u0010")
    public interface OneAbstractVar<T> {
        public void OneAbstractVar$_setter_$x_$eq(int var1);

        public int x();
    }
    ```

    cleanup

    TODO: overriding accessors

    don't mix in accessors if conflicting member exists

    getting closer to bootstrap

    exclude lazy vals, don't makeNotPrivate

    lazy accessors and presupers require old treatment

    constructors should leave strict valdefs alone

    restore constructors to minimal diff compared to #4723

    revert more gratuitous stuff

    revert more in mixins

    trying to get to bootstrap.. currently failing in scala.util.Properties

    reduction of bootstrap failures

    on a bed of TODOs, with a hint of minimalism

    use primary constructor as owner for stats in template?

    fix pattern match in infotransform, remove mutation

    deferred setter does need impl in subclass

    remove SYNTHESIZE_IMPL_IN_SUBCLASS

    Use NEEDS_TREES for all comms between InfoTransform and tree transform

    We can now compile the library again, though the bytecode diff
    is not empty yet :-)

    TODO:
      - Weirdly, scala signatures are not emitted?
      - Fields are no longer emitted for constants
        (an improvement, but should not do this until next milestone)
      - the volatile annotation is not preserved
      - App, Enumeration compiled differently
      - Owner chain changes due to lifting of rhs affects:
        --> anonymous function in Iterator, PartialFunction, scala/collection/immutable/HashMap
      - traitsetter name mangling differences
      - abortflag accessors duplicated in scala/collection/generic/VolatileAbort.class
      - ...

    yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

    distinguish accessors that should be mixed into subclass,
    and those that simply need to be implemented in tree transform,
    after info transform added the decl

    emit const vals for now to minimize bytecode diff

    TODO: still some bytecode diffs with constants remain (Enumeration)

    correct owner for stats in template

    closing in on boostrap

    strap.done:
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] Compiling 584 files to /Users/adriaan/git/scala/build/strap/classes/library
    [strap.library] /Users/adriaan/git/scala/src/library/scala/collection/convert/WrapAsScala.scala:173: warning: abstract type A in type pattern scala.collection.convert.Wrappers.ConcurrentMapWrapper[A,B] is unchecked since it is eliminated by erasure
    [strap.library]     case cmw: ConcurrentMapWrapper[A, B]  => cmw.underlying
    [strap.library]               ^
    [strap.library] warning: there were 111 deprecation warnings; re-run with -deprecation for details
    [strap.library] two warnings found
        [javac] Compiling 165 source files to /Users/adriaan/git/scala/build/strap/classes/library
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
    [propertyfile] Creating new property file: /Users/adriaan/git/scala/build/strap/classes/library/library.properties
         [copy] Copying 1 file to /Users/adriaan/git/scala/build/strap/classes/library
    [stopwatch] [strap.library.timer: 1:31.668 sec]
        [mkdir] Created dir: /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] Compiling 157 files to /Users/adriaan/git/scala/build/strap/classes/reflect
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/JavaUniverse.scala:16: error: overriding variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[JavaUniverse.this.Type];
    [strap.reflect]  value uniques needs `override' modifier
    [strap.reflect] class JavaUniverse extends InternalSymbolTable with JavaUniverseForce with ReflectSetup with RuntimeSymbolTable { self =>
    [strap.reflect]       ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedOps.scala:6: error: overriding variable uniques in trait SynchronizedTypes of type scala.collection.mutable.WeakHashMap[SynchronizedOps.this.Type,java.lang.ref.WeakReference[SynchronizedOps.this.Type]];
    [strap.reflect]  variable uniques in class SymbolTable of type scala.reflect.internal.util.WeakHashSet[SynchronizedOps.this.Type] needs to be a stable, immutable value
    [strap.reflect] private[reflect] trait SynchronizedOps extends internal.SymbolTable
    [strap.reflect]                        ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala:16: error: overriding variable _recursionTable in trait Symbols of type scala.collection.immutable.Map[SynchronizedSymbols.this.Symbol,Int];
    [strap.reflect]  lazy value _recursionTable has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _recursionTable = mkThreadLocalStorage(immutable.Map.empty[Symbol, Int])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:43: error: overriding variable _skolemizationLevel in trait Types of type Int;
    [strap.reflect]  lazy value _skolemizationLevel has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _skolemizationLevel = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:50: error: overriding variable _intersectionWitness in trait Types of type scala.collection.mutable.WeakHashMap[List[SynchronizedTypes.this.Type],scala.ref.WeakReference[SynchronizedTypes.this.Type]];
    [strap.reflect]  lazy value _intersectionWitness has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _intersectionWitness = mkThreadLocalStorage(perRunCaches.newWeakMap[List[Type], sWeakRef[Type]]())
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:53: error: overriding variable _subsametypeRecursions in trait TypeComparers of type Int;
    [strap.reflect]  lazy value _subsametypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _subsametypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:57: error: overriding variable _pendingSubTypes in trait TypeComparers of type scala.collection.mutable.HashSet[SynchronizedTypes.this.SubTypePair];
    [strap.reflect]  lazy value _pendingSubTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingSubTypes = mkThreadLocalStorage(new mutable.HashSet[SubTypePair])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:60: error: overriding variable _basetypeRecursions in trait Types of type Int;
    [strap.reflect]  lazy value _basetypeRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _basetypeRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:64: error: overriding variable _pendingBaseTypes in trait Types of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _pendingBaseTypes has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _pendingBaseTypes = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:67: error: overriding variable _lubResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _lubResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _lubResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:70: error: overriding variable _glbResults in trait GlbLubs of type scala.collection.mutable.HashMap[(scala.reflect.internal.Depth, List[SynchronizedTypes.this.Type]),SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _glbResults has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _glbResults = mkThreadLocalStorage(new mutable.HashMap[(Depth, List[Type]), Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:73: error: overriding variable _indent in trait Types of type String;
    [strap.reflect]  lazy value _indent has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _indent = mkThreadLocalStorage("")
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:77: error: overriding variable _toStringRecursions in trait TypeToStrings of type Int;
    [strap.reflect]  lazy value _toStringRecursions has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringRecursions = mkThreadLocalStorage(0)
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:81: error: overriding variable _toStringSubjects in trait TypeToStrings of type scala.collection.mutable.HashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  lazy value _toStringSubjects has weaker access privileges; it should not be private
    [strap.reflect]   private lazy val _toStringSubjects = mkThreadLocalStorage(new mutable.HashSet[Type])
    [strap.reflect]                    ^
    [strap.reflect] /Users/adriaan/git/scala/src/reflect/scala/reflect/runtime/SynchronizedTypes.scala:21: error: overriding variable uniques in trait Types of type scala.reflect.internal.util.WeakHashSet[SynchronizedTypes.this.Type];
    [strap.reflect]  variable uniques has incompatible type
    [strap.reflect]   private val uniques = mutable.WeakHashMap[Type, jWeakRef[Type]]()
    [strap.reflect]               ^
    [strap.reflect] 15 errors found

    make private vals in traits not-private

    TODO: refine

    only look at strict accessors

    don't widen type for getter -- wtf

    current TODO: overriding vals

    mor compact accessor synth

    major cleanup

    compiles library & reflect, but not compiler:

    [strap.compiler] /Users/adriaan/git/scala/src/compiler/scala/tools/nsc/CompileServer.scala:40: error: object creation impossible, since:
    [strap.compiler] it has 151 unimplemented members.

    last error flag pickling issue?

    info mangling, traitsetter

    remove hacks from other files

    trait fields stuff
30fcff6
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
fc58763
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
cb71696
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
5bba2ca
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
382089b
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
f04abc4
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
cc14f05
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
4cc975e
@adriaanm adriaanm added a commit to adriaanm/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
3ff2568
@retronym retronym added a commit to retronym/scala that referenced this pull request
@retronym retronym Re-enable trait forwarders
```
cat sandbox/test1.scala && javap -c -classpath . T C
trait T {
  def m = 42
}

class C extends T

object Test {
  def main(args: Array[String]): Unit = {
    val c = new C()
    assert(c.m == 42)
  }
}
Compiled from "test1.scala"
public interface T {
  public int m();
    Code:
       0: bipush        42
       2: ireturn

  public void $init$();
    Code:
       0: return
}
Compiled from "test1.scala"
public class C implements T {
  public int m();
    Code:
       0: aload_0
       1: invokespecial #14                 // Method T.m:()I
       4: ireturn

  public C();
    Code:
       0: aload_0
       1: invokespecial #20                 // Method java/lang/Object."<init>":()V
       4: aload_0
       5: invokespecial #23                 // Method T.$init$:()V
       8: return
}
```

Here's another test that shows private methods working:

```
cat sandbox/test3.scala && qscalac sandbox/test3.scala && javap -private -classpath . -c T C && qscala Test
trait T {
  private def foo = 0
  def bar = foo
}

class C extends T

object Test {
  def main(args: Array[String]): Unit = {
    new C().bar
  }
}
Compiled from "test3.scala"
public interface T {
  private int foo();
    Code:
       0: iconst_0
       1: ireturn

  public int bar();
    Code:
       0: aload_0
       1: invokespecial #15                 // Method foo:()I
       4: ireturn

  public void $init$();
    Code:
       0: return
}
Compiled from "test3.scala"
public class C implements T {
  public int bar();
    Code:
       0: aload_0
       1: invokespecial #14                 // Method T.bar:()I
       4: ireturn

  public C();
    Code:
       0: aload_0
       1: invokespecial #20                 // Method java/lang/Object."<init>":()V
       4: aload_0
       5: invokespecial #23                 // Method T.$init$:()V
       8: return
}
```
35d9123
@retronym retronym added a commit to retronym/scala that referenced this pull request
@adriaanm adriaanm fields phase
the info-transformed of constructors:
  - traits receive trait-setters for vals
  - classes receive fields & accessors for mixed in traits

Constructors tree transformer
  - makes trees for decls added during above info transform
  - adds mixin super calls to the primary constructor

```
trait OneConcreteVal[T] {
var x = 1 // : T = ???
def foo = x
}

trait OneOtherConcreteVal[T] {
var y: T = ???
}

class C extends OneConcreteVal[Int] with OneOtherConcreteVal[String]
```

we don't have a field -- only a getter -- so,
where will we keep non-getter but-field annotations?

mixin only deals with lazy accessors/vals

do not used referenced to correlate getter/setter
it messes with paramaccessor's usage, and we don't really need it

make sure to clone info's, so we don't share symbols for method args
this manifests itself as an exception in lambdalift, finding proxies

Use NEEDS_TREES for all comms between InfoTransform and tree transform

yep, need SYNTHESIZE_IMPL_IN_SUBCLASS

distinguish accessors that should be mixed into subclass,
and those that simply need to be implemented in tree transform,
after info transform added the decl

commit 4b4932e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 days ago

    do assignment to trait fields in AddInterfaces

    regular class vals get assignments during constructors, as before

impl classes get accessors + assignments through trait setters in addinterfaces
so that constructors acts on them there,
and produced the init method in the required spot (the impl class)

bootstrapped compiler needs new partest

commit baf568d
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    produce identical bytecode for constant trait val getters

    I couldn't bring myself to emit the unused fields that we
    used to emit for constant vals, even though the getters
    immediately return the constant, and thus the field goes unused.

    In the next version, there's no need to synthesize impls
    for these in subclasses -- the getter can be implemented
    in the interface.

commit b9052da
Author: Lukas Rytz <lukas.rytz@gmail.com>
Date:   3 weeks ago

    Fix enclosing method attribute for classes nested in trait fields

    Trait fields are now created as MethodSymbol (no longer TermSymbol).
    This symbol shows up in the `originalOwner` chain of a class declared
    within the field initializer. This promoted the field getter to
    being the enclosing method of the nested class, which it is not
    (the EnclosingMethod attribute is a source-level property).

commit cf845ab
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   3 weeks ago

    don't suppress field for unit-typed vals

    it affects the memory model -- even a write of unit to a field is relevant...

commit 337a9dd
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    unit-typed lazy vals should never receive a field

    this need was unmasked by test/files/run/t7843-jsr223-service.scala,
    which no longer printed the output expected from the `0 to 10 foreach`

    Currently failing tests:

     - test/files/pos/t6780.scala
     - test/files/neg/anytrait.scala
     - test/files/neg/delayed-init-ref.scala
     - test/files/neg/t562.scala
     - test/files/neg/t6276.scala
     - test/files/run/delambdafy_uncurry_byname_inline.scala
     - test/files/run/delambdafy_uncurry_byname_method.scala
     - test/files/run/delambdafy_uncurry_inline.scala
     - test/files/run/delambdafy_uncurry_method.scala
     - test/files/run/inner-obj-auto.scala
     - test/files/run/lazy-traits.scala
     - test/files/run/reify_lazyunit.scala
     - test/files/run/showraw_mods.scala
     - test/files/run/t3670.scala
     - test/files/run/t3980.scala
     - test/files/run/t4047.scala
     - test/files/run/t6622.scala
     - test/files/run/t7406.scala
     - test/files/run/t7843-jsr223-service.scala
     - test/files/jvm/innerClassAttribute
     - test/files/specialized/SI-7343.scala
     - test/files/specialized/constant_lambda.scala
     - test/files/specialized/spec-early.scala
     - test/files/specialized/spec-init.scala
     - test/files/specialized/spec-matrix-new.scala
     - test/files/specialized/spec-matrix-old.scala
     - test/files/presentation/scope-completion-3

commit b1b4e5c
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    wip: lambdalift fix

    test/files/trait-defaults/lambdalift.scala works,
    but still some related tests failing

    (note that we can't use a bootstrapped compiler yet
    due to binary incompatibility in partest)

commit eae7dac
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    update check now that trait vals can be concrete, use names not letters

    note the progression in a concrete trait val now being recognized as such
    ```
    -trait T => true
    -method $init$ => false
    -value z1 => true
    -value z2 => true // z2 is actually concrete!
    ```

commit 6555c74
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   4 weeks ago

    bootstraps again by running info transform once per class...

    not sure how this ever worked, as separate compilation would transform a trait's info
    multiple times, resulting in double defs...

commit 273cb20
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    skip presuper vals in new encoding

commit 728e71e
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    incoherent cyclic references between synthesized members

    must replace old trait accessor symbols by mixed in symbols
    in the infos of the mixed in symbols

    ```
    trait T { val a: String ; val b: a.type }
    class C extends T {
      // a, b synthesized, but the a in b's type, a.type, refers to the original symbol, not the clone in C
    }
    ```

    symbols occurring in types of synthesized members
    do not get rebound to other synthesized symbols

    package <empty>#4 {
      abstract <defaultparam/trait> trait N#7352 extends scala#22.AnyRef#2378 {
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$self_$eq#15011(x$1#15012: <empty>#3.this.N#7352): scala#23.this.Unit#2340;
        <method> <deferred> <mutable> <accessor> <triedcooking> <sub_synth> def N$_setter_$n_$eq#15013(x$1#15014: N#7352.this.self#7442.type): scala#23.this.Unit#2340;
        <method> def /*N*/$init$#7441(): scala#23.this.Unit#2340 = {
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> <sub_synth> def self#7442: <empty>#3.this.N#7352;
        N#7352.this.N$_setter_$self_$eq#15011(scala#22.Predef#1729.$qmark$qmark$qmark#6917);
        <method> <deferred> <stable> <accessor> <sub_synth> def n#7443: N#7352.this.self#7442.type;
        N#7352.this.N$_setter_$n_$eq#15013(N#7352.this.self#7442)
      };
      abstract class M#7353 extends scala#22.AnyRef#2378 {
        <method> <triedcooking> def <init>#13465(): <empty>#3.this.M#7353 = {
          M#7353.super.<init>#2719();
          ()
        };
        <method> <deferred> <stable> <accessor> <triedcooking> def self#13466: <empty>#3.this.N#7352;
        <method> <deferred> <stable> <accessor> def n#13467: M#7353.this.self#13466.type
      };
      class C#7354 extends M#7353 with <empty>#3.this.N#7352 {
        <method> <stable> <accessor> <triedcooking> def self#15016: <empty>#3.this.N#7352 = C#7354.this.self #15015;
        <triedcooking> private[this] val self #15015: <empty>#3.this.N#7352 = _;
        <method> <stable> <accessor> def n#15018: C#7354.this.self#7442.type = C#7354.this.n #15017;
        <triedcooking> private[this] val n #15017: C#7354.this.self#7442.type = _;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$self_$eq#15019(x$1#15021: <empty>#3.this.N#7352): scala#23.this.Unit#2340 = C#7354.this.self #15015 = x$1#15021;
        <method> <mutable> <accessor> <triedcooking> def N$_setter_$n_$eq#15022(x$1#15025: C#7354.this.self#7442.type): scala#23.this.Unit#2340 = C#7354.this.n #15017 = x$1#15025;
        <method> def <init>#14997(): <empty>#3.this.C#7354 = {
          C#7354.super.<init>#13465();
          ()
        }
      }
    }

    [running phase pickler on dependent_rebind.scala]
    [running phase refchecks on dependent_rebind.scala]
    test/files/trait-defaults/dependent_rebind.scala:16: error: overriding field n#15049 in trait N#7352 of type C#7354.this.self#15016.type;
     value n #15017 has incompatible type;
     found   : => C#7354.this.self#7442.type (with underlying type => C#7354.this.self#7442.type)
     required: => N#7352.this.self#7442.type
    class C extends M with N
          ^

    pos/t9111-inliner-workaround revealed need for:
-  override def transformInfo(sym: Symbol, tp: Type): Type = synthFieldsAndAccessors(tp)
+  override def transformInfo(sym: Symbol, tp: Type): Type = if (!sym.isJavaDefined) synthFieldsAndAccessors(tp) else tp

commit b56ca2f
Author: Adriaan Moors <adriaan.moors@typesafe.com>
Date:   6 weeks ago

    static forwarders & private[this] val in trait

    object Properties extends PropertiesTrait

    trait PropertiesTrait {
      // the protected member is not emitted as a static member of  -- it works when dropping the access modifier
      // somehow, the module class member is considered deferred in BForwardersGen
      protected val propFilename: String = /
    }

    // [log jvm] No forwarder for 'getter propFilename' from Properties to 'module class Properties': false || m.isDeferred == true || false || false

    // the following method is missing compared to scalac
    // public final class Properties {
    //     public static String propFilename() {
    //         return Properties$.MODULE$.propFilename();
    //     }

    trait Chars {
      private[this] val char2uescapeArray = Array[Char]('\', 'u', 0, 0, 0, 0)
    }

    object Chars extends Chars

    // +++ w/reflect/scala/reflect/internal/Chars$.class
    // -  private final [C scala83014char2uescapeArray

    constant fold in forwarder for backwards compat
    constant-typed final val in trait should yield impl method

    bean{setter,getter} delegates to setter/getter (commit 1655d1b)
bdb47dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 3, 2011
  1. @ijuma

    Delegate to Java's implementation of signum for Long and Int.

    ijuma committed
    The Java implementation is faster as it doesn't have branches.
    
    java.lang.Math includes implementations of signum for Double and Float,
    but I didn't change the ones in scala.math because there is a difference
    on how negative zero is handled.
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 9 deletions.
  1. +3 −9 src/library/scala/math/package.scala
  2. +15 −0 test/files/jvm/signum.scala
View
12 src/library/scala/math/package.scala
@@ -127,15 +127,9 @@ package object math {
else if (x > 0) 1.0f
else x // NaN
- def signum(x: Long): Long =
- if (x == 0l) 0l
- else if (x < 0) -1l
- else 1l
-
- def signum(x: Int): Int =
- if (x == 0) 0
- else if (x < 0) -1
- else 1
+ def signum(x: Long): Long = java.lang.Long.signum(x)
+
+ def signum(x: Int): Int = java.lang.Integer.signum(x)
// -----------------------------------------------------------------------
// root functions
View
15 test/files/jvm/signum.scala
@@ -0,0 +1,15 @@
+object Test {
+ def main(args: Array[String]) {
+ assert(math.signum(Long.MaxValue) == 1L)
+ assert(math.signum(1L) == 1L)
+ assert(math.signum(0L) == 0L)
+ assert(math.signum(-1L) == -1L)
+ assert(math.signum(Long.MinValue) == -1L)
+
+ assert(math.signum(Int.MaxValue) == 1)
+ assert(math.signum(1) == 1)
+ assert(math.signum(0) == 0)
+ assert(math.signum(-1) == -1)
+ assert(math.signum(Int.MinValue) == -1)
+ }
+}
Something went wrong with that request. Please try again.