diff options
-rw-r--r-- | README.md | 84 | ||||
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/FirstTransform.scala | 18 | ||||
-rw-r--r-- | src/dotty/tools/dotc/transform/TreeTransform.scala | 15 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 4 |
6 files changed, 101 insertions, 28 deletions
@@ -11,29 +11,75 @@ theory behind these constructors is researched in [DOT](http://www.cs.uwm.edu/~boyland/fool2012/papers/fool2012_submission_3.pdf), a calculus for dependent object types. -The dotty compiler is largely a new design. It takes a more functional -approach than current scalac, paired with aggressive caching to -achieve good performance. Some parts, in particular those that have to -do with configuration and input/output are ported from the Scala -compiler. The compiler is fully functional, in particular it can -compile itself. But there's more work needed (and planned) on -polishing rough edges, improving diagnostics, improving compilation -speed, and embedding in other tools. - -We expect that, over time, some of the new technologies explored in -this project will find their way into future versions of Scala. At -present it is too early to say which ones and when. - -If you want to try it out, to get started have a look at +####Current status: + _Technology preview_: currently unsupported, may be functionally incomplete or unsuitable for production use. + +####Is it going to be the future Scala? +Yes, eventually. + +####Who's working on it? +See [github contributors page](https://github.com/lampepfl/dotty/graphs/contributors). + +####What are the features that could make me consider trying it? +| Feature | Status | +|---------------------------------------------------------------------------------------------------------|---------------------| +| Union, Intersection and [Literal singleton types](http://docs.scala-lang.org/sips/pending/42.type.html) | Implemented | +| Fast compilation(phase fusion) | Implemented | +| [Trait parameters](http://docs.scala-lang.org/sips/pending/trait-parameters.html) | Implemented | +| [@Static methods and fields](https://github.com/scala/scala.github.com/pull/491) | Implemented | +| Colored Repl | Implemented | +| Sbt incremental build | Implemented | +| Non-blocking lazy vals | Implemented | +| Option-less pattern matching(based on [name-based patmat](https://github.com/scala/scala/pull/2848)) | Implemented | +| Function arity adaptation | Implemented | +| | | +| Non-boxed arrays of value classes | In progress | +| Working contravariant implicits | In progress | +| [Auto-Specialization](https://github.com/dotty-linker/dotty) | In progress | +| [Whole program optimizer](https://github.com/dotty-linker/dotty) | In progress | +| [Library defined optimizations](https://github.com/dotty-linker/dotty) | In progress | +| | | +| HList & HMaps\Record types | Under consideration | +| Implicit functions | Under consideration | +| Effects | Under consideration | +| Auto-completion in repl | Under consideration | +| Spec Option-less pattern matching | Under consideration | +| Multiverse equality | Under consideration | +| Exhaustivity checks in pattern matching | Under consideration | +There are also plethora of small details such as [per-callsite @tailrec annotations](https://github.com/lampepfl/dotty/issues/1221) + +####What are the complications that I can have If I start using Dotty? +Dotty can use libraries compiled by scalac 2.11, but Scala scalac can't use libraries compiled by Dotty.<br> +No existential types.<br> +No macro support yet. We have big plans here.<br> +No early initializers. No scala.DelayedInit. Use trait parameters instead.<br> +Whole program optimizer will only work if all dependencies are compiled by Dotty.<br> + + +####Can I write my code in a way that is going to be compatible with Scalac & Dotty? +Yes, Dotty itself is a project that can be compiled by both Dotty and Scalac.<br> +It's not very hard, and the biggest thing that you will likely miss is using macros. + +####How can I try it out? https://github.com/lampepfl/dotty/wiki/Getting-Started. +Here’s an example sbt project and instructions on how to set it up: https://github.com/smarter/dotty-example-project/ <br> +We have colored REPL :-). You can invoke it by running `dotc -repl`. -Developers mailing list is https://groups.google.com/forum/#!forum/dotty-internals. +####We also have: +Basic support for Scala.js,<br> +[Prototype](https://github.com/scala-native/scala-native/tree/topic/dotty-support) of compilation to x86 native code(Shabalin)<br> +####What about scalac: +Scalac is the basis for stability in scala. We expect scalac & dotty to coexist for long time. + +####Contributions are welcome! +We invite you to help us build the future of Scala.<br> +This is the best moment to participate, as everyone can make an impact.<br> - +####SI-2712? +If scalac will put it into 2.12, we’ll mimic their behaviour. But we have bigger plans for +HK-types. - -![YourKit](https://www.yourkit.com/images/yklogo.png) supports open source projects with its full-featured Java Profiler. -YourKit, LLC is the creator of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/index.jsp). +Developers mailing list is https://groups.google.com/forum/#!forum/dotty-internals. diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index b6a4dc5e7..12c1e65a6 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -46,7 +46,11 @@ object desugar { */ override def ensureCompletions(implicit ctx: Context) = if (!(ctx.owner is Package)) - if (ctx.owner is ModuleClass) ctx.owner.linkedClass.ensureCompleted() + if (ctx.owner.isClass) { + ctx.owner.ensureCompleted() + if (ctx.owner is ModuleClass) + ctx.owner.linkedClass.ensureCompleted() + } else ensureCompletions(ctx.outer) /** Return info of original symbol, where all references to siblings of the diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 83d427a8f..cceaed53d 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -179,7 +179,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas val ex = new BadSignature( sm"""error reading Scala signature of $classRoot from $source: |error occurred at position $readIndex: $msg""") - if (ctx.debug || true) original.getOrElse(ex).printStackTrace() // temporarilly enable printing of original failure signature to debug failing builds + if (ctx.debug || true) original.getOrElse(ex).printStackTrace() // temporarily enable printing of original failure signature to debug failing builds throw ex } diff --git a/src/dotty/tools/dotc/transform/FirstTransform.scala b/src/dotty/tools/dotc/transform/FirstTransform.scala index 97dd9404f..ae72d5f6c 100644 --- a/src/dotty/tools/dotc/transform/FirstTransform.scala +++ b/src/dotty/tools/dotc/transform/FirstTransform.scala @@ -28,6 +28,7 @@ import StdNames._ * - ensures there are companion objects for all classes except module classes * - eliminates some kinds of trees: Imports, NamedArgs * - stubs out native methods + * - eliminate self tree in Template and self symbol in ClassInfo */ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer with AnnotationTransformer { thisTransformer => import ast.tpd._ @@ -44,7 +45,14 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi this } - def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = tp/*{ + /** eliminate self symbol in ClassInfo */ + def transformInfo(tp: Type, sym: Symbol)(implicit ctx: Context): Type = tp match { + case tp@ClassInfo(_, _, _, _, self: Symbol) => + tp.derivedClassInfo(selfInfo = self.info) + case _ => + tp + } + /* tp match { //create companions for value classes that are not from currently compiled source file case tp@ClassInfo(_, cls, _, decls, _) @@ -59,7 +67,8 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi case _ => tp } } -*/ + */ + override def checkPostCondition(tree: Tree)(implicit ctx: Context): Unit = { tree match { case Select(qual, _) if tree.symbol.exists => @@ -132,6 +141,11 @@ class FirstTransform extends MiniPhaseTransform with IdentityDenotTransformer wi (modul, mcComp, classComp) } + /** elimiate self in Template */ + override def transformTemplate(impl: Template)(implicit ctx: Context, info: TransformerInfo): Tree = { + cpy.Template(impl)(self = EmptyValDef) + } + override def transformDefDef(ddef: DefDef)(implicit ctx: Context, info: TransformerInfo) = { if (ddef.symbol.hasAnnotation(defn.NativeAnnot)) { ddef.symbol.resetFlag(Deferred) diff --git a/src/dotty/tools/dotc/transform/TreeTransform.scala b/src/dotty/tools/dotc/transform/TreeTransform.scala index 67bd2f160..abada9ab4 100644 --- a/src/dotty/tools/dotc/transform/TreeTransform.scala +++ b/src/dotty/tools/dotc/transform/TreeTransform.scala @@ -185,12 +185,19 @@ object TreeTransforms { ref match { case ref: SymDenotation => - val annotTrees = ref.annotations.map(_.tree) - val annotTrees1 = annotTrees.mapConserve(annotationTransformer.macroTransform) - val annots1 = if (annotTrees eq annotTrees1) ref.annotations else annotTrees1.map(new ConcreteAnnotation(_)) + val annots1 = + if (!ref.symbol.isDefinedInCurrentRun) ref.annotations // leave annotations read from class files alone + else { + val annotTrees = ref.annotations.map(_.tree) + val annotTrees1 = annotTrees.mapConserve(annotationTransformer.macroTransform) + if (annotTrees eq annotTrees1) ref.annotations + else annotTrees1.map(new ConcreteAnnotation(_)) + } if ((info1 eq ref.info) && (annots1 eq ref.annotations)) ref else ref.copySymDenotation(info = info1, annotations = annots1) - case _ => if (info1 eq ref.info) ref else ref.derivedSingleDenotation(ref.symbol, info1) + case _ => + if (info1 eq ref.info) ref + else ref.derivedSingleDenotation(ref.symbol, info1) } } } diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index d70546f9d..390ecaee9 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -925,7 +925,9 @@ trait Applications extends Compatibility { self: Typer => /** Drop any implicit parameter section */ def stripImplicit(tp: Type): Type = tp match { case mt: ImplicitMethodType if !mt.isDependent => - mt.resultType // todo: make sure implicit method types are not dependent + mt.resultType + // todo: make sure implicit method types are not dependent? + // but check test case in /tests/pos/depmet_implicit_chaining_zw.scala case pt: PolyType => pt.derivedPolyType(pt.paramNames, pt.paramBounds, stripImplicit(pt.resultType)) case _ => |