Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crashes with object nested in value class method #6359

Open
scabug opened this issue Sep 11, 2012 · 13 comments
Open

Compiler crashes with object nested in value class method #6359

scabug opened this issue Sep 11, 2012 · 13 comments
Labels

Comments

@scabug
Copy link

@scabug scabug commented Sep 11, 2012

class M(val t: Int) extends AnyVal {
   def lazyString = {
      object X
      () => X
   }
}
error: no-symbol does not have an owner

     while compiling: M.scala
        during phase: global=explicitouter, atPhase=erasure
     library version: version 2.10.0-20120906-172417-b7e08723d1
    compiler version: version 2.10.0-20120906-172417-b7e08723d1
  reconstructed args: -d out

  last tree to typer: This(object X)
              symbol: object X (flags: <module>)
   symbol definition: class X extends Object
                 tpe: M.X.type
       symbol owners: object X -> method lazyString -> class M -> package <empty>
      context owners: object X -> method lazyString -> class M -> package <empty>

== Enclosing template or block ==

DefDef( // object X
  <method> <module> <stable> <triedcooking> <latemethod>
  "X"
  []
  List(Nil)
  <tpt> // tree.tpe=X.type
  Block( // tree.tpe=X.type
    Assign( // tree.tpe=Unit
      "X$module" // var X$module: X.type, tree.tpe=X.type
      Apply( // def <init>(arg$outer: M.this.type): X.type in object X, tree.tpe=X.type
        new X.type."<init>" // def <init>(arg$outer: M.this.type): X.type in object X, tree.tpe=()X.type
        Nil
      )
    )
    "X$module" // var X$module: X.type, tree.tpe=X.type
  )
)

== Expanded type of tree ==

ThisType(object X)

unhandled exception while transforming M.scala
error: 
     while compiling: M.scala
        during phase: explicitouter
     library version: version 2.10.0-20120906-172417-b7e08723d1
    compiler version: version 2.10.0-20120906-172417-b7e08723d1
  reconstructed args: -d out

  last tree to typer: This(object X)
              symbol: object X (flags: <module>)
   symbol definition: class X extends Object
                 tpe: M.X.type
       symbol owners: object X -> method lazyString -> class M -> package <empty>
      context owners: object X -> method lazyString -> class M -> package <empty>

== Enclosing template or block ==

DefDef( // object X
  <method> <module> <stable> <triedcooking> <latemethod>
  "X"
  []
  List(Nil)
  <tpt> // tree.tpe=X.type
  Block( // tree.tpe=X.type
    Assign( // tree.tpe=Unit
      "X$module" // var X$module: X.type, tree.tpe=X.type
      Apply( // def <init>(): X.type in object X, tree.tpe=X.type
        new X.type."<init>" // def <init>(): X.type in object X, tree.tpe=()X.type
        Nil
      )
    )
    "X$module" // var X$module: X.type, tree.tpe=X.type
  )
)

== Expanded type of tree ==

ThisType(object X)

uncaught exception during compilation: scala.reflect.internal.FatalError
error: scala.reflect.internal.FatalError: 
     while compiling: M.scala
        during phase: global=explicitouter, atPhase=erasure
     library version: version 2.10.0-20120906-172417-b7e08723d1
    compiler version: version 2.10.0-20120906-172417-b7e08723d1
  reconstructed args: -d out

  last tree to typer: This(object X)
              symbol: object X (flags: <module>)
   symbol definition: class X extends Object
                 tpe: M.X.type
       symbol owners: object X -> method lazyString -> class M -> package <empty>
      context owners: object X -> method lazyString -> class M -> package <empty>

== Enclosing template or block ==

DefDef( // object X
  <method> <module> <stable> <triedcooking> <latemethod>
  "X"
  []
  List(Nil)
  <tpt> // tree.tpe=X.type
  Block( // tree.tpe=X.type
    Assign( // tree.tpe=Unit
      "X$module" // var X$module: X.type, tree.tpe=X.type
      Apply( // def <init>(arg$outer: M.this.type): X.type in object X, tree.tpe=X.type
        new X.type."<init>" // def <init>(arg$outer: M.this.type): X.type in object X, tree.tpe=()X.type
        Nil
      )
    )
    "X$module" // var X$module: X.type, tree.tpe=X.type
  )
)

== Expanded type of tree ==

ThisType(object X)

