Skip to content

Scalameta 1.3.0

Compare
Choose a tag to compare
@xeno-by xeno-by released this 26 Apr 20:49
· 5116 commits to main since this release

Tokens

  • Some additional operations on Tokens now return Tokens instead of a sequence of tokens (details).

Trees

  • Type.Compound has been split into Type.With and Type.Refine in order to provide common ground for compatibility with Dotty. Dotty gets rid of with in favor of intersection types, but it still has type refinements, so we needed to extract Type.Refine, so that it can be used in both dialects.

    scala> t"A with B".structure
    res0: String = Type.With(Type.Name("A"), Type.Name("B"))
    
    scala> t"{ def x: Int }".structure
    res1: String = Type.Refine(None, Seq(Decl.Def(Nil, Term.Name("x"), Nil, Nil, Type.Name("Int"))))
    
    scala> t"A { def x: Int }".structure
    res2: String = Type.Refine(Some(Type.Name("A")), Seq(Decl.Def(Nil, Term.Name("x"), Nil, Nil, Type.Name("Int"))))
    
    scala> t"A with B { def x: Int }".structure
    res3: String = Type.Refine(Some(Type.With(Type.Name("A"), Type.Name("B"))), Seq(Decl.Def(Nil, Term.Name("x"), Nil, Nil, Type.Name("Int"))))
    
  • Pat.Type.And and Pat.Type.Or have been introduced to provide analogs of Type.And and Type.Or for pattern types. Not including them in 1.2.0 was an oversight, which is now fixed.

  • Some fields in AST nodes have been renamed in order to streamline naming:

    • Term.Ascribe.decltpe => Term.Ascribe.tpe
    • Term/Pat/Type.Tuple.elements => Term/Pat/Type.Tuple.args
    • Term.Match.scrut => Term.Match.expr
    • Term.Eta.term => Term.Eta.expr
    • Term.Named.rhs => Term.Named.expr
    • Term.Repeated.arg => Term.Repeated.expr
    • Type.Existential.quants => Type.Existential.stats
    • Pat.ExtractInfix.ref => Pat.ExtractInfix.op

Dotty support

  • A with B is now parsed as A & B in accordance with the behavior of the Dotty parser.
  • Type.And and Type.Or can no longer be prettyprinted in ScalaXXX and derived dialects.
  • Type.With can no longer be prettyprinted in Dotty and derived dialects.