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

Malformed code leads to compiler crash #3614

Closed
scabug opened this issue Jun 28, 2010 · 2 comments
Closed

Malformed code leads to compiler crash #3614

scabug opened this issue Jun 28, 2010 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Jun 28, 2010

The following line leads to to a compiler crash:

def v = new ({ def a=0 })

results in:

Welcome to Scala version 2.8.0.r22407-b20100628154216 (Java HotSpot(TM) Server VM, Java 1.5.0_22).
Type in expressions to have them evaluated.
Type :help for more information.

scala> def v = new ({ def a=0 })
<console>:5: error: class type required but AnyRef{def a: <?>} found
       def v = new ({ def a=0 })
                    ^
Exception in thread "main" scala.tools.nsc.symtab.Types$$TypeError: only declarations allowed here
        at scala.tools.nsc.typechecker.Contexts$$Context.error(Contexts.scala:273)
        at scala.tools.nsc.typechecker.Infer$$Inferencer.error(Infer.scala:213)
        at scala.tools.nsc.typechecker.Infer$$Inferencer.errorTree(Infer.scala:217)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2050)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
        at scala.collection.immutable.List.loop$$1(List.scala:115)
        at scala.collection.immutable.List.mapConserve(List.scala:132)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2135)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedRefinement$$1.apply$$mcV$$sp(Typers.scala:2030)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$apply$$1.apply(Analyzer.scala:87)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$apply$$1.apply(Analyzer.scala:87)
        at scala.collection.LinearSeqOptimized$$class.foreach(LinearSeqOptimized.scala:61)
        at scala.collection.immutable.List.foreach(List.scala:45)
        at scala.collection.generic.TraversableForwarder$$class.foreach(TraversableForwarder.scala:44)
        at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:42)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.apply(Analyzer.scala:87)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply$$mcV$$sp(Global.scala:278)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:278)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:278)
        at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
        at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:278)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:80)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:80)
        at scala.collection.Iterator$$class.foreach(Iterator.scala:631)
        at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:304)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.run(Analyzer.scala:80)
        at scala.tools.nsc.Global$$Run.compileSources(Global.scala:735)
@scabug
Copy link
Author

scabug commented Jun 28, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3614?orig=1
Reporter: @cunei

@scabug
Copy link
Author

scabug commented Oct 16, 2010

@odersky said:
(In r23285) Closes #3614. Closes #3856. Refined handling of imports to avoid trees with null types in presentation compiler. Review by moors

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

No branches or pull requests

2 participants