no-symbol does not have an owner
   at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:48)
   at scala.tools.nsc.Global.abort(Global.scala:241)
   at scala.reflect.internal.Symbols$NoSymbol.owner(Symbols.scala:3119)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.outerSelect(ExplicitOuter.scala:229)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.outerValue(ExplicitOuter.scala:215)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:497)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:659)
   at scala.collection.immutable.List.loop$1(List.scala:164)
   at scala.collection.immutable.List.mapConserve(List.scala:180)
   at scala.reflect.api.Trees$Transformer.transformTrees(Trees.scala:659)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1160)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:524)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1199)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:560)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:677)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:675)
   at scala.collection.immutable.List.loop$1(List.scala:164)
   at scala.collection.immutable.List.mapConserve(List.scala:180)
   at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:675)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1179)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:560)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1176)
   at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1174)
   at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1173)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:493)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:677)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:675)
   at scala.collection.immutable.List.loop$1(List.scala:164)
   at scala.collection.immutable.List.mapConserve(List.scala:180)
   at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:675)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1179)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:560)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1176)
   at scala.reflect.internal.Trees$$anonfun$itransform$2.apply(Trees.scala:1174)
   at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1173)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:493)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:677)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:675)
   at scala.collection.immutable.List.loop$1(List.scala:164)
   at scala.collection.immutable.List.mapConserve(List.scala:180)
   at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:675)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1217)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:44)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:44)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$1.apply(TypingTransformers.scala:44)
   at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:471)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.api.Trees$Transformer.transformTemplate(Trees.scala:661)
   at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1221)
   at scala.reflect.internal.Trees$$anonfun$itransform$4.apply(Trees.scala:1220)
   at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1219)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:48)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:560)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:677)
   at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:675)
   at scala.collection.immutable.List.loop$1(List.scala:164)
   at scala.collection.immutable.List.mapConserve(List.scala:180)
   at scala.reflect.api.Trees$Transformer.transformStats(Trees.scala:675)
   at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1239)
   at scala.reflect.internal.Trees$$anonfun$itransform$7.apply(Trees.scala:1239)
   at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:19)
   at scala.reflect.internal.Trees$class.itransform(Trees.scala:1238)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:12)
   at scala.reflect.api.Trees$Transformer.transform(Trees.scala:656)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(TypingTransformers.scala:44)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:46)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$transform$2.apply(TypingTransformers.scala:46)
   at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:684)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:34)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28)
   at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
   at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:272)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:560)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:333)
   at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:227)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.scala$tools$nsc$transform$ExplicitOuter$ExplicitOuterTransformer$$super$transformUnit(ExplicitOuter.scala:568)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer$$anonfun$transformUnit$1.apply$mcV$sp(ExplicitOuter.scala:568)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer$$anonfun$transformUnit$1.apply(ExplicitOuter.scala:568)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer$$anonfun$transformUnit$1.apply(ExplicitOuter.scala:568)
   at scala.reflect.internal.SymbolTable.atPhase(SymbolTable.scala:199)
   at scala.reflect.internal.SymbolTable.afterPhase(SymbolTable.scala:208)
   at scala.tools.nsc.Global.afterExplicitOuter(Global.scala:1086)
   at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transformUnit(ExplicitOuter.scala:568)
   at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
   at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:450)
   at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:417)
   at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:417)
   at scala.collection.Iterator$class.foreach(Iterator.scala:726)
   at scala.collection.AbstractIterator.foreach(Iterator.scala:1155)
   at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:417)
   at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1561)
   at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1535)
   at scala.tools.nsc.Global$Run.compileSources(Global.scala:1531)
   at scala.tools.nsc.Global$Run.compile(Global.scala:1641)
   at scala.tools.nsc.Driver.doCompile(Driver.scala:33)
   at scala.tools.nsc.Main$.doCompile(Main.scala:79)
   at scala.tools.nsc.Driver.process(Driver.scala:54)
   at scala.tools.nsc.Driver.main(Driver.scala:67)
   at scala.tools.nsc.Main.main(Main.scala)

error: fatal error: 
     while compiling: M.scala
        during phase: global=explicitouter, atPhase=erasure
     library version: version 2.10.0-20120906-172417-b7e08723d1
    compiler version: version 2.10.0-20120906-172417-b7e08723d1
  reconstructed args: -d out

  last tree to typer: This(object X)
              symbol: object X (flags: <module>)
   symbol definition: class X extends Object
                 tpe: M.X.type
       symbol owners: object X -> method lazyString -> class M -> package <empty>
      context owners: object X -> method lazyString -> class M -> package <empty>

== Enclosing template or block ==

DefDef( // object X
  <method> <module> <stable> <triedcooking> <latemethod>
  "X"
  []
  List(Nil)
  <tpt> // tree.tpe=X.type
  Block( // tree.tpe=X.type
    Assign( // tree.tpe=Unit
      "X$module" // var X$module: X.type, tree.tpe=X.type
      Apply( // def <init>(arg$outer: M.this.type): X.type in object X, tree.tpe=X.type
        new X.type."<init>" // def <init>(arg$outer: M.this.type): X.type in object X, tree.tpe=()X.type
        Nil
      )
    )
    "X$module" // var X$module: X.type, tree.tpe=X.type
  )
)

== Expanded type of tree ==

ThisType(object X)

no-symbol does not have an owner
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 11, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6359?orig=1
Reporter: @harrah
Affected Versions: 2.10.0-M7
See #6358, #5882

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 13, 2012

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 20, 2012

@odersky said:
I am going re-enable nested classes. It turns out the error is only linked to nested objects and my suspicion is it's because of the same problems that caused lazy vals to fail with value classes. So the test should pass. Reassigning to @hubertp. Test case in pending/pos/t6359.scala

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 21, 2012

@hubertp said:
I am not sure if the fix for #6358 will help because the translation for nested objects is slightly different from lazy val accessors. I have already struggled enough with local lazy vals and imagine that nested objects will create more problems as they are more common. Anyway, we will see.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 21, 2012

@retronym said:
-Yshow-syms is pretty revealing.

class M(val t: Int) extends AnyVal {
   def lazyString = {
      object X
      class Y

      () => {X; new Y}
   }
}


[[symbol layout at end of typer]]
F class M#7016 [+final]
*     method lazyString#7392
*         class Y#12575
*             constructor Y#12578
*             value <local Y>#12579
*         object X#12574
*             constructor X#12576
*             value <local X>#12577
*         object X#12573
*         value $anonfun#12580 (<synthetic>)

class M#7016 (final)
      method lazyString#7392
          object X#12574
              constructor X#12576
              value <local X>#12577
  object M#7393 (<synthetic>)
  object M#7394 (<synthetic>)
      constructor M#13922
*     method extension$lazyString#13933 (final)
O         class Y#12575 [Owner was method lazyString#7392, now method extension$lazyString#13933]
              constructor Y#12578
              value <local Y>#12579
O         object X#12573 [Owner was method lazyString#7392, now method extension$lazyString#13933]
O         value $anonfun#12580 [Owner was method lazyString#7392, now method extension$lazyString#13933] (<synthetic>)

Here's the naive fix (same as I tried for the lazy vals).

https://github.com/retronym/scala/compare/ticket/6359-2

But like last time (https://issues.scala-lang.org/browse/SI-6358?focusedCommentId=60029&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-60029), it might only be skin deep.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Sep 22, 2012

@odersky said:
If everything fails we need to disable lazy vals and objects in extension methods. But it would be exceeedingly ugly.

The root cause in both is that the generation of an extension method moves a tree from one context to another. It does this correctly, but if certain things are not in the tree they do not get the changes done and when they resurface in refchecks its too late.

Another, slightly less ugly patch would be to treat lazy val acessors and objects specially in the code that creates extension methods.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 14, 2012

@paulp said:
Since 5d9cde105e8 this fails in an orderly fashion:

test/files/pos/t6359.scala:3: error: implementation restriction: nested object is not allowed in value class
This restriction is planned to be removed in subsequent releases.
      object X
             ^
one error found
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 14, 2012

@gkossakowski said:
Which means we should close this ticket?

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 14, 2012

@paulp said:
Well, there ought to be a ticket to remove the implementation restriction.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Nov 15, 2012

@hubertp said:
I thought Josh was going to create one, at least he said he would.
I would prefer to leave this one open (possibly rename it) as it contains some history related to the bug.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 16, 2013

@retronym said:
@hubert: What's the plan for this one? It is currently marked for 2.10.1, is that realistic? Anything I can do to help?

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jan 17, 2013

@hubertp said:
Last time I looked into this (which was more than a month ago) I got stuck on a weird behaviour of nested classes in a normal, non value class, context once they are generated in namers. I should have a wip branch lying around, I will try to dig it up for you.

Timewise, I have some other obligations until 30th, so definitely nothing will happen from my side until then.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented May 20, 2013

@JamesIry said:
2.10.2 is about to be cut. Kicking down the road and un-assigning to foster work stealing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.