Skip to content

Testing dotty on the Scala Standard Library #237

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
samuelgruetter opened this issue Nov 19, 2014 · 4 comments
Closed

Testing dotty on the Scala Standard Library #237

samuelgruetter opened this issue Nov 19, 2014 · 4 comments

Comments

@samuelgruetter
Copy link
Contributor

I ran the rewriting tool with the ExplicitUnitReturn and ExplicitImplicitTypes transformations on the Scala Library 2.10.
Then I fed the result to dotty. FYI here's a list of the errors that I got (with links to the source position on github). I think most of them arise because the rewrite tool does not yet do all the rewritings that it should do, so I'll see how to improve it.

@samuelgruetter
Copy link
Contributor Author

Here's my analysis of the errors, plus questions:

  1. Might be tricky to rewrite this automatically so that the generated code looks nice, but I'll give it a try.
    
  2. Missing feature of the rewriting tool
    
  3. Missing feature of the rewriting tool, already reported: https://github.com/lampepfl/dotty/issues/129
    
  4. [Fixed](https://github.com/scala/scala/blob/2.11.x/src/library/scala/collection/immutable/RedBlackTree.scala#L114) in Scala 2.11, but do I still have to do something for this?
    
  5. Looks like https://github.com/lampepfl/dotty/pull/168 was not sufficient
    

@smarter
Copy link
Member

smarter commented Nov 20, 2014

4 has been reported as #235

@samuelgruetter
Copy link
Contributor Author

So I addressed all these problems and made the following changes to the rewrite tool:

  1. make early initializers normal late initializers + emit warning
  2. rewrite types using forSome with bounded wildcards
  3. also treat procedure syntax for abstract methods
  4. replace unnamed type parameters by fresh type variables
  5. varargs patterns: replace @ by :

For reference, in addition to the above features, the rewrite tool also does the following:

  • add explict types for implicit defs/vals
  • no procedure syntax for defs and constructors
  • [desactivated] undo autotupling

Then I ran the rewrite tool on the scala library of 2.10.x. You can find the changes that it performed in this commit.

When I run dotty on this rewritten code base, I get the following error:

exception occured while indexing /home/sam/Documents/git/scala/src/library/scala/Tuple9.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val <none>
    at scala.Predef$.assert(Predef.scala:165)
    at dotty.tools.dotc.core.Symbols$Symbol.asTerm(Symbols.scala:369)
    at dotty.tools.dotc.ast.tpd$.New(tpd.scala:305)
    at dotty.tools.dotc.ast.desugar$.makeAnnotated(Desugar.scala:550)
    at dotty.tools.dotc.ast.desugar$.dotty$tools$dotc$ast$desugar$$copyDefault$1(Desugar.scala:297)
    at dotty.tools.dotc.ast.desugar$$anonfun$12.apply(Desugar.scala:299)
    at dotty.tools.dotc.ast.desugar$$anonfun$12.apply(Desugar.scala:298)
    at scala.collection.immutable.List.map(List.scala:274)
    at dotty.tools.dotc.ast.desugar$.classDef(Desugar.scala:298)
    at dotty.tools.dotc.ast.desugar$.defTree(Desugar.scala:497)
    at dotty.tools.dotc.typer.Namer.expand(Namer.scala:288)
    at dotty.tools.dotc.typer.Namer$$anonfun$index$1.apply(Namer.scala:385)
    at dotty.tools.dotc.typer.Namer$$anonfun$index$1.apply(Namer.scala:385)
    at scala.collection.immutable.List.foreach(List.scala:383)
    at dotty.tools.dotc.typer.Namer.index(Namer.scala:385)
    at dotty.tools.dotc.typer.Namer.indexExpanded(Namer.scala:344)
    at dotty.tools.dotc.typer.Namer.index(Namer.scala:335)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$enterSyms$1.apply$mcV$sp(FrontEnd.scala:34)
    at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:17)
    at dotty.tools.dotc.typer.FrontEnd.enterSyms(FrontEnd.scala:32)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$2.apply(FrontEnd.scala:50)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$2.apply(FrontEnd.scala:50)
    at scala.collection.immutable.List.foreach(List.scala:383)
    at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:50)
    at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:49)
    at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:47)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
    at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply$mcV$sp(Run.scala:47)
    at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:39)
    at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:39)
    at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:68)
    at dotty.tools.dotc.Run.compileSources(Run.scala:38)
    at dotty.tools.dotc.Run.compile(Run.scala:29)
    at dotty.tools.dotc.Driver.doCompile(Driver.scala:19)
    at dotty.tools.dotc.Main$.doCompile(Main.scala:26)
    at dotty.tools.dotc.Driver.process(Driver.scala:30)
    at dotty.tools.dotc.Driver.main(Driver.scala:44)
    at dotty.tools.dotc.Main.main(Main.scala)

It's not (yet) clear to me why this happens, because I've not yet studied this error in detail.

@smarter
Copy link
Member

smarter commented Nov 18, 2015

Work is under way to get the standard library to compile, both by changing it and making the dotty compiler deal with more Scala2 stuff, so I'll close this issue.

@smarter smarter closed this as completed Nov 18, 2015
tgodzik added a commit to tgodzik/scala3 that referenced this issue Apr 29, 2025
Backport "improvement: use heuristic to figure out `nameSpan` if `pointDelta` too big" to 3.3 LTS
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