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 qualified "this" in auxiliary constructor #4842

Closed
scabug opened this issue Jul 27, 2011 · 3 comments
Closed

Compiler crashes with qualified "this" in auxiliary constructor #4842

scabug opened this issue Jul 27, 2011 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jul 27, 2011

The following will crash the compiler:

class Foo (x: AnyRef) {
  def this() = {
    this(new Object { println(Foo.this) } )
  }
}

Presumably it's invalid to reference "this" before calling the primary constructor, but the compiler should give an error rather than crashing.

I get a stack trace that begins with

error: java.lang.Error: no-symbol does not have owner
	at scala.reflect.internal.SymbolTable.abort(SymbolTable.scala:32)
	at scala.reflect.internal.Symbols$NoSymbol$.owner(Symbols.scala:2286)
	at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.outerSelect(ExplicitOuter.scala:214)
	at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.outerValue(ExplicitOuter.scala:200)
	at scala.tools.nsc.transform.ExplicitOuter$ExplicitOuterTransformer.transform(ExplicitOuter.scala:478)
	at scala.reflect.internal.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:1462)
	at scala.reflect.internal.Trees$Transformer$$anonfun$transformTrees$1.apply(Trees.scala:1462)
...
@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 27, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4842?orig=1
Reporter: Kipton Barros (kbarros)
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 11, 2012

@adriaanm said:
Jason, would you care to tackle another of those wannabe NPE's?

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 21, 2012

@scabug scabug closed this Jun 21, 2012
@scabug scabug added the quickfix label Apr 7, 2017
@scabug scabug added this to the 2.10.0-M4 milestone Apr 7, 2017
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
2 participants
You can’t perform that action at this time.