Skip to content

Top level tries kill repl #1367

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

Closed
DarkDimius opened this issue Jul 8, 2016 · 0 comments
Closed

Top level tries kill repl #1367

DarkDimius opened this issue Jul 8, 2016 · 0 comments

Comments

@DarkDimius
Copy link
Contributor

source: http://scalapuzzlers.com/#pzzlr-012

scala> var x = 0
x: Int = 0
scala> lazy val y = 1/x
java.lang.ArithmeticException: / by zero
    at .y(<console>:5)
    at RequestResult$.<init>(<console>:4)
    at RequestResult$.<clinit>(<console>)
    at RequestResult$result(<console>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth...
scala> try {
         println(y)
       } catch {
         case _ : Throwable =>
           x = 1
           println(y)
       }Exception in thread "main" scala.MatchError: ParsedTry(Block(List(),Apply(Ident(println),List(Ident(y)))),Match(EmptyTree,List(CaseDef(Typed(Ident(_),Ident(Throwable)),EmptyTree,Block(List(Assign(Ident(x),Literal(Constant(1)))),Apply(Ident(println),List(Ident(y))))))),EmptyTree) (of class dotty.tools.dotc.ast.untpd$ParsedTry)
    at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1225)
    at dotty.tools.dotc.ast.untpd$UntypedTreeAccumulator.foldOver(untpd.scala:446)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request$StatementHandler$$anon$2.apply(CompilingInterpreter.scala:644)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request$StatementHandler$$anon$2.apply(CompilingInterpreter.scala:640)
    at dotty.tools.dotc.ast.Trees$Instance$TreeAccumulator.foldOver(Trees.scala:1295)
    at dotty.tools.dotc.ast.untpd$UntypedTreeAccumulator.foldOver(untpd.scala:446)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request$StatementHandler.<init>(CompilingInterpreter.scala:647)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request$ValHandler.<init>(CompilingInterpreter.scala:665)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request.dotty$tools$dotc$repl$CompilingInterpreter$Request$$chooseHandler(CompilingInterpreter.scala:330)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request$$anonfun$4.apply(CompilingInterpreter.scala:340)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request$$anonfun$4.apply(CompilingInterpreter.scala:340)
    at scala.collection.immutable.List.map(List.scala:273)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request.<init>(CompilingInterpreter.scala:340)
    at dotty.tools.dotc.repl.CompilingInterpreter.interpret(CompilingInterpreter.scala:217)
    at dotty.tools.dotc.repl.CompilingInterpreter.interpret(CompilingInterpreter.scala:215)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$2.apply(AmmoniteReader.scala:19)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$2.apply(AmmoniteReader.scala:19)
    at dotty.tools.dotc.repl.CompilingInterpreter.delayOutputDuring(CompilingInterpreter.scala:103)
    at dotty.tools.dotc.repl.AmmoniteReader.incompleteInput(AmmoniteReader.scala:19)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$1.applyOrElse(AmmoniteReader.scala:31)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$1.applyOrElse(AmmoniteReader.scala:29)
    at scala.PartialFunction$Lifted.apply(PartialFunction.scala:223)
    at scala.PartialFunction$Lifted.apply(PartialFunction.scala:219)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1$$anonfun$apply$1.apply(Filter.scala:21)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1$$anonfun$apply$1.apply(Filter.scala:21)
    at scala.collection.Iterator$$anon$11.next(Iterator.scala:370)
    at scala.collection.Iterator$class.find(Iterator.scala:802)
    at scala.collection.AbstractIterator.find(Iterator.scala:1202)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1.apply(Filter.scala:21)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1.apply(Filter.scala:21)
    at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readChar$1(Terminal.scala:267)
    at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readLine(Terminal.scala:299)
    at dotty.tools.dotc.repl.AmmoniteReader.readLine(AmmoniteReader.scala:54)
    at dotty.tools.dotc.repl.InterpreterLoop.repl$default$1(InterpreterLoop.scala:74)
    at dotty.tools.dotc.repl.InterpreterLoop.repl(InterpreterLoop.scala:80)
    at dotty.tools.dotc.repl.InterpreterLoop.run(InterpreterLoop.scala:210)
    at dotty.tools.dotc.repl.REPL.doCompile(REPL.scala:43)
    at dotty.tools.dotc.Driver.process(Driver.scala:124)
    at dotty.tools.dotc.Driver.process(Driver.scala:93)
    at dotty.tools.dotc.Driver.process(Driver.scala:105)
    at dotty.tools.dotc.Driver.main(Driver.scala:132)
    at dotty.tools.dotc.repl.Main.main(Main.scala)
@DarkDimius DarkDimius changed the title Top level tries kill repl: Top level tries kill repl Jul 8, 2016
cswinter added a commit to cswinter/dotty that referenced this issue Aug 3, 2016
@smarter smarter closed this as completed in 28bc8e8 Aug 8, 2016
smarter added a commit that referenced this issue Aug 8, 2016
Fix #1367: Add ParsedTry case to UntypedTree{Copier,Map,Accumulator}
OlivierBlanvillain pushed a commit to OlivierBlanvillain/dotty that referenced this issue Dec 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants