Skip to content

Commit 3eab410

Browse files
oderskyDarkDimius
authored andcommitted
Removed annotations forced by union types
Removed annotations from the dotty codebase that were necessary because the inferred union types caused inference errors later on.
1 parent 4611bdf commit 3eab410

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ object desugar {
180180
constr1.mods, constr1.name, tparams, vparamss, constr1.tpt, constr1.rhs)
181181

182182
// a reference to the class type, with all parameters given.
183-
val classTypeRef: Tree = {
184-
// Dotty deviation: Without type annotation infers Ident | AppliedTypeTree, which
183+
val classTypeRef/*: Tree*/ = {
184+
// -language:keepUnions difference: classTypeRef needs type annotation, otherwise
185+
// infers Ident | AppliedTypeTree, which
185186
// renders the :\ in companions below untypable.
186187
val tycon = Ident(cdef.name) withPos cdef.pos.startPos
187188
val tparams = impl.constr.tparams

src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,9 @@ class Definitions {
286286
object FunctionType {
287287
def apply(args: List[Type], resultType: Type) =
288288
FunctionClass(args.length).typeRef.appliedTo(args ::: resultType :: Nil)
289-
def unapply(ft: Type): Option[(List[Type], Type)] = { // Dotty deviation: Type annotation needed because inferred type
290-
// is Some[(List[Type], Type)] | None, which is not a legal unapply type.
289+
def unapply(ft: Type)/*: Option[(List[Type], Type)]*/ = {
290+
// -language:keepUnions difference: unapply needs result type because inferred type
291+
// is Some[(List[Type], Type)] | None, which is not a legal unapply type.
291292
val tsym = ft.typeSymbol
292293
lazy val targs = ft.argInfos
293294
if ((FunctionClasses contains tsym) &&

0 commit comments

Comments
 (0)