From 2847a1cc4346fbae75baa1e69ca8eebc0b175154 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Sun, 20 Jun 2021 12:53:32 +0900 Subject: [PATCH 01/25] Add Singature information for Semanticdb --- .../tools/dotc/semanticdb/ConstantOps.scala | 27 ++ .../dotc/semanticdb/ExtractSemanticDB.scala | 237 +--------------- .../tools/dotc/semanticdb/LinkMode.scala | 4 + .../semanticdb/SemanticSymbolBuilder.scala | 123 +++++++++ .../semanticdb/SymbolInformationOps.scala | 137 ++++++++++ .../tools/dotc/semanticdb/SymbolOps.scala | 257 ++++++++++++++++++ .../dotty/tools/dotc/semanticdb/Tools.scala | 2 +- 7 files changed, 564 insertions(+), 223 deletions(-) create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/ConstantOps.scala create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/LinkMode.scala create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ConstantOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/ConstantOps.scala new file mode 100644 index 000000000000..4e058a2b65a6 --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/ConstantOps.scala @@ -0,0 +1,27 @@ +package dotty.tools +package dotc +package semanticdb + +import dotty.tools.dotc.{semanticdb => s} + +import core.Contexts.Context +import core.Constants._ + +object ConstantOps: + extension (const: Constant) + def toSemanticConst(using Context): s.Constant = const.tag match { + case UnitTag => s.UnitConstant() + case BooleanTag => s.BooleanConstant(const.booleanValue) + case ByteTag => s.ByteConstant(const.byteValue) + case ShortTag => s.ShortConstant(const.shortValue) + case CharTag => s.CharConstant(const.charValue) + case IntTag => s.IntConstant(const.intValue) + case LongTag => s.LongConstant(const.longValue) + case FloatTag => s.FloatConstant(const.floatValue) + case DoubleTag => s.DoubleConstant(const.doubleValue) + case StringTag => s.StringConstant(const.stringValue) + case NullTag => s.NullConstant() + // ConstantType(_: Type, ClazzTag) should be converted as it's type + // NoTag => it shouldn't happen + case _ => throw new Error(s"Constant ${const} can't be converted to Semanticdb Constant.") + } diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 89d8659dd4bc..6c79ee84f66e 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -22,6 +22,8 @@ import scala.collection.mutable import scala.annotation.{ threadUnsafe => tu, tailrec } import scala.PartialFunction.condOpt +import SemanticSymbolBuilder._ +import SymbolInformationOps._ /** Extract symbol references and uses to semanticdb files. * See https://scalameta.org/docs/semanticdb/specification.html#symbol-1 @@ -49,18 +51,9 @@ class ExtractSemanticDB extends Phase: /** Extractor of symbol occurrences from trees */ class Extractor extends TreeTraverser: - private var nextLocalIdx: Int = 0 - - /** The index of a local symbol */ - private val locals = mutable.HashMap[Symbol, Int]() - /** The bodies of synthetic locals */ private val localBodies = mutable.HashMap[Symbol, Tree]() - /** The local symbol(s) starting at given offset */ - private val symsAtOffset = new mutable.HashMap[Int, Set[Symbol]](): - override def default(key: Int) = Set[Symbol]() - /** The extracted symbol occurrences */ val occurrences = new mutable.ListBuffer[SymbolOccurrence]() @@ -142,12 +135,12 @@ class ExtractSemanticDB extends Phase: if !tree.symbol.isAllOf(ModuleValCreationFlags) then if !excludeDef(tree.symbol) && tree.span.hasLength then - registerDefinition(tree.symbol, tree.nameSpan, symbolKinds(tree), tree.source) + registerDefinition(tree.symbol, tree.nameSpan, tree.symbolKinds, tree.source) val privateWithin = tree.symbol.privateWithin if privateWithin.exists then registerUseGuarded(None, privateWithin, spanOfSymbol(privateWithin, tree.span, tree.source), tree.source) else if !excludeSymbol(tree.symbol) then - registerSymbol(tree.symbol, symbolName(tree.symbol), symbolKinds(tree)) + registerSymbol(tree.symbol, tree.symbolKinds) tree match case tree: ValDef if tree.symbol.isAllOf(EnumValue) => @@ -248,14 +241,6 @@ class ExtractSemanticDB extends Phase: end traverse - private def funParamSymbol(funSym: Symbol)(using Context): Name => String = - if funSym.isGlobal then - val funSymbol = symbolName(funSym) - name => s"$funSymbol($name)" - else - name => locals.keys.find(local => local.isTerm && local.owner == funSym && local.name == name) - .fold("")(Symbols.LocalPrefix + _) - private object PatternValDef: def unapply(tree: ValDef)(using Context): Option[(Tree, Tree)] = tree.rhs match @@ -289,92 +274,6 @@ class ExtractSemanticDB extends Phase: end PatternValDef - /** Add semanticdb name of the given symbol to string builder */ - private def addSymName(b: StringBuilder, sym: Symbol)(using Context): Unit = - - def addName(name: Name) = - val str = name.toString.unescapeUnicode - if str.isJavaIdent then b append str - else b append '`' append str append '`' - - def addOwner(owner: Symbol): Unit = - if !owner.isRoot then addSymName(b, owner) - - def addOverloadIdx(sym: Symbol): Unit = - val decls = - val decls0 = sym.owner.info.decls.lookupAll(sym.name) - if sym.owner.isAllOf(JavaModule) then - decls0 ++ sym.owner.companionClass.info.decls.lookupAll(sym.name) - else - decls0 - end decls - val alts = decls.filter(_.isOneOf(Method | Mutable)).toList.reverse - def find(filter: Symbol => Boolean) = alts match - case notSym :: rest if !filter(notSym) => - val idx = rest.indexWhere(filter).ensuring(_ >= 0) - b.append('+').append(idx + 1) - case _ => - end find - val sig = sym.signature - find(_.signature == sig) - - def addDescriptor(sym: Symbol): Unit = - if sym.is(ModuleClass) then - addDescriptor(sym.sourceModule) - else if sym.is(TypeParam) then - b.append('['); addName(sym.name); b.append(']') - else if sym.is(Param) then - b.append('('); addName(sym.name); b.append(')') - else if sym.isRoot then - b.append(Symbols.RootPackage) - else if sym.isEmptyPackage then - b.append(Symbols.EmptyPackage) - else if (sym.isScala2PackageObject) then - b.append(Symbols.PackageObjectDescriptor) - else - addName(sym.name) - if sym.is(Package) then b.append('/') - else if sym.isType || sym.isAllOf(JavaModule) then b.append('#') - else if sym.isOneOf(Method | Mutable) - && (!sym.is(StableRealizable) || sym.isConstructor) then - b.append('('); addOverloadIdx(sym); b.append(").") - else b.append('.') - - /** The index of local symbol `sym`. Symbols with the same name and - * the same starting position have the same index. - */ - def localIdx(sym: Symbol)(using Context): Int = - val startPos = - assert(sym.span.exists, s"$sym should have a span") - sym.span.start - @tailrec - def computeLocalIdx(sym: Symbol): Int = locals get sym match - case Some(idx) => idx - case None => symsAtOffset(startPos).find(_.name == sym.name) match - case Some(other) => computeLocalIdx(other) - case None => - val idx = nextLocalIdx - nextLocalIdx += 1 - locals(sym) = idx - symsAtOffset(startPos) += sym - idx - end computeLocalIdx - computeLocalIdx(sym) - end localIdx - - if sym.exists then - if sym.isGlobal then - addOwner(sym.owner); addDescriptor(sym) - else - b.append(Symbols.LocalPrefix).append(localIdx(sym)) - - end addSymName - - /** The semanticdb name of the given symbol */ - private def symbolName(sym: Symbol)(using Context): String = - val b = StringBuilder(20) - addSymName(b, sym) - b.toString private def range(span: Span, treeSource: SourceFile)(using Context): Option[Range] = def lineCol(offset: Int) = (treeSource.offsetToLine(offset), treeSource.column(offset)) @@ -382,92 +281,17 @@ class ExtractSemanticDB extends Phase: val (endLine, endCol) = lineCol(span.end) Some(Range(startLine, startCol, endLine, endCol)) - private def symbolKind(sym: Symbol, symkinds: Set[SymbolKind])(using Context): SymbolInformation.Kind = - if sym.isTypeParam then - SymbolInformation.Kind.TYPE_PARAMETER - else if sym.is(TermParam) then - SymbolInformation.Kind.PARAMETER - else if sym.isTerm && sym.owner.isTerm then - SymbolInformation.Kind.LOCAL - else if sym.isInlineMethod || sym.is(Macro) then - SymbolInformation.Kind.MACRO - else if sym.isConstructor then - SymbolInformation.Kind.CONSTRUCTOR - else if sym.isSelfSym then - SymbolInformation.Kind.SELF_PARAMETER - else if sym.isOneOf(Method) || symkinds.exists(_.isVarOrVal) then - SymbolInformation.Kind.METHOD - else if sym.isPackageObject then - SymbolInformation.Kind.PACKAGE_OBJECT - else if sym.is(Module) then - SymbolInformation.Kind.OBJECT - else if sym.is(Package) then - SymbolInformation.Kind.PACKAGE - else if sym.isAllOf(JavaInterface) then - SymbolInformation.Kind.INTERFACE - else if sym.is(Trait) then - SymbolInformation.Kind.TRAIT - else if sym.isClass then - SymbolInformation.Kind.CLASS - else if sym.isType then - SymbolInformation.Kind.TYPE - else if sym.is(ParamAccessor) then - SymbolInformation.Kind.FIELD - else - SymbolInformation.Kind.UNKNOWN_KIND - - private def symbolProps(sym: Symbol, symkinds: Set[SymbolKind])(using Context): Int = - if sym.is(ModuleClass) then - return symbolProps(sym.sourceModule, symkinds) - var props = 0 - if sym.isPrimaryConstructor then - props |= SymbolInformation.Property.PRIMARY.value - if sym.is(Abstract) || symkinds.contains(SymbolKind.Abstract) then - props |= SymbolInformation.Property.ABSTRACT.value - if sym.is(Final) then - props |= SymbolInformation.Property.FINAL.value - if sym.is(Sealed) then - props |= SymbolInformation.Property.SEALED.value - if sym.isOneOf(GivenOrImplicit) then - props |= SymbolInformation.Property.IMPLICIT.value - if sym.is(Lazy, butNot=Module) then - props |= SymbolInformation.Property.LAZY.value - if sym.isAllOf(Case | Module) || sym.is(CaseClass) || sym.isAllOf(EnumCase) then - props |= SymbolInformation.Property.CASE.value - if sym.is(Covariant) then - props |= SymbolInformation.Property.COVARIANT.value - if sym.is(Contravariant) then - props |= SymbolInformation.Property.CONTRAVARIANT.value - if sym.isAllOf(DefaultMethod | JavaDefined) || sym.is(Accessor) && sym.name.is(NameKinds.DefaultGetterName) then - props |= SymbolInformation.Property.DEFAULT.value - if symkinds.exists(_.isVal) then - props |= SymbolInformation.Property.VAL.value - if symkinds.exists(_.isVar) then - props |= SymbolInformation.Property.VAR.value - if sym.is(JavaStatic) then - props |= SymbolInformation.Property.STATIC.value - if sym.is(Enum) then - props |= SymbolInformation.Property.ENUM.value - props - - private def symbolInfo(sym: Symbol, symbolName: String, symkinds: Set[SymbolKind])(using Context): SymbolInformation = - SymbolInformation( - symbol = symbolName, - language = Language.SCALA, - kind = symbolKind(sym, symkinds), - properties = symbolProps(sym, symkinds), - displayName = Symbols.displaySymbol(sym) - ) - private def registerSymbol(sym: Symbol, symbolName: String, symkinds: Set[SymbolKind])(using Context): Unit = - val isLocal = symbolName.isLocal - if !isLocal || !localNames.contains(symbolName) then + private def registerSymbol(sym: Symbol, symkinds: Set[SymbolKind])(using Context): Unit = + val sname = symbolName(sym) + val isLocal = sname.isLocal + if !isLocal || !localNames.contains(sname) then if isLocal then - localNames += symbolName - symbolInfos += symbolInfo(sym, symbolName, symkinds) + localNames += sname + symbolInfos += sym.symbolInfo(symkinds)(using LinkMode.SymlinkChildren) private def registerSymbolSimple(sym: Symbol)(using Context): Unit = - registerSymbol(sym, symbolName(sym), Set.empty) + registerSymbol(sym, Set.empty) private def registerOccurrence(symbol: String, span: Span, role: SymbolOccurrence.Role, treeSource: SourceFile)(using Context): Unit = val occ = SymbolOccurrence(range(span, treeSource), symbol, role) @@ -486,15 +310,15 @@ class ExtractSemanticDB extends Phase: registerOccurrence(symbol, span, SymbolOccurrence.Role.REFERENCE, treeSource) private def registerDefinition(sym: Symbol, span: Span, symkinds: Set[SymbolKind], treeSource: SourceFile)(using Context) = - val symbol = symbolName(sym) + val sname = symbolName(sym) val finalSpan = if !span.hasLength || !sym.is(Given) || namePresentInSource(sym, span, treeSource) then span else Span(span.start) - registerOccurrence(symbol, finalSpan, SymbolOccurrence.Role.DEFINITION, treeSource) + registerOccurrence(sname, finalSpan, SymbolOccurrence.Role.DEFINITION, treeSource) if !sym.is(Package) then - registerSymbol(sym, symbol, symkinds) + registerSymbol(sym, symkinds) private def namePresentInSource(sym: Symbol, span: Span, source:SourceFile)(using Context): Boolean = val content = source.content() @@ -507,15 +331,6 @@ class ExtractSemanticDB extends Phase: val start = if idx >= 0 then idx else span.start Span(start, start + sym.name.show.length, start) - extension (list: List[List[ValDef]]) - private inline def isSingleArg = list match - case (_::Nil)::Nil => true - case _ => false - - extension (tree: DefDef) - private def isSetterDef(using Context): Boolean = - tree.name.isSetterName && tree.mods.is(Accessor) && tree.termParamss.isSingleArg - private def findGetters(ctorParams: Set[Names.TermName], body: List[Tree])(using Context): Map[Names.TermName, ValDef] = if ctorParams.isEmpty || body.isEmpty then Map.empty @@ -562,28 +377,6 @@ class ExtractSemanticDB extends Phase: private inline def matchingMemberType(ctorTypeParam: Symbol, classSym: Symbol)(using Context) = classSym.info.member(ctorTypeParam.name).symbol - /**Necessary because not all of the eventual flags are propagated from the Tree to the symbol yet. - */ - private def symbolKinds(tree: NamedDefTree)(using Context): Set[SymbolKind] = - if tree.symbol.isSelfSym then - Set.empty - else - val symkinds = mutable.HashSet.empty[SymbolKind] - tree match - case tree: ValDef => - if !tree.symbol.is(Param) then - symkinds += (if tree.mods is Mutable then SymbolKind.Var else SymbolKind.Val) - if tree.rhs.isEmpty && !tree.symbol.isOneOf(TermParam | CaseAccessor | ParamAccessor) then - symkinds += SymbolKind.Abstract - case tree: DefDef => - if tree.isSetterDef then - symkinds += SymbolKind.Setter - else if tree.rhs.isEmpty then - symkinds += SymbolKind.Abstract - case tree: Bind => - symkinds += SymbolKind.Val - case _ => - symkinds.toSet private def ctorParams( vparamss: List[List[ValDef]], body: List[Tree])(using Context): Unit = @@ -597,7 +390,7 @@ class ExtractSemanticDB extends Phase: val symkinds = getters.get(vparam.name).fold(SymbolKind.emptySet)(getter => if getter.mods.is(Mutable) then SymbolKind.VarSet else SymbolKind.ValSet) - registerSymbol(vparam.symbol, symbolName(vparam.symbol), symkinds) + registerSymbol(vparam.symbol, symkinds) traverse(vparam.tpt) object ExtractSemanticDB: diff --git a/compiler/src/dotty/tools/dotc/semanticdb/LinkMode.scala b/compiler/src/dotty/tools/dotc/semanticdb/LinkMode.scala new file mode 100644 index 000000000000..aac4c1254892 --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/LinkMode.scala @@ -0,0 +1,4 @@ +package dotty.tools.dotc.semanticdb + +enum LinkMode: + case SymlinkChildren, HardlinkChildren diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala new file mode 100644 index 000000000000..3e8dfacb116b --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala @@ -0,0 +1,123 @@ +package dotty.tools +package dotc +package semanticdb + +import core._ +import Contexts._ +import Symbols._ +import Flags._ +import Names.Name + +import scala.annotation.tailrec +import scala.collection.mutable + +object SemanticSymbolBuilder: + import Scala3.{_, given} + + private var nextLocalIdx: Int = 0 + + /** The index of a local symbol */ + private val locals = mutable.HashMap[Symbol, Int]() + + /** The local symbol(s) starting at given offset */ + private val symsAtOffset = new mutable.HashMap[Int, Set[Symbol]](): + override def default(key: Int) = Set[Symbol]() + + /** The semanticdb name of the given symbol */ + def symbolName(sym: Symbol)(using Context): String = + val b = StringBuilder(20) + addSymName(b, sym) + b.toString + + def funParamSymbol(funSym: Symbol)(using Context): Name => String = + if funSym.isGlobal then + val funSymbol = symbolName(funSym) + name => s"$funSymbol($name)" + else + name => locals.keys.find(local => local.isTerm && local.owner == funSym && local.name == name) + .fold("")(Symbols.LocalPrefix + _) + + /** Add semanticdb name of the given symbol to string builder */ + private def addSymName(b: StringBuilder, sym: Symbol)(using Context): Unit = + + def addName(name: Name) = + val str = name.toString.unescapeUnicode + if str.isJavaIdent then b append str + else b append '`' append str append '`' + + def addOwner(owner: Symbol): Unit = + if !owner.isRoot then addSymName(b, owner) + + def addOverloadIdx(sym: Symbol): Unit = + val decls = + val decls0 = sym.owner.info.decls.lookupAll(sym.name) + if sym.owner.isAllOf(JavaModule) then + decls0 ++ sym.owner.companionClass.info.decls.lookupAll(sym.name) + else + decls0 + end decls + val alts = decls.filter(_.isOneOf(Method | Mutable)).toList.reverse + def find(filter: Symbol => Boolean) = alts match + case notSym :: rest if !filter(notSym) => + val idx = rest.indexWhere(filter).ensuring(_ >= 0) + b.append('+').append(idx + 1) + case _ => + end find + val sig = sym.signature + find(_.signature == sig) + + def addDescriptor(sym: Symbol): Unit = + if sym.is(ModuleClass) then + addDescriptor(sym.sourceModule) + else if sym.is(TypeParam) then + b.append('['); addName(sym.name); b.append(']') + else if sym.is(Param) then + b.append('('); addName(sym.name); b.append(')') + else if sym.isRoot then + b.append(Symbols.RootPackage) + else if sym.isEmptyPackage then + b.append(Symbols.EmptyPackage) + else if (sym.isScala2PackageObject) then + b.append(Symbols.PackageObjectDescriptor) + else + addName(sym.name) + if sym.is(Package) then b.append('/') + else if sym.isType || sym.isAllOf(JavaModule) then b.append('#') + else if sym.isOneOf(Method | Mutable) + && (!sym.is(StableRealizable) || sym.isConstructor) then + b.append('('); addOverloadIdx(sym); b.append(").") + else b.append('.') + + /** The index of local symbol `sym`. Symbols with the same name and + * the same starting position have the same index. + */ + def localIdx(sym: Symbol)(using Context): Int = + val startPos = + if sym.span.exists then Some(sym.span.start) else None + // assert(sym.span.exists, s"$sym should have a span") + @tailrec + def computeLocalIdx(sym: Symbol): Int = locals get sym match + case Some(idx) => idx + case None => (for { + pos <- startPos + samePosSyms <- symsAtOffset.get(pos) + sameName <- samePosSyms.find(_.name == sym.name) + } yield sameName) match + case Some(other) => computeLocalIdx(other) + case None => + val idx = nextLocalIdx + nextLocalIdx += 1 + locals(sym) = idx + startPos.foreach(pos => symsAtOffset(pos) += sym) + idx + end computeLocalIdx + computeLocalIdx(sym) + end localIdx + + if sym.exists then + if sym.isGlobal then + addOwner(sym.owner); addDescriptor(sym) + else + b.append(Symbols.LocalPrefix).append(localIdx(sym)) + + end addSymName diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala new file mode 100644 index 000000000000..3a3f57ff4cf2 --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala @@ -0,0 +1,137 @@ +package dotty.tools +package dotc +package semanticdb + +import dotty.tools.dotc.{semanticdb => s} +import dotty.tools.dotc.semanticdb.Scala3.SymbolKind +import SemanticSymbolBuilder._ +import Scala3.Symbols + +import core.NameKinds +import core.Symbols._ +import core.Flags._ +import core.Contexts.Context +import ast.tpd._ +import core.NameOps._ + +import scala.collection.mutable + +object SymbolInformationOps: + extension (sym: Symbol) + def toSymbolInformation(using LinkMode, Context): s.SymbolInformation = + // val symkinds = sym.defTree.symbolKinds + sym.symbolInfo(Set.empty) + + def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context): SymbolInformation = + import s.SymbolOps._ + val sname = symbolName(sym) + val signature = sym.sig + SymbolInformation( + symbol = sname, + language = Language.SCALA, + kind = symbolKind(symkinds), + properties = sym.symbolProps(symkinds), + displayName = Symbols.displaySymbol(sym), + signature = signature, + ) + + private def symbolKind(symkinds: Set[SymbolKind])(using Context): SymbolInformation.Kind = + if sym.isTypeParam then + SymbolInformation.Kind.TYPE_PARAMETER + else if sym.is(TermParam) then + SymbolInformation.Kind.PARAMETER + else if sym.isTerm && sym.owner.isTerm then + SymbolInformation.Kind.LOCAL + else if sym.isInlineMethod || sym.is(Macro) then + SymbolInformation.Kind.MACRO + else if sym.isConstructor then + SymbolInformation.Kind.CONSTRUCTOR + else if sym.isSelfSym then + SymbolInformation.Kind.SELF_PARAMETER + else if sym.isOneOf(Method) || symkinds.exists(_.isVarOrVal) then + SymbolInformation.Kind.METHOD + else if sym.isPackageObject then + SymbolInformation.Kind.PACKAGE_OBJECT + else if sym.is(Module) then + SymbolInformation.Kind.OBJECT + else if sym.is(Package) then + SymbolInformation.Kind.PACKAGE + else if sym.isAllOf(JavaInterface) then + SymbolInformation.Kind.INTERFACE + else if sym.is(Trait) then + SymbolInformation.Kind.TRAIT + else if sym.isClass then + SymbolInformation.Kind.CLASS + else if sym.isType then + SymbolInformation.Kind.TYPE + else if sym.is(ParamAccessor) then + SymbolInformation.Kind.FIELD + else + SymbolInformation.Kind.UNKNOWN_KIND + + private def symbolProps(symkinds: Set[SymbolKind])(using Context): Int = + if sym.is(ModuleClass) then + return sym.sourceModule.symbolProps(symkinds) + var props = 0 + if sym.isPrimaryConstructor then + props |= SymbolInformation.Property.PRIMARY.value + if sym.is(Abstract) || symkinds.contains(SymbolKind.Abstract) then + props |= SymbolInformation.Property.ABSTRACT.value + if sym.is(Final) then + props |= SymbolInformation.Property.FINAL.value + if sym.is(Sealed) then + props |= SymbolInformation.Property.SEALED.value + if sym.isOneOf(GivenOrImplicit) then + props |= SymbolInformation.Property.IMPLICIT.value + if sym.is(Lazy, butNot=Module) then + props |= SymbolInformation.Property.LAZY.value + if sym.isAllOf(Case | Module) || sym.is(CaseClass) || sym.isAllOf(EnumCase) then + props |= SymbolInformation.Property.CASE.value + if sym.is(Covariant) then + props |= SymbolInformation.Property.COVARIANT.value + if sym.is(Contravariant) then + props |= SymbolInformation.Property.CONTRAVARIANT.value + if sym.isAllOf(DefaultMethod | JavaDefined) || sym.is(Accessor) && sym.name.is(NameKinds.DefaultGetterName) then + props |= SymbolInformation.Property.DEFAULT.value + if symkinds.exists(_.isVal) then + props |= SymbolInformation.Property.VAL.value + if symkinds.exists(_.isVar) then + props |= SymbolInformation.Property.VAR.value + if sym.is(JavaStatic) then + props |= SymbolInformation.Property.STATIC.value + if sym.is(Enum) then + props |= SymbolInformation.Property.ENUM.value + props + + /**Necessary because not all of the eventual flags are propagated from the Tree to the symbol yet. + */ + extension (tree: Tree) + def symbolKinds(using Context): Set[SymbolKind] = + if tree.symbol.isSelfSym then + Set.empty + else + val symkinds = mutable.HashSet.empty[SymbolKind] + tree match + case tree: ValDef => + if !tree.symbol.is(Param) then + symkinds += (if tree.mods is Mutable then SymbolKind.Var else SymbolKind.Val) + if tree.rhs.isEmpty && !tree.symbol.isOneOf(TermParam | CaseAccessor | ParamAccessor) then + symkinds += SymbolKind.Abstract + case tree: DefDef => + if tree.isSetterDef then + symkinds += SymbolKind.Setter + else if tree.rhs.isEmpty then + symkinds += SymbolKind.Abstract + case tree: Bind => + symkinds += SymbolKind.Val + case _ => + symkinds.toSet + + extension (tree: DefDef) + private def isSetterDef(using Context): Boolean = + tree.name.isSetterName && tree.mods.is(Accessor) && tree.termParamss.isSingleArg + + extension (list: List[List[ValDef]]) + private inline def isSingleArg = list match + case (_::Nil)::Nil => true + case _ => false diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala new file mode 100644 index 000000000000..764e18fe27c1 --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala @@ -0,0 +1,257 @@ +package dotty.tools +package dotc +package semanticdb + +import core.Symbols._ +import core.Contexts.Context +import core.Types._ +import core.Annotations.Annotation +import core.Flags +import ast.tpd._ + +import dotty.tools.dotc.{semanticdb => s} + +import SemanticSymbolBuilder._ + +object SymbolOps: + extension (sym: Symbol) + def sig(using LinkMode, Context): s.Signature = + import TypeOps._ + // println("") + val sig = sym.info.toSemanticSig(sym) + // println(sym.toString) + // println(s"=========sym.info================") + // pprint.pprintln(sym.info) + // println(s"=========sig================") + // pprint.pprintln(sig) + sig + +object TypeOps: + import SymbolScopeOps._ + extension (tpe: Type) + def toSemanticSig(using LinkMode, Context)(sym: Symbol): s.Signature = + def loop(tpe: Type): s.Signature = tpe match { + case mt: MethodType => + val stparams = Some(s.Scope()) + val paramss = + if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss + val sparamss = paramss.map(_.sscope) + s.MethodSignature( + stparams, + sparamss, + mt.resType.toSemanticType(sym) + ) + + case cls: ClassInfo => + val stparams = + if (cls.cls.typeParams.nonEmpty) + Some(cls.cls.typeParams.sscope) + else None + val sparents = cls.parents.map(_.toSemanticType(sym)) + val sself = cls.selfType.toSemanticType(sym) + val decls = cls.decls.toList.sscope + s.ClassSignature(stparams, sparents, sself, Some(decls)) + + case TypeBounds(lo, hi) => + // for `type X[T] = T` is equivalent to `[T] =>> T` + def tparams(tpe: Type): (Type, List[Symbol]) = tpe match { + case lambda: HKTypeLambda => + val paramSyms = lambda.paramNames.zip(lambda.paramInfos).map { (nme, info) => + newSymbol(sym, nme, Flags.TypeParam, info) + } + (lambda.resType, paramSyms) + case _ => (tpe, Nil) + } + val (loRes, loParams) = tparams(lo) + val (hiRes, hiParams) = tparams(hi) + val params = (loParams ++ hiParams).distinctBy(_.name) + val slo = loRes.toSemanticType(sym) + val shi = hiRes.toSemanticType(sym) + val stparams = params.sscope + s.TypeSignature(Some(stparams), slo, shi) + + case pt: PolyType => + loop(pt.resType) match { + case m: s.MethodSignature => + val paramss = + if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss + val tparamss = paramss.filter(ps => ps.forall(_.isTypeParam)) + val stparams = tparamss.flatten.sscope + m.copy(typeParameters = Some(stparams)) + case v: s.ValueSignature => + val paramss = + if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss + val tparamss = paramss.filter(ps => ps.forall(_.isTypeParam)) + val stparams = tparamss.flatten.sscope + s.ValueSignature(s.UniversalType(Some(stparams), v.tpe)) + case _ => s.Signature.Empty + } + + case other => + s.ValueSignature( + other.toSemanticType(sym) + ) + } + loop(tpe) + + private def toSemanticType(using LinkMode)(using ctx: Context)(sym: Symbol): s.Type = + import ConstantOps._ + def loop(tpe: Type): s.Type = tpe match { + case ExprType(tpe) => + val stpe = loop(tpe) + s.ByNameType(stpe) + + case TypeRef(pre, desig) if desig.isInstanceOf[Symbol] => + val spre = if(tpe.hasTrivialPrefix) s.Type.Empty else loop(pre) + val ssym = symbolName(desig.asInstanceOf[Symbol]) + s.TypeRef(spre, ssym, Seq.empty) + + case TermRef(pre, desig) if desig.isInstanceOf[Symbol] => + val spre = if(tpe.hasTrivialPrefix) s.Type.Empty else loop(pre) + val ssym = symbolName(desig.asInstanceOf[Symbol]) + s.SingleType(spre, ssym) + + case tref: ParamRef => + val paramref = sym.rawParamss.flatMap { params => + if (params.length > tref.paramNum) Some(params(tref.paramNum)) + else None + }.find(p => p.name == tref.paramName) + paramref match { + case Some(ref) => + val ssym = symbolName(ref) + tref match { + case _: TypeParamRef => s.TypeRef(s.Type.Empty, ssym, Seq.empty) + case _: TermParamRef => s.SingleType(s.Type.Empty, ssym) + } + case None => // shouldn't happen + s.Type.Empty + } + + case ThisType(TypeRef(_, desig)) if desig.isInstanceOf[Symbol] => + val ssym = symbolName(desig.asInstanceOf[Symbol]) + s.ThisType(ssym) + + case SuperType(thistpe, supertpe) => + val spre = loop(thistpe.typeSymbol.info) + val ssym = symbolName(supertpe.typeSymbol) + s.SuperType(spre, ssym) + + // val clazzOf = classOf[...] + case ConstantType(const) if const.tag == core.Constants.ClazzTag => + loop(const.typeValue) + + case ConstantType(const) => + s.ConstantType(const.toSemanticConst) + + case rt @ RefinedType(parent, name, info) => + // `X { def x: Int; def y: Int }` + // RefinedType( + // parent = RefinedType( + // parent = TypeRef(..., X) + // ... + // ) + // refinedName = x + // refinedInfo = TypeRef(..., Int) + // ) + type RefinedInfo = (core.Names.Name, Type) + def flatten(tpe: Type, acc: List[RefinedInfo]): (Type, List[RefinedInfo]) = tpe match { + case RefinedType(parent, name, info) => + flatten(parent, acc :+ (name, info)) + case _ => + (tpe, acc) + } + + // flatten parent types to list + // e.g. `X with Y with Z { refined }` + // RefinedType(parent = AndType(X, AndType(Y, Z)), ...) + // => List(X, Y, Z) + def flattenParent(parent: Type): List[s.Type] = parent match { + case AndType(tp1, tp2) => + flattenParent(tp1) ++ flattenParent(tp2) + case _ => List(loop(parent)) + } + + val (parent, refinedInfos) = flatten(rt, List.empty) + val stpe = s.WithType(flattenParent(parent)) + + // Create dummy symbols for refinements + // since there's no way to retrieve symbols of refinements from RefinedType at this moment. + val decls = for (name, info) <- refinedInfos + yield newSymbol(sym, name, Flags.EmptyFlags, info) + val sdecls = decls.sscope(using LinkMode.HardlinkChildren) + s.StructuralType(stpe, Some(sdecls)) + + case rec: RecType => + loop(rec.parent) // should be handled as RefinedType + + // repeated params: e.g. `Int*`, which is the syntax sugar of + // `Seq[Int] @Repeated` (or `Array[Int] @Repeated`) + // See: Desugar.scala and TypeApplications.scala + case AnnotatedType(AppliedType(_, targs), annot) + if (annot matches defn.RepeatedAnnot) && (targs.length == 1) => + val stpe = loop(targs(0)) + s.RepeatedType(stpe) + + case ann: AnnotatedType if ann.annot.symbol.info.isInstanceOf[ClassInfo] => + def flatten(tpe: Type, annots: List[Annotation]): (Type, List[Annotation]) = tpe match + case AnnotatedType(parent, annot) if annot.symbol.info.isInstanceOf[ClassInfo] => + flatten(parent, annot +: annots) + case other => (other, annots) + + val (parent, annots) = flatten(ann, List.empty) + val sparent = loop(parent) + val sannots = annots.map(a => + s.Annotation(loop(a.symbol.info.asInstanceOf[ClassInfo].selfType)) + ) + s.AnnotatedType(sannots, sparent) + + case app @ AppliedType(tycon, args) => + val sargs = args.map(loop) + loop(tycon) match + case ref: s.TypeRef => ref.copy(typeArguments = sargs) + // is there any other cases? + case _ => s.Type.Empty + + case and: AndType => + def flatten(child: Type): List[Type] = child match + case AndType(ct1, ct2) => flatten(ct1) ++ flatten(ct2) + case other => List(other) + val stpes = flatten(and).map(loop) + s.IntersectionType(stpes) + + case or: OrType => + def flatten(child: Type): List[Type] = child match + case OrType(ct1, ct2) => flatten(ct1) ++ flatten(ct2) + case other => List(other) + val stpes = flatten(or).map(loop) + s.UnionType(stpes) + + case NoPrefix => + s.Type.Empty + + case _ => s.Type.Empty + } + loop(tpe) + + /** Return true if the prefix is like `_root_.this` */ + private def hasTrivialPrefix(using Context): Boolean = + def checkTrivialPrefix(pre: Type, sym: Symbol)(using Context): Boolean = + pre =:= sym.owner.thisType + tpe match { + case TypeRef(pre, desig) if desig.isInstanceOf[Symbol] => + checkTrivialPrefix(pre, desig.asInstanceOf[Symbol]) + case TermRef(pre, desig) if desig.isInstanceOf[Symbol] => + checkTrivialPrefix(pre, desig.asInstanceOf[Symbol]) + case _ => false + } + +object SymbolScopeOps: + import SymbolInformationOps._ + extension (syms: List[Symbol]) + def sscope(using linkMode: LinkMode)(using Context): s.Scope = + linkMode match { + case LinkMode.SymlinkChildren => + s.Scope(symlinks = syms.map(symbolName)) + case LinkMode.HardlinkChildren => + s.Scope(hardlinks = syms.map(_.toSymbolInformation)) + } diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala b/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala index ce2e943ed7a1..ce0df71e41e5 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala @@ -119,7 +119,7 @@ object Tools: case TRAIT => sb.append("trait ") case INTERFACE => sb.append("interface ") case UNKNOWN_KIND | Unrecognized(_) => sb.append("unknown ") - sb.append(info.displayName).nl + sb.append(s"${info.displayName} ${info.signature}").nl end processSymbol private def processOccurrence(occ: SymbolOccurrence)(using sb: StringBuilder, sourceFile: SourceFile): Unit = From d21fe5914d5ea49d93894f3aa15858f747b7ba17 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Thu, 24 Jun 2021 17:51:10 +0900 Subject: [PATCH 02/25] Reset local symbol index for each TextDocument, updateExpect --- .../dotc/semanticdb/ExtractSemanticDB.scala | 11 +- .../semanticdb/SemanticSymbolBuilder.scala | 29 ++--- .../semanticdb/SymbolInformationOps.scala | 7 +- .../tools/dotc/semanticdb/SymbolOps.scala | 22 ++-- tests/semanticdb/expect/Advanced.expect.scala | 10 +- tests/semanticdb/expect/Classes.expect.scala | 8 +- tests/semanticdb/expect/Methods.expect.scala | 2 +- tests/semanticdb/expect/Traits.expect.scala | 2 +- .../expect/semanticdb-Types.expect.scala | 10 +- tests/semanticdb/metac.expect | 114 +++++++++++------- 10 files changed, 120 insertions(+), 95 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 6c79ee84f66e..4ecd24f7e76f 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -22,8 +22,8 @@ import scala.collection.mutable import scala.annotation.{ threadUnsafe => tu, tailrec } import scala.PartialFunction.condOpt -import SemanticSymbolBuilder._ import SymbolInformationOps._ +import dotty.tools.dotc.semanticdb.SemanticSymbolBuilder /** Extract symbol references and uses to semanticdb files. * See https://scalameta.org/docs/semanticdb/specification.html#symbol-1 @@ -50,6 +50,7 @@ class ExtractSemanticDB extends Phase: /** Extractor of symbol occurrences from trees */ class Extractor extends TreeTraverser: + given builder: SemanticSymbolBuilder = SemanticSymbolBuilder() /** The bodies of synthetic locals */ private val localBodies = mutable.HashMap[Symbol, Tree]() @@ -188,7 +189,7 @@ class ExtractSemanticDB extends Phase: else tree.body.foreach(traverse) case tree: Apply => - @tu lazy val genParamSymbol: Name => String = funParamSymbol(tree.fun.symbol) + @tu lazy val genParamSymbol: Name => String = tree.fun.symbol.funParamSymbol traverse(tree.fun) for arg <- tree.args do arg match @@ -283,7 +284,7 @@ class ExtractSemanticDB extends Phase: private def registerSymbol(sym: Symbol, symkinds: Set[SymbolKind])(using Context): Unit = - val sname = symbolName(sym) + val sname = sym.symbolName val isLocal = sname.isLocal if !isLocal || !localNames.contains(sname) then if isLocal then @@ -304,13 +305,13 @@ class ExtractSemanticDB extends Phase: registerUse(sym, span, treeSource) private def registerUse(sym: Symbol, span: Span, treeSource: SourceFile)(using Context): Unit = - registerUse(symbolName(sym), span, treeSource) + registerUse(sym.symbolName, span, treeSource) private def registerUse(symbol: String, span: Span, treeSource: SourceFile)(using Context): Unit = registerOccurrence(symbol, span, SymbolOccurrence.Role.REFERENCE, treeSource) private def registerDefinition(sym: Symbol, span: Span, symkinds: Set[SymbolKind], treeSource: SourceFile)(using Context) = - val sname = symbolName(sym) + val sname = sym.symbolName val finalSpan = if !span.hasLength || !sym.is(Given) || namePresentInSource(sym, span, treeSource) then span else diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala index 3e8dfacb116b..31f38f2d1027 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala @@ -11,7 +11,7 @@ import Names.Name import scala.annotation.tailrec import scala.collection.mutable -object SemanticSymbolBuilder: +class SemanticSymbolBuilder: import Scala3.{_, given} private var nextLocalIdx: Int = 0 @@ -23,19 +23,20 @@ object SemanticSymbolBuilder: private val symsAtOffset = new mutable.HashMap[Int, Set[Symbol]](): override def default(key: Int) = Set[Symbol]() - /** The semanticdb name of the given symbol */ - def symbolName(sym: Symbol)(using Context): String = - val b = StringBuilder(20) - addSymName(b, sym) - b.toString - - def funParamSymbol(funSym: Symbol)(using Context): Name => String = - if funSym.isGlobal then - val funSymbol = symbolName(funSym) - name => s"$funSymbol($name)" - else - name => locals.keys.find(local => local.isTerm && local.owner == funSym && local.name == name) - .fold("")(Symbols.LocalPrefix + _) + extension (sym: Symbol) + /** The semanticdb name of the given symbol */ + def symbolName(using Context): String = + val b = StringBuilder(20) + addSymName(b, sym) + b.toString + + def funParamSymbol(using Context): Name => String = + if sym.isGlobal then + val funSymbol = sym.symbolName + name => s"$funSymbol($name)" + else + name => locals.keys.find(local => local.isTerm && local.owner == sym && local.name == name) + .fold("")(Symbols.LocalPrefix + _) /** Add semanticdb name of the given symbol to string builder */ private def addSymName(b: StringBuilder, sym: Symbol)(using Context): Unit = diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala index 3a3f57ff4cf2..15851fdaf1c8 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala @@ -4,7 +4,6 @@ package semanticdb import dotty.tools.dotc.{semanticdb => s} import dotty.tools.dotc.semanticdb.Scala3.SymbolKind -import SemanticSymbolBuilder._ import Scala3.Symbols import core.NameKinds @@ -18,13 +17,13 @@ import scala.collection.mutable object SymbolInformationOps: extension (sym: Symbol) - def toSymbolInformation(using LinkMode, Context): s.SymbolInformation = + def toSymbolInformation(using LinkMode, Context, SemanticSymbolBuilder): s.SymbolInformation = // val symkinds = sym.defTree.symbolKinds sym.symbolInfo(Set.empty) - def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context): SymbolInformation = + def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context, SemanticSymbolBuilder): SymbolInformation = import s.SymbolOps._ - val sname = symbolName(sym) + val sname = sym.symbolName val signature = sym.sig SymbolInformation( symbol = sname, diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala index 764e18fe27c1..de1ff79d3044 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala @@ -11,11 +11,9 @@ import ast.tpd._ import dotty.tools.dotc.{semanticdb => s} -import SemanticSymbolBuilder._ - object SymbolOps: extension (sym: Symbol) - def sig(using LinkMode, Context): s.Signature = + def sig(using LinkMode, Context, SemanticSymbolBuilder): s.Signature = import TypeOps._ // println("") val sig = sym.info.toSemanticSig(sym) @@ -29,7 +27,7 @@ object SymbolOps: object TypeOps: import SymbolScopeOps._ extension (tpe: Type) - def toSemanticSig(using LinkMode, Context)(sym: Symbol): s.Signature = + def toSemanticSig(using LinkMode, Context, SemanticSymbolBuilder)(sym: Symbol): s.Signature = def loop(tpe: Type): s.Signature = tpe match { case mt: MethodType => val stparams = Some(s.Scope()) @@ -94,7 +92,7 @@ object TypeOps: } loop(tpe) - private def toSemanticType(using LinkMode)(using ctx: Context)(sym: Symbol): s.Type = + private def toSemanticType(using LinkMode, SemanticSymbolBuilder, Context)(sym: Symbol): s.Type = import ConstantOps._ def loop(tpe: Type): s.Type = tpe match { case ExprType(tpe) => @@ -103,12 +101,12 @@ object TypeOps: case TypeRef(pre, desig) if desig.isInstanceOf[Symbol] => val spre = if(tpe.hasTrivialPrefix) s.Type.Empty else loop(pre) - val ssym = symbolName(desig.asInstanceOf[Symbol]) + val ssym = desig.asInstanceOf[Symbol].symbolName s.TypeRef(spre, ssym, Seq.empty) case TermRef(pre, desig) if desig.isInstanceOf[Symbol] => val spre = if(tpe.hasTrivialPrefix) s.Type.Empty else loop(pre) - val ssym = symbolName(desig.asInstanceOf[Symbol]) + val ssym = desig.asInstanceOf[Symbol].symbolName s.SingleType(spre, ssym) case tref: ParamRef => @@ -118,7 +116,7 @@ object TypeOps: }.find(p => p.name == tref.paramName) paramref match { case Some(ref) => - val ssym = symbolName(ref) + val ssym = ref.symbolName tref match { case _: TypeParamRef => s.TypeRef(s.Type.Empty, ssym, Seq.empty) case _: TermParamRef => s.SingleType(s.Type.Empty, ssym) @@ -128,12 +126,12 @@ object TypeOps: } case ThisType(TypeRef(_, desig)) if desig.isInstanceOf[Symbol] => - val ssym = symbolName(desig.asInstanceOf[Symbol]) + val ssym = desig.asInstanceOf[Symbol].symbolName s.ThisType(ssym) case SuperType(thistpe, supertpe) => val spre = loop(thistpe.typeSymbol.info) - val ssym = symbolName(supertpe.typeSymbol) + val ssym = supertpe.typeSymbol.symbolName s.SuperType(spre, ssym) // val clazzOf = classOf[...] @@ -248,10 +246,10 @@ object TypeOps: object SymbolScopeOps: import SymbolInformationOps._ extension (syms: List[Symbol]) - def sscope(using linkMode: LinkMode)(using Context): s.Scope = + def sscope(using linkMode: LinkMode)(using SemanticSymbolBuilder, Context): s.Scope = linkMode match { case LinkMode.SymlinkChildren => - s.Scope(symlinks = syms.map(symbolName)) + s.Scope(symlinks = syms.map(_.symbolName)) case LinkMode.HardlinkChildren => s.Scope(hardlinks = syms.map(_.toSymbolInformation)) } diff --git a/tests/semanticdb/expect/Advanced.expect.scala b/tests/semanticdb/expect/Advanced.expect.scala index d52b8cecf668..2c7e8d684907 100644 --- a/tests/semanticdb/expect/Advanced.expect.scala +++ b/tests/semanticdb/expect/Advanced.expect.scala @@ -10,9 +10,9 @@ class C/*<-advanced::C#*/[T/*<-advanced::C#[T]*/] { } class Structural/*<-advanced::Structural#*/ { - def s1/*<-advanced::Structural#s1().*/: { val x/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ - def s2/*<-advanced::Structural#s2().*/: { val x/*<-local1*/: Int/*->scala::Int#*/ } = new { val x/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } - def s3/*<-advanced::Structural#s3().*/: { def m/*<-local4*/(x/*<-local5*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local7*/(x/*<-local8*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s1/*<-advanced::Structural#s1().*/: { val x/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + def s2/*<-advanced::Structural#s2().*/: { val x/*<-local3*/: Int/*->scala::Int#*/ } = new { val x/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s3/*<-advanced::Structural#s3().*/: { def m/*<-local9*/(x/*<-local10*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local13*/(x/*<-local14*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } } class Wildcards/*<-advanced::Wildcards#*/ { @@ -34,8 +34,8 @@ object Test/*<-advanced::Test.*/ { { (???/*->scala::Predef.`???`().*/ : Any/*->scala::Any#*/) match { - case e3/*<-local9*/: List/*->scala::package.List#*/[_] => - val e3x/*<-local10*/ = e3/*->local9*/.head/*->scala::collection::IterableOps#head().*/ + case e3/*<-local19*/: List/*->scala::package.List#*/[_] => + val e3x/*<-local21*/ = e3/*->local19*/.head/*->scala::collection::IterableOps#head().*/ () } } diff --git a/tests/semanticdb/expect/Classes.expect.scala b/tests/semanticdb/expect/Classes.expect.scala index af092703c250..8b9845a6d085 100644 --- a/tests/semanticdb/expect/Classes.expect.scala +++ b/tests/semanticdb/expect/Classes.expect.scala @@ -47,10 +47,10 @@ class C12/*<-classes::C12#*/ { object N/*<-classes::N.*/ { val anonClass/*<-classes::N.anonClass.*/ = new C7/*->classes::C7#*/(42) { - val local/*<-local1*/ = ???/*->scala::Predef.`???`().*/ + val local/*<-local2*/ = ???/*->scala::Predef.`???`().*/ } - val anonFun/*<-classes::N.anonFun.*/ = List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/(1).map/*->scala::collection::immutable::List#map().*/ { i/*<-local2*/ => - val local/*<-local3*/ = 2 - local/*->local3*/ +/*->scala::Int#`+`(+4).*/ 2 + val anonFun/*<-classes::N.anonFun.*/ = List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/(1).map/*->scala::collection::immutable::List#map().*/ { i/*<-local3*/ => + val local/*<-local4*/ = 2 + local/*->local4*/ +/*->scala::Int#`+`(+4).*/ 2 } } diff --git a/tests/semanticdb/expect/Methods.expect.scala b/tests/semanticdb/expect/Methods.expect.scala index 8190bf0308d1..08bdd896293e 100644 --- a/tests/semanticdb/expect/Methods.expect.scala +++ b/tests/semanticdb/expect/Methods.expect.scala @@ -23,7 +23,7 @@ class Methods/*<-example::Methods#*/[T/*<-example::Methods#[T]*/] { def m11/*<-example::Methods#m11().*/(x/*<-example::Methods#m11().(x)*/: Predef/*->scala::Predef.*/.type) = ???/*->scala::Predef.`???`().*/ def m11/*<-example::Methods#m11(+1).*/(x/*<-example::Methods#m11(+1).(x)*/: Example/*->example::Example.*/.type) = ???/*->scala::Predef.`???`().*/ def m12a/*<-example::Methods#m12a().*/(x/*<-example::Methods#m12a().(x)*/: {}) = ???/*->scala::Predef.`???`().*/ - def m12b/*<-example::Methods#m12b().*/(x/*<-example::Methods#m12b().(x)*/: { val x/*<-local0*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ + def m12b/*<-example::Methods#m12b().*/(x/*<-example::Methods#m12b().(x)*/: { val x/*<-local1*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ def m13/*<-example::Methods#m13().*/(x/*<-example::Methods#m13().(x)*/: Int/*->scala::Int#*/ @unchecked/*->scala::unchecked#*/) = ???/*->scala::Predef.`???`().*/ def m15/*<-example::Methods#m15().*/(x/*<-example::Methods#m15().(x)*/: => Int/*->scala::Int#*/) = ???/*->scala::Predef.`???`().*/ def m16/*<-example::Methods#m16().*/(x/*<-example::Methods#m16().(x)*/: Int/*->scala::Int#*/*) = ???/*->scala::Predef.`???`().*/ diff --git a/tests/semanticdb/expect/Traits.expect.scala b/tests/semanticdb/expect/Traits.expect.scala index 193390b38826..4cb0d6d65b22 100644 --- a/tests/semanticdb/expect/Traits.expect.scala +++ b/tests/semanticdb/expect/Traits.expect.scala @@ -10,5 +10,5 @@ object U/*<-traits::U.*/ { } class C/*<-traits::C#*/ -trait V/*<-traits::V#*/ { self/*<-local1*/: C/*->traits::C#*/ => +trait V/*<-traits::V#*/ { self/*<-local2*/: C/*->traits::C#*/ => } diff --git a/tests/semanticdb/expect/semanticdb-Types.expect.scala b/tests/semanticdb/expect/semanticdb-Types.expect.scala index 122579d42a9e..f7865818fcc6 100644 --- a/tests/semanticdb/expect/semanticdb-Types.expect.scala +++ b/tests/semanticdb/expect/semanticdb-Types.expect.scala @@ -59,12 +59,12 @@ object Test/*<-types::Test.*/ { val superType2/*<-types::Test.C#superType2.*/ = super[M].m/*->types::Test.M#m().*/ val superType3/*<-types::Test.C#superType3.*/ = C.super[M].m/*->types::Test.M#m().*/ - val compoundType1/*<-types::Test.C#compoundType1.*/: { def k/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + val compoundType1/*<-types::Test.C#compoundType1.*/: { def k/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ val compoundType2/*<-types::Test.C#compoundType2.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ = ???/*->scala::Predef.`???`().*/ - val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ - val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local3*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } val compoundType5/*<-types::Test.C#compoundType5.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ - val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local11*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } val annType1/*<-types::Test.C#annType1.*/: T/*->types::T#*/ @ann(42) = ???/*->scala::Predef.`???`().*/ val annType2/*<-types::Test.C#annType2.*/: T/*->types::T#*/ @ann1/*->types::ann1#*/ @ann2/*->types::ann2#*/ = ???/*->scala::Predef.`???`().*/ @@ -74,7 +74,7 @@ object Test/*<-types::Test.*/ { val existentialType4/*<-types::Test.C#existentialType4.*/ = Class/*->java::lang::Class#*/.forName/*->java::lang::Class#forName().*/("foo.Bar") def typeLambda1/*<-types::Test.C#typeLambda1().*/[M/*<-types::Test.C#typeLambda1().[M]*/[_]] = ???/*->scala::Predef.`???`().*/ - typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local7*/[T/*<-local8*/] = List/*->scala::package.List#*/[T/*->local8*/] })#L] + typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local12*/[T/*<-local14*/] = List/*->scala::package.List#*/[T/*->local14*/] })#L] object ClassInfoType1/*<-types::Test.C#ClassInfoType1.*/ class ClassInfoType2/*<-types::Test.C#ClassInfoType2#*/ extends B/*->types::B#*/ { def x/*<-types::Test.C#ClassInfoType2#x().*/ = 42 } diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 00ed8c849766..a45f1e8adc2b 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -76,17 +76,17 @@ advanced/Test.s3x. => val method s3x advanced/Wildcards# => class Wildcards advanced/Wildcards#``(). => primary ctor advanced/Wildcards#e1(). => method e1 -local0 => abstract val method x local1 => abstract val method x -local2 => final class $anon -local3 => val method x -local4 => abstract method m -local5 => param x -local6 => final class $anon -local7 => method m -local8 => param x -local9 => val local e3 -local10 => val local e3x +local3 => abstract val method x +local4 => final class $anon +local6 => val method x +local9 => abstract method m +local10 => param x +local11 => final class $anon +local13 => method m +local14 => param x +local19 => val local e3 +local21 => val local e3x Occurrences: [0:8..0:16): advanced <- advanced/ @@ -109,22 +109,22 @@ Occurrences: [11:6..11:16): Structural <- advanced/Structural# [12:2..12:2): <- advanced/Structural#``(). [12:6..12:8): s1 <- advanced/Structural#s1(). -[12:16..12:17): x <- local0 +[12:16..12:17): x <- local1 [12:19..12:22): Int -> scala/Int# [12:27..12:30): ??? -> scala/Predef.`???`(). [13:6..13:8): s2 <- advanced/Structural#s2(). -[13:16..13:17): x <- local1 +[13:16..13:17): x <- local3 [13:19..13:22): Int -> scala/Int# -[13:37..13:38): x <- local3 +[13:37..13:38): x <- local6 [13:40..13:43): Int -> scala/Int# [13:46..13:49): ??? -> scala/Predef.`???`(). [14:6..14:8): s3 <- advanced/Structural#s3(). -[14:16..14:17): m <- local4 -[14:18..14:19): x <- local5 +[14:16..14:17): m <- local9 +[14:18..14:19): x <- local10 [14:21..14:24): Int -> scala/Int# [14:27..14:30): Int -> scala/Int# -[14:45..14:46): m <- local7 -[14:47..14:48): x <- local8 +[14:45..14:46): m <- local13 +[14:47..14:48): x <- local14 [14:50..14:53): Int -> scala/Int# [14:56..14:59): Int -> scala/Int# [14:62..14:65): ??? -> scala/Predef.`???`(). @@ -174,10 +174,10 @@ Occurrences: [32:17..32:21): head -> scala/collection/IterableOps#head(). [35:5..35:8): ??? -> scala/Predef.`???`(). [35:11..35:14): Any -> scala/Any# -[36:11..36:13): e3 <- local9 +[36:11..36:13): e3 <- local19 [36:15..36:19): List -> scala/package.List# -[37:12..37:15): e3x <- local10 -[37:18..37:20): e3 -> local9 +[37:12..37:15): e3x <- local21 +[37:18..37:20): e3 -> local19 [37:21..37:25): head -> scala/collection/IterableOps#head(). expect/Annotations.scala @@ -472,9 +472,9 @@ classes/N. => final object N classes/N.anonClass. => val method anonClass classes/N.anonFun. => val method anonFun local0 => final class $anon -local1 => val method local -local2 => param i -local3 => val local local +local2 => val method local +local3 => param i +local4 => val local local Occurrences: [0:8..0:15): classes <- classes/ @@ -597,15 +597,15 @@ Occurrences: [48:6..48:15): anonClass <- classes/N.anonClass. [48:22..48:24): C7 -> classes/C7# [48:24..48:24): -> classes/C7#``(). -[49:8..49:13): local <- local1 +[49:8..49:13): local <- local2 [49:16..49:19): ??? -> scala/Predef.`???`(). [51:6..51:13): anonFun <- classes/N.anonFun. [51:16..51:20): List -> scala/package.List. [51:20..51:20): -> scala/collection/IterableFactory#apply(). [51:24..51:27): map -> scala/collection/immutable/List#map(). -[51:30..51:31): i <- local2 -[52:8..52:13): local <- local3 -[53:4..53:9): local -> local3 +[51:30..51:31): i <- local3 +[52:8..52:13): local <- local4 +[53:4..53:9): local -> local4 [53:10..53:11): + -> scala/Int#`+`(+4). expect/Empty.scala @@ -2264,7 +2264,7 @@ example/Methods#m20().(a) => param a example/Methods#m20(+1). => method m20 example/Methods#m20(+1).(b) => param b example/Methods#m20(+2). => var method m20 -local0 => abstract val method x +local1 => abstract val method x Occurrences: [0:8..0:15): example <- example/ @@ -2359,7 +2359,7 @@ Occurrences: [24:20..24:23): ??? -> scala/Predef.`???`(). [25:6..25:10): m12b <- example/Methods#m12b(). [25:11..25:12): x <- example/Methods#m12b().(x) -[25:20..25:21): x <- local0 +[25:20..25:21): x <- local1 [25:23..25:26): Int -> scala/Int# [25:32..25:35): ??? -> scala/Predef.`???`(). [26:6..26:9): m13 <- example/Methods#m13(). @@ -2751,6 +2751,32 @@ Occurrences: [5:4..5:5): b <- ext/RightAssociativeExtension$package.b. [5:14..5:17): :*: -> ext/RightAssociativeExtension$package.`:*:`(). +expect/Scala3Types.scala +------------------------ + +Summary: +Schema => SemanticDB v4 +Uri => Scala3Types.scala +Text => empty +Language => Scala +Symbols => 4 entries +Occurrences => 7 entries + +Symbols: +scala3types/Scala3Types$package. => final package object scala3types +scala3types/Scala3Types$package.A# => type A +scala3types/Scala3Types$package.X# => type X +scala3types/Scala3Types$package.X#[T] => typeparam T + +Occurrences: +[0:8..0:19): scala3types <- scala3types/ +[2:5..2:6): X <- scala3types/Scala3Types$package.X# +[2:7..2:8): T <- scala3types/Scala3Types$package.X#[T] +[2:12..2:16): List -> scala/package.List# +[2:17..2:18): T -> scala3types/Scala3Types$package.X#[T] +[3:5..3:6): A <- scala3types/Scala3Types$package.A# +[3:9..3:12): Int -> scala/Int# + expect/Selfs.scala ------------------ @@ -3033,7 +3059,7 @@ Occurrences => 16 entries Symbols: local0 => final class $anon -local1 => selfparam self +local2 => selfparam self traits/C# => class C traits/C#``(). => primary ctor traits/T# => trait T @@ -3061,7 +3087,7 @@ Occurrences: [11:6..11:7): C <- traits/C# [12:6..12:7): V <- traits/V# [12:10..12:10): <- traits/V#``(). -[12:10..12:14): self <- local1 +[12:10..12:14): self <- local2 [12:16..12:17): C -> traits/C# expect/ValPattern.scala @@ -3916,15 +3942,15 @@ Symbols => 142 entries Occurrences => 250 entries Symbols: -local0 => abstract method k local1 => abstract method k -local2 => final class $anon -local3 => method k +local3 => abstract method k local4 => final class $anon -local5 => final class $anon local6 => method k -local7 => type L -local8 => typeparam T +local7 => final class $anon +local9 => final class $anon +local11 => method k +local12 => type L +local14 => typeparam T types/B# => class B types/B#``(). => primary ctor types/C# => class C @@ -4173,7 +4199,7 @@ Occurrences: [59:8..59:18): superType3 <- types/Test.C#superType3. [59:32..59:33): m -> types/Test.M#m(). [61:8..61:21): compoundType1 <- types/Test.C#compoundType1. -[61:29..61:30): k <- local0 +[61:29..61:30): k <- local1 [61:32..61:35): Int -> scala/Int# [61:40..61:43): ??? -> scala/Predef.`???`(). [62:8..62:21): compoundType2 <- types/Test.C#compoundType2. @@ -4183,11 +4209,11 @@ Occurrences: [63:8..63:21): compoundType3 <- types/Test.C#compoundType3. [63:23..63:24): M -> types/Test.M# [63:30..63:31): N -> types/Test.N# -[63:38..63:39): k <- local1 +[63:38..63:39): k <- local3 [63:41..63:44): Int -> scala/Int# [63:49..63:52): ??? -> scala/Predef.`???`(). [64:8..64:21): compoundType4 <- types/Test.C#compoundType4. -[64:34..64:35): k <- local3 +[64:34..64:35): k <- local6 [64:37..64:40): Int -> scala/Int# [64:43..64:46): ??? -> scala/Predef.`???`(). [65:8..65:21): compoundType5 <- types/Test.C#compoundType5. @@ -4198,7 +4224,7 @@ Occurrences: [66:28..66:29): M -> types/Test.M# [66:29..66:29): -> types/Test.M#``(). [66:35..66:36): N -> types/Test.N# -[66:43..66:44): k <- local6 +[66:43..66:44): k <- local11 [66:46..66:49): Int -> scala/Int# [66:52..66:55): ??? -> scala/Predef.`???`(). [68:8..68:16): annType1 <- types/Test.C#annType1. @@ -4222,10 +4248,10 @@ Occurrences: [75:20..75:21): M <- types/Test.C#typeLambda1().[M] [75:28..75:31): ??? -> scala/Predef.`???`(). [76:4..76:15): typeLambda1 -> types/Test.C#typeLambda1(). -[76:24..76:25): L <- local7 -[76:26..76:27): T <- local8 +[76:24..76:25): L <- local12 +[76:26..76:27): T <- local14 [76:31..76:35): List -> scala/package.List# -[76:36..76:37): T -> local8 +[76:36..76:37): T -> local14 [78:11..78:25): ClassInfoType1 <- types/Test.C#ClassInfoType1. [79:10..79:24): ClassInfoType2 <- types/Test.C#ClassInfoType2# [79:33..79:33): <- types/Test.C#ClassInfoType2#``(). From 9c6015e2baaa4b78cf6b1dee2f38303fa8756fd3 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Thu, 24 Jun 2021 23:33:44 +0900 Subject: [PATCH 03/25] PrettyPrint signature and update metac.expect --- .../tools/dotc/semanticdb/Descriptor.scala | 120 + .../dotty/tools/dotc/semanticdb/PPrint.scala | 252 ++ .../dotty/tools/dotc/semanticdb/Scala3.scala | 4 + .../tools/dotc/semanticdb/SymbolOps.scala | 2 +- .../dotty/tools/dotc/semanticdb/Tools.scala | 42 +- tests/semanticdb/metac.expect | 2442 ++++++++--------- 6 files changed, 1590 insertions(+), 1272 deletions(-) create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/Descriptor.scala create mode 100644 compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Descriptor.scala b/compiler/src/dotty/tools/dotc/semanticdb/Descriptor.scala new file mode 100644 index 000000000000..a93b99df602c --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/Descriptor.scala @@ -0,0 +1,120 @@ +package dotty.tools.dotc.semanticdb + +import java.lang.System.{lineSeparator => EOL} +import dotty.tools.dotc.semanticdb.{Descriptor => d} + +class DescriptorParser(s: String) { + var i = s.length + def fail() = { + val message = "invalid symbol format" + val caret = " " * i + "^" + sys.error(s"$message$EOL$s$EOL$caret") + } + + val BOF = '\u0000' + val EOF = '\u001A' + var currChar = EOF + def readChar(): Char = { + if (i <= 0) { + if (i == 0) { + i -= 1 + currChar = BOF + currChar + } else { + fail() + } + } else { + i -= 1 + currChar = s(i) + currChar + } + } + + def parseValue(): String = { + if (currChar == '`') { + val end = i + while (readChar() != '`') {} + readChar() + s.substring(i + 2, end) + } else { + val end = i + 1 + if (!Character.isJavaIdentifierPart(currChar)) fail() + while (Character.isJavaIdentifierPart(readChar()) && currChar != BOF) {} + s.substring(i + 1, end) + } + } + + def parseDisambiguator(): String = { + val end = i + 1 + if (currChar != ')') fail() + while (readChar() != '(') {} + readChar() + s.substring(i + 1, end) + } + + def parseDescriptor(): Descriptor = { + if (currChar == '.') { + readChar() + if (currChar == ')') { + val disambiguator = parseDisambiguator() + val value = parseValue() + d.Method(value, disambiguator) + } else { + d.Term(parseValue()) + } + } else if (currChar == '#') { + readChar() + d.Type(parseValue()) + } else if (currChar == '/') { + readChar() + d.Package(parseValue()) + } else if (currChar == ')') { + readChar() + val value = parseValue() + if (currChar != '(') fail() + else readChar() + d.Parameter(value) + } else if (currChar == ']') { + readChar() + val value = parseValue() + if (currChar != '[') fail() + else readChar() + d.TypeParameter(value) + } else { + fail() + } + } + + def entryPoint(): (Descriptor, String) = { + readChar() + val desc = parseDescriptor() + (desc, s.substring(0, i + 1)) + } +} + +object DescriptorParser { + def apply(symbol: String): (Descriptor, String) = { + val parser = new DescriptorParser(symbol) + parser.entryPoint() + } +} + +sealed trait Descriptor { + def isNone: Boolean = this == d.None + def isTerm: Boolean = this.isInstanceOf[d.Term] + def isMethod: Boolean = this.isInstanceOf[d.Method] + def isType: Boolean = this.isInstanceOf[d.Type] + def isPackage: Boolean = this.isInstanceOf[d.Package] + def isParameter: Boolean = this.isInstanceOf[d.Parameter] + def isTypeParameter: Boolean = this.isInstanceOf[d.TypeParameter] + def value: String +} +object Descriptor { + case object None extends Descriptor { def value: String = "" } + final case class Term(value: String) extends Descriptor + final case class Method(value: String, disambiguator: String) extends Descriptor + final case class Type(value: String) extends Descriptor + final case class Package(value: String) extends Descriptor + final case class Parameter(value: String) extends Descriptor + final case class TypeParameter(value: String) extends Descriptor +} diff --git a/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala b/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala new file mode 100644 index 000000000000..f1dde00c038f --- /dev/null +++ b/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala @@ -0,0 +1,252 @@ +package dotty.tools.dotc.semanticdb + +import dotty.tools.dotc.{semanticdb => s} + +import scala.collection.mutable +import dotty.tools.dotc.semanticdb.Scala3.{_, given} +import SymbolInformation.Kind._ + +class SymbolInfomationPrinter (symtab: PrinterSymtab): + val notes = InfoNotes() + val infoPrinter = InfoPrinter(notes) + + def pprintSymbolInformation(info: SymbolInformation): String = + val sb = new StringBuilder() + sb.append(info.symbol).append(" => ") + sb.append(infoPrinter.pprint(info)) + sb.toString + + class InfoNotes: + private val noteSymtab = mutable.Map[String, SymbolInformation]() + def enter(info: SymbolInformation) = + if (symtab.info(info.symbol).isEmpty && info.kind != UNKNOWN_KIND) + noteSymtab(info.symbol) = info + + def visit(sym: String): SymbolInformation = + val symtabInfo = noteSymtab.get(sym).orElse(symtab.info(sym)) + symtabInfo.getOrElse { + val displayName = if sym.isGlobal then sym.desc.value else sym + SymbolInformation(symbol = sym, displayName = displayName) + } + + class InfoPrinter(notes: InfoNotes) { + private enum SymbolStyle: + case Reference, Definition + def pprint(info: SymbolInformation): String = + val sb = new StringBuilder() + if info.isAbstract then sb.append("abstract ") + if info.isFinal then sb.append("final ") + if info.isSealed then sb.append("sealed ") + if info.isImplicit then sb.append("implicit ") + if info.isLazy then sb.append("lazy ") + if info.isCase then sb.append("case ") + if info.isCovariant then sb.append("covariant ") + if info.isContravariant then sb.append("contravariant ") + if info.isVal then sb.append("val ") + if info.isVar then sb.append("var ") + if info.isStatic then sb.append("static ") + if info.isPrimary then sb.append("primary ") + if info.isEnum then sb.append("enum ") + if info.isDefault then sb.append("default ") + info.kind match + case LOCAL => sb.append("local ") + case FIELD => sb.append("field ") + case METHOD => sb.append("method ") + case CONSTRUCTOR => sb.append("ctor ") + case MACRO => sb.append("macro ") + case TYPE => sb.append("type ") + case PARAMETER => sb.append("param ") + case SELF_PARAMETER => sb.append("selfparam ") + case TYPE_PARAMETER => sb.append("typeparam ") + case OBJECT => sb.append("object ") + case PACKAGE => sb.append("package ") + case PACKAGE_OBJECT => sb.append("package object ") + case CLASS => sb.append("class ") + case TRAIT => sb.append("trait ") + case INTERFACE => sb.append("interface ") + case UNKNOWN_KIND | Unrecognized(_) => sb.append("unknown ") + sb.append(s"${info.displayName}${info.prefixBeforeTpe}${pprint(info.signature)}") + sb.toString + + private def pprintDef(info: SymbolInformation) = + notes.enter(info) + pprint(info.symbol, SymbolStyle.Definition) + private def pprintRef(sym: String): String = pprint(sym, SymbolStyle.Reference) + private def pprintDef(sym: String): String = pprint(sym, SymbolStyle.Definition) + private def pprint(sym: String, style: SymbolStyle): String = + val info = notes.visit(sym) + style match + case SymbolStyle.Reference => + info.displayName + case SymbolStyle.Definition => + pprint(info) + + + private def pprint(sig: Signature): String = + sig match + case ClassSignature(tparams, parents, self, decls) => + val sb = new StringBuilder() + if (tparams.infos.nonEmpty) + sb.append(tparams.infos.map(pprintDef).mkString("[", ", ", "] ")) + if (parents.nonEmpty) + sb.append(parents.map(pprint).mkString("extends ", " with ", " ")) + if (self.isDefined || decls.infos.nonEmpty) { + val selfStr = if (self.isDefined) s"self: ${pprint(self)} =>" else "" + val declsStr = if (decls.infos.nonEmpty) s"+${decls.infos.length} decls" else "" + sb.append(s"{ ${selfStr} ${declsStr} }") + } + sb.toString + case MethodSignature(tparams, paramss, res) => + val sb = new StringBuilder() + if (tparams.infos.nonEmpty) + sb.append(tparams.infos.map(pprintDef).mkString("[", ", ", "]")) + paramss.foreach { params => + val paramsStr = params.infos.map(pprintDef).mkString("(", ", ", ")") + sb.append(paramsStr) + } + sb.append(s": ${pprint(res)}") + sb.toString + case TypeSignature(tparams, lo, hi) => + val sb = new StringBuilder() + if (tparams.infos.nonEmpty) + sb.append(tparams.infos.map(pprintDef).mkString("[", ", ", "]")) + if (lo == hi) { + sb.append(s" = ${pprint(lo)}") + } else { + lo match + case TypeRef(Type.Empty, "scala/Nothing#", Nil) => () + case lo => sb.append(s" >: ${pprint(lo)}") + hi match + case TypeRef(Type.Empty, "scala/Any#", Nil) => () + case TypeRef(Type.Empty, "java/lang/Object#", Nil) => () + case hi => s" <: ${pprint(hi)}" + } + sb.toString + case ValueSignature(tpe) => + pprint(tpe) + case _ => + "" + + private def pprint(tpe: Type): String = { + def prefix(tpe: Type): String = tpe match + case TypeRef(pre, sym, args) => + val preStr = pre match { + case _: SingleType | _: ThisType | _: SuperType => + s"${prefix(pre)}." + case Type.Empty => "" + case _ => + s"${prefix(pre)}#" + } + val argsStr = if (args.nonEmpty) args.map(normal).mkString("[", ", ", "]") else "" + s"${preStr}${pprintRef(sym)}${argsStr}" + case SingleType(pre, sym) => + s"${prefix(pre)}.${pprintRef(sym)}" + case ThisType(sym) => + s"${pprintRef(sym)}.this" + case SuperType(pre, sym) => + s"${prefix(pre)}.super[${pprintRef(sym)}]" + case ConstantType(const) => + pprint(const) + case IntersectionType(types) => + types.map(normal).mkString(" & ") + case UnionType(types) => + types.map(normal).mkString(" | ") + case WithType(types) => + types.map(normal).mkString(" with ") + case StructuralType(utpe, decls) => + val declsStr = + if (decls.infos.nonEmpty) + s"{ ${decls.infos.map(pprintDef).mkString("; ")} }" + else "{}" + s"${normal(utpe)} ${declsStr}" + case AnnotatedType(anns, utpe) => + s"${normal(utpe)} ${anns.map(pprint).mkString(" ")}" + // case ExistentialType(utpe, decls) => // Scala3 shouldn't emit ExistentialType + case UniversalType(tparams, utpe) => + val params = tparams.infos.map(_.displayName).mkString("[", ", ", "]") + val resType = normal(utpe) + s"${params} => ${resType}" + case ByNameType(utpe) => + s"=> ${normal(utpe)}" + case RepeatedType(utpe) => + s"${normal(utpe)}*" + case _ => + "" + + def normal(tpe: Type): String = tpe match + case _: SingleType | _: ThisType | _: SuperType => + s"${prefix(tpe)}.type" + case _ => + prefix(tpe) + normal(tpe) + } + + private def pprint(ann: Annotation): String = + ann.tpe match { + case Type.Empty => s"@" + case tpe => s"@${pprint(tpe)}" + } + + private def pprint(const: Constant): String = const match { + case Constant.Empty => + "" + case UnitConstant() => + "()" + case BooleanConstant(true) => + "true" + case BooleanConstant(false) => + "false" + case ByteConstant(value) => + value.toByte.toString + case ShortConstant(value) => + value.toShort.toString + case CharConstant(value) => + s"'${value.toChar.toString}'" + case IntConstant(value) => + value.toString + case LongConstant(value) => + s"${value.toString}L" + case FloatConstant(value) => + s"${value.toString}f" + case DoubleConstant(value) => + value.toString + case StringConstant(value) => + "\"" + value + "\"" + case NullConstant() => + "null" + } + + extension (scope: Scope) + private def infos: List[SymbolInformation] = + if (scope.symlinks.nonEmpty) + scope.symlinks.map(symbol => SymbolInformation(symbol = symbol)).toList + else + scope.hardlinks.toList + + extension (scope: Option[Scope]) + private def infos: List[SymbolInformation] = scope match { + case Some(s) => s.infos + case None => Nil + } + } +end SymbolInfomationPrinter + +extension (info: SymbolInformation) + def prefixBeforeTpe: String = { + info.kind match { + case LOCAL | FIELD | PARAMETER | SELF_PARAMETER | UNKNOWN_KIND | Unrecognized(_) => + ": " + case METHOD | CONSTRUCTOR | MACRO | TYPE | TYPE_PARAMETER | OBJECT | PACKAGE | + PACKAGE_OBJECT | CLASS | TRAIT | INTERFACE => + " " + } + } + +trait PrinterSymtab: + def info(symbol: String): Option[SymbolInformation] +object PrinterSymtab: + def fromTextDocument(doc: TextDocument): PrinterSymtab = + val map = doc.symbols.map(info => (info.symbol, info)).toMap + new PrinterSymtab { + override def info(symbol: String): Option[SymbolInformation] = map.get(symbol) + } diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala index 211c1576254f..99d9a1c5f460 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala @@ -164,6 +164,10 @@ object Scala3: def isTypeParameter: Boolean = !symbol.isEmpty && !symbol.isMulti && symbol.last == ']' def isParameter: Boolean = !symbol.isEmpty && !symbol.isMulti && symbol.last == ')' + def desc: Descriptor = + if isGlobal then DescriptorParser(symbol)._1 + else Descriptor.None + def unescapeUnicode = unicodeEscape.replaceAllIn(symbol, m => String.valueOf(Integer.parseInt(m.group(1), 16).toChar)) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala index de1ff79d3044..1b115f04053b 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala @@ -15,8 +15,8 @@ object SymbolOps: extension (sym: Symbol) def sig(using LinkMode, Context, SemanticSymbolBuilder): s.Signature = import TypeOps._ - // println("") val sig = sym.info.toSemanticSig(sym) + // println("") // println(sym.toString) // println(s"=========sym.info================") // pprint.pprintln(sym.info) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala b/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala index ce0df71e41e5..a7bfdcefc047 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Tools.scala @@ -47,6 +47,8 @@ object Tools: TextDocuments.parseFrom(bytes) def metac(doc: TextDocument, realPath: Path)(using sb: StringBuilder): StringBuilder = + val symtab = PrinterSymtab.fromTextDocument(doc) + val symPrinter = SymbolInfomationPrinter(symtab) val realURI = realPath.toString given SourceFile = SourceFile.virtual(doc.uri, doc.text) sb.append(realURI).nl @@ -61,7 +63,7 @@ object Tools: sb.append("Occurrences => ").append(doc.occurrences.length).append(" entries").nl sb.nl sb.append("Symbols:").nl - doc.symbols.sorted.foreach(processSymbol) + doc.symbols.sorted.foreach(s => processSymbol(s, symPrinter)) sb.nl sb.append("Occurrences:").nl doc.occurrences.sorted.foreach(processOccurrence) @@ -85,42 +87,8 @@ object Tools: case UNKNOWN_LANGUAGE | Unrecognized(_) => "unknown" end languageString - private def processSymbol(info: SymbolInformation)(using sb: StringBuilder): Unit = - import SymbolInformation.Kind._ - sb.append(info.symbol).append(" => ") - if info.isAbstract then sb.append("abstract ") - if info.isFinal then sb.append("final ") - if info.isSealed then sb.append("sealed ") - if info.isImplicit then sb.append("implicit ") - if info.isLazy then sb.append("lazy ") - if info.isCase then sb.append("case ") - if info.isCovariant then sb.append("covariant ") - if info.isContravariant then sb.append("contravariant ") - if info.isVal then sb.append("val ") - if info.isVar then sb.append("var ") - if info.isStatic then sb.append("static ") - if info.isPrimary then sb.append("primary ") - if info.isEnum then sb.append("enum ") - if info.isDefault then sb.append("default ") - info.kind match - case LOCAL => sb.append("local ") - case FIELD => sb.append("field ") - case METHOD => sb.append("method ") - case CONSTRUCTOR => sb.append("ctor ") - case MACRO => sb.append("macro ") - case TYPE => sb.append("type ") - case PARAMETER => sb.append("param ") - case SELF_PARAMETER => sb.append("selfparam ") - case TYPE_PARAMETER => sb.append("typeparam ") - case OBJECT => sb.append("object ") - case PACKAGE => sb.append("package ") - case PACKAGE_OBJECT => sb.append("package object ") - case CLASS => sb.append("class ") - case TRAIT => sb.append("trait ") - case INTERFACE => sb.append("interface ") - case UNKNOWN_KIND | Unrecognized(_) => sb.append("unknown ") - sb.append(s"${info.displayName} ${info.signature}").nl - end processSymbol + private def processSymbol(info: SymbolInformation, printer: SymbolInfomationPrinter)(using sb: StringBuilder): Unit = + sb.append(printer.pprintSymbolInformation(info)).nl private def processOccurrence(occ: SymbolOccurrence)(using sb: StringBuilder, sourceFile: SourceFile): Unit = occ.range match diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index a45f1e8adc2b..7d0fe12e7216 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -10,15 +10,15 @@ Symbols => 9 entries Occurrences => 19 entries Symbols: -example/Access# => class Access -example/Access#``(). => primary ctor -example/Access#m1(). => method m1 -example/Access#m2(). => method m2 -example/Access#m3(). => method m3 -example/Access#m4(). => method m4 -example/Access#m5(). => method m5 -example/Access#m6(). => method m6 -example/Access#m7(). => method m7 +example/Access# => class Access extends Object { self: Access => +8 decls } +example/Access#``(). => primary ctor (): Access +example/Access#m1(). => method m1 => Nothing +example/Access#m2(). => method m2 => Nothing +example/Access#m3(). => method m3 => Nothing +example/Access#m4(). => method m4 => Nothing +example/Access#m5(). => method m5 => Nothing +example/Access#m6(). => method m6 => Nothing +example/Access#m7(). => method m7 => Nothing Occurrences: [0:8..0:15): example <- example/ @@ -53,40 +53,40 @@ Symbols => 34 entries Occurrences => 90 entries Symbols: -advanced/C# => class C -advanced/C#[T] => typeparam T -advanced/C#``(). => primary ctor -advanced/C#t(). => method t -advanced/Structural# => class Structural -advanced/Structural#``(). => primary ctor -advanced/Structural#s1(). => method s1 -advanced/Structural#s2(). => method s2 -advanced/Structural#s3(). => method s3 -advanced/Test. => final object Test -advanced/Test.e. => val method e -advanced/Test.e1. => val method e1 -advanced/Test.e1x. => val method e1x -advanced/Test.s. => val method s -advanced/Test.s1. => val method s1 -advanced/Test.s1x. => val method s1x -advanced/Test.s2. => val method s2 -advanced/Test.s2x. => val method s2x -advanced/Test.s3. => val method s3 -advanced/Test.s3x. => val method s3x -advanced/Wildcards# => class Wildcards -advanced/Wildcards#``(). => primary ctor -advanced/Wildcards#e1(). => method e1 -local1 => abstract val method x -local3 => abstract val method x -local4 => final class $anon -local6 => val method x -local9 => abstract method m -local10 => param x -local11 => final class $anon -local13 => method m -local14 => param x -local19 => val local e3 -local21 => val local e3x +advanced/C# => class C [typeparam T ] extends Object { self: C[T] => +3 decls } +advanced/C#[T] => typeparam T +advanced/C#``(). => primary ctor [unknown T: ](unknown T: ): C[T] +advanced/C#t(). => method t => T +advanced/Structural# => class Structural extends Object { self: Structural => +4 decls } +advanced/Structural#``(). => primary ctor (): Structural +advanced/Structural#s1(). => method s1 => Object { local x: Int } +advanced/Structural#s2(). => method s2 => Object { local x: Int } +advanced/Structural#s3(). => method s3 => Object { local m: (param x: Int): Int } +advanced/Test. => final object Test extends Object { self: .Test.type => +11 decls } +advanced/Test.e. => val method e Wildcards +advanced/Test.e1. => val method e1 List[] +advanced/Test.e1x. => val method e1x Any +advanced/Test.s. => val method s Structural +advanced/Test.s1. => val method s1 Object { local x: Int } +advanced/Test.s1x. => val method s1x Int +advanced/Test.s2. => val method s2 Object { local x: Int } +advanced/Test.s2x. => val method s2x Int +advanced/Test.s3. => val method s3 Object { local m: (param x: Int): Int } +advanced/Test.s3x. => val method s3x Int +advanced/Wildcards# => class Wildcards extends Object { self: Wildcards => +2 decls } +advanced/Wildcards#``(). => primary ctor (): Wildcards +advanced/Wildcards#e1(). => method e1 => List[] +local1 => abstract val method x Int +local3 => abstract val method x Int +local4 => final class $anon extends Object { self: $anon => +2 decls } +local6 => val method x Int +local9 => abstract method m (param x: Int): Int +local10 => param x: Int +local11 => final class $anon extends Object { self: $anon => +2 decls } +local13 => method m (param x: Int): Int +local14 => param x: Int +local19 => val local e3: List[local20] +local21 => val local e3x: local20 Occurrences: [0:8..0:16): advanced <- advanced/ @@ -192,28 +192,28 @@ Symbols => 22 entries Occurrences => 52 entries Symbols: -annot/Alias. => final object Alias -annot/Alias.A# => type A -annot/Annotations# => class Annotations -annot/Annotations#S# => type S -annot/Annotations#[T] => typeparam T -annot/Annotations#``(). => primary ctor -annot/Annotations#``().(x) => param x -annot/Annotations#field. => val method field -annot/Annotations#method(). => method method -annot/Annotations#x. => val method x -annot/B# => class B -annot/B#``(). => primary ctor -annot/B#``().(x) => param x -annot/B#``(+1). => ctor -annot/B#x. => val method x -annot/M. => final object M -annot/M.m(). => macro m -annot/M.m().[TT] => typeparam TT -annot/T# => trait T -annot/T#``(). => primary ctor -local0 => selfparam self -local1 => val local local +annot/Alias. => final object Alias extends Object { self: .Alias.type => +2 decls } +annot/Alias.A# => type A = ClassAnnotation @param +annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef & Annotations[T] => +6 decls } +annot/Annotations#S# => type S +annot/Annotations#[T] => typeparam T +annot/Annotations#``(). => primary ctor [unknown T: ](unknown T: )(param x: T): Annotations[T] +annot/Annotations#``().(x) => param x: T +annot/Annotations#field. => val method field Int +annot/Annotations#method(). => method method => Int +annot/Annotations#x. => val method x T +annot/B# => class B extends Object { self: B => +3 decls } +annot/B#``(). => primary ctor (param x: Int): B +annot/B#``().(x) => param x: Int +annot/B#``(+1). => ctor (): B +annot/B#x. => val method x Int +annot/M. => final object M extends Object { self: .M.type => +1 decls } +annot/M.m(). => macro m [] => Int +annot/M.m().[TT] => typeparam TT +annot/T# => trait T extends Object { self: T => +1 decls } +annot/T#``(). => primary ctor (): T +local0 => selfparam self: AnyRef +local1 => val local local: Int Occurrences: [0:8..0:13): annot <- annot/ @@ -281,19 +281,19 @@ Symbols => 13 entries Occurrences => 32 entries Symbols: -example/Anonymous# => class Anonymous -example/Anonymous#Foo# => trait Foo -example/Anonymous#Foo#``(). => primary ctor -example/Anonymous#``(). => primary ctor -example/Anonymous#foo. => val method foo -example/Anonymous#locally(). => method locally -example/Anonymous#locally().(x) => param x -example/Anonymous#locally().[A] => typeparam A -example/Anonymous#m1(). => method m1 -example/Anonymous#m1().[T] => typeparam T -example/Anonymous#m2(). => method m2 -local0 => val local x -local1 => final class $anon +example/Anonymous# => class Anonymous extends Object { self: Anonymous & Anonymous => +6 decls } +example/Anonymous#Foo# => trait Foo extends Object { self: Foo => +1 decls } +example/Anonymous#Foo#``(). => primary ctor (): Foo +example/Anonymous#``(). => primary ctor (): Anonymous +example/Anonymous#foo. => val method foo Foo +example/Anonymous#locally(). => method locally [typeparam A ](typeparam A )(param x: A): A +example/Anonymous#locally().(x) => param x: A +example/Anonymous#locally().[A] => typeparam A +example/Anonymous#m1(). => method m1 [] => Nothing +example/Anonymous#m1().[T] => typeparam T [unknown _$1: ] +example/Anonymous#m2(). => method m2 => Map[, List[]] +local0 => val local x: Function1[Int, Int] +local1 => final class $anon extends Object with Foo { self: $anon => +1 decls } Occurrences: [0:8..0:15): example <- example/ @@ -341,11 +341,11 @@ Symbols => 5 entries Occurrences => 5 entries Symbols: -angiven/AnonymousGiven$package. => final package object angiven -angiven/AnonymousGiven$package.bar(). => method bar -angiven/AnonymousGiven$package.bar().(x$1) => implicit param x$1 -angiven/Foo# => trait Foo -angiven/Foo#``(). => primary ctor +angiven/AnonymousGiven$package. => final package object angiven extends Object { self: .angiven.type => +2 decls } +angiven/AnonymousGiven$package.bar(). => method bar (implicit param x$1: Foo): Int +angiven/AnonymousGiven$package.bar().(x$1) => implicit param x$1: Foo +angiven/Foo# => trait Foo extends Object { self: Foo => +1 decls } +angiven/Foo#``(). => primary ctor (): Foo Occurrences: [0:8..0:15): angiven <- angiven/ @@ -366,115 +366,115 @@ Symbols => 109 entries Occurrences => 130 entries Symbols: -classes/C1# => final class C1 -classes/C1#``(). => primary ctor -classes/C1#``().(x1) => val param x1 -classes/C1#x1. => val method x1 -classes/C1. => final object C1 -classes/C2# => final class C2 -classes/C2#``(). => primary ctor -classes/C2#``().(x2) => val param x2 -classes/C2#x2. => val method x2 -classes/C2. => final object C2 -classes/C3# => case class C3 -classes/C3#_1(). => method _1 -classes/C3#``(). => primary ctor -classes/C3#``().(x) => val param x -classes/C3#copy$default$1(). => method copy$default$1 -classes/C3#copy(). => method copy -classes/C3#copy().(x) => param x -classes/C3#x. => val method x -classes/C3. => final object C3 -classes/C3.apply(). => method apply -classes/C3.apply().(x) => param x -classes/C3.toString(). => method toString -classes/C3.unapply(). => method unapply -classes/C3.unapply().(x$1) => param x$1 -classes/C4# => case class C4 -classes/C4#_1(). => method _1 -classes/C4#``(). => primary ctor -classes/C4#``().(x) => val param x -classes/C4#copy$default$1(). => method copy$default$1 -classes/C4#copy(). => method copy -classes/C4#copy().(x) => param x -classes/C4#x. => val method x -classes/C4. => final object C4 -classes/C4.apply(). => method apply -classes/C4.apply().(x) => param x -classes/C4.toString(). => method toString -classes/C4.unapply(). => method unapply -classes/C4.unapply().(x$1) => param x$1 -classes/C6# => case class C6 -classes/C6#_1(). => method _1 -classes/C6#``(). => primary ctor -classes/C6#``().(x) => param x -classes/C6#copy$default$1(). => method copy$default$1 -classes/C6#copy(). => method copy -classes/C6#copy().(x) => param x -classes/C6#x. => val method x -classes/C6. => final object C6 -classes/C6.apply(). => method apply -classes/C6.apply().(x) => param x -classes/C6.toString(). => method toString -classes/C6.unapply(). => method unapply -classes/C6.unapply().(x$1) => param x$1 -classes/C7# => class C7 -classes/C7#``(). => primary ctor -classes/C7#``().(x) => param x -classes/C7#x. => val method x -classes/C8# => class C8 -classes/C8#``(). => primary ctor -classes/C8#``().(x) => param x -classes/C8#x. => val method x -classes/C9# => class C9 -classes/C9#``(). => primary ctor -classes/C9#``().(x) => param x -classes/C9#x(). => var method x -classes/C10# => class C10 -classes/C10#``(). => primary ctor -classes/C10#``().(s) => param s -classes/C10#s. => val method s -classes/C11# => class C11 -classes/C11#``(). => primary ctor -classes/C11#foo(). => macro foo -classes/C11#foo(). => macro foo -classes/C12# => class C12 -classes/C12#Context# => class Context -classes/C12#Context#Expr# => type Expr -classes/C12#Context#Expr#[T] => typeparam T -classes/C12#Context#``(). => primary ctor -classes/C12#``(). => primary ctor -classes/C12#foo1(). => macro foo1 -classes/C12#foo1(). => method foo1 -classes/C12#foo1().(x) => param x -classes/C12#foo1().(x) => param x -classes/C12#foo1Impl(). => method foo1Impl -classes/C12#foo1Impl().(context) => param context -classes/C12#foo1Impl().(x) => param x -classes/C12#foo2(). => macro foo2 -classes/C12#foo2(). => method foo2 -classes/C12#foo2().(x) => param x -classes/C12#foo2().(x) => param x -classes/C12#foo2().(y) => param y -classes/C12#foo2().(y) => param y -classes/C12#foo2Impl(). => method foo2Impl -classes/C12#foo2Impl().(context) => param context -classes/C12#foo2Impl().(x) => param x -classes/C12#foo2Impl().(y) => param y -classes/M. => final object M -classes/M.C5# => class C5 -classes/M.C5#``(). => primary ctor -classes/M.C5#``().(x) => param x -classes/M.C5#x. => val method x -classes/M.C5(). => final implicit method C5 -classes/M.C5().(x) => param x -classes/N. => final object N -classes/N.anonClass. => val method anonClass -classes/N.anonFun. => val method anonFun -local0 => final class $anon -local2 => val method local -local3 => param i -local4 => val local local +classes/C1# => final class C1 extends AnyVal { self: C1 => +2 decls } +classes/C1#``(). => primary ctor (val param x1: Int): C1 +classes/C1#``().(x1) => val param x1: Int +classes/C1#x1. => val method x1 Int +classes/C1. => final object C1 extends Object { self: .C1.type => +2 decls } +classes/C2# => final class C2 extends AnyVal { self: C2 => +2 decls } +classes/C2#``(). => primary ctor (val param x2: Int): C2 +classes/C2#``().(x2) => val param x2: Int +classes/C2#x2. => val method x2 Int +classes/C2. => final object C2 extends Object { self: .C2.type => +2 decls } +classes/C3# => case class C3 extends Object with Product with Serializable { self: C3 => +5 decls } +classes/C3#_1(). => method _1 => Int +classes/C3#``(). => primary ctor (val param x: Int): C3 +classes/C3#``().(x) => val param x: Int +classes/C3#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance +classes/C3#copy(). => method copy (param x: Int): C3 +classes/C3#copy().(x) => param x: Int +classes/C3#x. => val method x Int +classes/C3. => final object C3 extends Object { self: .C3.type => +4 decls } +classes/C3.apply(). => method apply (param x: Int): C3 +classes/C3.apply().(x) => param x: Int +classes/C3.toString(). => method toString => String +classes/C3.unapply(). => method unapply (param x$1: C3): C3 +classes/C3.unapply().(x$1) => param x$1: C3 +classes/C4# => case class C4 extends Object with Product with Serializable { self: C4 => +5 decls } +classes/C4#_1(). => method _1 => Int +classes/C4#``(). => primary ctor (val param x: Int): C4 +classes/C4#``().(x) => val param x: Int +classes/C4#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance +classes/C4#copy(). => method copy (param x: Int): C4 +classes/C4#copy().(x) => param x: Int +classes/C4#x. => val method x Int +classes/C4. => final object C4 extends Object { self: .C4.type => +4 decls } +classes/C4.apply(). => method apply (param x: Int): C4 +classes/C4.apply().(x) => param x: Int +classes/C4.toString(). => method toString => String +classes/C4.unapply(). => method unapply (param x$1: C4): C4 +classes/C4.unapply().(x$1) => param x$1: C4 +classes/C6# => case class C6 extends Object with Product with Serializable { self: C6 => +5 decls } +classes/C6#_1(). => method _1 => Int +classes/C6#``(). => primary ctor (param x: Int): C6 +classes/C6#``().(x) => param x: Int +classes/C6#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance +classes/C6#copy(). => method copy (param x: Int): C6 +classes/C6#copy().(x) => param x: Int +classes/C6#x. => val method x Int +classes/C6. => final object C6 extends Object { self: .C6.type => +4 decls } +classes/C6.apply(). => method apply (param x: Int): C6 +classes/C6.apply().(x) => param x: Int +classes/C6.toString(). => method toString => String +classes/C6.unapply(). => method unapply (param x$1: C6): C6 +classes/C6.unapply().(x$1) => param x$1: C6 +classes/C7# => class C7 extends Object { self: C7 => +2 decls } +classes/C7#``(). => primary ctor (param x: Int): C7 +classes/C7#``().(x) => param x: Int +classes/C7#x. => val method x Int +classes/C8# => class C8 extends Object { self: C8 => +2 decls } +classes/C8#``(). => primary ctor (param x: Int): C8 +classes/C8#``().(x) => param x: Int +classes/C8#x. => val method x Int +classes/C9# => class C9 extends Object { self: C9 => +2 decls } +classes/C9#``(). => primary ctor (param x: Int): C9 +classes/C9#``().(x) => param x: Int +classes/C9#x(). => var method x Int +classes/C10# => class C10 extends Object { self: C10 => +2 decls } +classes/C10#``(). => primary ctor (param s: => String): C10 +classes/C10#``().(s) => param s: => String +classes/C10#s. => val method s => String +classes/C11# => class C11 extends Object { self: C11 => +2 decls } +classes/C11#``(). => primary ctor (): C11 +classes/C11#foo(). => macro foo => Int +classes/C11#foo(). => macro foo => Int +classes/C12# => class C12 extends Object { self: C12 => +8 decls } +classes/C12#Context# => class Context extends Object { self: Context => +2 decls } +classes/C12#Context#Expr# => type Expr [typeparam T ] +classes/C12#Context#Expr#[T] => typeparam T +classes/C12#Context#``(). => primary ctor (): Context +classes/C12#``(). => primary ctor (): C12 +classes/C12#foo1(). => macro foo1 (param x: Int): Int +classes/C12#foo1(). => method foo1 (param x: Int): Int +classes/C12#foo1().(x) => param x: Int +classes/C12#foo1().(x) => param x: Int +classes/C12#foo1Impl(). => method foo1Impl (param context: Context)(param x: .context.Expr[Int]): +classes/C12#foo1Impl().(context) => param context: Context +classes/C12#foo1Impl().(x) => param x: .context.Expr[Int] +classes/C12#foo2(). => macro foo2 (param x: Int, param y: String): Int +classes/C12#foo2(). => method foo2 (param x: Int, param y: String): Int +classes/C12#foo2().(x) => param x: Int +classes/C12#foo2().(x) => param x: Int +classes/C12#foo2().(y) => param y: String +classes/C12#foo2().(y) => param y: String +classes/C12#foo2Impl(). => method foo2Impl (param context: Context)(param x: .context.Expr[Int], param y: .context.Expr[String]): +classes/C12#foo2Impl().(context) => param context: Context +classes/C12#foo2Impl().(x) => param x: .context.Expr[Int] +classes/C12#foo2Impl().(y) => param y: .context.Expr[String] +classes/M. => final object M extends Object { self: .M.type => +3 decls } +classes/M.C5# => class C5 extends Object { self: C5 => +2 decls } +classes/M.C5#``(). => primary ctor (param x: Int): C5 +classes/M.C5#``().(x) => param x: Int +classes/M.C5#x. => val method x Int +classes/M.C5(). => final implicit method C5 (param x: Int): C5 +classes/M.C5().(x) => param x: Int +classes/N. => final object N extends Object { self: .N.type => +3 decls } +classes/N.anonClass. => val method anonClass C7 +classes/N.anonFun. => val method anonFun List[Int] +local0 => final class $anon extends C7 { self: $anon => +2 decls } +local2 => val method local Nothing +local3 => param i: Int +local4 => val local local: Int Occurrences: [0:8..0:15): classes <- classes/ @@ -620,12 +620,12 @@ Symbols => 6 entries Occurrences => 10 entries Symbols: -_empty_/A# => class A -_empty_/A#``(). => primary ctor -_empty_/A#b(). => method b -_empty_/B# => class B -_empty_/B#``(). => primary ctor -_empty_/B#a(). => method a +_empty_/A# => class A extends Object { self: A => +2 decls } +_empty_/A#``(). => primary ctor (): A +_empty_/A#b(). => method b => B +_empty_/B# => class B extends Object { self: B => +2 decls } +_empty_/B#``(). => primary ctor (): B +_empty_/B#a(). => method a => A Occurrences: [0:6..0:7): A <- _empty_/A# @@ -651,7 +651,7 @@ Symbols => 1 entries Occurrences => 2 entries Symbols: -example/EmptyObject. => final object EmptyObject +example/EmptyObject. => final object EmptyObject extends Object { self: .EmptyObject.type => +1 decls } Occurrences: [0:8..0:15): example <- example/ @@ -669,30 +669,30 @@ Symbols => 24 entries Occurrences => 42 entries Symbols: -endmarkers/Container# => class Container -endmarkers/Container#``(). => primary ctor -endmarkers/Container#`baz_=`(). => var method baz_= -endmarkers/Container#`baz_=`().(x$1) => param x$1 -endmarkers/Container#bar. => val method bar -endmarkers/Container#baz(). => var method baz -endmarkers/Container#foo(). => method foo -endmarkers/EndMarkers$package. => final package object endmarkers -endmarkers/EndMarkers$package.`topLevelVar_=`(). => var method topLevelVar_= -endmarkers/EndMarkers$package.`topLevelVar_=`().(x$1) => param x$1 -endmarkers/EndMarkers$package.topLevelMethod(). => method topLevelMethod -endmarkers/EndMarkers$package.topLevelVal. => val method topLevelVal -endmarkers/EndMarkers$package.topLevelVar(). => var method topLevelVar -endmarkers/EndMarkers$package.topLevelWithLocals(). => method topLevelWithLocals -endmarkers/MultiCtor# => class MultiCtor -endmarkers/MultiCtor#``(). => primary ctor -endmarkers/MultiCtor#``().(i) => val param i -endmarkers/MultiCtor#``(+1). => ctor -endmarkers/MultiCtor#i. => val method i -endmarkers/TestObj. => final object TestObj -endmarkers/TestObj.foo(). => method foo -local0 => val local localVal -local1 => var local localVar -local2 => local localDef +endmarkers/Container# => class Container extends Object { self: Container => +5 decls } +endmarkers/Container#``(). => primary ctor (): Container +endmarkers/Container#`baz_=`(). => var method baz_= (param x$1: Int): Unit +endmarkers/Container#`baz_=`().(x$1) => param x$1: Int +endmarkers/Container#bar. => val method bar Tuple3[Int, Int, Int] +endmarkers/Container#baz(). => var method baz Int +endmarkers/Container#foo(). => method foo => Tuple3[Int, Int, Int] +endmarkers/EndMarkers$package. => final package object endmarkers extends Object { self: .endmarkers.type => +6 decls } +endmarkers/EndMarkers$package.`topLevelVar_=`(). => var method topLevelVar_= (param x$1: String): Unit +endmarkers/EndMarkers$package.`topLevelVar_=`().(x$1) => param x$1: String +endmarkers/EndMarkers$package.topLevelMethod(). => method topLevelMethod => String +endmarkers/EndMarkers$package.topLevelVal. => val method topLevelVal Int +endmarkers/EndMarkers$package.topLevelVar(). => var method topLevelVar String +endmarkers/EndMarkers$package.topLevelWithLocals(). => method topLevelWithLocals => Unit +endmarkers/MultiCtor# => class MultiCtor extends Object { self: MultiCtor => +3 decls } +endmarkers/MultiCtor#``(). => primary ctor (val param i: Int): MultiCtor +endmarkers/MultiCtor#``().(i) => val param i: Int +endmarkers/MultiCtor#``(+1). => ctor (): MultiCtor +endmarkers/MultiCtor#i. => val method i Int +endmarkers/TestObj. => final object TestObj extends Object { self: .TestObj.type => +2 decls } +endmarkers/TestObj.foo(). => method foo => Int +local0 => val local localVal: Int +local1 => var local localVar: Int +local2 => local localDef: => Int Occurrences: [0:8..0:18): endmarkers <- endmarkers/ @@ -750,8 +750,8 @@ Symbols => 2 entries Occurrences => 5 entries Symbols: -endmarkers2/package. => final package object endmarkers2 -endmarkers2/package.Foo# => type Foo +endmarkers2/package. => final package object endmarkers2 extends Object { self: .endmarkers2.type => +2 decls } +endmarkers2/package.Foo# => type Foo = Unit Occurrences: [0:15..0:26): endmarkers2 <- endmarkers2/package. @@ -772,22 +772,22 @@ Symbols => 16 entries Occurrences => 21 entries Symbols: -enumVal/A# => trait A -enumVal/A#``(). => primary ctor -enumVal/Color# => abstract sealed enum class Color -enumVal/Color#``(). => primary ctor -enumVal/Color#``().(rgb) => val param rgb -enumVal/Color#rgb. => val method rgb -enumVal/Color. => final object Color -enumVal/Color.$values. => val method $values -enumVal/Color.Blue. => case val static enum method Blue -enumVal/Color.Green. => case val static enum method Green -enumVal/Color.Red. => case val static enum method Red -enumVal/Color.fromOrdinal(). => method fromOrdinal -enumVal/Color.fromOrdinal().(ordinal) => param ordinal -enumVal/Color.valueOf(). => method valueOf -enumVal/Color.valueOf().($name) => param $name -enumVal/Color.values(). => method values +enumVal/A# => trait A extends Object { self: A => +1 decls } +enumVal/A#``(). => primary ctor (): A +enumVal/Color# => abstract sealed enum class Color extends Object with Enum { self: Color => +2 decls } +enumVal/Color#``(). => primary ctor (val param rgb: Int): Color +enumVal/Color#``().(rgb) => val param rgb: Int +enumVal/Color#rgb. => val method rgb Int +enumVal/Color. => final object Color extends Object { self: .Color.type => +8 decls } +enumVal/Color.$values. => val method $values Array[Color] +enumVal/Color.Blue. => case val static enum method Blue Color +enumVal/Color.Green. => case val static enum method Green Color & A +enumVal/Color.Red. => case val static enum method Red Color +enumVal/Color.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Color +enumVal/Color.fromOrdinal().(ordinal) => param ordinal: Int +enumVal/Color.valueOf(). => method valueOf (param $name: String): Color +enumVal/Color.valueOf().($name) => param $name: String +enumVal/Color.values(). => method values => Array[Color] Occurrences: [0:8..0:15): enumVal <- enumVal/ @@ -824,187 +824,187 @@ Symbols => 181 entries Occurrences => 184 entries Symbols: -_empty_/Enums. => final object Enums -_empty_/Enums.Coin# => abstract sealed enum class Coin -_empty_/Enums.Coin#``(). => primary ctor -_empty_/Enums.Coin#``().(value) => param value -_empty_/Enums.Coin#value. => val method value -_empty_/Enums.Coin. => final object Coin -_empty_/Enums.Coin.$values. => val method $values -_empty_/Enums.Coin.Dime. => case val static enum method Dime -_empty_/Enums.Coin.Dollar. => case val static enum method Dollar -_empty_/Enums.Coin.Nickel. => case val static enum method Nickel -_empty_/Enums.Coin.Penny. => case val static enum method Penny -_empty_/Enums.Coin.Quarter. => case val static enum method Quarter -_empty_/Enums.Coin.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Coin.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Coin.valueOf(). => method valueOf -_empty_/Enums.Coin.valueOf().($name) => param $name -_empty_/Enums.Coin.values(). => method values -_empty_/Enums.Colour# => abstract sealed enum class Colour -_empty_/Enums.Colour#``(). => primary ctor -_empty_/Enums.Colour. => final object Colour -_empty_/Enums.Colour.$new(). => method $new -_empty_/Enums.Colour.$new().($name) => param $name -_empty_/Enums.Colour.$new().(_$ordinal) => param _$ordinal -_empty_/Enums.Colour.$values. => val method $values -_empty_/Enums.Colour.Blue. => case val static enum method Blue -_empty_/Enums.Colour.Green. => case val static enum method Green -_empty_/Enums.Colour.Red. => case val static enum method Red -_empty_/Enums.Colour.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Colour.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Colour.valueOf(). => method valueOf -_empty_/Enums.Colour.valueOf().($name) => param $name -_empty_/Enums.Colour.values(). => method values -_empty_/Enums.Directions# => abstract sealed enum class Directions -_empty_/Enums.Directions#``(). => primary ctor -_empty_/Enums.Directions. => final object Directions -_empty_/Enums.Directions.$new(). => method $new -_empty_/Enums.Directions.$new().($name) => param $name -_empty_/Enums.Directions.$new().(_$ordinal) => param _$ordinal -_empty_/Enums.Directions.$values. => val method $values -_empty_/Enums.Directions.East. => case val static enum method East -_empty_/Enums.Directions.North. => case val static enum method North -_empty_/Enums.Directions.South. => case val static enum method South -_empty_/Enums.Directions.West. => case val static enum method West -_empty_/Enums.Directions.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Directions.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Directions.valueOf(). => method valueOf -_empty_/Enums.Directions.valueOf().($name) => param $name -_empty_/Enums.Directions.values(). => method values -_empty_/Enums.Maybe# => abstract sealed enum class Maybe -_empty_/Enums.Maybe#[A] => covariant typeparam A -_empty_/Enums.Maybe#``(). => primary ctor -_empty_/Enums.Maybe. => final object Maybe -_empty_/Enums.Maybe.Just# => final case enum class Just -_empty_/Enums.Maybe.Just#[A] => covariant typeparam A -_empty_/Enums.Maybe.Just#_1(). => method _1 -_empty_/Enums.Maybe.Just#``(). => primary ctor -_empty_/Enums.Maybe.Just#``().(value) => val param value -_empty_/Enums.Maybe.Just#copy$default$1(). => method copy$default$1 -_empty_/Enums.Maybe.Just#copy$default$1().[A] => typeparam A -_empty_/Enums.Maybe.Just#copy(). => method copy -_empty_/Enums.Maybe.Just#copy().(value) => param value -_empty_/Enums.Maybe.Just#copy().[A] => typeparam A -_empty_/Enums.Maybe.Just#ordinal(). => method ordinal -_empty_/Enums.Maybe.Just#value. => val method value -_empty_/Enums.Maybe.Just. => final object Just -_empty_/Enums.Maybe.Just.apply(). => method apply -_empty_/Enums.Maybe.Just.apply().(value) => param value -_empty_/Enums.Maybe.Just.apply().[A] => typeparam A -_empty_/Enums.Maybe.Just.toString(). => method toString -_empty_/Enums.Maybe.Just.unapply(). => method unapply -_empty_/Enums.Maybe.Just.unapply().(x$1) => param x$1 -_empty_/Enums.Maybe.Just.unapply().[A] => typeparam A -_empty_/Enums.Maybe.None. => case val static enum method None -_empty_/Enums.Maybe.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Maybe.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Planet# => abstract sealed enum class Planet -_empty_/Enums.Planet#G. => final val method G -_empty_/Enums.Planet#``(). => primary ctor -_empty_/Enums.Planet#``().(mass) => param mass -_empty_/Enums.Planet#``().(radius) => param radius -_empty_/Enums.Planet#mass. => val method mass -_empty_/Enums.Planet#radius. => val method radius -_empty_/Enums.Planet#surfaceGravity(). => method surfaceGravity -_empty_/Enums.Planet#surfaceWeight(). => method surfaceWeight -_empty_/Enums.Planet#surfaceWeight().(otherMass) => param otherMass -_empty_/Enums.Planet. => final object Planet -_empty_/Enums.Planet.$values. => val method $values -_empty_/Enums.Planet.Earth. => case val static enum method Earth -_empty_/Enums.Planet.Jupiter. => case val static enum method Jupiter -_empty_/Enums.Planet.Mars. => case val static enum method Mars -_empty_/Enums.Planet.Mercury. => case val static enum method Mercury -_empty_/Enums.Planet.Neptune. => case val static enum method Neptune -_empty_/Enums.Planet.Saturn. => case val static enum method Saturn -_empty_/Enums.Planet.Uranus. => case val static enum method Uranus -_empty_/Enums.Planet.Venus. => case val static enum method Venus -_empty_/Enums.Planet.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Planet.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Planet.valueOf(). => method valueOf -_empty_/Enums.Planet.valueOf().($name) => param $name -_empty_/Enums.Planet.values(). => method values -_empty_/Enums.Suits# => abstract sealed enum class Suits -_empty_/Enums.Suits#``(). => primary ctor -_empty_/Enums.Suits. => final object Suits -_empty_/Enums.Suits.$new(). => method $new -_empty_/Enums.Suits.$new().($name) => param $name -_empty_/Enums.Suits.$new().(_$ordinal) => param _$ordinal -_empty_/Enums.Suits.$values. => val method $values -_empty_/Enums.Suits.Clubs. => case val static enum method Clubs -_empty_/Enums.Suits.Diamonds. => case val static enum method Diamonds -_empty_/Enums.Suits.Hearts. => case val static enum method Hearts -_empty_/Enums.Suits.Spades. => case val static enum method Spades -_empty_/Enums.Suits.derived$CanEqual. => implicit lazy val method derived$CanEqual -_empty_/Enums.Suits.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Suits.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Suits.isBlack(). => method isBlack -_empty_/Enums.Suits.isBlack().(suit) => param suit -_empty_/Enums.Suits.isRed(). => method isRed -_empty_/Enums.Suits.isRed().(suit) => param suit -_empty_/Enums.Suits.valueOf(). => method valueOf -_empty_/Enums.Suits.valueOf().($name) => param $name -_empty_/Enums.Suits.values(). => method values -_empty_/Enums.Tag# => abstract sealed enum class Tag -_empty_/Enums.Tag#[A] => typeparam A -_empty_/Enums.Tag#``(). => primary ctor -_empty_/Enums.Tag. => final object Tag -_empty_/Enums.Tag.$values. => val method $values -_empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag -_empty_/Enums.Tag.IntTag. => case val static enum method IntTag -_empty_/Enums.Tag.fromOrdinal(). => method fromOrdinal -_empty_/Enums.Tag.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.Tag.valueOf(). => method valueOf -_empty_/Enums.Tag.valueOf().($name) => param $name -_empty_/Enums.Tag.values(). => method values -_empty_/Enums.WeekDays# => abstract sealed enum class WeekDays -_empty_/Enums.WeekDays#``(). => primary ctor -_empty_/Enums.WeekDays. => final object WeekDays -_empty_/Enums.WeekDays.$new(). => method $new -_empty_/Enums.WeekDays.$new().($name) => param $name -_empty_/Enums.WeekDays.$new().(_$ordinal) => param _$ordinal -_empty_/Enums.WeekDays.$values. => val method $values -_empty_/Enums.WeekDays.Friday. => case val static enum method Friday -_empty_/Enums.WeekDays.Monday. => case val static enum method Monday -_empty_/Enums.WeekDays.Saturday. => case val static enum method Saturday -_empty_/Enums.WeekDays.Sunday. => case val static enum method Sunday -_empty_/Enums.WeekDays.Thursday. => case val static enum method Thursday -_empty_/Enums.WeekDays.Tuesday. => case val static enum method Tuesday -_empty_/Enums.WeekDays.Wednesday. => case val static enum method Wednesday -_empty_/Enums.WeekDays.fromOrdinal(). => method fromOrdinal -_empty_/Enums.WeekDays.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.WeekDays.valueOf(). => method valueOf -_empty_/Enums.WeekDays.valueOf().($name) => param $name -_empty_/Enums.WeekDays.values(). => method values -_empty_/Enums.`<:<`# => abstract sealed enum class <:< -_empty_/Enums.`<:<`#[A] => contravariant typeparam A -_empty_/Enums.`<:<`#[B] => typeparam B -_empty_/Enums.`<:<`#``(). => primary ctor -_empty_/Enums.`<:<`. => final object <:< -_empty_/Enums.`<:<`.Refl# => final case enum class Refl -_empty_/Enums.`<:<`.Refl#[C] => typeparam C -_empty_/Enums.`<:<`.Refl#``(). => primary ctor -_empty_/Enums.`<:<`.Refl#copy(). => method copy -_empty_/Enums.`<:<`.Refl#copy().[C] => typeparam C -_empty_/Enums.`<:<`.Refl#ordinal(). => method ordinal -_empty_/Enums.`<:<`.Refl. => final object Refl -_empty_/Enums.`<:<`.Refl.apply(). => method apply -_empty_/Enums.`<:<`.Refl.apply().[C] => typeparam C -_empty_/Enums.`<:<`.Refl.toString(). => method toString -_empty_/Enums.`<:<`.Refl.unapply(). => method unapply -_empty_/Enums.`<:<`.Refl.unapply().(x$1) => param x$1 -_empty_/Enums.`<:<`.Refl.unapply().[C] => typeparam C -_empty_/Enums.`<:<`.`given_<:<_T_T`(). => final implicit method given_<:<_T_T -_empty_/Enums.`<:<`.`given_<:<_T_T`().[T] => typeparam T -_empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal -_empty_/Enums.`<:<`.fromOrdinal().(ordinal) => param ordinal -_empty_/Enums.some1. => val method some1 -_empty_/Enums.unwrap(). => method unwrap -_empty_/Enums.unwrap().(ev) => implicit param ev -_empty_/Enums.unwrap().(opt) => param opt -_empty_/Enums.unwrap().[A] => typeparam A -_empty_/Enums.unwrap().[B] => typeparam B -local0 => param x +_empty_/Enums. => final object Enums extends Object { self: .Enums.type => +30 decls } +_empty_/Enums.Coin# => abstract sealed enum class Coin extends Object with Enum { self: Coin => +2 decls } +_empty_/Enums.Coin#``(). => primary ctor (param value: Int): Coin +_empty_/Enums.Coin#``().(value) => param value: Int +_empty_/Enums.Coin#value. => val method value Int +_empty_/Enums.Coin. => final object Coin extends Object { self: .Coin.type => +10 decls } +_empty_/Enums.Coin.$values. => val method $values Array[Coin] +_empty_/Enums.Coin.Dime. => case val static enum method Dime Coin +_empty_/Enums.Coin.Dollar. => case val static enum method Dollar Coin +_empty_/Enums.Coin.Nickel. => case val static enum method Nickel Coin +_empty_/Enums.Coin.Penny. => case val static enum method Penny Coin +_empty_/Enums.Coin.Quarter. => case val static enum method Quarter Coin +_empty_/Enums.Coin.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Coin +_empty_/Enums.Coin.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Coin.valueOf(). => method valueOf (param $name: String): Coin +_empty_/Enums.Coin.valueOf().($name) => param $name: String +_empty_/Enums.Coin.values(). => method values => Array[Coin] +_empty_/Enums.Colour# => abstract sealed enum class Colour extends Object with Enum { self: Colour => +1 decls } +_empty_/Enums.Colour#``(). => primary ctor (): Colour +_empty_/Enums.Colour. => final object Colour extends Object { self: .Colour.type => +9 decls } +_empty_/Enums.Colour.$new(). => method $new (param _$ordinal: Int, param $name: String): Colour +_empty_/Enums.Colour.$new().($name) => param $name: String +_empty_/Enums.Colour.$new().(_$ordinal) => param _$ordinal: Int +_empty_/Enums.Colour.$values. => val method $values Array[Colour] +_empty_/Enums.Colour.Blue. => case val static enum method Blue Colour +_empty_/Enums.Colour.Green. => case val static enum method Green Colour +_empty_/Enums.Colour.Red. => case val static enum method Red Colour +_empty_/Enums.Colour.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Colour +_empty_/Enums.Colour.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Colour.valueOf(). => method valueOf (param $name: String): Colour +_empty_/Enums.Colour.valueOf().($name) => param $name: String +_empty_/Enums.Colour.values(). => method values => Array[Colour] +_empty_/Enums.Directions# => abstract sealed enum class Directions extends Object with Enum { self: Directions => +1 decls } +_empty_/Enums.Directions#``(). => primary ctor (): Directions +_empty_/Enums.Directions. => final object Directions extends Object { self: .Directions.type => +10 decls } +_empty_/Enums.Directions.$new(). => method $new (param _$ordinal: Int, param $name: String): Directions +_empty_/Enums.Directions.$new().($name) => param $name: String +_empty_/Enums.Directions.$new().(_$ordinal) => param _$ordinal: Int +_empty_/Enums.Directions.$values. => val method $values Array[Directions] +_empty_/Enums.Directions.East. => case val static enum method East Directions +_empty_/Enums.Directions.North. => case val static enum method North Directions +_empty_/Enums.Directions.South. => case val static enum method South Directions +_empty_/Enums.Directions.West. => case val static enum method West Directions +_empty_/Enums.Directions.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Directions +_empty_/Enums.Directions.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Directions.valueOf(). => method valueOf (param $name: String): Directions +_empty_/Enums.Directions.valueOf().($name) => param $name: String +_empty_/Enums.Directions.values(). => method values => Array[Directions] +_empty_/Enums.Maybe# => abstract sealed enum class Maybe [covariant typeparam A ] extends Object with Enum { self: Maybe[A] => +2 decls } +_empty_/Enums.Maybe#[A] => covariant typeparam A +_empty_/Enums.Maybe#``(). => primary ctor [unknown A: ](unknown A: ): Maybe[A] +_empty_/Enums.Maybe. => final object Maybe extends Object { self: .Maybe.type => +6 decls } +_empty_/Enums.Maybe.Just# => final case enum class Just [covariant typeparam A ] extends Maybe[A] { self: Just[A] => +7 decls } +_empty_/Enums.Maybe.Just#[A] => covariant typeparam A +_empty_/Enums.Maybe.Just#_1(). => method _1 => A +_empty_/Enums.Maybe.Just#``(). => primary ctor [unknown A: ](unknown A: )(val param value: A): Just[A] +_empty_/Enums.Maybe.Just#``().(value) => val param value: A +_empty_/Enums.Maybe.Just#copy$default$1(). => method copy$default$1 [] => A +_empty_/Enums.Maybe.Just#copy$default$1().[A] => typeparam A +_empty_/Enums.Maybe.Just#copy(). => method copy [typeparam A ](typeparam A )(param value: A): Just[A] +_empty_/Enums.Maybe.Just#copy().(value) => param value: A +_empty_/Enums.Maybe.Just#copy().[A] => typeparam A +_empty_/Enums.Maybe.Just#ordinal(). => method ordinal => Int +_empty_/Enums.Maybe.Just#value. => val method value A +_empty_/Enums.Maybe.Just. => final object Just extends Object { self: .Just.type => +4 decls } +_empty_/Enums.Maybe.Just.apply(). => method apply [typeparam A ](typeparam A )(param value: A): Just[A] +_empty_/Enums.Maybe.Just.apply().(value) => param value: A +_empty_/Enums.Maybe.Just.apply().[A] => typeparam A +_empty_/Enums.Maybe.Just.toString(). => method toString => String +_empty_/Enums.Maybe.Just.unapply(). => method unapply [typeparam A ](typeparam A )(param x$1: Just[A]): Just[A] +_empty_/Enums.Maybe.Just.unapply().(x$1) => param x$1: Just[A] +_empty_/Enums.Maybe.Just.unapply().[A] => typeparam A +_empty_/Enums.Maybe.None. => case val static enum method None Maybe[Nothing] +_empty_/Enums.Maybe.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Maybe[] +_empty_/Enums.Maybe.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Planet# => abstract sealed enum class Planet extends Enum[Planet] with Enum { self: Planet => +6 decls } +_empty_/Enums.Planet#G. => final val method G 6.673E-11 +_empty_/Enums.Planet#``(). => primary ctor (param mass: Double, param radius: Double): Planet +_empty_/Enums.Planet#``().(mass) => param mass: Double +_empty_/Enums.Planet#``().(radius) => param radius: Double +_empty_/Enums.Planet#mass. => val method mass Double +_empty_/Enums.Planet#radius. => val method radius Double +_empty_/Enums.Planet#surfaceGravity(). => method surfaceGravity => Double +_empty_/Enums.Planet#surfaceWeight(). => method surfaceWeight (param otherMass: Double): Double +_empty_/Enums.Planet#surfaceWeight().(otherMass) => param otherMass: Double +_empty_/Enums.Planet. => final object Planet extends Object { self: .Planet.type => +13 decls } +_empty_/Enums.Planet.$values. => val method $values Array[Planet] +_empty_/Enums.Planet.Earth. => case val static enum method Earth Planet +_empty_/Enums.Planet.Jupiter. => case val static enum method Jupiter Planet +_empty_/Enums.Planet.Mars. => case val static enum method Mars Planet +_empty_/Enums.Planet.Mercury. => case val static enum method Mercury Planet +_empty_/Enums.Planet.Neptune. => case val static enum method Neptune Planet +_empty_/Enums.Planet.Saturn. => case val static enum method Saturn Planet +_empty_/Enums.Planet.Uranus. => case val static enum method Uranus Planet +_empty_/Enums.Planet.Venus. => case val static enum method Venus Planet +_empty_/Enums.Planet.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Planet +_empty_/Enums.Planet.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Planet.valueOf(). => method valueOf (param $name: String): Planet +_empty_/Enums.Planet.valueOf().($name) => param $name: String +_empty_/Enums.Planet.values(). => method values => Array[Planet] +_empty_/Enums.Suits# => abstract sealed enum class Suits extends Object with Enum { self: Suits => +1 decls } +_empty_/Enums.Suits#``(). => primary ctor (): Suits +_empty_/Enums.Suits. => final object Suits extends Object { self: .Suits.type => +13 decls } +_empty_/Enums.Suits.$new(). => method $new (param _$ordinal: Int, param $name: String): Suits +_empty_/Enums.Suits.$new().($name) => param $name: String +_empty_/Enums.Suits.$new().(_$ordinal) => param _$ordinal: Int +_empty_/Enums.Suits.$values. => val method $values Array[Suits] +_empty_/Enums.Suits.Clubs. => case val static enum method Clubs Suits +_empty_/Enums.Suits.Diamonds. => case val static enum method Diamonds Suits +_empty_/Enums.Suits.Hearts. => case val static enum method Hearts Suits +_empty_/Enums.Suits.Spades. => case val static enum method Spades Suits +_empty_/Enums.Suits.derived$CanEqual. => implicit lazy val method derived$CanEqual CanEqual[Suits, Suits] +_empty_/Enums.Suits.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Suits +_empty_/Enums.Suits.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Suits.isBlack(). => method isBlack (param suit: Suits): Boolean +_empty_/Enums.Suits.isBlack().(suit) => param suit: Suits +_empty_/Enums.Suits.isRed(). => method isRed (param suit: Suits): Boolean +_empty_/Enums.Suits.isRed().(suit) => param suit: Suits +_empty_/Enums.Suits.valueOf(). => method valueOf (param $name: String): Suits +_empty_/Enums.Suits.valueOf().($name) => param $name: String +_empty_/Enums.Suits.values(). => method values => Array[Suits] +_empty_/Enums.Tag# => abstract sealed enum class Tag [typeparam A ] extends Object with Enum { self: Tag[A] => +2 decls } +_empty_/Enums.Tag#[A] => typeparam A +_empty_/Enums.Tag#``(). => primary ctor [unknown A: ](unknown A: ): Tag[A] +_empty_/Enums.Tag. => final object Tag extends Object { self: .Tag.type => +7 decls } +_empty_/Enums.Tag.$values. => val method $values Array[Tag[]] +_empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag Tag[Boolean] +_empty_/Enums.Tag.IntTag. => case val static enum method IntTag Tag[Int] +_empty_/Enums.Tag.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Tag[] +_empty_/Enums.Tag.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.Tag.valueOf(). => method valueOf (param $name: String): Tag[] +_empty_/Enums.Tag.valueOf().($name) => param $name: String +_empty_/Enums.Tag.values(). => method values => Array[Tag[]] +_empty_/Enums.WeekDays# => abstract sealed enum class WeekDays extends Object with Enum { self: WeekDays => +1 decls } +_empty_/Enums.WeekDays#``(). => primary ctor (): WeekDays +_empty_/Enums.WeekDays. => final object WeekDays extends Object { self: .WeekDays.type => +13 decls } +_empty_/Enums.WeekDays.$new(). => method $new (param _$ordinal: Int, param $name: String): WeekDays +_empty_/Enums.WeekDays.$new().($name) => param $name: String +_empty_/Enums.WeekDays.$new().(_$ordinal) => param _$ordinal: Int +_empty_/Enums.WeekDays.$values. => val method $values Array[WeekDays] +_empty_/Enums.WeekDays.Friday. => case val static enum method Friday WeekDays +_empty_/Enums.WeekDays.Monday. => case val static enum method Monday WeekDays +_empty_/Enums.WeekDays.Saturday. => case val static enum method Saturday WeekDays +_empty_/Enums.WeekDays.Sunday. => case val static enum method Sunday WeekDays +_empty_/Enums.WeekDays.Thursday. => case val static enum method Thursday WeekDays +_empty_/Enums.WeekDays.Tuesday. => case val static enum method Tuesday WeekDays +_empty_/Enums.WeekDays.Wednesday. => case val static enum method Wednesday WeekDays +_empty_/Enums.WeekDays.fromOrdinal(). => method fromOrdinal (param ordinal: Int): WeekDays +_empty_/Enums.WeekDays.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.WeekDays.valueOf(). => method valueOf (param $name: String): WeekDays +_empty_/Enums.WeekDays.valueOf().($name) => param $name: String +_empty_/Enums.WeekDays.values(). => method values => Array[WeekDays] +_empty_/Enums.`<:<`# => abstract sealed enum class <:< [contravariant typeparam A , typeparam B ] extends Object with Enum { self: <:<[A, B] => +3 decls } +_empty_/Enums.`<:<`#[A] => contravariant typeparam A +_empty_/Enums.`<:<`#[B] => typeparam B +_empty_/Enums.`<:<`#``(). => primary ctor [unknown A: , unknown B: ](unknown A: , unknown B: ): <:<[A, B] +_empty_/Enums.`<:<`. => final object <:< extends Object { self: .<:<.type => +6 decls } +_empty_/Enums.`<:<`.Refl# => final case enum class Refl [typeparam C ] extends <:<[C, C] { self: Refl[C] => +4 decls } +_empty_/Enums.`<:<`.Refl#[C] => typeparam C +_empty_/Enums.`<:<`.Refl#``(). => primary ctor [unknown C: ](unknown C: ): Refl[C] +_empty_/Enums.`<:<`.Refl#copy(). => method copy [typeparam C ](typeparam C ): Refl[C] +_empty_/Enums.`<:<`.Refl#copy().[C] => typeparam C +_empty_/Enums.`<:<`.Refl#ordinal(). => method ordinal => Int +_empty_/Enums.`<:<`.Refl. => final object Refl extends Object { self: .Refl.type => +4 decls } +_empty_/Enums.`<:<`.Refl.apply(). => method apply [typeparam C ](typeparam C ): Refl[C] +_empty_/Enums.`<:<`.Refl.apply().[C] => typeparam C +_empty_/Enums.`<:<`.Refl.toString(). => method toString => String +_empty_/Enums.`<:<`.Refl.unapply(). => method unapply [typeparam C ](typeparam C )(param x$1: Refl[C]): true +_empty_/Enums.`<:<`.Refl.unapply().(x$1) => param x$1: Refl[C] +_empty_/Enums.`<:<`.Refl.unapply().[C] => typeparam C +_empty_/Enums.`<:<`.`given_<:<_T_T`(). => final implicit method given_<:<_T_T [] => <:<[T, T] +_empty_/Enums.`<:<`.`given_<:<_T_T`().[T] => typeparam T +_empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal (param ordinal: Int): <:<[, ] +_empty_/Enums.`<:<`.fromOrdinal().(ordinal) => param ordinal: Int +_empty_/Enums.some1. => val method some1 Option[Int] +_empty_/Enums.unwrap(). => method unwrap [typeparam A , typeparam B ](typeparam A , typeparam B )(param opt: Option[A])(implicit param ev: <:<[A, Option[B]]): +_empty_/Enums.unwrap().(ev) => implicit param ev: <:<[A, Option[B]] +_empty_/Enums.unwrap().(opt) => param opt: Option[A] +_empty_/Enums.unwrap().[A] => typeparam A +_empty_/Enums.unwrap().[B] => typeparam B +local0 => param x: Option[B] Occurrences: [0:7..0:12): Enums <- _empty_/Enums. @@ -1204,9 +1204,9 @@ Symbols => 3 entries Occurrences => 12 entries Symbols: -example/EtaExpansion# => class EtaExpansion -example/EtaExpansion#``(). => primary ctor -local0 => param x +example/EtaExpansion# => class EtaExpansion extends Object { self: EtaExpansion => +1 decls } +example/EtaExpansion#``(). => primary ctor (): EtaExpansion +local0 => param x: Int Occurrences: [0:8..0:15): example <- example/ @@ -1234,11 +1234,11 @@ Symbols => 5 entries Occurrences => 25 entries Symbols: -example/Example. => final object Example -example/Example.main(). => method main -example/Example.main().(args) => param args -example/Example.x. => val method x -local0 => selfparam self +example/Example. => final object Example extends Object { self: .Example.type => +3 decls } +example/Example.main(). => method main (param args: Array[String]): Unit +example/Example.main().(args) => param args: Array[String] +example/Example.x. => val method x ClassTag[Int] +local0 => selfparam self: .Example.type Occurrences: [0:8..0:15): example <- example/ @@ -1279,14 +1279,14 @@ Symbols => 8 entries Occurrences => 18 entries Symbols: -ext/Extension$package. => final package object ext -ext/Extension$package.`#*#`(). => method #*# -ext/Extension$package.`#*#`().(i) => param i -ext/Extension$package.`#*#`().(s) => param s -ext/Extension$package.a. => val method a -ext/Extension$package.c. => val method c -ext/Extension$package.foo(). => method foo -ext/Extension$package.foo().(s) => param s +ext/Extension$package. => final package object ext extends Object { self: .ext.type => +5 decls } +ext/Extension$package.`#*#`(). => method #*# (param s: String)(param i: Int): +ext/Extension$package.`#*#`().(i) => param i: Int +ext/Extension$package.`#*#`().(s) => param s: String +ext/Extension$package.a. => val method a Int +ext/Extension$package.c. => val method c Tuple2[String, Int] +ext/Extension$package.foo(). => method foo (param s: String): Int +ext/Extension$package.foo().(s) => param s: String Occurrences: [0:8..0:11): ext <- ext/ @@ -1320,19 +1320,19 @@ Symbols => 13 entries Occurrences => 88 entries Symbols: -example/ForComprehension# => class ForComprehension -example/ForComprehension#``(). => primary ctor -local0 => param a -local1 => param b -local2 => val local c -local3 => param x$1 -local4 => param a -local5 => param b -local6 => param x$1 -local7 => val local c -local8 => val local d -local9 => val local e -local10 => param f +example/ForComprehension# => class ForComprehension extends Object { self: ForComprehension => +1 decls } +example/ForComprehension#``(). => primary ctor (): ForComprehension +local0 => param a: Int +local1 => param b: Int +local2 => val local c: Int +local3 => param x$1: Tuple2[Int, Int] +local4 => param a: Int +local5 => param b: Int +local6 => param x$1: Tuple2[Int, Int] +local7 => val local c: Int +local8 => val local d: Int +local9 => val local e: Tuple4[Int, Int, Int, Int] +local10 => param f: Tuple4[Int, Int, Int, Int] Occurrences: [0:8..0:15): example <- example/ @@ -1436,35 +1436,35 @@ Symbols => 29 entries Occurrences => 70 entries Symbols: -a/b/Givens. => final object Givens -a/b/Givens.Monoid# => trait Monoid -a/b/Givens.Monoid#[A] => typeparam A -a/b/Givens.Monoid#``(). => primary ctor -a/b/Givens.Monoid#combine(). => abstract method combine -a/b/Givens.Monoid#combine().(x) => param x -a/b/Givens.Monoid#combine().(y) => param y -a/b/Givens.Monoid#empty(). => abstract method empty -a/b/Givens.foo(). => method foo -a/b/Givens.foo().(A) => implicit param A -a/b/Givens.foo().[A] => typeparam A -a/b/Givens.given_Monoid_String. => final implicit object given_Monoid_String -a/b/Givens.given_Monoid_String.combine(). => method combine -a/b/Givens.given_Monoid_String.combine().(x) => param x -a/b/Givens.given_Monoid_String.combine().(y) => param y -a/b/Givens.given_Monoid_String.empty(). => method empty -a/b/Givens.goodbye1. => val method goodbye1 -a/b/Givens.hello1. => val method hello1 -a/b/Givens.int2String(). => final implicit macro int2String -a/b/Givens.sayGoodbye(). => method sayGoodbye -a/b/Givens.sayGoodbye().(any) => param any -a/b/Givens.sayGoodbye().[B] => typeparam B -a/b/Givens.sayHello(). => method sayHello -a/b/Givens.sayHello().(any) => param any -a/b/Givens.sayHello().[A] => typeparam A -a/b/Givens.saySoLong(). => method saySoLong -a/b/Givens.saySoLong().(any) => param any -a/b/Givens.saySoLong().[B] => typeparam B -a/b/Givens.soLong1. => val method soLong1 +a/b/Givens. => final object Givens extends Object { self: .Givens.type => +12 decls } +a/b/Givens.Monoid# => trait Monoid [typeparam A ] extends Object { self: Monoid[A] => +4 decls } +a/b/Givens.Monoid#[A] => typeparam A +a/b/Givens.Monoid#``(). => primary ctor [unknown A: ](unknown A: ): Monoid[A] +a/b/Givens.Monoid#combine(). => abstract method combine (param x: A)(param y: A): +a/b/Givens.Monoid#combine().(x) => param x: A +a/b/Givens.Monoid#combine().(y) => param y: A +a/b/Givens.Monoid#empty(). => abstract method empty => A +a/b/Givens.foo(). => method foo [typeparam A ](typeparam A )(implicit param A: Monoid[A]): A +a/b/Givens.foo().(A) => implicit param A: Monoid[A] +a/b/Givens.foo().[A] => typeparam A +a/b/Givens.given_Monoid_String. => final implicit object given_Monoid_String extends Object with Monoid[String] { self: .given_Monoid_String.type => +3 decls } +a/b/Givens.given_Monoid_String.combine(). => method combine (param x: String)(param y: String): +a/b/Givens.given_Monoid_String.combine().(x) => param x: String +a/b/Givens.given_Monoid_String.combine().(y) => param y: String +a/b/Givens.given_Monoid_String.empty(). => method empty => String +a/b/Givens.goodbye1. => val method goodbye1 String +a/b/Givens.hello1. => val method hello1 String +a/b/Givens.int2String(). => final implicit macro int2String => Conversion[Int, String] +a/b/Givens.sayGoodbye(). => method sayGoodbye [typeparam B ](typeparam B )(param any: B): String +a/b/Givens.sayGoodbye().(any) => param any: B +a/b/Givens.sayGoodbye().[B] => typeparam B +a/b/Givens.sayHello(). => method sayHello [typeparam A ](typeparam A )(param any: A): String +a/b/Givens.sayHello().(any) => param any: A +a/b/Givens.sayHello().[A] => typeparam A +a/b/Givens.saySoLong(). => method saySoLong [typeparam B ](typeparam B )(param any: B): String +a/b/Givens.saySoLong().(any) => param any: B +a/b/Givens.saySoLong().[B] => typeparam B +a/b/Givens.soLong1. => val method soLong1 String Occurrences: [0:8..0:9): a <- a/ @@ -1550,29 +1550,29 @@ Symbols => 23 entries Occurrences => 62 entries Symbols: -example/ImplicitConversion# => class ImplicitConversion -example/ImplicitConversion#``(). => primary ctor -example/ImplicitConversion#a. => val method a -example/ImplicitConversion#b. => val method b -example/ImplicitConversion#char. => val method char -example/ImplicitConversion#message. => val method message -example/ImplicitConversion#number. => val method number -example/ImplicitConversion#string2Number(). => implicit method string2Number -example/ImplicitConversion#string2Number().(string) => param string -example/ImplicitConversion#tuple. => val method tuple -example/ImplicitConversion#x. => val method x -example/ImplicitConversion. => final object ImplicitConversion -example/ImplicitConversion.newAny2stringadd# => final class newAny2stringadd -example/ImplicitConversion.newAny2stringadd#[A] => typeparam A -example/ImplicitConversion.newAny2stringadd#`+`(). => method + -example/ImplicitConversion.newAny2stringadd#`+`().(other) => param other -example/ImplicitConversion.newAny2stringadd#``(). => primary ctor -example/ImplicitConversion.newAny2stringadd#``().(self) => param self -example/ImplicitConversion.newAny2stringadd#self. => val method self -example/ImplicitConversion.newAny2stringadd(). => final implicit method newAny2stringadd -example/ImplicitConversion.newAny2stringadd().(self) => param self -example/ImplicitConversion.newAny2stringadd().[A] => typeparam A -example/ImplicitConversion.newAny2stringadd. => final object newAny2stringadd +example/ImplicitConversion# => class ImplicitConversion extends Object { self: ImplicitConversion => +9 decls } +example/ImplicitConversion#``(). => primary ctor (): ImplicitConversion +example/ImplicitConversion#a. => val method a Int +example/ImplicitConversion#b. => val method b Long +example/ImplicitConversion#char. => val method char Char +example/ImplicitConversion#message. => val method message String +example/ImplicitConversion#number. => val method number Int +example/ImplicitConversion#string2Number(). => implicit method string2Number (param string: String): Int +example/ImplicitConversion#string2Number().(string) => param string: String +example/ImplicitConversion#tuple. => val method tuple Tuple2[Int, Int] +example/ImplicitConversion#x. => val method x Int +example/ImplicitConversion. => final object ImplicitConversion extends Object { self: .ImplicitConversion.type => +6 decls } +example/ImplicitConversion.newAny2stringadd# => final class newAny2stringadd [typeparam A ] extends AnyVal { self: newAny2stringadd[A] => +4 decls } +example/ImplicitConversion.newAny2stringadd#[A] => typeparam A +example/ImplicitConversion.newAny2stringadd#`+`(). => method + (param other: String): String +example/ImplicitConversion.newAny2stringadd#`+`().(other) => param other: String +example/ImplicitConversion.newAny2stringadd#``(). => primary ctor [unknown A: ](unknown A: )(param self: A): newAny2stringadd[A] +example/ImplicitConversion.newAny2stringadd#``().(self) => param self: A +example/ImplicitConversion.newAny2stringadd#self. => val method self A +example/ImplicitConversion.newAny2stringadd(). => final implicit method newAny2stringadd [typeparam A ](typeparam A )(param self: A): newAny2stringadd[A] +example/ImplicitConversion.newAny2stringadd().(self) => param self: A +example/ImplicitConversion.newAny2stringadd().[A] => typeparam A +example/ImplicitConversion.newAny2stringadd. => final object newAny2stringadd extends Object { self: .newAny2stringadd.type => +2 decls } Occurrences: [0:8..0:15): example <- example/ @@ -1669,14 +1669,14 @@ Symbols => 8 entries Occurrences => 55 entries Symbols: -example/InstrumentTyper# => class InstrumentTyper -example/InstrumentTyper#AnnotatedType# => type AnnotatedType -example/InstrumentTyper#``(). => primary ctor -example/InstrumentTyper#all(). => method all -example/InstrumentTyper#clazzOf. => final val method clazzOf -example/InstrumentTyper#singletonType(). => method singletonType -example/InstrumentTyper#singletonType().(x) => param x -local0 => selfparam self +example/InstrumentTyper# => class InstrumentTyper extends Object { self: AnyRef & InstrumentTyper => +5 decls } +example/InstrumentTyper#AnnotatedType# => type AnnotatedType = Int @param +example/InstrumentTyper#``(). => primary ctor (): InstrumentTyper +example/InstrumentTyper#all(). => method all => List[Matchable] +example/InstrumentTyper#clazzOf. => final val method clazzOf Option[Int] +example/InstrumentTyper#singletonType(). => method singletonType (param x: .Predef.type): Nothing +example/InstrumentTyper#singletonType().(x) => param x: .Predef.type +local0 => selfparam self: AnyRef Occurrences: [0:8..0:15): example <- example/ @@ -1747,51 +1747,51 @@ Symbols => 45 entries Occurrences => 72 entries Symbols: -givens/InventedNames$package. => final package object givens -givens/InventedNames$package.`* *`. => final implicit lazy val method * * -givens/InventedNames$package.a. => val method a -givens/InventedNames$package.b. => val method b -givens/InventedNames$package.c. => val method c -givens/InventedNames$package.d. => val method d -givens/InventedNames$package.e. => val method e -givens/InventedNames$package.f. => val method f -givens/InventedNames$package.g. => val method g -givens/InventedNames$package.given_Char. => final implicit lazy val method given_Char -givens/InventedNames$package.given_Double(). => final implicit method given_Double -givens/InventedNames$package.given_Double().(x$1) => implicit param x$1 -givens/InventedNames$package.given_Float. => final implicit lazy val method given_Float -givens/InventedNames$package.given_List_T(). => final implicit method given_List_T -givens/InventedNames$package.given_List_T().[T] => typeparam T -givens/InventedNames$package.given_String. => final implicit lazy val method given_String -givens/InventedNames$package.given_X. => final implicit object given_X -givens/InventedNames$package.given_X.doX(). => method doX -givens/InventedNames$package.given_Y# => class given_Y -givens/InventedNames$package.given_Y#``(). => primary ctor -givens/InventedNames$package.given_Y#``().(x$1) => implicit val param x$1 -givens/InventedNames$package.given_Y#doY(). => method doY -givens/InventedNames$package.given_Y#x$1. => implicit val method x$1 -givens/InventedNames$package.given_Y(). => final implicit method given_Y -givens/InventedNames$package.given_Y().(x$1) => implicit param x$1 -givens/InventedNames$package.given_Z_T# => class given_Z_T -givens/InventedNames$package.given_Z_T#[T] => typeparam T -givens/InventedNames$package.given_Z_T#``(). => primary ctor -givens/InventedNames$package.given_Z_T#doZ(). => method doZ -givens/InventedNames$package.given_Z_T(). => final implicit method given_Z_T -givens/InventedNames$package.given_Z_T().[T] => typeparam T -givens/InventedNames$package.intValue. => final implicit lazy val method intValue -givens/InventedNames$package.x. => val method x -givens/InventedNames$package.y. => val method y -givens/InventedNames$package.z. => val method z -givens/X# => trait X -givens/X#``(). => primary ctor -givens/X#doX(). => abstract method doX -givens/Y# => trait Y -givens/Y#``(). => primary ctor -givens/Y#doY(). => abstract method doY -givens/Z# => trait Z -givens/Z#[T] => typeparam T -givens/Z#``(). => primary ctor -givens/Z#doZ(). => abstract method doZ +givens/InventedNames$package. => final package object givens extends Object { self: .givens.type => +24 decls } +givens/InventedNames$package.`* *`. => final implicit lazy val method * * Long +givens/InventedNames$package.a. => val method a Int +givens/InventedNames$package.b. => val method b String +givens/InventedNames$package.c. => val method c Double +givens/InventedNames$package.d. => val method d List[Int] +givens/InventedNames$package.e. => val method e Char +givens/InventedNames$package.f. => val method f Float +givens/InventedNames$package.g. => val method g Long +givens/InventedNames$package.given_Char. => final implicit lazy val method given_Char Char +givens/InventedNames$package.given_Double(). => final implicit method given_Double (implicit param x$1: Int): Double +givens/InventedNames$package.given_Double().(x$1) => implicit param x$1: Int +givens/InventedNames$package.given_Float. => final implicit lazy val method given_Float Float +givens/InventedNames$package.given_List_T(). => final implicit method given_List_T [] => List[T] +givens/InventedNames$package.given_List_T().[T] => typeparam T +givens/InventedNames$package.given_String. => final implicit lazy val method given_String String +givens/InventedNames$package.given_X. => final implicit object given_X extends Object with X { self: .given_X.type => +2 decls } +givens/InventedNames$package.given_X.doX(). => method doX => Int +givens/InventedNames$package.given_Y# => class given_Y extends Object with Y { self: given_Y => +3 decls } +givens/InventedNames$package.given_Y#``(). => primary ctor (implicit val param x$1: X): +givens/InventedNames$package.given_Y#``().(x$1) => implicit val param x$1: X +givens/InventedNames$package.given_Y#doY(). => method doY => String +givens/InventedNames$package.given_Y#x$1. => implicit val method x$1 X +givens/InventedNames$package.given_Y(). => final implicit method given_Y (implicit param x$1: X): given_Y +givens/InventedNames$package.given_Y().(x$1) => implicit param x$1: X +givens/InventedNames$package.given_Z_T# => class given_Z_T [typeparam T ] extends Object with Z[T] { self: given_Z_T[T] => +3 decls } +givens/InventedNames$package.given_Z_T#[T] => typeparam T +givens/InventedNames$package.given_Z_T#``(). => primary ctor [unknown T: ](unknown T: ): given_Z_T[T] +givens/InventedNames$package.given_Z_T#doZ(). => method doZ => List[T] +givens/InventedNames$package.given_Z_T(). => final implicit method given_Z_T [] => given_Z_T[T] +givens/InventedNames$package.given_Z_T().[T] => typeparam T +givens/InventedNames$package.intValue. => final implicit lazy val method intValue Int +givens/InventedNames$package.x. => val method x .given_X.type +givens/InventedNames$package.y. => val method y given_Y +givens/InventedNames$package.z. => val method z given_Z_T[String] +givens/X# => trait X extends Object { self: X => +2 decls } +givens/X#``(). => primary ctor (): X +givens/X#doX(). => abstract method doX => Int +givens/Y# => trait Y extends Object { self: Y => +2 decls } +givens/Y#``(). => primary ctor (): Y +givens/Y#doY(). => abstract method doY => String +givens/Z# => trait Z [typeparam T ] extends Object { self: Z[T] => +3 decls } +givens/Z#[T] => typeparam T +givens/Z#``(). => primary ctor [unknown T: ](unknown T: ): Z[T] +givens/Z#doZ(). => abstract method doZ => List[T] Occurrences: [0:8..0:14): givens <- givens/ @@ -1879,13 +1879,13 @@ Symbols => 7 entries Occurrences => 30 entries Symbols: -example/Issue1749# => class Issue1749 -example/Issue1749#``(). => primary ctor -example/Issue1749#x1. => val method x1 -example/Issue1749#x2. => val method x2 -example/Issue1854# => class Issue1854 -example/Issue1854#``(). => primary ctor -example/Issue1854#map. => val method map +example/Issue1749# => class Issue1749 extends Object { self: Issue1749 => +3 decls } +example/Issue1749#``(). => primary ctor (): Issue1749 +example/Issue1749#x1. => val method x1 Int +example/Issue1749#x2. => val method x2 Int +example/Issue1854# => class Issue1854 extends Object { self: Issue1854 => +2 decls } +example/Issue1854#``(). => primary ctor (): Issue1854 +example/Issue1854#map. => val method map Map[String, String] Occurrences: [1:8..1:15): example <- example/ @@ -1931,12 +1931,12 @@ Symbols => 6 entries Occurrences => 11 entries Symbols: -example/Local# => class Local -example/Local#``(). => primary ctor -example/Local#a(). => method a -local0 => local id -local1 => typeparam A -local2 => param a +example/Local# => class Local extends Object { self: Local => +2 decls } +example/Local#``(). => primary ctor (): Local +example/Local#a(). => method a (): Int +local0 => local id: [typeparam A ](typeparam A )(param a: A): A +local1 => typeparam A +local2 => param a: A Occurrences: [0:8..0:15): example <- example/ @@ -1963,9 +1963,9 @@ Symbols => 3 entries Occurrences => 7 entries Symbols: -local0 => val local x -locals/Test. => final object Test -locals/Test.xs. => val method xs +local0 => val local x: Int +locals/Test. => final object Test extends Object { self: .Test.type => +2 decls } +locals/Test.xs. => val method xs List[Int] Occurrences: [0:8..0:14): locals <- locals/ @@ -1988,16 +1988,16 @@ Symbols => 10 entries Occurrences => 72 entries Symbols: -example/MetacJava# => class MetacJava -example/MetacJava#``(). => primary ctor -example/MetacJava#coin. => val method coin -example/MetacJava#entry. => val method entry -example/MetacJava#inner. => val method inner -example/MetacJava#interface. => val method interface -example/MetacJava#nonStatic. => val method nonStatic -example/MetacJava#overload1. => val method overload1 -example/MetacJava#overload2. => val method overload2 -example/MetacJava#staticInner. => val method staticInner +example/MetacJava# => class MetacJava extends Object { self: MetacJava => +9 decls } +example/MetacJava#``(). => primary ctor (): MetacJava +example/MetacJava#coin. => val method coin Coin +example/MetacJava#entry. => val method entry Entry[Int, Int] +example/MetacJava#inner. => val method inner MetacJava +example/MetacJava#interface. => val method interface Interface +example/MetacJava#nonStatic. => val method nonStatic .staticInner.NonStatic +example/MetacJava#overload1. => val method overload1 .inner.Overload1 +example/MetacJava#overload2. => val method overload2 .inner.Overload2 +example/MetacJava#staticInner. => val method staticInner StaticInner Occurrences: [0:8..0:15): example <- example/ @@ -2085,9 +2085,9 @@ Symbols => 3 entries Occurrences => 85 entries Symbols: -example/MethodUsages# => class MethodUsages -example/MethodUsages#``(). => primary ctor -example/MethodUsages#m. => val method m +example/MethodUsages# => class MethodUsages extends Object { self: MethodUsages => +2 decls } +example/MethodUsages#``(). => primary ctor (): MethodUsages +example/MethodUsages#m. => val method m Methods[Int] Occurrences: [0:8..0:15): example <- example/ @@ -2188,83 +2188,83 @@ Symbols => 77 entries Occurrences => 149 entries Symbols: -example/Methods# => class Methods -example/Methods#AList# => type AList -example/Methods#AList#[T] => typeparam T -example/Methods#List# => class List -example/Methods#List#[T] => typeparam T -example/Methods#List#``(). => primary ctor -example/Methods#[T] => typeparam T -example/Methods#``(). => primary ctor -example/Methods#`m8().`(). => method m8(). -example/Methods#`m9().`# => class m9(). -example/Methods#`m9().`#``(). => primary ctor -example/Methods#`m20_=`(). => var method m20_= -example/Methods#`m20_=`().(x$1) => param x$1 -example/Methods#m1(). => method m1 -example/Methods#m2(). => method m2 -example/Methods#m3(). => method m3 -example/Methods#m3().(x) => param x -example/Methods#m4(). => method m4 -example/Methods#m4().(x) => param x -example/Methods#m4().(y) => param y -example/Methods#m5(). => method m5 -example/Methods#m5().(x) => param x -example/Methods#m5(+1). => method m5 -example/Methods#m5(+1).(x) => param x -example/Methods#m6(). => method m6 -example/Methods#m6().(x) => param x -example/Methods#m6(+1). => method m6 -example/Methods#m6(+1).(x) => param x -example/Methods#m6(+2). => method m6 -example/Methods#m6(+2).(x) => param x -example/Methods#m7(). => method m7 -example/Methods#m7().(c) => param c -example/Methods#m7().(l) => param l -example/Methods#m7().[U] => typeparam U -example/Methods#m9(). => method m9 -example/Methods#m9().(x) => param x -example/Methods#m10(). => method m10 -example/Methods#m10().(x) => param x -example/Methods#m11(). => method m11 -example/Methods#m11().(x) => param x -example/Methods#m11(+1). => method m11 -example/Methods#m11(+1).(x) => param x -example/Methods#m12a(). => method m12a -example/Methods#m12a().(x) => param x -example/Methods#m12b(). => method m12b -example/Methods#m12b().(x) => param x -example/Methods#m13(). => method m13 -example/Methods#m13().(x) => param x -example/Methods#m15(). => method m15 -example/Methods#m15().(x) => param x -example/Methods#m16(). => method m16 -example/Methods#m16().(x) => param x -example/Methods#m17(). => method m17 -example/Methods#m17().(a) => param a -example/Methods#m17(+1). => method m17 -example/Methods#m17(+1).(b) => param b -example/Methods#m17. => final object m17 -example/Methods#m17.m(). => method m -example/Methods#m18(). => method m18 -example/Methods#m18().(a) => param a -example/Methods#m18(+1). => method m18 -example/Methods#m18(+1).(b) => param b -example/Methods#m18. => val method m18 -example/Methods#m19$default$2(). => method m19$default$2 -example/Methods#m19$default$3(). => method m19$default$3 -example/Methods#m19$default$3().(x) => param x -example/Methods#m19$default$3().(y) => param y -example/Methods#m19(). => method m19 -example/Methods#m19().(x) => param x -example/Methods#m19().(y) => param y -example/Methods#m19().(z) => param z -example/Methods#m20(). => method m20 -example/Methods#m20().(a) => param a -example/Methods#m20(+1). => method m20 -example/Methods#m20(+1).(b) => param b -example/Methods#m20(+2). => var method m20 -local1 => abstract val method x +example/Methods# => class Methods [typeparam T ] extends Object { self: Methods[T] => +43 decls } +example/Methods#AList# => type AList [typeparam T ] = List[] +example/Methods#AList#[T] => typeparam T +example/Methods#List# => class List [typeparam T ] extends Object { self: List[T] => +2 decls } +example/Methods#List#[T] => typeparam T +example/Methods#List#``(). => primary ctor [unknown T: ](unknown T: ): List[T] +example/Methods#[T] => typeparam T +example/Methods#``(). => primary ctor [unknown T: ](unknown T: ): Methods[T] +example/Methods#`m8().`(). => method m8(). (): Nothing +example/Methods#`m9().`# => class m9(). extends Object { self: m9(). => +1 decls } +example/Methods#`m9().`#``(). => primary ctor (): m9(). +example/Methods#`m20_=`(). => var method m20_= (param x$1: .m17.type): Unit +example/Methods#`m20_=`().(x$1) => param x$1: .m17.type +example/Methods#m1(). => method m1 => Nothing +example/Methods#m2(). => method m2 (): Nothing +example/Methods#m3(). => method m3 (param x: Int): Nothing +example/Methods#m3().(x) => param x: Int +example/Methods#m4(). => method m4 (param x: Int)(param y: Int): +example/Methods#m4().(x) => param x: Int +example/Methods#m4().(y) => param y: Int +example/Methods#m5(). => method m5 (param x: String): Nothing +example/Methods#m5().(x) => param x: String +example/Methods#m5(+1). => method m5 (param x: Int): Nothing +example/Methods#m5(+1).(x) => param x: Int +example/Methods#m6(). => method m6 (param x: Int): Nothing +example/Methods#m6().(x) => param x: Int +example/Methods#m6(+1). => method m6 (param x: List[T]): Nothing +example/Methods#m6(+1).(x) => param x: List[T] +example/Methods#m6(+2). => method m6 (param x: List[T]): Nothing +example/Methods#m6(+2).(x) => param x: List[T] +example/Methods#m7(). => method m7 [typeparam U ](typeparam U )(param c: Methods[T], param l: List[U])(unknown evidence$1: ): +example/Methods#m7().(c) => param c: Methods[T] +example/Methods#m7().(l) => param l: List[U] +example/Methods#m7().[U] => typeparam U +example/Methods#m9(). => method m9 (param x: m9().): Nothing +example/Methods#m9().(x) => param x: m9(). +example/Methods#m10(). => method m10 (param x: List[T]): Nothing +example/Methods#m10().(x) => param x: List[T] +example/Methods#m11(). => method m11 (param x: .Predef.type): Nothing +example/Methods#m11().(x) => param x: .Predef.type +example/Methods#m11(+1). => method m11 (param x: .Example.type): Nothing +example/Methods#m11(+1).(x) => param x: .Example.type +example/Methods#m12a(). => method m12a (param x: Object): Nothing +example/Methods#m12a().(x) => param x: Object +example/Methods#m12b(). => method m12b (param x: Object { local x: Int }): Nothing +example/Methods#m12b().(x) => param x: Object { local x: Int } +example/Methods#m13(). => method m13 (param x: Int @unchecked): Nothing +example/Methods#m13().(x) => param x: Int @unchecked +example/Methods#m15(). => method m15 (param x: => Int): Nothing +example/Methods#m15().(x) => param x: => Int +example/Methods#m16(). => method m16 (param x: Int*): Nothing +example/Methods#m16().(x) => param x: Int* +example/Methods#m17(). => method m17 (param a: Int): Nothing +example/Methods#m17().(a) => param a: Int +example/Methods#m17(+1). => method m17 (param b: String): Nothing +example/Methods#m17(+1).(b) => param b: String +example/Methods#m17. => final object m17 extends Object { self: .m17.type => +2 decls } +example/Methods#m17.m(). => method m (): Nothing +example/Methods#m18(). => method m18 (param a: Int): Nothing +example/Methods#m18().(a) => param a: Int +example/Methods#m18(+1). => method m18 (param b: String): Nothing +example/Methods#m18(+1).(b) => param b: String +example/Methods#m18. => val method m18 .m17.type +example/Methods#m19$default$2(). => method m19$default$2 => Int @uncheckedVariance +example/Methods#m19$default$3(). => method m19$default$3 (param x: Int, param y: Int): Int @uncheckedVariance +example/Methods#m19$default$3().(x) => param x: Int +example/Methods#m19$default$3().(y) => param y: Int +example/Methods#m19(). => method m19 (param x: Int, param y: Int)(param z: Int): +example/Methods#m19().(x) => param x: Int +example/Methods#m19().(y) => param y: Int +example/Methods#m19().(z) => param z: Int +example/Methods#m20(). => method m20 (param a: Int): Nothing +example/Methods#m20().(a) => param a: Int +example/Methods#m20(+1). => method m20 (param b: String): Nothing +example/Methods#m20(+1).(b) => param b: String +example/Methods#m20(+2). => var method m20 .m17.type +local1 => abstract val method x Int Occurrences: [0:8..0:15): example <- example/ @@ -2429,49 +2429,49 @@ Symbols => 43 entries Occurrences => 43 entries Symbols: -example/NamedApplyBlockCaseClassConstruction. => final object NamedApplyBlockCaseClassConstruction -example/NamedApplyBlockCaseClassConstruction.Msg# => case class Msg -example/NamedApplyBlockCaseClassConstruction.Msg#_1(). => method _1 -example/NamedApplyBlockCaseClassConstruction.Msg#_2(). => method _2 -example/NamedApplyBlockCaseClassConstruction.Msg#_3(). => method _3 -example/NamedApplyBlockCaseClassConstruction.Msg#``(). => primary ctor -example/NamedApplyBlockCaseClassConstruction.Msg#``().(body) => val param body -example/NamedApplyBlockCaseClassConstruction.Msg#``().(head) => val param head -example/NamedApplyBlockCaseClassConstruction.Msg#``().(tail) => val param tail -example/NamedApplyBlockCaseClassConstruction.Msg#body. => val method body -example/NamedApplyBlockCaseClassConstruction.Msg#copy$default$1(). => method copy$default$1 -example/NamedApplyBlockCaseClassConstruction.Msg#copy$default$2(). => method copy$default$2 -example/NamedApplyBlockCaseClassConstruction.Msg#copy$default$3(). => method copy$default$3 -example/NamedApplyBlockCaseClassConstruction.Msg#copy(). => method copy -example/NamedApplyBlockCaseClassConstruction.Msg#copy().(body) => param body -example/NamedApplyBlockCaseClassConstruction.Msg#copy().(head) => param head -example/NamedApplyBlockCaseClassConstruction.Msg#copy().(tail) => param tail -example/NamedApplyBlockCaseClassConstruction.Msg#head. => val method head -example/NamedApplyBlockCaseClassConstruction.Msg#tail. => val method tail -example/NamedApplyBlockCaseClassConstruction.Msg. => final object Msg -example/NamedApplyBlockCaseClassConstruction.Msg.$lessinit$greater$default$2(). => method $lessinit$greater$default$2 -example/NamedApplyBlockCaseClassConstruction.Msg.apply(). => method apply -example/NamedApplyBlockCaseClassConstruction.Msg.apply().(body) => param body -example/NamedApplyBlockCaseClassConstruction.Msg.apply().(head) => param head -example/NamedApplyBlockCaseClassConstruction.Msg.apply().(tail) => param tail -example/NamedApplyBlockCaseClassConstruction.Msg.toString(). => method toString -example/NamedApplyBlockCaseClassConstruction.Msg.unapply(). => method unapply -example/NamedApplyBlockCaseClassConstruction.Msg.unapply().(x$1) => param x$1 -example/NamedApplyBlockCaseClassConstruction.bodyText. => val method bodyText -example/NamedApplyBlockCaseClassConstruction.msg. => val method msg -example/NamedApplyBlockMethods. => final object NamedApplyBlockMethods -example/NamedApplyBlockMethods.baseCase(). => method baseCase -example/NamedApplyBlockMethods.foo$default$1(). => method foo$default$1 -example/NamedApplyBlockMethods.foo$default$2(). => method foo$default$2 -example/NamedApplyBlockMethods.foo$default$3(). => method foo$default$3 -example/NamedApplyBlockMethods.foo(). => method foo -example/NamedApplyBlockMethods.foo().(a) => param a -example/NamedApplyBlockMethods.foo().(b) => param b -example/NamedApplyBlockMethods.foo().(c) => param c -example/NamedApplyBlockMethods.local. => val method local -example/NamedApplyBlockMethods.recursive(). => method recursive -local0 => val local c$1 -local1 => val local b$1 +example/NamedApplyBlockCaseClassConstruction. => final object NamedApplyBlockCaseClassConstruction extends Object { self: .NamedApplyBlockCaseClassConstruction.type => +6 decls } +example/NamedApplyBlockCaseClassConstruction.Msg# => case class Msg extends Object with Product with Serializable { self: Msg => +11 decls } +example/NamedApplyBlockCaseClassConstruction.Msg#_1(). => method _1 => String +example/NamedApplyBlockCaseClassConstruction.Msg#_2(). => method _2 => String +example/NamedApplyBlockCaseClassConstruction.Msg#_3(). => method _3 => String +example/NamedApplyBlockCaseClassConstruction.Msg#``(). => primary ctor (val param body: String, val param head: String, val param tail: String): Msg +example/NamedApplyBlockCaseClassConstruction.Msg#``().(body) => val param body: String +example/NamedApplyBlockCaseClassConstruction.Msg#``().(head) => val param head: String +example/NamedApplyBlockCaseClassConstruction.Msg#``().(tail) => val param tail: String +example/NamedApplyBlockCaseClassConstruction.Msg#body. => val method body String +example/NamedApplyBlockCaseClassConstruction.Msg#copy$default$1(). => method copy$default$1 => String @uncheckedVariance +example/NamedApplyBlockCaseClassConstruction.Msg#copy$default$2(). => method copy$default$2 => String @uncheckedVariance +example/NamedApplyBlockCaseClassConstruction.Msg#copy$default$3(). => method copy$default$3 => String @uncheckedVariance +example/NamedApplyBlockCaseClassConstruction.Msg#copy(). => method copy (param body: String, param head: String, param tail: String): Msg +example/NamedApplyBlockCaseClassConstruction.Msg#copy().(body) => param body: String +example/NamedApplyBlockCaseClassConstruction.Msg#copy().(head) => param head: String +example/NamedApplyBlockCaseClassConstruction.Msg#copy().(tail) => param tail: String +example/NamedApplyBlockCaseClassConstruction.Msg#head. => val method head String +example/NamedApplyBlockCaseClassConstruction.Msg#tail. => val method tail String +example/NamedApplyBlockCaseClassConstruction.Msg. => final object Msg extends Object { self: .Msg.type => +5 decls } +example/NamedApplyBlockCaseClassConstruction.Msg.$lessinit$greater$default$2(). => method $lessinit$greater$default$2 => String @uncheckedVariance +example/NamedApplyBlockCaseClassConstruction.Msg.apply(). => method apply (param body: String, param head: String, param tail: String): Msg +example/NamedApplyBlockCaseClassConstruction.Msg.apply().(body) => param body: String +example/NamedApplyBlockCaseClassConstruction.Msg.apply().(head) => param head: String +example/NamedApplyBlockCaseClassConstruction.Msg.apply().(tail) => param tail: String +example/NamedApplyBlockCaseClassConstruction.Msg.toString(). => method toString => String +example/NamedApplyBlockCaseClassConstruction.Msg.unapply(). => method unapply (param x$1: Msg): Msg +example/NamedApplyBlockCaseClassConstruction.Msg.unapply().(x$1) => param x$1: Msg +example/NamedApplyBlockCaseClassConstruction.bodyText. => val method bodyText String +example/NamedApplyBlockCaseClassConstruction.msg. => val method msg Msg +example/NamedApplyBlockMethods. => final object NamedApplyBlockMethods extends Object { self: .NamedApplyBlockMethods.type => +8 decls } +example/NamedApplyBlockMethods.baseCase(). => method baseCase => Int +example/NamedApplyBlockMethods.foo$default$1(). => method foo$default$1 => Int @uncheckedVariance +example/NamedApplyBlockMethods.foo$default$2(). => method foo$default$2 => Int @uncheckedVariance +example/NamedApplyBlockMethods.foo$default$3(). => method foo$default$3 => Int @uncheckedVariance +example/NamedApplyBlockMethods.foo(). => method foo (param a: Int, param b: Int, param c: Int): Int +example/NamedApplyBlockMethods.foo().(a) => param a: Int +example/NamedApplyBlockMethods.foo().(b) => param b: Int +example/NamedApplyBlockMethods.foo().(c) => param c: Int +example/NamedApplyBlockMethods.local. => val method local Int +example/NamedApplyBlockMethods.recursive(). => method recursive => Int +local0 => val local c$1: Int +local1 => val local b$1: Int @uncheckedVariance Occurrences: [0:8..0:15): example <- example/ @@ -2530,22 +2530,22 @@ Symbols => 16 entries Occurrences => 13 entries Symbols: -example/NamedArguments# => class NamedArguments -example/NamedArguments#User# => case class User -example/NamedArguments#User#_1(). => method _1 -example/NamedArguments#User#``(). => primary ctor -example/NamedArguments#User#``().(name) => val param name -example/NamedArguments#User#copy$default$1(). => method copy$default$1 -example/NamedArguments#User#copy(). => method copy -example/NamedArguments#User#copy().(name) => param name -example/NamedArguments#User#name. => val method name -example/NamedArguments#User. => final object User -example/NamedArguments#User.apply(). => method apply -example/NamedArguments#User.apply().(name) => param name -example/NamedArguments#User.toString(). => method toString -example/NamedArguments#User.unapply(). => method unapply -example/NamedArguments#User.unapply().(x$1) => param x$1 -example/NamedArguments#``(). => primary ctor +example/NamedArguments# => class NamedArguments extends Object { self: NamedArguments => +4 decls } +example/NamedArguments#User# => case class User extends Object with Product with Serializable { self: User => +5 decls } +example/NamedArguments#User#_1(). => method _1 => String +example/NamedArguments#User#``(). => primary ctor (val param name: String): User +example/NamedArguments#User#``().(name) => val param name: String +example/NamedArguments#User#copy$default$1(). => method copy$default$1 => String @uncheckedVariance +example/NamedArguments#User#copy(). => method copy (param name: String): User +example/NamedArguments#User#copy().(name) => param name: String +example/NamedArguments#User#name. => val method name String +example/NamedArguments#User. => final object User extends Object { self: .User.type => +4 decls } +example/NamedArguments#User.apply(). => method apply (param name: String): User +example/NamedArguments#User.apply().(name) => param name: String +example/NamedArguments#User.toString(). => method toString => String +example/NamedArguments#User.unapply(). => method unapply (param x$1: User): User +example/NamedArguments#User.unapply().(x$1) => param x$1: User +example/NamedArguments#``(). => primary ctor (): NamedArguments Occurrences: [0:8..0:15): example <- example/ @@ -2574,9 +2574,9 @@ Symbols => 3 entries Occurrences => 4 entries Symbols: -_empty_/NewModifiers. => final object NewModifiers -_empty_/NewModifiers.A# => type A -_empty_/NewModifiers.foo. => val method foo +_empty_/NewModifiers. => final object NewModifiers extends Object { self: .NewModifiers.type { type A } => +3 decls } +_empty_/NewModifiers.A# => type A +_empty_/NewModifiers.foo. => val method foo "foo" Occurrences: [0:7..0:19): NewModifiers <- _empty_/NewModifiers. @@ -2596,8 +2596,8 @@ Symbols => 2 entries Occurrences => 3 entries Symbols: -objects/X. => final object X -objects/X.Y. => final object Y +objects/X. => final object X extends Object { self: .X.type => +3 decls } +objects/X.Y. => final object Y extends Object { self: .Y.type => +1 decls } Occurrences: [0:8..0:15): objects <- objects/ @@ -2616,12 +2616,12 @@ Symbols => 6 entries Occurrences => 10 entries Symbols: -example/A# => trait A -example/A#``(). => primary ctor -example/A#foo(). => abstract method foo -example/B# => class B -example/B#``(). => primary ctor -example/B#foo(). => method foo +example/A# => trait A extends Object { self: A => +2 decls } +example/A#``(). => primary ctor (): A +example/A#foo(). => abstract method foo => Int +example/B# => class B extends Object with A { self: B => +2 decls } +example/B#``(). => primary ctor (): B +example/B#foo(). => method foo => Int Occurrences: [0:8..0:15): example <- example/ @@ -2647,25 +2647,25 @@ Symbols => 19 entries Occurrences => 49 entries Symbols: -prefixes/C# => class C -prefixes/C#N. => final object N -prefixes/C#N.U# => type U -prefixes/C#T# => type T -prefixes/C#``(). => primary ctor -prefixes/C#k1(). => method k1 -prefixes/C#m1(). => method m1 -prefixes/M. => final object M -prefixes/M.T# => type T -prefixes/M.n1(). => method n1 -prefixes/O. => final object O -prefixes/O.o1(). => method o1 -prefixes/Test. => final object Test -prefixes/Test.c. => val method c -prefixes/Test.k2(). => method k2 -prefixes/Test.k3(). => method k3 -prefixes/Test.m2(). => method m2 -prefixes/Test.n2(). => method n2 -prefixes/Test.n3(). => method n3 +prefixes/C# => class C extends Object { self: C => +6 decls } +prefixes/C#N. => final object N extends Object { self: .N.type => +2 decls } +prefixes/C#N.U# => type U +prefixes/C#T# => type T +prefixes/C#``(). => primary ctor (): C +prefixes/C#k1(). => method k1 => U +prefixes/C#m1(). => method m1 => T +prefixes/M. => final object M extends Object { self: .M.type => +3 decls } +prefixes/M.T# => type T +prefixes/M.n1(). => method n1 => T +prefixes/O. => final object O extends C { self: .O.type => +2 decls } +prefixes/O.o1(). => method o1 => O.this.T +prefixes/Test. => final object Test extends Object { self: .Test.type => +7 decls } +prefixes/Test.c. => val method c C +prefixes/Test.k2(). => method k2 => .c.N.U +prefixes/Test.k3(). => method k3 => .c.N.U +prefixes/Test.m2(). => method m2 => .c.T +prefixes/Test.n2(). => method n2 => T +prefixes/Test.n3(). => method n3 => T Occurrences: [0:8..0:16): prefixes <- prefixes/ @@ -2730,11 +2730,11 @@ Symbols => 5 entries Occurrences => 13 entries Symbols: -ext/RightAssociativeExtension$package. => final package object ext -ext/RightAssociativeExtension$package.`:*:`(). => method :*: -ext/RightAssociativeExtension$package.`:*:`().(i) => param i -ext/RightAssociativeExtension$package.`:*:`().(s) => param s -ext/RightAssociativeExtension$package.b. => val method b +ext/RightAssociativeExtension$package. => final package object ext extends Object { self: .ext.type => +3 decls } +ext/RightAssociativeExtension$package.`:*:`(). => method :*: (param i: Int)(param s: String): +ext/RightAssociativeExtension$package.`:*:`().(i) => param i: Int +ext/RightAssociativeExtension$package.`:*:`().(s) => param s: String +ext/RightAssociativeExtension$package.b. => val method b Tuple2[String, Int] Occurrences: [0:8..0:11): ext <- ext/ @@ -2751,32 +2751,6 @@ Occurrences: [5:4..5:5): b <- ext/RightAssociativeExtension$package.b. [5:14..5:17): :*: -> ext/RightAssociativeExtension$package.`:*:`(). -expect/Scala3Types.scala ------------------------- - -Summary: -Schema => SemanticDB v4 -Uri => Scala3Types.scala -Text => empty -Language => Scala -Symbols => 4 entries -Occurrences => 7 entries - -Symbols: -scala3types/Scala3Types$package. => final package object scala3types -scala3types/Scala3Types$package.A# => type A -scala3types/Scala3Types$package.X# => type X -scala3types/Scala3Types$package.X#[T] => typeparam T - -Occurrences: -[0:8..0:19): scala3types <- scala3types/ -[2:5..2:6): X <- scala3types/Scala3Types$package.X# -[2:7..2:8): T <- scala3types/Scala3Types$package.X#[T] -[2:12..2:16): List -> scala/package.List# -[2:17..2:18): T -> scala3types/Scala3Types$package.X#[T] -[3:5..3:6): A <- scala3types/Scala3Types$package.A# -[3:9..3:12): Int -> scala/Int# - expect/Selfs.scala ------------------ @@ -2789,19 +2763,19 @@ Symbols => 13 entries Occurrences => 26 entries Symbols: -local0 => selfparam self -local1 => selfparam self -local2 => selfparam self -selfs/B# => class B -selfs/B#``(). => primary ctor -selfs/C1# => class C1 -selfs/C1#``(). => primary ctor -selfs/C2# => class C2 -selfs/C2#``(). => primary ctor -selfs/C3# => class C3 -selfs/C3#``(). => primary ctor -selfs/C6# => class C6 -selfs/C6#``(). => primary ctor +local0 => selfparam self: C1 +local1 => selfparam self: B +local2 => selfparam self: B & C1 +selfs/B# => class B extends Object { self: B => +1 decls } +selfs/B#``(). => primary ctor (): B +selfs/C1# => class C1 extends B { self: C1 & C1 => +1 decls } +selfs/C1#``(). => primary ctor (): C1 +selfs/C2# => class C2 extends B { self: B & C2 => +1 decls } +selfs/C2#``(). => primary ctor (): C2 +selfs/C3# => class C3 extends B { self: B & C1 & C3 => +1 decls } +selfs/C3#``(). => primary ctor (): C3 +selfs/C6# => class C6 extends B { self: B & C6 => +1 decls } +selfs/C6#``(). => primary ctor (): C6 Occurrences: [0:8..0:13): selfs <- selfs/ @@ -2843,44 +2817,44 @@ Symbols => 38 entries Occurrences => 162 entries Symbols: -example/Synthetic# => class Synthetic -example/Synthetic#F# => class F -example/Synthetic#F#``(). => primary ctor -example/Synthetic#J# => class J -example/Synthetic#J#[T] => typeparam T -example/Synthetic#J#``(). => primary ctor -example/Synthetic#J#arr. => val method arr -example/Synthetic#Name. => val method Name -example/Synthetic#``(). => primary ctor -example/Synthetic#a1. => val method a1 -example/Synthetic#a2. => val method a2 -example/Synthetic#as. => val method as -example/Synthetic#f. => val method f -example/Synthetic#lst. => val method lst -example/Synthetic#name. => val method name -example/Synthetic#ordering. => implicit val method ordering -example/Synthetic#s. => final object s -example/Synthetic#s.Bar# => case class Bar -example/Synthetic#s.Bar#``(). => primary ctor -example/Synthetic#s.Bar#copy(). => method copy -example/Synthetic#s.Bar. => final object Bar -example/Synthetic#s.Bar.apply(). => method apply -example/Synthetic#s.Bar.toString(). => method toString -example/Synthetic#s.Bar.unapply(). => method unapply -example/Synthetic#s.Bar.unapply().(x$1) => param x$1 -example/Synthetic#s.apply(). => method apply -example/Synthetic#x. => val method x -example/Synthetic#xs. => val method xs -local0 => param x -local1 => param y -local2 => param i -local3 => param j -local4 => param i -local5 => param j -local6 => param a -local7 => param b -local8 => param a -local9 => param b +example/Synthetic# => class Synthetic extends Object { self: Synthetic => +21 decls } +example/Synthetic#F# => class F extends Object { self: F => +1 decls } +example/Synthetic#F#``(). => primary ctor (): F +example/Synthetic#J# => class J [typeparam T ] extends Object { self: J[T] => +4 decls } +example/Synthetic#J#[T] => typeparam T +example/Synthetic#J#``(). => primary ctor [unknown T: ](unknown T: )(unknown evidence$1: ): +example/Synthetic#J#arr. => val method arr Array[T] +example/Synthetic#Name. => val method Name Regex +example/Synthetic#``(). => primary ctor (): Synthetic +example/Synthetic#a1. => val method a1 Int +example/Synthetic#a2. => val method a2 Int +example/Synthetic#as. => val method as LazyList[Int] +example/Synthetic#f. => val method f Ordered[F] +example/Synthetic#lst. => val method lst LazyList[Int] +example/Synthetic#name. => val method name String +example/Synthetic#ordering. => implicit val method ordering Ordering[F] +example/Synthetic#s. => final object s extends Object { self: .s.type => +5 decls } +example/Synthetic#s.Bar# => case class Bar extends Object with Product with Serializable { self: Bar => +2 decls } +example/Synthetic#s.Bar#``(). => primary ctor (): Bar +example/Synthetic#s.Bar#copy(). => method copy (): Bar +example/Synthetic#s.Bar. => final object Bar extends Object { self: .Bar.type => +4 decls } +example/Synthetic#s.Bar.apply(). => method apply (): Bar +example/Synthetic#s.Bar.toString(). => method toString => String +example/Synthetic#s.Bar.unapply(). => method unapply (param x$1: Bar): true +example/Synthetic#s.Bar.unapply().(x$1) => param x$1: Bar +example/Synthetic#s.apply(). => method apply (): Int +example/Synthetic#x. => val method x Int +example/Synthetic#xs. => val method xs LazyList[Int] +local0 => param x: Int +local1 => param y: Int +local2 => param i: Int +local3 => param j: Int +local4 => param i: Int +local5 => param j: Int +local6 => param a: Int +local7 => param b: Int +local8 => param a: Int +local9 => param b: Int Occurrences: [0:8..0:15): example <- example/ @@ -3058,19 +3032,19 @@ Symbols => 13 entries Occurrences => 16 entries Symbols: -local0 => final class $anon -local2 => selfparam self -traits/C# => class C -traits/C#``(). => primary ctor -traits/T# => trait T -traits/T#``(). => primary ctor -traits/T#x(). => method x -traits/U# => sealed trait U -traits/U#``(). => primary ctor -traits/U. => final object U -traits/U.u(). => method u -traits/V# => trait V -traits/V#``(). => primary ctor +local0 => final class $anon extends Object with U { self: $anon => +1 decls } +local2 => selfparam self: C +traits/C# => class C extends Object { self: C => +1 decls } +traits/C#``(). => primary ctor (): C +traits/T# => trait T extends Object { self: T => +2 decls } +traits/T#``(). => primary ctor (): T +traits/T#x(). => method x => Int +traits/U# => sealed trait U extends Object { self: U => +1 decls } +traits/U#``(). => primary ctor (): U +traits/U. => final object U extends Object { self: .U.type => +2 decls } +traits/U.u(). => method u => U +traits/V# => trait V extends Object { self: C & V => +1 decls } +traits/V#``(). => primary ctor (): V Occurrences: [0:8..0:14): traits <- traits/ @@ -3102,28 +3076,28 @@ Symbols => 22 entries Occurrences => 63 entries Symbols: -example/ValPattern# => class ValPattern -example/ValPattern#``(). => primary ctor -example/ValPattern#`leftVar_=`(). => var method leftVar_= -example/ValPattern#`leftVar_=`().(x$1) => param x$1 -example/ValPattern#`number1Var_=`(). => var method number1Var_= -example/ValPattern#`number1Var_=`().(x$1) => param x$1 -example/ValPattern#`rightVar_=`(). => var method rightVar_= -example/ValPattern#`rightVar_=`().(x$1) => param x$1 -example/ValPattern#app(). => method app -example/ValPattern#left. => val method left -example/ValPattern#leftVar(). => var method leftVar -example/ValPattern#number1. => val method number1 -example/ValPattern#number1Var(). => var method number1Var -example/ValPattern#q1. => val method q1 -example/ValPattern#right. => val method right -example/ValPattern#rightVar(). => var method rightVar -local0 => val local left -local1 => val local right -local2 => val local number1 -local3 => var local leftVar -local4 => var local rightVar -local5 => var local number1Var +example/ValPattern# => class ValPattern extends Object { self: ValPattern => +14 decls } +example/ValPattern#``(). => primary ctor (): ValPattern +example/ValPattern#`leftVar_=`(). => var method leftVar_= (param x$1: Int): Unit +example/ValPattern#`leftVar_=`().(x$1) => param x$1: Int +example/ValPattern#`number1Var_=`(). => var method number1Var_= (param x$1: Int): Unit +example/ValPattern#`number1Var_=`().(x$1) => param x$1: Int +example/ValPattern#`rightVar_=`(). => var method rightVar_= (param x$1: Int): Unit +example/ValPattern#`rightVar_=`().(x$1) => param x$1: Int +example/ValPattern#app(). => method app (): Unit +example/ValPattern#left. => val method left Int +example/ValPattern#leftVar(). => var method leftVar Int +example/ValPattern#number1. => val method number1 Int +example/ValPattern#number1Var(). => var method number1Var Int +example/ValPattern#q1. => val method q1 Nothing +example/ValPattern#right. => val method right Int +example/ValPattern#rightVar(). => var method rightVar Int +local0 => val local left: Int +local1 => val local right: Int +local2 => val local number1: Int +local3 => var local leftVar: Int +local4 => var local rightVar: Int +local5 => var local number1Var: Int Occurrences: [0:8..0:15): example <- example/ @@ -3202,48 +3176,48 @@ Symbols => 42 entries Occurrences => 129 entries Symbols: -example/ValUsages. => final object ValUsages -example/ValUsages.v. => val method v -example/Vals# => abstract class Vals -example/Vals#_explicitSetter(). => var method _explicitSetter -example/Vals#``(). => primary ctor -example/Vals#``().(p) => param p -example/Vals#``().(xp) => val param xp -example/Vals#``().(yp) => var param yp -example/Vals#`explicitSetter_=`(). => method explicitSetter_= -example/Vals#`explicitSetter_=`().(x) => param x -example/Vals#`yam_=`(). => var method yam_= -example/Vals#`yam_=`().(x$1) => param x$1 -example/Vals#`yfm_=`(). => final var method yfm_= -example/Vals#`yfm_=`().(x$1) => param x$1 -example/Vals#`yim_=`(). => var method yim_= -example/Vals#`yim_=`().(x$1) => param x$1 -example/Vals#`ym_=`(). => var method ym_= -example/Vals#`ym_=`().(x$1) => param x$1 -example/Vals#`yp_=`(). => var method yp_= -example/Vals#`yp_=`().(x$1) => param x$1 -example/Vals#explicitSetter(). => method explicitSetter -example/Vals#m(). => method m -example/Vals#p. => val method p -example/Vals#xam. => abstract val method xam -example/Vals#xfm. => final val method xfm -example/Vals#xim. => implicit val method xim -example/Vals#xlm. => val method xlm -example/Vals#xm. => val method xm -example/Vals#xp. => val method xp -example/Vals#xzlm. => lazy val method xzlm -example/Vals#xzm. => lazy val method xzm -example/Vals#yam(). => abstract var method yam -example/Vals#yfm(). => final var method yfm -example/Vals#yim(). => implicit var method yim -example/Vals#ylm(). => var method ylm -example/Vals#ym(). => var method ym -example/Vals#yp(). => var method yp -local0 => val local xl -local1 => lazy val local xzl -local2 => implicit val local xil -local3 => var local yl -local4 => implicit var local yil +example/ValUsages. => final object ValUsages extends Object { self: .ValUsages.type => +2 decls } +example/ValUsages.v. => val method v Vals +example/Vals# => abstract class Vals extends Object { self: Vals => +25 decls } +example/Vals#_explicitSetter(). => var method _explicitSetter Int +example/Vals#``(). => primary ctor (param p: Int, val param xp: Int, var param yp: Int): Vals +example/Vals#``().(p) => param p: Int +example/Vals#``().(xp) => val param xp: Int +example/Vals#``().(yp) => var param yp: Int +example/Vals#`explicitSetter_=`(). => method explicitSetter_= (param x: Int): Unit +example/Vals#`explicitSetter_=`().(x) => param x: Int +example/Vals#`yam_=`(). => var method yam_= (param x$1: Int): Unit +example/Vals#`yam_=`().(x$1) => param x$1: Int +example/Vals#`yfm_=`(). => final var method yfm_= (param x$1: Int): Unit +example/Vals#`yfm_=`().(x$1) => param x$1: Int +example/Vals#`yim_=`(). => var method yim_= (param x$1: Int): Unit +example/Vals#`yim_=`().(x$1) => param x$1: Int +example/Vals#`ym_=`(). => var method ym_= (param x$1: Int): Unit +example/Vals#`ym_=`().(x$1) => param x$1: Int +example/Vals#`yp_=`(). => var method yp_= (param x$1: Int): Unit +example/Vals#`yp_=`().(x$1) => param x$1: Int +example/Vals#explicitSetter(). => method explicitSetter => Int +example/Vals#m(). => method m => Unit +example/Vals#p. => val method p Int +example/Vals#xam. => abstract val method xam Int +example/Vals#xfm. => final val method xfm Int +example/Vals#xim. => implicit val method xim Int +example/Vals#xlm. => val method xlm Int +example/Vals#xm. => val method xm Int +example/Vals#xp. => val method xp Int +example/Vals#xzlm. => lazy val method xzlm Int +example/Vals#xzm. => lazy val method xzm Int +example/Vals#yam(). => abstract var method yam Int +example/Vals#yfm(). => final var method yfm Int +example/Vals#yim(). => implicit var method yim Int +example/Vals#ylm(). => var method ylm Int +example/Vals#ym(). => var method ym Int +example/Vals#yp(). => var method yp Int +local0 => val local xl: Int +local1 => lazy val local xzl: Int +local2 => implicit val local xil: Int +local3 => var local yl: Int +local4 => implicit var local yil: Int Occurrences: [0:8..0:15): example <- example/ @@ -3388,12 +3362,12 @@ Symbols => 6 entries Occurrences => 11 entries Symbols: -example/Vararg# => class Vararg -example/Vararg#``(). => primary ctor -example/Vararg#add1(). => method add1 -example/Vararg#add1().(a) => param a -example/Vararg#add2(). => method add2 -example/Vararg#add2().(a) => param a +example/Vararg# => class Vararg extends Object { self: Vararg => +3 decls } +example/Vararg#``(). => primary ctor (): Vararg +example/Vararg#add1(). => method add1 (param a: Int*): Unit +example/Vararg#add1().(a) => param a: Int* +example/Vararg#add2(). => method add2 (param a: Seq[Int]*): Unit +example/Vararg#add2().(a) => param a: Seq[Int]* Occurrences: [0:8..0:15): example <- example/ @@ -3420,27 +3394,27 @@ Symbols => 21 entries Occurrences => 39 entries Symbols: -exports/example/Codec# => trait Codec -exports/example/Codec#[T] => typeparam T -exports/example/Codec#``(). => primary ctor -exports/example/Codec#``().(decode) => param decode -exports/example/Codec#``().(encode) => param encode -exports/example/Codec#decode(). => final method decode -exports/example/Codec#decode().(a) => param a -exports/example/Codec#decode. => val method decode -exports/example/Codec#encode(). => final method encode -exports/example/Codec#encode().(t) => param t -exports/example/Codec#encode. => val method encode -exports/example/Decoder# => trait Decoder -exports/example/Decoder#[T] => covariant typeparam T -exports/example/Decoder#``(). => primary ctor -exports/example/Decoder#decode(). => abstract method decode -exports/example/Decoder#decode().(a) => param a -exports/example/Encoder# => trait Encoder -exports/example/Encoder#[T] => contravariant typeparam T -exports/example/Encoder#``(). => primary ctor -exports/example/Encoder#encode(). => abstract method encode -exports/example/Encoder#encode().(t) => param t +exports/example/Codec# => trait Codec [typeparam T ] extends Object with Decoder[T] with Encoder[T] { self: Codec[T] => +6 decls } +exports/example/Codec#[T] => typeparam T +exports/example/Codec#``(). => primary ctor [unknown T: ](unknown T: )(param decode: Decoder[T], param encode: Encoder[T]): Codec[T] +exports/example/Codec#``().(decode) => param decode: Decoder[T] +exports/example/Codec#``().(encode) => param encode: Encoder[T] +exports/example/Codec#decode(). => final method decode (param a: Array[Byte]): T +exports/example/Codec#decode().(a) => param a: Array[Byte] +exports/example/Codec#decode. => val method decode Decoder[T] +exports/example/Codec#encode(). => final method encode (param t: T): Array[Byte] +exports/example/Codec#encode().(t) => param t: T +exports/example/Codec#encode. => val method encode Encoder[T] +exports/example/Decoder# => trait Decoder [covariant typeparam T ] extends Object { self: Decoder[T] => +3 decls } +exports/example/Decoder#[T] => covariant typeparam T +exports/example/Decoder#``(). => primary ctor [unknown T: ](unknown T: ): Decoder[T] +exports/example/Decoder#decode(). => abstract method decode (param a: Array[Byte]): T +exports/example/Decoder#decode().(a) => param a: Array[Byte] +exports/example/Encoder# => trait Encoder [contravariant typeparam T ] extends Object { self: Encoder[T] => +3 decls } +exports/example/Encoder#[T] => contravariant typeparam T +exports/example/Encoder#``(). => primary ctor [unknown T: ](unknown T: ): Encoder[T] +exports/example/Encoder#encode(). => abstract method encode (param t: T): Array[Byte] +exports/example/Encoder#encode().(t) => param t: T Occurrences: [0:8..0:15): exports -> exports/ @@ -3495,10 +3469,10 @@ Symbols => 4 entries Occurrences => 5 entries Symbols: -exports/`exports-package$package`. => final package object exports -exports/`exports-package$package`.Codec# => final type Codec -exports/`exports-package$package`.Decoder# => final type Decoder -exports/`exports-package$package`.Encoder# => final type Encoder +exports/`exports-package$package`. => final package object exports extends Object { self: .exports.type => +4 decls } +exports/`exports-package$package`.Codec# => final type Codec [unknown T: ] = Codec[] +exports/`exports-package$package`.Decoder# => final type Decoder [unknown T: ] = Decoder[] +exports/`exports-package$package`.Encoder# => final type Encoder [unknown T: ] = Encoder[] Occurrences: [0:8..0:15): exports <- exports/ @@ -3519,8 +3493,8 @@ Symbols => 2 entries Occurrences => 3 entries Symbols: -example/FilenameWithSpaces# => class FilenameWithSpaces -example/FilenameWithSpaces#``(). => primary ctor +example/FilenameWithSpaces# => class FilenameWithSpaces extends Object { self: FilenameWithSpaces => +1 decls } +example/FilenameWithSpaces#``(). => primary ctor (): FilenameWithSpaces Occurrences: [0:8..0:15): example <- example/ @@ -3539,13 +3513,13 @@ Symbols => 7 entries Occurrences => 11 entries Symbols: -i9727/Test# => class Test -i9727/Test#``(). => primary ctor -i9727/Test#``().(a) => param a -i9727/Test#a. => val method a -i9727/i9727$package. => final package object i9727 -i9727/i9727$package.a. => val method a -i9727/i9727$package.b. => val method b +i9727/Test# => class Test extends Object { self: Test => +2 decls } +i9727/Test#``(). => primary ctor (param a: Int): Test +i9727/Test#``().(a) => param a: Int +i9727/Test#a. => val method a Int +i9727/i9727$package. => final package object i9727 extends Object { self: .i9727.type => +3 decls } +i9727/i9727$package.a. => val method a Test +i9727/i9727$package.b. => val method b Test Occurrences: [0:8..0:13): i9727 <- i9727/ @@ -3572,9 +3546,9 @@ Symbols => 3 entries Occurrences => 9 entries Symbols: -inlineconsume/Foo# => class Foo -inlineconsume/Foo#``(). => primary ctor -inlineconsume/Foo#test(). => method test +inlineconsume/Foo# => class Foo extends Object { self: Foo => +2 decls } +inlineconsume/Foo#``(). => primary ctor (): Foo +inlineconsume/Foo#test(). => method test => Unit Occurrences: [0:8..0:21): inlineconsume <- inlineconsume/ @@ -3599,9 +3573,9 @@ Symbols => 3 entries Occurrences => 12 entries Symbols: -inlinedefs/FakePredef. => final object FakePredef -inlinedefs/FakePredef.assert(). => final macro assert -inlinedefs/FakePredef.assert().(assertion) => param assertion +inlinedefs/FakePredef. => final object FakePredef extends Object { self: .FakePredef.type => +2 decls } +inlinedefs/FakePredef.assert(). => final macro assert (param assertion: Boolean): Unit +inlinedefs/FakePredef.assert().(assertion) => param assertion: Boolean Occurrences: [0:8..0:18): inlinedefs <- inlinedefs/ @@ -3629,9 +3603,9 @@ Symbols => 3 entries Occurrences => 7 entries Symbols: -example/`local-file`# => class local-file -example/`local-file`#``(). => primary ctor -local0 => val local local +example/`local-file`# => class local-file extends Object { self: local-file => +1 decls } +example/`local-file`#``(). => primary ctor (): local-file +local0 => val local local: Int Occurrences: [0:8..0:15): example <- example/ @@ -3654,42 +3628,42 @@ Symbols => 36 entries Occurrences => 56 entries Symbols: -local0 => case val method N$1 -local1 => val local p -local2 => case val method N$2 -local3 => val local p -local4 => val local Nat_this -local5 => val local Nat_this -local6 => val local Nat_this -recursion/Nats. => final object Nats -recursion/Nats.Nat# => sealed trait Nat -recursion/Nats.Nat#`++`(). => macro ++ -recursion/Nats.Nat#`+`(). => macro + -recursion/Nats.Nat#`+`().(that) => param that -recursion/Nats.Nat#``(). => primary ctor -recursion/Nats.Succ# => case class Succ -recursion/Nats.Succ#[N] => typeparam N -recursion/Nats.Succ#_1(). => method _1 -recursion/Nats.Succ#``(). => primary ctor -recursion/Nats.Succ#``().(p) => val param p -recursion/Nats.Succ#copy$default$1(). => method copy$default$1 -recursion/Nats.Succ#copy$default$1().[N] => typeparam N -recursion/Nats.Succ#copy(). => method copy -recursion/Nats.Succ#copy().(p) => param p -recursion/Nats.Succ#copy().[N] => typeparam N -recursion/Nats.Succ#p. => val method p -recursion/Nats.Succ. => final object Succ -recursion/Nats.Succ.apply(). => method apply -recursion/Nats.Succ.apply().(p) => param p -recursion/Nats.Succ.apply().[N] => typeparam N -recursion/Nats.Succ.toString(). => method toString -recursion/Nats.Succ.unapply(). => method unapply -recursion/Nats.Succ.unapply().(x$1) => param x$1 -recursion/Nats.Succ.unapply().[N] => typeparam N -recursion/Nats.Zero. => final case object Zero -recursion/Nats.j31. => val method j31 -recursion/Nats.toIntg(). => macro toIntg -recursion/Nats.toIntg().(n) => param n +local0 => case val method N$1 +local1 => val local p: N$1 +local2 => case val method N$2 +local3 => val local p: N$2 +local4 => val local Nat_this: .Zero.type +local5 => val local Nat_this: Succ[.Zero.type] +local6 => val local Nat_this: Succ[] +recursion/Nats. => final object Nats extends Object { self: .Nats.type => +9 decls } +recursion/Nats.Nat# => sealed trait Nat extends Object { self: Nat => +3 decls } +recursion/Nats.Nat#`++`(). => macro ++ => Succ[Nat.this.type] +recursion/Nats.Nat#`+`(). => macro + (param that: Nat): Nat +recursion/Nats.Nat#`+`().(that) => param that: Nat +recursion/Nats.Nat#``(). => primary ctor (): Nat +recursion/Nats.Succ# => case class Succ [typeparam N ] extends Object with Nat with Product with Serializable { self: Succ[N] => +6 decls } +recursion/Nats.Succ#[N] => typeparam N +recursion/Nats.Succ#_1(). => method _1 => N +recursion/Nats.Succ#``(). => primary ctor [unknown N: ](unknown N: )(val param p: N): Succ[N] +recursion/Nats.Succ#``().(p) => val param p: N +recursion/Nats.Succ#copy$default$1(). => method copy$default$1 [] => N +recursion/Nats.Succ#copy$default$1().[N] => typeparam N +recursion/Nats.Succ#copy(). => method copy [typeparam N ](typeparam N )(param p: N): Succ[N] +recursion/Nats.Succ#copy().(p) => param p: N +recursion/Nats.Succ#copy().[N] => typeparam N +recursion/Nats.Succ#p. => val method p N +recursion/Nats.Succ. => final object Succ extends Object { self: .Succ.type => +4 decls } +recursion/Nats.Succ.apply(). => method apply [typeparam N ](typeparam N )(param p: N): Succ[N] +recursion/Nats.Succ.apply().(p) => param p: N +recursion/Nats.Succ.apply().[N] => typeparam N +recursion/Nats.Succ.toString(). => method toString => String +recursion/Nats.Succ.unapply(). => method unapply [typeparam N ](typeparam N )(param x$1: Succ[N]): Succ[N] +recursion/Nats.Succ.unapply().(x$1) => param x$1: Succ[N] +recursion/Nats.Succ.unapply().[N] => typeparam N +recursion/Nats.Zero. => final case object Zero extends Object with Nat with Product with Serializable { self: .Zero.type => +1 decls } +recursion/Nats.j31. => val method j31 Int +recursion/Nats.toIntg(). => macro toIntg (param n: Nat): Int +recursion/Nats.toIntg().(n) => param n: Nat Occurrences: [1:8..1:17): recursion <- recursion/ @@ -3761,16 +3735,16 @@ Symbols => 10 entries Occurrences => 9 entries Symbols: -a/Definitions. => final object Definitions -a/Definitions.D# => class D -a/Definitions.D#``(). => primary ctor -a/Definitions.E# => trait E -a/Definitions.E#``(). => primary ctor -a/Definitions.`b_=`(). => var method b_= -a/Definitions.`b_=`().(x$1) => param x$1 -a/Definitions.a. => val method a -a/Definitions.b(). => var method b -a/Definitions.c(). => method c +a/Definitions. => final object Definitions extends Object { self: .Definitions.type => +9 decls } +a/Definitions.D# => class D extends Object { self: D => +1 decls } +a/Definitions.D#``(). => primary ctor (): D +a/Definitions.E# => trait E extends Object { self: E => +1 decls } +a/Definitions.E#``(). => primary ctor (): E +a/Definitions.`b_=`(). => var method b_= (param x$1: Int): Unit +a/Definitions.`b_=`().(x$1) => param x$1: Int +a/Definitions.a. => val method a Int +a/Definitions.b(). => var method b Int +a/Definitions.c(). => method c => Int Occurrences: [0:8..0:9): a <- a/ @@ -3795,56 +3769,56 @@ Symbols => 50 entries Occurrences => 82 entries Symbols: -flags/p/package. => final package object p -flags/p/package.AA# => class AA -flags/p/package.AA#``(). => primary ctor -flags/p/package.AA#``().(x) => param x -flags/p/package.AA#``().(y) => val param y -flags/p/package.AA#``().(z) => var param z -flags/p/package.AA#`z_=`(). => var method z_= -flags/p/package.AA#`z_=`().(x$1) => param x$1 -flags/p/package.AA#x. => val method x -flags/p/package.AA#y. => val method y -flags/p/package.AA#z(). => var method z -flags/p/package.C# => abstract class C -flags/p/package.C#[T] => covariant typeparam T -flags/p/package.C#[U] => contravariant typeparam U -flags/p/package.C#[V] => typeparam V -flags/p/package.C#``(). => primary ctor -flags/p/package.C#``().(x) => param x -flags/p/package.C#``().(y) => param y -flags/p/package.C#``().(z) => param z -flags/p/package.C#``(+1). => ctor -flags/p/package.C#``(+2). => ctor -flags/p/package.C#``(+2).(t) => param t -flags/p/package.C#w(). => abstract method w -flags/p/package.C#x. => val method x -flags/p/package.C#y. => val method y -flags/p/package.C#z. => val method z -flags/p/package.S# => class S -flags/p/package.S#[T] => typeparam T -flags/p/package.S#``(). => primary ctor -flags/p/package.T1# => type T1 -flags/p/package.T2# => type T2 -flags/p/package.T2#[T] => typeparam T -flags/p/package.U# => type U -flags/p/package.V# => type V -flags/p/package.X. => final case object X -flags/p/package.Y# => final class Y -flags/p/package.Y#``(). => primary ctor -flags/p/package.Z# => sealed trait Z -flags/p/package.Z#``(). => primary ctor -flags/p/package.`y_=`(). => var method y_= -flags/p/package.`y_=`().(x$1) => param x$1 -flags/p/package.m(). => macro m -flags/p/package.m().[TT] => typeparam TT -flags/p/package.x. => lazy val method x -flags/p/package.xs1. => val method xs1 -flags/p/package.y(). => implicit var method y -flags/p/package.z(). => method z -flags/p/package.z().(pp) => param pp -local0 => val local xs2 -local1 => case val method t +flags/p/package. => final package object p extends Object { self: .p.type => +23 decls } +flags/p/package.AA# => class AA extends Object { self: AA => +5 decls } +flags/p/package.AA#``(). => primary ctor (param x: Int, val param y: Int, var param z: Int): AA +flags/p/package.AA#``().(x) => param x: Int +flags/p/package.AA#``().(y) => val param y: Int +flags/p/package.AA#``().(z) => var param z: Int +flags/p/package.AA#`z_=`(). => var method z_= (param x$1: Int): Unit +flags/p/package.AA#`z_=`().(x$1) => param x$1: Int +flags/p/package.AA#x. => val method x Int +flags/p/package.AA#y. => val method y Int +flags/p/package.AA#z(). => var method z Int +flags/p/package.C# => abstract class C [covariant typeparam T , contravariant typeparam U , typeparam V ] extends Object { self: C[T, U, V] => +10 decls } +flags/p/package.C#[T] => covariant typeparam T +flags/p/package.C#[U] => contravariant typeparam U +flags/p/package.C#[V] => typeparam V +flags/p/package.C#``(). => primary ctor [unknown T: , unknown U: , unknown V: ](unknown T: , unknown U: , unknown V: )(param x: T, param y: U, param z: V): C[T, U, V] +flags/p/package.C#``().(x) => param x: T +flags/p/package.C#``().(y) => param y: U +flags/p/package.C#``().(z) => param z: V +flags/p/package.C#``(+1). => ctor [unknown T: , unknown U: , unknown V: ](unknown T: , unknown U: , unknown V: ): C[T, U, V] +flags/p/package.C#``(+2). => ctor [unknown T: , unknown U: , unknown V: ](unknown T: , unknown U: , unknown V: )(param t: T): C[T, U, V] +flags/p/package.C#``(+2).(t) => param t: T +flags/p/package.C#w(). => abstract method w => Int +flags/p/package.C#x. => val method x T +flags/p/package.C#y. => val method y U +flags/p/package.C#z. => val method z V +flags/p/package.S# => class S [typeparam T ] extends Object { self: S[T] => +2 decls } +flags/p/package.S#[T] => typeparam T +flags/p/package.S#``(). => primary ctor [unknown T: ](unknown T: ): S[T] +flags/p/package.T1# => type T1 = Int +flags/p/package.T2# => type T2 [typeparam T ] = S[] +flags/p/package.T2#[T] => typeparam T +flags/p/package.U# => type U +flags/p/package.V# => type V >: Int +flags/p/package.X. => final case object X extends Object with Product with Serializable { self: .X.type => +1 decls } +flags/p/package.Y# => final class Y extends Object { self: Y => +1 decls } +flags/p/package.Y#``(). => primary ctor (): Y +flags/p/package.Z# => sealed trait Z extends Object { self: Z => +1 decls } +flags/p/package.Z#``(). => primary ctor (): Z +flags/p/package.`y_=`(). => var method y_= (param x$1: Int): Unit +flags/p/package.`y_=`().(x$1) => param x$1: Int +flags/p/package.m(). => macro m [] => Int +flags/p/package.m().[TT] => typeparam TT +flags/p/package.x. => lazy val method x Int +flags/p/package.xs1. => val method xs1 Nothing +flags/p/package.y(). => implicit var method y Int +flags/p/package.z(). => method z (param pp: Int): Int +flags/p/package.z().(pp) => param pp: Int +local0 => val local xs2: Nothing +local1 => case val method t Occurrences: [0:8..0:13): flags <- flags/ @@ -3942,148 +3916,148 @@ Symbols => 142 entries Occurrences => 250 entries Symbols: -local1 => abstract method k -local3 => abstract method k -local4 => final class $anon -local6 => method k -local7 => final class $anon -local9 => final class $anon -local11 => method k -local12 => type L -local14 => typeparam T -types/B# => class B -types/B#``(). => primary ctor -types/C# => class C -types/C#``(). => primary ctor -types/Foo# => case class Foo -types/Foo#_1(). => method _1 -types/Foo#``(). => primary ctor -types/Foo#``().(s) => val param s -types/Foo#copy$default$1(). => method copy$default$1 -types/Foo#copy(). => method copy -types/Foo#copy().(s) => param s -types/Foo#s. => val method s -types/Foo. => final object Foo -types/Foo.apply(). => method apply -types/Foo.apply().(s) => param s -types/Foo.toString(). => method toString -types/Foo.unapply(). => method unapply -types/Foo.unapply().(x$1) => param x$1 -types/Foo.x. => val method x -types/Foo.y. => val method y -types/P# => class P -types/P#C# => class C -types/P#C#``(). => primary ctor -types/P#X# => class X -types/P#X#``(). => primary ctor -types/P#``(). => primary ctor -types/P#x. => val method x -types/T# => class T -types/T#C# => class C -types/T#C#``(). => primary ctor -types/T#X# => class X -types/T#X#``(). => primary ctor -types/T#``(). => primary ctor -types/T#x. => val method x -types/Test. => final object Test -types/Test.C# => class C -types/Test.C#ByNameType. => final object ByNameType -types/Test.C#ByNameType.m1(). => method m1 -types/Test.C#ByNameType.m1().(x) => param x -types/Test.C#ClassInfoType1. => final object ClassInfoType1 -types/Test.C#ClassInfoType2# => class ClassInfoType2 -types/Test.C#ClassInfoType2#``(). => primary ctor -types/Test.C#ClassInfoType2#x(). => method x -types/Test.C#ClassInfoType3# => trait ClassInfoType3 -types/Test.C#ClassInfoType3#[T] => typeparam T -types/Test.C#ClassInfoType3#``(). => primary ctor -types/Test.C#Either. => val method Either -types/Test.C#MethodType. => final object MethodType -types/Test.C#MethodType.m3(). => method m3 -types/Test.C#MethodType.m4(). => method m4 -types/Test.C#MethodType.m5(). => method m5 -types/Test.C#MethodType.m5().(x) => param x -types/Test.C#MethodType.m6(). => method m6 -types/Test.C#MethodType.m6().(x) => param x -types/Test.C#MethodType.m6().[T] => typeparam T -types/Test.C#MethodType.x1(). => method x1 -types/Test.C#MethodType.x2(). => method x2 -types/Test.C#RepeatedType# => case class RepeatedType -types/Test.C#RepeatedType#_1(). => method _1 -types/Test.C#RepeatedType#``(). => primary ctor -types/Test.C#RepeatedType#``().(s) => val param s -types/Test.C#RepeatedType#m1(). => method m1 -types/Test.C#RepeatedType#m1().(x) => param x -types/Test.C#RepeatedType#s. => val method s -types/Test.C#RepeatedType. => final object RepeatedType -types/Test.C#RepeatedType.apply(). => method apply -types/Test.C#RepeatedType.apply().(s) => param s -types/Test.C#RepeatedType.toString(). => method toString -types/Test.C#RepeatedType.unapplySeq(). => method unapplySeq -types/Test.C#RepeatedType.unapplySeq().(x$1) => param x$1 -types/Test.C#TypeType. => final object TypeType -types/Test.C#TypeType.T1# => type T1 -types/Test.C#TypeType.T4# => type T4 -types/Test.C#TypeType.T5# => type T5 -types/Test.C#TypeType.T5#[U] => typeparam U -types/Test.C#TypeType.m2(). => method m2 -types/Test.C#TypeType.m2().[T2] => typeparam T2 -types/Test.C#TypeType.m3(). => method m3 -types/Test.C#TypeType.m3().[M3] => typeparam M3 -types/Test.C#``(). => primary ctor -types/Test.C#annType1. => val method annType1 -types/Test.C#annType2. => val method annType2 -types/Test.C#compoundType1. => val method compoundType1 -types/Test.C#compoundType2. => val method compoundType2 -types/Test.C#compoundType3. => val method compoundType3 -types/Test.C#compoundType4. => val method compoundType4 -types/Test.C#compoundType5. => val method compoundType5 -types/Test.C#compoundType6. => val method compoundType6 -types/Test.C#existentialType2. => val method existentialType2 -types/Test.C#existentialType3. => val method existentialType3 -types/Test.C#existentialType4. => val method existentialType4 -types/Test.C#p. => val method p -types/Test.C#singleType1. => val method singleType1 -types/Test.C#singleType2. => val method singleType2 -types/Test.C#superType1. => val method superType1 -types/Test.C#superType2. => val method superType2 -types/Test.C#superType3. => val method superType3 -types/Test.C#thisType1. => val method thisType1 -types/Test.C#thisType2. => val method thisType2 -types/Test.C#typeLambda1(). => method typeLambda1 -types/Test.C#typeLambda1().[M] => typeparam M -types/Test.C#typeRef1. => val method typeRef1 -types/Test.C#typeRef2. => val method typeRef2 -types/Test.C#typeRef3. => val method typeRef3 -types/Test.C#typeRef4. => val method typeRef4 -types/Test.C#x. => val method x -types/Test.Literal. => final object Literal -types/Test.Literal.bool. => final val method bool -types/Test.Literal.char. => final val method char -types/Test.Literal.clazzOf. => final val method clazzOf -types/Test.Literal.double. => final val method double -types/Test.Literal.float. => final val method float -types/Test.Literal.int. => final val method int -types/Test.Literal.javaEnum. => final val method javaEnum -types/Test.Literal.long. => final val method long -types/Test.Literal.nil. => final val method nil -types/Test.Literal.string. => final val method string -types/Test.Literal.unit. => final val method unit -types/Test.M# => class M -types/Test.M#``(). => primary ctor -types/Test.M#m(). => method m -types/Test.N# => trait N -types/Test.N#``(). => primary ctor -types/Test.N#n(). => method n -types/ann# => class ann -types/ann#[T] => typeparam T -types/ann#``(). => primary ctor -types/ann#``().(x) => param x -types/ann#x. => val method x -types/ann1# => class ann1 -types/ann1#``(). => primary ctor -types/ann2# => class ann2 -types/ann2#``(). => primary ctor +local1 => abstract method k => Int +local3 => abstract method k => Int +local4 => final class $anon extends Object { self: $anon => +2 decls } +local6 => method k => Int +local7 => final class $anon extends M with N { self: $anon => +1 decls } +local9 => final class $anon extends M with N { self: $anon => +2 decls } +local11 => method k => Int +local12 => type L [unknown local13: ] = List[] +local14 => typeparam T +types/B# => class B extends Object { self: B => +1 decls } +types/B#``(). => primary ctor (): B +types/C# => class C extends Object { self: C => +1 decls } +types/C#``(). => primary ctor (): C +types/Foo# => case class Foo extends Object with Product with Serializable { self: Foo => +5 decls } +types/Foo#_1(). => method _1 => "abc" +types/Foo#``(). => primary ctor (val param s: "abc"): Foo +types/Foo#``().(s) => val param s: "abc" +types/Foo#copy$default$1(). => method copy$default$1 => "abc" @uncheckedVariance +types/Foo#copy(). => method copy (param s: "abc"): Foo +types/Foo#copy().(s) => param s: "abc" +types/Foo#s. => val method s "abc" +types/Foo. => final object Foo extends Object { self: .Foo.type => +6 decls } +types/Foo.apply(). => method apply (param s: "abc"): Foo +types/Foo.apply().(s) => param s: "abc" +types/Foo.toString(). => method toString => String +types/Foo.unapply(). => method unapply (param x$1: Foo): Foo +types/Foo.unapply().(x$1) => param x$1: Foo +types/Foo.x. => val method x "abc" @deprecated +types/Foo.y. => val method y "abc" +types/P# => class P extends Object { self: P => +8 decls } +types/P#C# => class C extends Object { self: C => +1 decls } +types/P#C#``(). => primary ctor (): C +types/P#X# => class X extends Object { self: X => +1 decls } +types/P#X#``(). => primary ctor (): X +types/P#``(). => primary ctor (): P +types/P#x. => val method x X +types/T# => class T extends Object { self: T => +8 decls } +types/T#C# => class C extends Object { self: C => +1 decls } +types/T#C#``(). => primary ctor (): C +types/T#X# => class X extends Object { self: X => +1 decls } +types/T#X#``(). => primary ctor (): X +types/T#``(). => primary ctor (): T +types/T#x. => val method x X +types/Test. => final object Test extends Object { self: .Test.type => +10 decls } +types/Test.C# => class C extends M { self: C => +42 decls } +types/Test.C#ByNameType. => final object ByNameType extends Object { self: .ByNameType.type => +2 decls } +types/Test.C#ByNameType.m1(). => method m1 (param x: => Int): Int +types/Test.C#ByNameType.m1().(x) => param x: => Int +types/Test.C#ClassInfoType1. => final object ClassInfoType1 extends Object { self: .ClassInfoType1.type => +1 decls } +types/Test.C#ClassInfoType2# => class ClassInfoType2 extends B { self: ClassInfoType2 => +2 decls } +types/Test.C#ClassInfoType2#``(). => primary ctor (): ClassInfoType2 +types/Test.C#ClassInfoType2#x(). => method x => Int +types/Test.C#ClassInfoType3# => trait ClassInfoType3 [typeparam T ] extends Object { self: ClassInfoType3[T] => +2 decls } +types/Test.C#ClassInfoType3#[T] => typeparam T +types/Test.C#ClassInfoType3#``(). => primary ctor [unknown T: ](unknown T: ): ClassInfoType3[T] +types/Test.C#Either. => val method Either .Either.type +types/Test.C#MethodType. => final object MethodType extends Object { self: .MethodType.type => +7 decls } +types/Test.C#MethodType.m3(). => method m3 => Int +types/Test.C#MethodType.m4(). => method m4 (): Int +types/Test.C#MethodType.m5(). => method m5 (param x: Int): Int +types/Test.C#MethodType.m5().(x) => param x: Int +types/Test.C#MethodType.m6(). => method m6 [typeparam T ](typeparam T )(param x: T): T +types/Test.C#MethodType.m6().(x) => param x: T +types/Test.C#MethodType.m6().[T] => typeparam T +types/Test.C#MethodType.x1(). => method x1 => Int +types/Test.C#MethodType.x2(). => method x2 => Int +types/Test.C#RepeatedType# => case class RepeatedType extends Object with Product with Serializable { self: RepeatedType => +4 decls } +types/Test.C#RepeatedType#_1(). => method _1 => String* +types/Test.C#RepeatedType#``(). => primary ctor (val param s: String*): RepeatedType +types/Test.C#RepeatedType#``().(s) => val param s: String* +types/Test.C#RepeatedType#m1(). => method m1 (param x: Int*): Int +types/Test.C#RepeatedType#m1().(x) => param x: Int* +types/Test.C#RepeatedType#s. => val method s String* +types/Test.C#RepeatedType. => final object RepeatedType extends Object { self: .RepeatedType.type => +4 decls } +types/Test.C#RepeatedType.apply(). => method apply (param s: String*): RepeatedType +types/Test.C#RepeatedType.apply().(s) => param s: String* +types/Test.C#RepeatedType.toString(). => method toString => String +types/Test.C#RepeatedType.unapplySeq(). => method unapplySeq (param x$1: RepeatedType): RepeatedType +types/Test.C#RepeatedType.unapplySeq().(x$1) => param x$1: RepeatedType +types/Test.C#TypeType. => final object TypeType extends Object { self: .TypeType.type => +6 decls } +types/Test.C#TypeType.T1# => type T1 +types/Test.C#TypeType.T4# => type T4 = C +types/Test.C#TypeType.T5# => type T5 [typeparam U ] = +types/Test.C#TypeType.T5#[U] => typeparam U +types/Test.C#TypeType.m2(). => method m2 [] => Nothing +types/Test.C#TypeType.m2().[T2] => typeparam T2 = C +types/Test.C#TypeType.m3(). => method m3 [] => Nothing +types/Test.C#TypeType.m3().[M3] => typeparam M3 [unknown _$2: ] +types/Test.C#``(). => primary ctor (): C +types/Test.C#annType1. => val method annType1 T @ann[T] +types/Test.C#annType2. => val method annType2 T @ann1 @ann2 +types/Test.C#compoundType1. => val method compoundType1 Object { local k: => Int } +types/Test.C#compoundType2. => val method compoundType2 M & N +types/Test.C#compoundType3. => val method compoundType3 M with N { local k: => Int } +types/Test.C#compoundType4. => val method compoundType4 Object +types/Test.C#compoundType5. => val method compoundType5 M & N +types/Test.C#compoundType6. => val method compoundType6 M & N +types/Test.C#existentialType2. => val method existentialType2 List[] +types/Test.C#existentialType3. => val method existentialType3 Class[] +types/Test.C#existentialType4. => val method existentialType4 Class[] +types/Test.C#p. => val method p P +types/Test.C#singleType1. => val method singleType1 .x.type +types/Test.C#singleType2. => val method singleType2 .p.x.type +types/Test.C#superType1. => val method superType1 Int +types/Test.C#superType2. => val method superType2 Int +types/Test.C#superType3. => val method superType3 Int +types/Test.C#thisType1. => val method thisType1 C.this.type +types/Test.C#thisType2. => val method thisType2 C.this.type +types/Test.C#typeLambda1(). => method typeLambda1 [] => Nothing +types/Test.C#typeLambda1().[M] => typeparam M [unknown _$1: ] +types/Test.C#typeRef1. => val method typeRef1 C +types/Test.C#typeRef2. => val method typeRef2 .p.C +types/Test.C#typeRef3. => val method typeRef3 T#C +types/Test.C#typeRef4. => val method typeRef4 List[Int] +types/Test.C#x. => val method x .p.X +types/Test.Literal. => final object Literal extends Object { self: .Literal.type => +12 decls } +types/Test.Literal.bool. => final val method bool true +types/Test.Literal.char. => final val method char 'a' +types/Test.Literal.clazzOf. => final val method clazzOf Option[Int] +types/Test.Literal.double. => final val method double 2.0 +types/Test.Literal.float. => final val method float 1.0f +types/Test.Literal.int. => final val method int 1 +types/Test.Literal.javaEnum. => final val method javaEnum LinkOption +types/Test.Literal.long. => final val method long 1L +types/Test.Literal.nil. => final val method nil Null +types/Test.Literal.string. => final val method string "a" +types/Test.Literal.unit. => final val method unit Unit +types/Test.M# => class M extends Object { self: M => +2 decls } +types/Test.M#``(). => primary ctor (): M +types/Test.M#m(). => method m => Int +types/Test.N# => trait N extends Object { self: N => +2 decls } +types/Test.N#``(). => primary ctor (): N +types/Test.N#n(). => method n => Int +types/ann# => class ann [typeparam T ] extends Annotation with StaticAnnotation { self: ann[T] => +3 decls } +types/ann#[T] => typeparam T +types/ann#``(). => primary ctor [unknown T: ](unknown T: )(param x: T): ann[T] +types/ann#``().(x) => param x: T +types/ann#x. => val method x T +types/ann1# => class ann1 extends Annotation with StaticAnnotation { self: ann1 => +1 decls } +types/ann1#``(). => primary ctor (): ann1 +types/ann2# => class ann2 extends Annotation with StaticAnnotation { self: ann2 => +1 decls } +types/ann2#``(). => primary ctor (): ann2 Occurrences: [0:8..0:13): types <- types/ @@ -4349,24 +4323,24 @@ Symbols => 18 entries Occurrences => 22 entries Symbols: -_empty_/AnObject. => final object AnObject -_empty_/AnObject.Foo# => case class Foo -_empty_/AnObject.Foo#_1(). => method _1 -_empty_/AnObject.Foo#``(). => primary ctor -_empty_/AnObject.Foo#``().(x) => val param x -_empty_/AnObject.Foo#copy$default$1(). => method copy$default$1 -_empty_/AnObject.Foo#copy(). => method copy -_empty_/AnObject.Foo#copy().(x) => param x -_empty_/AnObject.Foo#x. => val method x -_empty_/AnObject.Foo. => final object Foo -_empty_/AnObject.Foo.apply(). => method apply -_empty_/AnObject.Foo.apply().(x) => param x -_empty_/AnObject.Foo.toString(). => method toString -_empty_/AnObject.Foo.unapply(). => method unapply -_empty_/AnObject.Foo.unapply().(x$1) => param x$1 -_empty_/AnObject.foo(). => method foo -_empty_/AnObject.foo().(x) => param x -_empty_/AnObject.foo(+1). => method foo +_empty_/AnObject. => final object AnObject extends Object { self: .AnObject.type => +6 decls } +_empty_/AnObject.Foo# => case class Foo extends Object with Product with Serializable { self: Foo => +5 decls } +_empty_/AnObject.Foo#_1(). => method _1 => Int +_empty_/AnObject.Foo#``(). => primary ctor (val param x: Int): Foo +_empty_/AnObject.Foo#``().(x) => val param x: Int +_empty_/AnObject.Foo#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance +_empty_/AnObject.Foo#copy(). => method copy (param x: Int): Foo +_empty_/AnObject.Foo#copy().(x) => param x: Int +_empty_/AnObject.Foo#x. => val method x Int +_empty_/AnObject.Foo. => final object Foo extends Object { self: .Foo.type => +4 decls } +_empty_/AnObject.Foo.apply(). => method apply (param x: Int): Foo +_empty_/AnObject.Foo.apply().(x) => param x: Int +_empty_/AnObject.Foo.toString(). => method toString => String +_empty_/AnObject.Foo.unapply(). => method unapply (param x$1: Foo): Foo +_empty_/AnObject.Foo.unapply().(x$1) => param x$1: Foo +_empty_/AnObject.foo(). => method foo (param x: Int): Unit +_empty_/AnObject.foo().(x) => param x: Int +_empty_/AnObject.foo(+1). => method foo (): Unit Occurrences: [0:7..0:15): AnObject <- _empty_/AnObject. @@ -4404,25 +4378,25 @@ Symbols => 19 entries Occurrences => 44 entries Symbols: -_empty_/MyProgram# => final class MyProgram -_empty_/MyProgram#``(). => primary ctor -_empty_/MyProgram#main(). => static method main -_empty_/MyProgram#main().(args) => param args -_empty_/toplevel$package. => final package object _empty_ -_empty_/toplevel$package.MyProgram(). => method MyProgram -_empty_/toplevel$package.MyProgram().(times) => param times -_empty_/toplevel$package.a. => val method a -_empty_/toplevel$package.combine(). => method combine -_empty_/toplevel$package.combine().(x) => param x -_empty_/toplevel$package.combine().(y) => param y -_empty_/toplevel$package.combine(+1). => method combine -_empty_/toplevel$package.combine(+1).(x) => param x -_empty_/toplevel$package.combine(+1).(y) => param y -_empty_/toplevel$package.combine(+1).(z) => param z -_empty_/toplevel$package.combine(+2). => method combine -_empty_/toplevel$package.foo(). => method foo -_empty_/toplevel$package.fooRef(). => method fooRef -local0 => val local error +_empty_/MyProgram# => final class MyProgram extends Object { self: MyProgram => +2 decls } +_empty_/MyProgram#``(). => primary ctor (): MyProgram +_empty_/MyProgram#main(). => static method main (param args: Array[String]): Unit +_empty_/MyProgram#main().(args) => param args: Array[String] +_empty_/toplevel$package. => final package object _empty_ extends Object { self: ._empty_.type => +8 decls } +_empty_/toplevel$package.MyProgram(). => method MyProgram (param times: Int): Unit +_empty_/toplevel$package.MyProgram().(times) => param times: Int +_empty_/toplevel$package.a. => val method a "" +_empty_/toplevel$package.combine(). => method combine (param x: Int)(param y: Int): +_empty_/toplevel$package.combine().(x) => param x: Int +_empty_/toplevel$package.combine().(y) => param y: Int +_empty_/toplevel$package.combine(+1). => method combine (param x: Int, param y: Int, param z: Int): Int +_empty_/toplevel$package.combine(+1).(x) => param x: Int +_empty_/toplevel$package.combine(+1).(y) => param y: Int +_empty_/toplevel$package.combine(+1).(z) => param z: Int +_empty_/toplevel$package.combine(+2). => method combine => Int +_empty_/toplevel$package.foo(). => method foo => String +_empty_/toplevel$package.fooRef(). => method fooRef => String +local0 => val local error: ParseError Occurrences: [0:11..0:12): a <- _empty_/toplevel$package.a. From 90177c67fde68ca5110d87ac9e99d1da757618f4 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Fri, 25 Jun 2021 02:13:16 +0900 Subject: [PATCH 04/25] Integrate SymbolInformationOps into Scala3#SymbolOps --- .../dotc/semanticdb/ExtractSemanticDB.scala | 36 ++++- .../dotty/tools/dotc/semanticdb/Scala3.scala | 80 +++++++++++ .../semanticdb/SymbolInformationOps.scala | 136 ------------------ .../{SymbolOps.scala => TypeOps.scala} | 17 +-- 4 files changed, 115 insertions(+), 154 deletions(-) delete mode 100644 compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala rename compiler/src/dotty/tools/dotc/semanticdb/{SymbolOps.scala => TypeOps.scala} (94%) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 4ecd24f7e76f..6252e08d0244 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -22,7 +22,6 @@ import scala.collection.mutable import scala.annotation.{ threadUnsafe => tu, tailrec } import scala.PartialFunction.condOpt -import SymbolInformationOps._ import dotty.tools.dotc.semanticdb.SemanticSymbolBuilder /** Extract symbol references and uses to semanticdb files. @@ -136,12 +135,12 @@ class ExtractSemanticDB extends Phase: if !tree.symbol.isAllOf(ModuleValCreationFlags) then if !excludeDef(tree.symbol) && tree.span.hasLength then - registerDefinition(tree.symbol, tree.nameSpan, tree.symbolKinds, tree.source) + registerDefinition(tree.symbol, tree.nameSpan, symbolKinds(tree), tree.source) val privateWithin = tree.symbol.privateWithin if privateWithin.exists then registerUseGuarded(None, privateWithin, spanOfSymbol(privateWithin, tree.span, tree.source), tree.source) else if !excludeSymbol(tree.symbol) then - registerSymbol(tree.symbol, tree.symbolKinds) + registerSymbol(tree.symbol, symbolKinds(tree)) tree match case tree: ValDef if tree.symbol.isAllOf(EnumValue) => @@ -332,6 +331,15 @@ class ExtractSemanticDB extends Phase: val start = if idx >= 0 then idx else span.start Span(start, start + sym.name.show.length, start) + extension (list: List[List[ValDef]]) + private inline def isSingleArg = list match + case (_::Nil)::Nil => true + case _ => false + + extension (tree: DefDef) + private def isSetterDef(using Context): Boolean = + tree.name.isSetterName && tree.mods.is(Accessor) && tree.termParamss.isSingleArg + private def findGetters(ctorParams: Set[Names.TermName], body: List[Tree])(using Context): Map[Names.TermName, ValDef] = if ctorParams.isEmpty || body.isEmpty then Map.empty @@ -378,6 +386,28 @@ class ExtractSemanticDB extends Phase: private inline def matchingMemberType(ctorTypeParam: Symbol, classSym: Symbol)(using Context) = classSym.info.member(ctorTypeParam.name).symbol + /**Necessary because not all of the eventual flags are propagated from the Tree to the symbol yet. + */ + private def symbolKinds(tree: NamedDefTree)(using Context): Set[SymbolKind] = + if tree.symbol.isSelfSym then + Set.empty + else + val symkinds = mutable.HashSet.empty[SymbolKind] + tree match + case tree: ValDef => + if !tree.symbol.is(Param) then + symkinds += (if tree.mods is Mutable then SymbolKind.Var else SymbolKind.Val) + if tree.rhs.isEmpty && !tree.symbol.isOneOf(TermParam | CaseAccessor | ParamAccessor) then + symkinds += SymbolKind.Abstract + case tree: DefDef => + if tree.isSetterDef then + symkinds += SymbolKind.Setter + else if tree.rhs.isEmpty then + symkinds += SymbolKind.Abstract + case tree: Bind => + symkinds += SymbolKind.Val + case _ => + symkinds.toSet private def ctorParams( vparamss: List[List[ValDef]], body: List[Tree])(using Context): Unit = diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala index 99d9a1c5f460..2db6118bb092 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala @@ -126,6 +126,86 @@ object Scala3: def isSyntheticWithIdent(using Context): Boolean = sym.is(Synthetic) && !sym.isAnonymous && !sym.name.isEmptyNumbered + def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context, SemanticSymbolBuilder): SymbolInformation = + import TypeOps._ + val sname = sym.symbolName + val signature = sym.info.toSemanticSig(sym) + SymbolInformation( + symbol = sname, + language = Language.SCALA, + kind = symbolKind(symkinds), + properties = sym.symbolProps(symkinds), + displayName = Symbols.displaySymbol(sym), + signature = signature, + ) + + private def symbolKind(symkinds: Set[SymbolKind])(using Context): SymbolInformation.Kind = + if sym.isTypeParam then + SymbolInformation.Kind.TYPE_PARAMETER + else if sym.is(TermParam) then + SymbolInformation.Kind.PARAMETER + else if sym.isTerm && sym.owner.isTerm then + SymbolInformation.Kind.LOCAL + else if sym.isInlineMethod || sym.is(Macro) then + SymbolInformation.Kind.MACRO + else if sym.isConstructor then + SymbolInformation.Kind.CONSTRUCTOR + else if sym.isSelfSym then + SymbolInformation.Kind.SELF_PARAMETER + else if sym.isOneOf(Method) || symkinds.exists(_.isVarOrVal) then + SymbolInformation.Kind.METHOD + else if sym.isPackageObject then + SymbolInformation.Kind.PACKAGE_OBJECT + else if sym.is(Module) then + SymbolInformation.Kind.OBJECT + else if sym.is(Package) then + SymbolInformation.Kind.PACKAGE + else if sym.isAllOf(JavaInterface) then + SymbolInformation.Kind.INTERFACE + else if sym.is(Trait) then + SymbolInformation.Kind.TRAIT + else if sym.isClass then + SymbolInformation.Kind.CLASS + else if sym.isType then + SymbolInformation.Kind.TYPE + else if sym.is(ParamAccessor) then + SymbolInformation.Kind.FIELD + else + SymbolInformation.Kind.UNKNOWN_KIND + + private def symbolProps(symkinds: Set[SymbolKind])(using Context): Int = + if sym.is(ModuleClass) then + return sym.sourceModule.symbolProps(symkinds) + var props = 0 + if sym.isPrimaryConstructor then + props |= SymbolInformation.Property.PRIMARY.value + if sym.is(Abstract) || symkinds.contains(SymbolKind.Abstract) then + props |= SymbolInformation.Property.ABSTRACT.value + if sym.is(Final) then + props |= SymbolInformation.Property.FINAL.value + if sym.is(Sealed) then + props |= SymbolInformation.Property.SEALED.value + if sym.isOneOf(GivenOrImplicit) then + props |= SymbolInformation.Property.IMPLICIT.value + if sym.is(Lazy, butNot=Module) then + props |= SymbolInformation.Property.LAZY.value + if sym.isAllOf(Case | Module) || sym.is(CaseClass) || sym.isAllOf(EnumCase) then + props |= SymbolInformation.Property.CASE.value + if sym.is(Covariant) then + props |= SymbolInformation.Property.COVARIANT.value + if sym.is(Contravariant) then + props |= SymbolInformation.Property.CONTRAVARIANT.value + if sym.isAllOf(DefaultMethod | JavaDefined) || sym.is(Accessor) && sym.name.is(NameKinds.DefaultGetterName) then + props |= SymbolInformation.Property.DEFAULT.value + if symkinds.exists(_.isVal) then + props |= SymbolInformation.Property.VAL.value + if symkinds.exists(_.isVar) then + props |= SymbolInformation.Property.VAR.value + if sym.is(JavaStatic) then + props |= SymbolInformation.Property.STATIC.value + if sym.is(Enum) then + props |= SymbolInformation.Property.ENUM.value + props end SymbolOps object LocalSymbol: diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala deleted file mode 100644 index 15851fdaf1c8..000000000000 --- a/compiler/src/dotty/tools/dotc/semanticdb/SymbolInformationOps.scala +++ /dev/null @@ -1,136 +0,0 @@ -package dotty.tools -package dotc -package semanticdb - -import dotty.tools.dotc.{semanticdb => s} -import dotty.tools.dotc.semanticdb.Scala3.SymbolKind -import Scala3.Symbols - -import core.NameKinds -import core.Symbols._ -import core.Flags._ -import core.Contexts.Context -import ast.tpd._ -import core.NameOps._ - -import scala.collection.mutable - -object SymbolInformationOps: - extension (sym: Symbol) - def toSymbolInformation(using LinkMode, Context, SemanticSymbolBuilder): s.SymbolInformation = - // val symkinds = sym.defTree.symbolKinds - sym.symbolInfo(Set.empty) - - def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context, SemanticSymbolBuilder): SymbolInformation = - import s.SymbolOps._ - val sname = sym.symbolName - val signature = sym.sig - SymbolInformation( - symbol = sname, - language = Language.SCALA, - kind = symbolKind(symkinds), - properties = sym.symbolProps(symkinds), - displayName = Symbols.displaySymbol(sym), - signature = signature, - ) - - private def symbolKind(symkinds: Set[SymbolKind])(using Context): SymbolInformation.Kind = - if sym.isTypeParam then - SymbolInformation.Kind.TYPE_PARAMETER - else if sym.is(TermParam) then - SymbolInformation.Kind.PARAMETER - else if sym.isTerm && sym.owner.isTerm then - SymbolInformation.Kind.LOCAL - else if sym.isInlineMethod || sym.is(Macro) then - SymbolInformation.Kind.MACRO - else if sym.isConstructor then - SymbolInformation.Kind.CONSTRUCTOR - else if sym.isSelfSym then - SymbolInformation.Kind.SELF_PARAMETER - else if sym.isOneOf(Method) || symkinds.exists(_.isVarOrVal) then - SymbolInformation.Kind.METHOD - else if sym.isPackageObject then - SymbolInformation.Kind.PACKAGE_OBJECT - else if sym.is(Module) then - SymbolInformation.Kind.OBJECT - else if sym.is(Package) then - SymbolInformation.Kind.PACKAGE - else if sym.isAllOf(JavaInterface) then - SymbolInformation.Kind.INTERFACE - else if sym.is(Trait) then - SymbolInformation.Kind.TRAIT - else if sym.isClass then - SymbolInformation.Kind.CLASS - else if sym.isType then - SymbolInformation.Kind.TYPE - else if sym.is(ParamAccessor) then - SymbolInformation.Kind.FIELD - else - SymbolInformation.Kind.UNKNOWN_KIND - - private def symbolProps(symkinds: Set[SymbolKind])(using Context): Int = - if sym.is(ModuleClass) then - return sym.sourceModule.symbolProps(symkinds) - var props = 0 - if sym.isPrimaryConstructor then - props |= SymbolInformation.Property.PRIMARY.value - if sym.is(Abstract) || symkinds.contains(SymbolKind.Abstract) then - props |= SymbolInformation.Property.ABSTRACT.value - if sym.is(Final) then - props |= SymbolInformation.Property.FINAL.value - if sym.is(Sealed) then - props |= SymbolInformation.Property.SEALED.value - if sym.isOneOf(GivenOrImplicit) then - props |= SymbolInformation.Property.IMPLICIT.value - if sym.is(Lazy, butNot=Module) then - props |= SymbolInformation.Property.LAZY.value - if sym.isAllOf(Case | Module) || sym.is(CaseClass) || sym.isAllOf(EnumCase) then - props |= SymbolInformation.Property.CASE.value - if sym.is(Covariant) then - props |= SymbolInformation.Property.COVARIANT.value - if sym.is(Contravariant) then - props |= SymbolInformation.Property.CONTRAVARIANT.value - if sym.isAllOf(DefaultMethod | JavaDefined) || sym.is(Accessor) && sym.name.is(NameKinds.DefaultGetterName) then - props |= SymbolInformation.Property.DEFAULT.value - if symkinds.exists(_.isVal) then - props |= SymbolInformation.Property.VAL.value - if symkinds.exists(_.isVar) then - props |= SymbolInformation.Property.VAR.value - if sym.is(JavaStatic) then - props |= SymbolInformation.Property.STATIC.value - if sym.is(Enum) then - props |= SymbolInformation.Property.ENUM.value - props - - /**Necessary because not all of the eventual flags are propagated from the Tree to the symbol yet. - */ - extension (tree: Tree) - def symbolKinds(using Context): Set[SymbolKind] = - if tree.symbol.isSelfSym then - Set.empty - else - val symkinds = mutable.HashSet.empty[SymbolKind] - tree match - case tree: ValDef => - if !tree.symbol.is(Param) then - symkinds += (if tree.mods is Mutable then SymbolKind.Var else SymbolKind.Val) - if tree.rhs.isEmpty && !tree.symbol.isOneOf(TermParam | CaseAccessor | ParamAccessor) then - symkinds += SymbolKind.Abstract - case tree: DefDef => - if tree.isSetterDef then - symkinds += SymbolKind.Setter - else if tree.rhs.isEmpty then - symkinds += SymbolKind.Abstract - case tree: Bind => - symkinds += SymbolKind.Val - case _ => - symkinds.toSet - - extension (tree: DefDef) - private def isSetterDef(using Context): Boolean = - tree.name.isSetterName && tree.mods.is(Accessor) && tree.termParamss.isSingleArg - - extension (list: List[List[ValDef]]) - private inline def isSingleArg = list match - case (_::Nil)::Nil => true - case _ => false diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala similarity index 94% rename from compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala rename to compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 1b115f04053b..0d925dfe32cd 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SymbolOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -11,19 +11,6 @@ import ast.tpd._ import dotty.tools.dotc.{semanticdb => s} -object SymbolOps: - extension (sym: Symbol) - def sig(using LinkMode, Context, SemanticSymbolBuilder): s.Signature = - import TypeOps._ - val sig = sym.info.toSemanticSig(sym) - // println("") - // println(sym.toString) - // println(s"=========sym.info================") - // pprint.pprintln(sym.info) - // println(s"=========sig================") - // pprint.pprintln(sig) - sig - object TypeOps: import SymbolScopeOps._ extension (tpe: Type) @@ -244,12 +231,12 @@ object TypeOps: } object SymbolScopeOps: - import SymbolInformationOps._ + import Scala3.given extension (syms: List[Symbol]) def sscope(using linkMode: LinkMode)(using SemanticSymbolBuilder, Context): s.Scope = linkMode match { case LinkMode.SymlinkChildren => s.Scope(symlinks = syms.map(_.symbolName)) case LinkMode.HardlinkChildren => - s.Scope(hardlinks = syms.map(_.toSymbolInformation)) + s.Scope(hardlinks = syms.map(_.symbolInfo(Set.empty))) } From de36d34c83fcb5cfba4cb322389b8590ba6f7c99 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Fri, 25 Jun 2021 02:22:47 +0900 Subject: [PATCH 05/25] Model WithType for AndType https://github.com/lampepfl/dotty/pull/12885#discussion_r655372990 --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 2 +- tests/semanticdb/metac.expect | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 0d925dfe32cd..83e49bc0bba7 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -202,7 +202,7 @@ object TypeOps: case AndType(ct1, ct2) => flatten(ct1) ++ flatten(ct2) case other => List(other) val stpes = flatten(and).map(loop) - s.IntersectionType(stpes) + s.WithType(stpes) case or: OrType => def flatten(child: Type): List[Type] = child match diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 7d0fe12e7216..818912c47c48 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -194,7 +194,7 @@ Occurrences => 52 entries Symbols: annot/Alias. => final object Alias extends Object { self: .Alias.type => +2 decls } annot/Alias.A# => type A = ClassAnnotation @param -annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef & Annotations[T] => +6 decls } +annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef with Annotations[T] => +6 decls } annot/Annotations#S# => type S annot/Annotations#[T] => typeparam T annot/Annotations#``(). => primary ctor [unknown T: ](unknown T: )(param x: T): Annotations[T] @@ -281,7 +281,7 @@ Symbols => 13 entries Occurrences => 32 entries Symbols: -example/Anonymous# => class Anonymous extends Object { self: Anonymous & Anonymous => +6 decls } +example/Anonymous# => class Anonymous extends Object { self: Anonymous with Anonymous => +6 decls } example/Anonymous#Foo# => trait Foo extends Object { self: Foo => +1 decls } example/Anonymous#Foo#``(). => primary ctor (): Foo example/Anonymous#``(). => primary ctor (): Anonymous @@ -781,7 +781,7 @@ enumVal/Color#rgb. => val method rgb Int enumVal/Color. => final object Color extends Object { self: .Color.type => +8 decls } enumVal/Color.$values. => val method $values Array[Color] enumVal/Color.Blue. => case val static enum method Blue Color -enumVal/Color.Green. => case val static enum method Green Color & A +enumVal/Color.Green. => case val static enum method Green Color with A enumVal/Color.Red. => case val static enum method Red Color enumVal/Color.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Color enumVal/Color.fromOrdinal().(ordinal) => param ordinal: Int @@ -1669,7 +1669,7 @@ Symbols => 8 entries Occurrences => 55 entries Symbols: -example/InstrumentTyper# => class InstrumentTyper extends Object { self: AnyRef & InstrumentTyper => +5 decls } +example/InstrumentTyper# => class InstrumentTyper extends Object { self: AnyRef with InstrumentTyper => +5 decls } example/InstrumentTyper#AnnotatedType# => type AnnotatedType = Int @param example/InstrumentTyper#``(). => primary ctor (): InstrumentTyper example/InstrumentTyper#all(). => method all => List[Matchable] @@ -2765,16 +2765,16 @@ Occurrences => 26 entries Symbols: local0 => selfparam self: C1 local1 => selfparam self: B -local2 => selfparam self: B & C1 +local2 => selfparam self: B with C1 selfs/B# => class B extends Object { self: B => +1 decls } selfs/B#``(). => primary ctor (): B -selfs/C1# => class C1 extends B { self: C1 & C1 => +1 decls } +selfs/C1# => class C1 extends B { self: C1 with C1 => +1 decls } selfs/C1#``(). => primary ctor (): C1 -selfs/C2# => class C2 extends B { self: B & C2 => +1 decls } +selfs/C2# => class C2 extends B { self: B with C2 => +1 decls } selfs/C2#``(). => primary ctor (): C2 -selfs/C3# => class C3 extends B { self: B & C1 & C3 => +1 decls } +selfs/C3# => class C3 extends B { self: B with C1 with C3 => +1 decls } selfs/C3#``(). => primary ctor (): C3 -selfs/C6# => class C6 extends B { self: B & C6 => +1 decls } +selfs/C6# => class C6 extends B { self: B with C6 => +1 decls } selfs/C6#``(). => primary ctor (): C6 Occurrences: @@ -3043,7 +3043,7 @@ traits/U# => sealed trait U extends Object { self: U => +1 decls } traits/U#``(). => primary ctor (): U traits/U. => final object U extends Object { self: .U.type => +2 decls } traits/U.u(). => method u => U -traits/V# => trait V extends Object { self: C & V => +1 decls } +traits/V# => trait V extends Object { self: C with V => +1 decls } traits/V#``(). => primary ctor (): V Occurrences: @@ -4008,11 +4008,11 @@ types/Test.C#``(). => primary ctor (): C types/Test.C#annType1. => val method annType1 T @ann[T] types/Test.C#annType2. => val method annType2 T @ann1 @ann2 types/Test.C#compoundType1. => val method compoundType1 Object { local k: => Int } -types/Test.C#compoundType2. => val method compoundType2 M & N +types/Test.C#compoundType2. => val method compoundType2 M with N types/Test.C#compoundType3. => val method compoundType3 M with N { local k: => Int } types/Test.C#compoundType4. => val method compoundType4 Object -types/Test.C#compoundType5. => val method compoundType5 M & N -types/Test.C#compoundType6. => val method compoundType6 M & N +types/Test.C#compoundType5. => val method compoundType5 M with N +types/Test.C#compoundType6. => val method compoundType6 M with N types/Test.C#existentialType2. => val method existentialType2 List[] types/Test.C#existentialType3. => val method existentialType3 Class[] types/Test.C#existentialType4. => val method existentialType4 Class[] From 7dd91ad1f8cc1cc3247a8522d9230e91db193548 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Tue, 29 Jun 2021 19:48:03 +0900 Subject: [PATCH 06/25] Resolve ParamRef by constructing SymbolTable To construct symbol table before referring the ParamRef it's required to traverse the child trees before registering the symbol. --- .../dotc/semanticdb/ExtractSemanticDB.scala | 93 +++++------ .../dotty/tools/dotc/semanticdb/Scala3.scala | 3 +- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 41 ++++- tests/semanticdb/expect/Advanced.expect.scala | 6 +- tests/semanticdb/expect/Classes.expect.scala | 2 +- .../expect/ForComprehension.expect.scala | 2 +- tests/semanticdb/expect/Givens.expect.scala | 2 +- .../expect/InventedNames.expect.scala | 6 +- tests/semanticdb/expect/Local.expect.scala | 4 +- tests/semanticdb/expect/Methods.expect.scala | 2 +- .../semanticdb/expect/Synthetic.expect.scala | 2 +- .../semanticdb/expect/recursion.expect.scala | 2 +- .../expect/semanticdb-Types.expect.scala | 10 +- tests/semanticdb/expect/toplevel.expect.scala | 2 +- tests/semanticdb/metac.expect | 158 +++++++++--------- 15 files changed, 177 insertions(+), 158 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 6252e08d0244..9134057ed542 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -23,6 +23,7 @@ import scala.annotation.{ threadUnsafe => tu, tailrec } import scala.PartialFunction.condOpt import dotty.tools.dotc.semanticdb.SemanticSymbolBuilder +import dotty.tools.dotc.semanticdb.{TypeOps => TOps} /** Extract symbol references and uses to semanticdb files. * See https://scalameta.org/docs/semanticdb/specification.html#symbol-1 @@ -50,6 +51,7 @@ class ExtractSemanticDB extends Phase: /** Extractor of symbol occurrences from trees */ class Extractor extends TreeTraverser: given builder: SemanticSymbolBuilder = SemanticSymbolBuilder() + given typeOps: TOps = TOps() /** The bodies of synthetic locals */ private val localBodies = mutable.HashMap[Symbol, Tree]() @@ -123,61 +125,52 @@ class ExtractSemanticDB extends Phase: tree match case tree: PackageDef => - if !excludeDef(tree.pid.symbol) - && tree.pid.span.hasLength then - tree.pid match - case tree: Select => - registerDefinition(tree.symbol, selectSpan(tree), Set.empty, tree.source) - traverse(tree.qualifier) - case tree => registerDefinition(tree.symbol, tree.span, Set.empty, tree.source) tree.stats.foreach(traverse) + if !excludeDef(tree.pid.symbol) && tree.pid.span.hasLength then + tree.pid match + case tree: Select => + traverse(tree.qualifier) + registerDefinition(tree.symbol, selectSpan(tree), Set.empty, tree.source) + case tree => registerDefinition(tree.symbol, tree.span, Set.empty, tree.source) case tree: NamedDefTree => if !tree.symbol.isAllOf(ModuleValCreationFlags) then - if !excludeDef(tree.symbol) - && tree.span.hasLength then + tree match { + case tree: ValDef if tree.symbol.isAllOf(EnumValue) => + tree.rhs match + case Block(TypeDef(_, template: Template) :: _, _) => // simple case with specialised extends clause + template.parents.filter(!_.span.isZeroExtent).foreach(traverse) + case _ => // calls $new + case tree: ValDef if tree.symbol.isSelfSym => + if tree.tpt.span.hasLength then + traverse(tree.tpt) + case tree: DefDef if tree.symbol.isConstructor => // ignore typeparams for secondary ctors + tree.trailingParamss.foreach(_.foreach(traverse)) + traverse(tree.rhs) + case tree: (DefDef | ValDef) if tree.symbol.isSyntheticWithIdent => + tree match + case tree: DefDef => + tree.paramss.foreach(_.foreach(param => registerSymbolSimple(param.symbol))) + case tree: ValDef if tree.symbol.is(Given) => traverse(tree.tpt) + case _ => + if !tree.symbol.isGlobal then + localBodies(tree.symbol) = tree.rhs + // ignore rhs + case PatternValDef(pat, rhs) => + traverse(rhs) + PatternValDef.collectPats(pat).foreach(traverse) + case tree => + if !excludeChildren(tree.symbol) then + traverseChildren(tree) + } + if !excludeDef(tree.symbol) && tree.span.hasLength then registerDefinition(tree.symbol, tree.nameSpan, symbolKinds(tree), tree.source) val privateWithin = tree.symbol.privateWithin if privateWithin.exists then registerUseGuarded(None, privateWithin, spanOfSymbol(privateWithin, tree.span, tree.source), tree.source) else if !excludeSymbol(tree.symbol) then registerSymbol(tree.symbol, symbolKinds(tree)) - tree match - case tree: ValDef - if tree.symbol.isAllOf(EnumValue) => - tree.rhs match - case Block(TypeDef(_, template: Template) :: _, _) => // simple case with specialised extends clause - template.parents.filter(!_.span.isZeroExtent).foreach(traverse) - case _ => // calls $new - case tree: ValDef - if tree.symbol.isSelfSym => - if tree.tpt.span.hasLength then - traverse(tree.tpt) - case tree: DefDef - if tree.symbol.isConstructor => // ignore typeparams for secondary ctors - tree.trailingParamss.foreach(_.foreach(traverse)) - traverse(tree.rhs) - case tree: (DefDef | ValDef) - if tree.symbol.isSyntheticWithIdent => - tree match - case tree: DefDef => - tree.paramss.foreach(_.foreach(param => registerSymbolSimple(param.symbol))) - case tree: ValDef if tree.symbol.is(Given) => traverse(tree.tpt) - case _ => - if !tree.symbol.isGlobal then - localBodies(tree.symbol) = tree.rhs - // ignore rhs - case PatternValDef(pat, rhs) => - traverse(rhs) - PatternValDef.collectPats(pat).foreach(traverse) - case tree => - if !excludeChildren(tree.symbol) then - traverseChildren(tree) case tree: Template => val ctorSym = tree.constr.symbol - if !excludeDef(ctorSym) then - traverseAnnotsOfDefinition(ctorSym) - registerDefinition(ctorSym, tree.constr.nameSpan.startPos, Set.empty, tree.source) - ctorParams(tree.constr.termParamss, tree.body) for parent <- tree.parentsOrDerived if parent.span.hasLength do traverse(parent) val selfSpan = tree.self.span @@ -187,14 +180,18 @@ class ExtractSemanticDB extends Phase: tree.body.foreachUntilImport(traverse).foreach(traverse) // the first import statement else tree.body.foreach(traverse) + if !excludeDef(ctorSym) then + traverseAnnotsOfDefinition(ctorSym) + ctorParams(tree.constr.termParamss, tree.body) + registerDefinition(ctorSym, tree.constr.nameSpan.startPos, Set.empty, tree.source) case tree: Apply => @tu lazy val genParamSymbol: Name => String = tree.fun.symbol.funParamSymbol traverse(tree.fun) for arg <- tree.args do arg match case tree @ NamedArg(name, arg) => - registerUse(genParamSymbol(name), tree.span.startPos.withEnd(tree.span.start + name.toString.length), tree.source) traverse(localBodies.get(arg.symbol).getOrElse(arg)) + registerUse(genParamSymbol(name), tree.span.startPos.withEnd(tree.span.start + name.toString.length), tree.source) case _ => traverse(arg) case tree: Assign => val qualSym = condOpt(tree.lhs) { case Select(qual, _) if qual.symbol.exists => qual.symbol } @@ -214,11 +211,12 @@ class ExtractSemanticDB extends Phase: val qual = tree.qualifier val qualSpan = qual.span val sym = tree.symbol.adjustIfCtorTyparam - registerUseGuarded(qual.symbol.ifExists, sym, selectSpan(tree), tree.source) if qualSpan.exists && qualSpan.hasLength then traverse(qual) + registerUseGuarded(qual.symbol.ifExists, sym, selectSpan(tree), tree.source) case tree: Import => if tree.span.exists && tree.span.hasLength then + traverseChildren(tree) for sel <- tree.selectors do val imported = sel.imported.name if imported != nme.WILDCARD then @@ -226,7 +224,6 @@ class ExtractSemanticDB extends Phase: registerUseGuarded(None, alt.symbol, sel.imported.span, tree.source) if (alt.symbol.companionClass.exists) registerUseGuarded(None, alt.symbol.companionClass, sel.imported.span, tree.source) - traverseChildren(tree) case tree: Inlined => traverse(tree.call) case _ => @@ -416,13 +413,13 @@ class ExtractSemanticDB extends Phase: vparams <- vparamss vparam <- vparams do + traverse(vparam.tpt) if !excludeSymbol(vparam.symbol) then traverseAnnotsOfDefinition(vparam.symbol) val symkinds = getters.get(vparam.name).fold(SymbolKind.emptySet)(getter => if getter.mods.is(Mutable) then SymbolKind.VarSet else SymbolKind.ValSet) registerSymbol(vparam.symbol, symkinds) - traverse(vparam.tpt) object ExtractSemanticDB: import java.nio.file.Path diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala index 2db6118bb092..f1fab5a152a9 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala @@ -126,8 +126,7 @@ object Scala3: def isSyntheticWithIdent(using Context): Boolean = sym.is(Synthetic) && !sym.isAnonymous && !sym.name.isEmptyNumbered - def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context, SemanticSymbolBuilder): SymbolInformation = - import TypeOps._ + def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context, SemanticSymbolBuilder, TypeOps): SymbolInformation = val sname = sym.symbolName val signature = sym.info.toSemanticSig(sym) SymbolInformation( diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 83e49bc0bba7..d62018d9f8a8 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -7,14 +7,39 @@ import core.Contexts.Context import core.Types._ import core.Annotations.Annotation import core.Flags +import core.Names.Name import ast.tpd._ +import collection.mutable + import dotty.tools.dotc.{semanticdb => s} -object TypeOps: +class TypeOps: import SymbolScopeOps._ + private val symtab = mutable.Map[(LambdaType, Name), Symbol]() + given typeOps: TypeOps = this extension (tpe: Type) def toSemanticSig(using LinkMode, Context, SemanticSymbolBuilder)(sym: Symbol): s.Signature = + + def enter(keyTpe: Type): Unit = + keyTpe match { + case lam: LambdaType => + symtab((lam, sym.name)) = sym + + // for class constructor + case cls: ClassInfo if sym.info.isInstanceOf[LambdaType] => + val lam = sym.info.asInstanceOf[LambdaType] + cls.cls.typeParams.foreach { param => + symtab((lam, param.name)) = param + } + + case tb: TypeBounds => + enter(tb.lo) + enter(tb.hi) + case _ => () + } + enter(sym.owner.info) + def loop(tpe: Type): s.Signature = tpe match { case mt: MethodType => val stparams = Some(s.Scope()) @@ -41,8 +66,9 @@ object TypeOps: // for `type X[T] = T` is equivalent to `[T] =>> T` def tparams(tpe: Type): (Type, List[Symbol]) = tpe match { case lambda: HKTypeLambda => - val paramSyms = lambda.paramNames.zip(lambda.paramInfos).map { (nme, info) => - newSymbol(sym, nme, Flags.TypeParam, info) + val paramSyms = lambda.paramNames.flatMap { paramName => + val key = (lambda, paramName) + symtab.get(key) } (lambda.resType, paramSyms) case _ => (tpe, Nil) @@ -97,11 +123,8 @@ object TypeOps: s.SingleType(spre, ssym) case tref: ParamRef => - val paramref = sym.rawParamss.flatMap { params => - if (params.length > tref.paramNum) Some(params(tref.paramNum)) - else None - }.find(p => p.name == tref.paramName) - paramref match { + val key = (tref.binder, tref.paramName) + symtab.get(key) match { case Some(ref) => val ssym = ref.symbolName tref match { @@ -233,7 +256,7 @@ object TypeOps: object SymbolScopeOps: import Scala3.given extension (syms: List[Symbol]) - def sscope(using linkMode: LinkMode)(using SemanticSymbolBuilder, Context): s.Scope = + def sscope(using linkMode: LinkMode)(using SemanticSymbolBuilder, TypeOps, Context): s.Scope = linkMode match { case LinkMode.SymlinkChildren => s.Scope(symlinks = syms.map(_.symbolName)) diff --git a/tests/semanticdb/expect/Advanced.expect.scala b/tests/semanticdb/expect/Advanced.expect.scala index 2c7e8d684907..7a6a1e3ed3e3 100644 --- a/tests/semanticdb/expect/Advanced.expect.scala +++ b/tests/semanticdb/expect/Advanced.expect.scala @@ -10,9 +10,9 @@ class C/*<-advanced::C#*/[T/*<-advanced::C#[T]*/] { } class Structural/*<-advanced::Structural#*/ { - def s1/*<-advanced::Structural#s1().*/: { val x/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ - def s2/*<-advanced::Structural#s2().*/: { val x/*<-local3*/: Int/*->scala::Int#*/ } = new { val x/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } - def s3/*<-advanced::Structural#s3().*/: { def m/*<-local9*/(x/*<-local10*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local13*/(x/*<-local14*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s1/*<-advanced::Structural#s1().*/: { val x/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + def s2/*<-advanced::Structural#s2().*/: { val x/*<-local2*/: Int/*->scala::Int#*/ } = new { val x/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s3/*<-advanced::Structural#s3().*/: { def m/*<-local8*/(x/*<-local7*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local10*/(x/*<-local9*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } } class Wildcards/*<-advanced::Wildcards#*/ { diff --git a/tests/semanticdb/expect/Classes.expect.scala b/tests/semanticdb/expect/Classes.expect.scala index 8b9845a6d085..2cc69d1aa785 100644 --- a/tests/semanticdb/expect/Classes.expect.scala +++ b/tests/semanticdb/expect/Classes.expect.scala @@ -47,7 +47,7 @@ class C12/*<-classes::C12#*/ { object N/*<-classes::N.*/ { val anonClass/*<-classes::N.anonClass.*/ = new C7/*->classes::C7#*/(42) { - val local/*<-local2*/ = ???/*->scala::Predef.`???`().*/ + val local/*<-local0*/ = ???/*->scala::Predef.`???`().*/ } val anonFun/*<-classes::N.anonFun.*/ = List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/(1).map/*->scala::collection::immutable::List#map().*/ { i/*<-local3*/ => val local/*<-local4*/ = 2 diff --git a/tests/semanticdb/expect/ForComprehension.expect.scala b/tests/semanticdb/expect/ForComprehension.expect.scala index c4d3340bc84c..69427c3552a0 100644 --- a/tests/semanticdb/expect/ForComprehension.expect.scala +++ b/tests/semanticdb/expect/ForComprehension.expect.scala @@ -17,7 +17,7 @@ class ForComprehension/*<-example::ForComprehension#*/ { /*->local6*//*->scala::Tuple2.unapply().*/( /*->scala::Tuple2.unapply().*/c/*<-local7*/, d/*<-local8*/ - ) <- List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/((/*->scala::Tuple2.apply().*/a/*->local4*/, b/*->local5*/))/*->scala::collection::WithFilter#withFilter().*//*->scala::collection::IterableOps#withFilter().*/ + ) <- List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/((/*->scala::Tuple2.apply().*/a/*->local4*/, b/*->local5*/))/*->scala::collection::IterableOps#withFilter().*//*->scala::collection::WithFilter#withFilter().*/ if ( /*->scala::Tuple4.apply().*/a/*->local4*/, b/*->local5*/, diff --git a/tests/semanticdb/expect/Givens.expect.scala b/tests/semanticdb/expect/Givens.expect.scala index 35ef1d7c3cf9..21e20ecea804 100644 --- a/tests/semanticdb/expect/Givens.expect.scala +++ b/tests/semanticdb/expect/Givens.expect.scala @@ -18,7 +18,7 @@ object Givens/*<-a::b::Givens.*/: def empty/*<-a::b::Givens.Monoid#empty().*/: A/*->a::b::Givens.Monoid#[A]*/ extension (x/*<-a::b::Givens.Monoid#combine().(x)*/: A/*->a::b::Givens.Monoid#[A]*/) def combine/*<-a::b::Givens.Monoid#combine().*/(y/*<-a::b::Givens.Monoid#combine().(y)*/: A/*->a::b::Givens.Monoid#[A]*/): A/*->a::b::Givens.Monoid#[A]*/ - given Monoid[String] with/*<-a::b::Givens.given_Monoid_String.*//*->a::b::Givens.Monoid#*//*->scala::Predef.String#*/ + given Monoid/*->a::b::Givens.Monoid#*/[String] with/*<-a::b::Givens.given_Monoid_String.*//*->scala::Predef.String#*/ def empty/*<-a::b::Givens.given_Monoid_String.empty().*/ = "" extension (x/*<-a::b::Givens.given_Monoid_String.combine().(x)*/: String/*->scala::Predef.String#*/) def combine/*<-a::b::Givens.given_Monoid_String.combine().*/(y/*<-a::b::Givens.given_Monoid_String.combine().(y)*/: String/*->scala::Predef.String#*/) = x/*->a::b::Givens.given_Monoid_String.combine().(x)*/ +/*->java::lang::String#`+`().*/ y/*->a::b::Givens.given_Monoid_String.combine().(y)*/ diff --git a/tests/semanticdb/expect/InventedNames.expect.scala b/tests/semanticdb/expect/InventedNames.expect.scala index f1ac3a4ae0cb..5e247a808a12 100644 --- a/tests/semanticdb/expect/InventedNames.expect.scala +++ b/tests/semanticdb/expect/InventedNames.expect.scala @@ -12,15 +12,15 @@ trait Z/*<-givens::Z#*/[T/*<-givens::Z#[T]*/]: given intValue/*<-givens::InventedNames$package.intValue.*/: Int/*->scala::Int#*/ = 4 -given /*<-givens::InventedNames$package.given_String.*/String/*->scala::Predef.String#*/ = "str" +given String/*->scala::Predef.String#*//*<-givens::InventedNames$package.given_String.*/ = "str" given /*<-givens::InventedNames$package.given_Double().*/(using Int/*->scala::Int#*/): Double/*->scala::Double#*/ = 4.0 given /*<-givens::InventedNames$package.given_List_T().*/[T/*<-givens::InventedNames$package.given_List_T().[T]*/]: List/*->scala::package.List#*/[T/*->givens::InventedNames$package.given_List_T().[T]*/] = Nil/*->scala::package.Nil.*/ given given_Char/*<-givens::InventedNames$package.given_Char.*/: Char/*->scala::Char#*/ = '?' given `given_Float/*<-givens::InventedNames$package.given_Float.*/`: Float/*->scala::Float#*/ = 3.0 given `* */*<-givens::InventedNames$package.`* *`.*/`: Long/*->scala::Long#*/ = 5 -given X with -/*<-givens::InventedNames$package.given_X.*//*->givens::X#*/ def doX/*<-givens::InventedNames$package.given_X.doX().*/ = 7 +given X/*->givens::X#*/ with +/*<-givens::InventedNames$package.given_X.*/ def doX/*<-givens::InventedNames$package.given_X.doX().*/ = 7 given (using X/*->givens::X#*/): Y/*->givens::Y#*/ with def doY/*<-givens::InventedNames$package.given_Y#doY().*/ = "7" diff --git a/tests/semanticdb/expect/Local.expect.scala b/tests/semanticdb/expect/Local.expect.scala index 6c1aa8440b23..e6dfc04f5422 100644 --- a/tests/semanticdb/expect/Local.expect.scala +++ b/tests/semanticdb/expect/Local.expect.scala @@ -2,7 +2,7 @@ package example class Local/*<-example::Local#*/ { def a/*<-example::Local#a().*/() = { - def id/*<-local0*/[A/*<-local1*/](a/*<-local2*/: A/*->local1*/): A/*->local1*/ = a/*->local2*/ - id/*->local0*/(1) + def id/*<-local2*/[A/*<-local0*/](a/*<-local1*/: A/*->local0*/): A/*->local0*/ = a/*->local1*/ + id/*->local2*/(1) } } diff --git a/tests/semanticdb/expect/Methods.expect.scala b/tests/semanticdb/expect/Methods.expect.scala index 08bdd896293e..8190bf0308d1 100644 --- a/tests/semanticdb/expect/Methods.expect.scala +++ b/tests/semanticdb/expect/Methods.expect.scala @@ -23,7 +23,7 @@ class Methods/*<-example::Methods#*/[T/*<-example::Methods#[T]*/] { def m11/*<-example::Methods#m11().*/(x/*<-example::Methods#m11().(x)*/: Predef/*->scala::Predef.*/.type) = ???/*->scala::Predef.`???`().*/ def m11/*<-example::Methods#m11(+1).*/(x/*<-example::Methods#m11(+1).(x)*/: Example/*->example::Example.*/.type) = ???/*->scala::Predef.`???`().*/ def m12a/*<-example::Methods#m12a().*/(x/*<-example::Methods#m12a().(x)*/: {}) = ???/*->scala::Predef.`???`().*/ - def m12b/*<-example::Methods#m12b().*/(x/*<-example::Methods#m12b().(x)*/: { val x/*<-local1*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ + def m12b/*<-example::Methods#m12b().*/(x/*<-example::Methods#m12b().(x)*/: { val x/*<-local0*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ def m13/*<-example::Methods#m13().*/(x/*<-example::Methods#m13().(x)*/: Int/*->scala::Int#*/ @unchecked/*->scala::unchecked#*/) = ???/*->scala::Predef.`???`().*/ def m15/*<-example::Methods#m15().*/(x/*<-example::Methods#m15().(x)*/: => Int/*->scala::Int#*/) = ???/*->scala::Predef.`???`().*/ def m16/*<-example::Methods#m16().*/(x/*<-example::Methods#m16().(x)*/: Int/*->scala::Int#*/*) = ???/*->scala::Predef.`???`().*/ diff --git a/tests/semanticdb/expect/Synthetic.expect.scala b/tests/semanticdb/expect/Synthetic.expect.scala index 0f95d9d0b01f..97a4034a7732 100644 --- a/tests/semanticdb/expect/Synthetic.expect.scala +++ b/tests/semanticdb/expect/Synthetic.expect.scala @@ -44,7 +44,7 @@ class Synthetic/*<-example::Synthetic#*/ { for { a/*<-local8*/ <- scala.concurrent.Future/*->scala::concurrent::Future.*/.successful/*->scala::concurrent::Future.successful().*/(1)/*->scala::concurrent::Future#flatMap().*/ b/*<-local9*/ <- scala.concurrent.Future/*->scala::concurrent::Future.*/.successful/*->scala::concurrent::Future.successful().*/(2)/*->scala::concurrent::Future#withFilter().*/ - if a/*->local8*/ scala::Int#`<`(+3).*/ b/*->local9*//*->scala::concurrent::Future#map().*//*->scala::concurrent::ExecutionContext.Implicits.global().*/ + if a/*->local8*/ scala::Int#`<`(+3).*/ b/*->local9*//*->scala::concurrent::ExecutionContext.Implicits.global().*//*->scala::concurrent::Future#map().*/ } yield a/*->local8*//*->scala::concurrent::ExecutionContext.Implicits.global().*/ } diff --git a/tests/semanticdb/expect/recursion.expect.scala b/tests/semanticdb/expect/recursion.expect.scala index aba74b1b032e..f336a589ffe1 100644 --- a/tests/semanticdb/expect/recursion.expect.scala +++ b/tests/semanticdb/expect/recursion.expect.scala @@ -21,5 +21,5 @@ object Nats/*<-recursion::Nats.*/ { case Succ/*->recursion::Nats.Succ.*//*->recursion::Nats.Succ.unapply().*//*->local2*/(p/*<-local3*/) => toIntg/*->recursion::Nats.toIntg().*/(p/*->local3*/) +/*->scala::Int#`+`(+4).*/ 1 } - val j31/*<-recursion::Nats.j31.*/ = toIntg/*->recursion::Nats.toIntg().*/(Zero/*->recursion::Nats.Zero.*/.++.++.++/*<-local4*//*->recursion::Nats.Zero.*//*->recursion::Nats.Nat#`++`().*/ + /*<-local5*//*->recursion::Nats.Nat#`++`().*/Zer/*<-local6*//*->recursion::Nats.Nat#`++`().*//*->recursion::Nats.Nat#`+`().*/o/*->recursion::Nats.Zero.*/.++/*->recursion::Nats.Nat#`++`().*/) + val j31/*<-recursion::Nats.j31.*/ = toIntg/*->recursion::Nats.toIntg().*/(Zero/*->recursion::Nats.Zero.*/./*->recursion::Nats.Zero.*/++.++.++/*<-local4*//*->recursion::Nats.Nat#`++`().*/ + /*<-local5*//*->recursion::Nats.Nat#`++`().*/Zer/*<-local6*//*->recursion::Nats.Nat#`++`().*//*->recursion::Nats.Nat#`+`().*/o/*->recursion::Nats.Zero.*/.++/*->recursion::Nats.Nat#`++`().*/) } diff --git a/tests/semanticdb/expect/semanticdb-Types.expect.scala b/tests/semanticdb/expect/semanticdb-Types.expect.scala index f7865818fcc6..b7a203d9c74e 100644 --- a/tests/semanticdb/expect/semanticdb-Types.expect.scala +++ b/tests/semanticdb/expect/semanticdb-Types.expect.scala @@ -59,12 +59,12 @@ object Test/*<-types::Test.*/ { val superType2/*<-types::Test.C#superType2.*/ = super[M].m/*->types::Test.M#m().*/ val superType3/*<-types::Test.C#superType3.*/ = C.super[M].m/*->types::Test.M#m().*/ - val compoundType1/*<-types::Test.C#compoundType1.*/: { def k/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + val compoundType1/*<-types::Test.C#compoundType1.*/: { def k/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ val compoundType2/*<-types::Test.C#compoundType2.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ = ???/*->scala::Predef.`???`().*/ - val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local3*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ - val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local2*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local4*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } val compoundType5/*<-types::Test.C#compoundType5.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ - val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local11*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local9*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } val annType1/*<-types::Test.C#annType1.*/: T/*->types::T#*/ @ann(42) = ???/*->scala::Predef.`???`().*/ val annType2/*<-types::Test.C#annType2.*/: T/*->types::T#*/ @ann1/*->types::ann1#*/ @ann2/*->types::ann2#*/ = ???/*->scala::Predef.`???`().*/ @@ -74,7 +74,7 @@ object Test/*<-types::Test.*/ { val existentialType4/*<-types::Test.C#existentialType4.*/ = Class/*->java::lang::Class#*/.forName/*->java::lang::Class#forName().*/("foo.Bar") def typeLambda1/*<-types::Test.C#typeLambda1().*/[M/*<-types::Test.C#typeLambda1().[M]*/[_]] = ???/*->scala::Predef.`???`().*/ - typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local12*/[T/*<-local14*/] = List/*->scala::package.List#*/[T/*->local14*/] })#L] + typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local13*/[T/*<-local12*/] = List/*->scala::package.List#*/[T/*->local12*/] })#L] object ClassInfoType1/*<-types::Test.C#ClassInfoType1.*/ class ClassInfoType2/*<-types::Test.C#ClassInfoType2#*/ extends B/*->types::B#*/ { def x/*<-types::Test.C#ClassInfoType2#x().*/ = 42 } diff --git a/tests/semanticdb/expect/toplevel.expect.scala b/tests/semanticdb/expect/toplevel.expect.scala index dfb0cc5de508..633b0b87a436 100644 --- a/tests/semanticdb/expect/toplevel.expect.scala +++ b/tests/semanticdb/expect/toplevel.expect.scala @@ -3,5 +3,5 @@ extension (x/*<-_empty_::toplevel$package.combine().(x)*/: Int/*->scala::Int#*/) def combine/*<-_empty_::toplevel$package.combine(+1).*/(x/*<-_empty_::toplevel$package.combine(+1).(x)*/: Int/*->scala::Int#*/, y/*<-_empty_::toplevel$package.combine(+1).(y)*/: Int/*->scala::Int#*/, z/*<-_empty_::toplevel$package.combine(+1).(z)*/: Int/*->scala::Int#*/) = x/*->_empty_::toplevel$package.combine(+1).(x)*/ +/*->scala::Int#`+`(+4).*/ y/*->_empty_::toplevel$package.combine(+1).(y)*/ +/*->scala::Int#`+`(+4).*/ z/*->_empty_::toplevel$package.combine(+1).(z)*/ def combine/*<-_empty_::toplevel$package.combine(+2).*/ = 0 def foo/*<-_empty_::toplevel$package.foo().*/ = "foo" -/*<-_empty_::MyProgram#*//*->_empty_::toplevel$package.MyProgram().*//*->scala::util::CommandLineParser.parseArgument().*//*->_empty_::MyProgram#main().(args)*//*->scala::util::CommandLineParser.FromString.given_FromString_Int.*//*->scala::util::CommandLineParser.showError().*//*->local0*/@main/*->scala::main#*/ def MyProgram/*<-_empty_::toplevel$package.MyProgram().*/(times/*<-_empty_::toplevel$package.MyProgram().(times)*/: Int/*->scala::Int#*/): Unit/*->scala::Unit#*/ = (/*->scala::LowPriorityImplicits#intWrapper().*/1 to/*->scala::runtime::RichInt#to().*/ times/*->_empty_::toplevel$package.MyProgram().(times)*/) foreach/*->scala::collection::immutable::Range#foreach().*/ (_ => println/*->scala::Predef.println(+1).*/("hello")) +/*->_empty_::toplevel$package.MyProgram().*//*->scala::util::CommandLineParser.parseArgument().*//*->_empty_::MyProgram#main().(args)*//*->scala::util::CommandLineParser.FromString.given_FromString_Int.*//*->scala::util::CommandLineParser.showError().*//*->local0*//*<-_empty_::MyProgram#*/@main/*->scala::main#*/ def MyProgram/*<-_empty_::toplevel$package.MyProgram().*/(times/*<-_empty_::toplevel$package.MyProgram().(times)*/: Int/*->scala::Int#*/): Unit/*->scala::Unit#*/ = (/*->scala::LowPriorityImplicits#intWrapper().*/1 to/*->scala::runtime::RichInt#to().*/ times/*->_empty_::toplevel$package.MyProgram().(times)*/) foreach/*->scala::collection::immutable::Range#foreach().*/ (_ => println/*->scala::Predef.println(+1).*/("hello")) def fooRef/*<-_empty_::toplevel$package.fooRef().*/ = toplevel$package/*->_empty_::toplevel$package.*/.foo/*->_empty_::toplevel$package.foo().*/ diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 818912c47c48..8e8a8cd57183 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -76,15 +76,15 @@ advanced/Test.s3x. => val method s3x Int advanced/Wildcards# => class Wildcards extends Object { self: Wildcards => +2 decls } advanced/Wildcards#``(). => primary ctor (): Wildcards advanced/Wildcards#e1(). => method e1 => List[] -local1 => abstract val method x Int -local3 => abstract val method x Int +local0 => abstract val method x Int +local2 => abstract val method x Int +local3 => val method x Int local4 => final class $anon extends Object { self: $anon => +2 decls } -local6 => val method x Int -local9 => abstract method m (param x: Int): Int -local10 => param x: Int +local7 => param x: Int +local8 => abstract method m (param x: Int): Int +local9 => param x: Int +local10 => method m (param x: Int): Int local11 => final class $anon extends Object { self: $anon => +2 decls } -local13 => method m (param x: Int): Int -local14 => param x: Int local19 => val local e3: List[local20] local21 => val local e3x: local20 @@ -109,22 +109,22 @@ Occurrences: [11:6..11:16): Structural <- advanced/Structural# [12:2..12:2): <- advanced/Structural#``(). [12:6..12:8): s1 <- advanced/Structural#s1(). -[12:16..12:17): x <- local1 +[12:16..12:17): x <- local0 [12:19..12:22): Int -> scala/Int# [12:27..12:30): ??? -> scala/Predef.`???`(). [13:6..13:8): s2 <- advanced/Structural#s2(). -[13:16..13:17): x <- local3 +[13:16..13:17): x <- local2 [13:19..13:22): Int -> scala/Int# -[13:37..13:38): x <- local6 +[13:37..13:38): x <- local3 [13:40..13:43): Int -> scala/Int# [13:46..13:49): ??? -> scala/Predef.`???`(). [14:6..14:8): s3 <- advanced/Structural#s3(). -[14:16..14:17): m <- local9 -[14:18..14:19): x <- local10 +[14:16..14:17): m <- local8 +[14:18..14:19): x <- local7 [14:21..14:24): Int -> scala/Int# [14:27..14:30): Int -> scala/Int# -[14:45..14:46): m <- local13 -[14:47..14:48): x <- local14 +[14:45..14:46): m <- local10 +[14:47..14:48): x <- local9 [14:50..14:53): Int -> scala/Int# [14:56..14:59): Int -> scala/Int# [14:62..14:65): ??? -> scala/Predef.`???`(). @@ -290,7 +290,7 @@ example/Anonymous#locally(). => method locally [typeparam A ](typeparam A )(para example/Anonymous#locally().(x) => param x: A example/Anonymous#locally().[A] => typeparam A example/Anonymous#m1(). => method m1 [] => Nothing -example/Anonymous#m1().[T] => typeparam T [unknown _$1: ] +example/Anonymous#m1().[T] => typeparam T example/Anonymous#m2(). => method m2 => Map[, List[]] local0 => val local x: Function1[Int, Int] local1 => final class $anon extends Object with Foo { self: $anon => +1 decls } @@ -471,8 +471,8 @@ classes/M.C5().(x) => param x: Int classes/N. => final object N extends Object { self: .N.type => +3 decls } classes/N.anonClass. => val method anonClass C7 classes/N.anonFun. => val method anonFun List[Int] -local0 => final class $anon extends C7 { self: $anon => +2 decls } -local2 => val method local Nothing +local0 => val method local Nothing +local1 => final class $anon extends C7 { self: $anon => +2 decls } local3 => param i: Int local4 => val local local: Int @@ -597,7 +597,7 @@ Occurrences: [48:6..48:15): anonClass <- classes/N.anonClass. [48:22..48:24): C7 -> classes/C7# [48:24..48:24): -> classes/C7#``(). -[49:8..49:13): local <- local2 +[49:8..49:13): local <- local0 [49:16..49:19): ??? -> scala/Predef.`???`(). [51:6..51:13): anonFun <- classes/N.anonFun. [51:16..51:20): List -> scala/package.List. @@ -1211,8 +1211,8 @@ local0 => param x: Int Occurrences: [0:8..0:15): example <- example/ [2:6..2:18): EtaExpansion <- example/EtaExpansion# -[3:2..3:2): <- example/EtaExpansion#``(). [3:2..3:6): Some -> scala/Some. +[3:2..3:2): <- example/EtaExpansion#``(). [3:6..3:6): -> scala/Some.apply(). [3:10..3:13): map -> scala/Option#map(). [3:14..3:22): identity -> scala/Predef.identity(). @@ -1388,8 +1388,8 @@ Occurrences: [19:15..19:15): -> scala/Tuple2.apply(). [19:15..19:16): a -> local4 [19:18..19:19): b -> local5 -[19:21..19:21): -> scala/collection/WithFilter#withFilter(). [19:21..19:21): -> scala/collection/IterableOps#withFilter(). +[19:21..19:21): -> scala/collection/WithFilter#withFilter(). [21:6..21:6): -> scala/Tuple4.apply(). [21:6..21:7): a -> local4 [22:6..22:7): b -> local5 @@ -1508,8 +1508,8 @@ Occurrences: [18:33..18:34): y <- a/b/Givens.Monoid#combine().(y) [18:36..18:37): A -> a/b/Givens.Monoid#[A] [18:40..18:41): A -> a/b/Givens.Monoid#[A] -[20:8..20:27): Monoid[String] with <- a/b/Givens.given_Monoid_String. [20:8..20:14): Monoid -> a/b/Givens.Monoid# +[20:8..20:27): Monoid[String] with <- a/b/Givens.given_Monoid_String. [20:15..20:21): String -> scala/Predef.String# [21:8..21:13): empty <- a/b/Givens.given_Monoid_String.empty(). [22:15..22:16): x <- a/b/Givens.given_Monoid_String.combine().(x) @@ -1693,8 +1693,8 @@ Occurrences: [5:7..5:12): types -> types/ [5:13..5:17): Test -> types/Test. [7:6..7:21): InstrumentTyper <- example/InstrumentTyper# -[7:24..7:24): <- example/InstrumentTyper#``(). [7:24..7:28): self <- local0 +[7:24..7:24): <- example/InstrumentTyper#``(). [7:30..7:36): AnyRef -> scala/AnyRef# [8:6..8:9): all <- example/InstrumentTyper#all(). [8:12..8:16): List -> scala/package.List. @@ -1811,8 +1811,8 @@ Occurrences: [9:16..9:17): T -> givens/Z#[T] [13:6..13:14): intValue <- givens/InventedNames$package.intValue. [13:16..13:19): Int -> scala/Int# -[14:6..14:6): <- givens/InventedNames$package.given_String. [14:6..14:12): String -> scala/Predef.String# +[14:6..14:6): <- givens/InventedNames$package.given_String. [15:6..15:6): <- givens/InventedNames$package.given_Double(). [15:13..15:16): Int -> scala/Int# [15:19..15:25): Double -> scala/Double# @@ -1827,15 +1827,15 @@ Occurrences: [18:21..18:26): Float -> scala/Float# [19:7..19:10): * * <- givens/InventedNames$package.`* *`. [19:13..19:17): Long -> scala/Long# -[21:6..22:0): <- givens/InventedNames$package.given_X. [21:6..21:7): X -> givens/X# +[21:6..22:0): <- givens/InventedNames$package.given_X. [22:6..22:9): doX <- givens/InventedNames$package.given_X.doX(). -[24:13..24:13): <- givens/InventedNames$package.given_Y#``(). [24:13..24:14): X -> givens/X# +[24:13..24:13): <- givens/InventedNames$package.given_Y#``(). [24:17..24:18): Y -> givens/Y# [25:6..25:9): doY <- givens/InventedNames$package.given_Y#doY(). -[27:7..27:7): <- givens/InventedNames$package.given_Z_T#``(). [27:7..27:8): T <- givens/InventedNames$package.given_Z_T#[T] +[27:7..27:7): <- givens/InventedNames$package.given_Z_T#``(). [27:11..27:12): Z -> givens/Z# [27:13..27:14): T -> givens/InventedNames$package.given_Z_T#[T] [28:6..28:9): doZ <- givens/InventedNames$package.given_Z_T#doZ(). @@ -1934,22 +1934,22 @@ Symbols: example/Local# => class Local extends Object { self: Local => +2 decls } example/Local#``(). => primary ctor (): Local example/Local#a(). => method a (): Int -local0 => local id: [typeparam A ](typeparam A )(param a: A): A -local1 => typeparam A -local2 => param a: A +local0 => typeparam A +local1 => param a: A +local2 => local id: [typeparam A ](typeparam A )(param a: A): A Occurrences: [0:8..0:15): example <- example/ [2:6..2:11): Local <- example/Local# [3:2..3:2): <- example/Local#``(). [3:6..3:7): a <- example/Local#a(). -[4:8..4:10): id <- local0 -[4:11..4:12): A <- local1 -[4:14..4:15): a <- local2 -[4:17..4:18): A -> local1 -[4:21..4:22): A -> local1 -[4:25..4:26): a -> local2 -[5:4..5:6): id -> local0 +[4:8..4:10): id <- local2 +[4:11..4:12): A <- local0 +[4:14..4:15): a <- local1 +[4:17..4:18): A -> local0 +[4:21..4:22): A -> local0 +[4:25..4:26): a -> local1 +[5:4..5:6): id -> local2 expect/Locals.scala ------------------- @@ -2004,8 +2004,8 @@ Occurrences: [2:7..2:10): com -> com/ [2:11..2:17): javacp -> com/javacp/ [4:6..4:15): MetacJava <- example/MetacJava# -[5:2..5:2): <- example/MetacJava#``(). [5:2..5:8): javacp -> com/javacp/ +[5:2..5:2): <- example/MetacJava#``(). [5:9..5:18): MetacJava -> com/javacp/MetacJava# [5:19..5:30): StaticInner -> com/javacp/MetacJava#StaticInner# [5:31..5:39): isStatic -> com/javacp/MetacJava#StaticInner#isStatic(). @@ -2189,7 +2189,7 @@ Occurrences => 149 entries Symbols: example/Methods# => class Methods [typeparam T ] extends Object { self: Methods[T] => +43 decls } -example/Methods#AList# => type AList [typeparam T ] = List[] +example/Methods#AList# => type AList [typeparam T ] = List[T] example/Methods#AList#[T] => typeparam T example/Methods#List# => class List [typeparam T ] extends Object { self: List[T] => +2 decls } example/Methods#List#[T] => typeparam T @@ -2264,7 +2264,7 @@ example/Methods#m20().(a) => param a: Int example/Methods#m20(+1). => method m20 (param b: String): Nothing example/Methods#m20(+1).(b) => param b: String example/Methods#m20(+2). => var method m20 .m17.type -local1 => abstract val method x Int +local0 => abstract val method x Int Occurrences: [0:8..0:15): example <- example/ @@ -2359,7 +2359,7 @@ Occurrences: [24:20..24:23): ??? -> scala/Predef.`???`(). [25:6..25:10): m12b <- example/Methods#m12b(). [25:11..25:12): x <- example/Methods#m12b().(x) -[25:20..25:21): x <- local1 +[25:20..25:21): x <- local0 [25:23..25:26): Int -> scala/Int# [25:32..25:35): ??? -> scala/Predef.`???`(). [26:6..26:9): m13 <- example/Methods#m13(). @@ -2782,26 +2782,26 @@ Occurrences: [2:0..2:0): <- selfs/B#``(). [2:6..2:7): B <- selfs/B# [4:6..4:8): C1 <- selfs/C1# -[4:17..4:17): <- selfs/C1#``(). [4:17..4:18): B -> selfs/B# +[4:17..4:17): <- selfs/C1#``(). [4:18..4:18): -> selfs/B#``(). [4:21..4:25): self <- local0 [7:6..7:8): C2 <- selfs/C2# -[7:17..7:17): <- selfs/C2#``(). [7:17..7:18): B -> selfs/B# +[7:17..7:17): <- selfs/C2#``(). [7:18..7:18): -> selfs/B#``(). [7:21..7:25): self <- local1 [7:27..7:28): B -> selfs/B# [10:6..10:8): C3 <- selfs/C3# -[10:17..10:17): <- selfs/C3#``(). [10:17..10:18): B -> selfs/B# +[10:17..10:17): <- selfs/C3#``(). [10:18..10:18): -> selfs/B#``(). [10:21..10:25): self <- local2 [10:27..10:28): B -> selfs/B# [10:34..10:36): C1 -> selfs/C1# [13:6..13:8): C6 <- selfs/C6# -[13:17..13:17): <- selfs/C6#``(). [13:17..13:18): B -> selfs/B# +[13:17..13:17): <- selfs/C6#``(). [13:18..13:18): -> selfs/B#``(). [13:27..13:28): B -> selfs/B# @@ -2862,8 +2862,8 @@ Occurrences: [2:13..2:21): language -> scala/language. [2:22..2:41): implicitConversions -> scala/language.implicitConversions. [4:6..4:15): Synthetic <- example/Synthetic# -[5:2..5:2): <- example/Synthetic#``(). [5:2..5:6): List -> scala/package.List. +[5:2..5:2): <- example/Synthetic#``(). [5:6..5:6): -> scala/collection/IterableFactory#apply(). [5:10..5:13): map -> scala/collection/immutable/List#map(). [5:16..5:17): + -> scala/Int#`+`(+4). @@ -3015,8 +3015,8 @@ Occurrences: [46:7..46:8): a -> local8 [46:9..46:10): < -> scala/Int#`<`(+3). [46:11..46:12): b -> local9 -[46:12..46:12): -> scala/concurrent/Future#map(). [46:12..46:12): -> scala/concurrent/ExecutionContext.Implicits.global(). +[46:12..46:12): -> scala/concurrent/Future#map(). [47:10..47:11): a -> local8 [47:11..47:11): -> scala/concurrent/ExecutionContext.Implicits.global(). @@ -3060,8 +3060,8 @@ Occurrences: [11:0..11:0): <- traits/C#``(). [11:6..11:7): C <- traits/C# [12:6..12:7): V <- traits/V# -[12:10..12:10): <- traits/V#``(). [12:10..12:14): self <- local2 +[12:10..12:10): <- traits/V#``(). [12:16..12:17): C -> traits/C# expect/ValPattern.scala @@ -3470,9 +3470,9 @@ Occurrences => 5 entries Symbols: exports/`exports-package$package`. => final package object exports extends Object { self: .exports.type => +4 decls } -exports/`exports-package$package`.Codec# => final type Codec [unknown T: ] = Codec[] -exports/`exports-package$package`.Decoder# => final type Decoder [unknown T: ] = Decoder[] -exports/`exports-package$package`.Encoder# => final type Encoder [unknown T: ] = Encoder[] +exports/`exports-package$package`.Codec# => final type Codec = Codec[] +exports/`exports-package$package`.Decoder# => final type Decoder = Decoder[] +exports/`exports-package$package`.Encoder# => final type Encoder = Encoder[] Occurrences: [0:8..0:15): exports <- exports/ @@ -3610,8 +3610,8 @@ local0 => val local local: Int Occurrences: [0:8..0:15): example <- example/ [2:7..2:17): local-file <- example/`local-file`# -[3:2..3:2): <- example/`local-file`#``(). [3:2..3:9): locally -> scala/Predef.locally(). +[3:2..3:2): <- example/`local-file`#``(). [4:8..4:13): local <- local0 [5:4..5:9): local -> local0 [5:10..5:11): + -> scala/Int#`+`(+4). @@ -3712,8 +3712,8 @@ Occurrences: [23:6..23:9): j31 <- recursion/Nats.j31. [23:12..23:18): toIntg -> recursion/Nats.toIntg(). [23:19..23:23): Zero -> recursion/Nats.Zero. -[23:24..23:32): ++.++.++ <- local4 [23:24..23:24): -> recursion/Nats.Zero. +[23:24..23:32): ++.++.++ <- local4 [23:24..23:26): ++ -> recursion/Nats.Nat#`++`(). [23:27..23:35): ++.++ + <- local5 [23:27..23:29): ++ -> recursion/Nats.Nat#`++`(). @@ -3799,7 +3799,7 @@ flags/p/package.S# => class S [typeparam T ] extends Object { self: S[T] => +2 d flags/p/package.S#[T] => typeparam T flags/p/package.S#``(). => primary ctor [unknown T: ](unknown T: ): S[T] flags/p/package.T1# => type T1 = Int -flags/p/package.T2# => type T2 [typeparam T ] = S[] +flags/p/package.T2# => type T2 [typeparam T ] = S[T] flags/p/package.T2#[T] => typeparam T flags/p/package.U# => type U flags/p/package.V# => type V >: Int @@ -3916,15 +3916,15 @@ Symbols => 142 entries Occurrences => 250 entries Symbols: -local1 => abstract method k => Int -local3 => abstract method k => Int -local4 => final class $anon extends Object { self: $anon => +2 decls } -local6 => method k => Int +local0 => abstract method k => Int +local2 => abstract method k => Int +local4 => method k => Int +local5 => final class $anon extends Object { self: $anon => +2 decls } local7 => final class $anon extends M with N { self: $anon => +1 decls } -local9 => final class $anon extends M with N { self: $anon => +2 decls } -local11 => method k => Int -local12 => type L [unknown local13: ] = List[] -local14 => typeparam T +local9 => method k => Int +local10 => final class $anon extends M with N { self: $anon => +2 decls } +local12 => typeparam T +local13 => type L [typeparam T ] = List[T] types/B# => class B extends Object { self: B => +1 decls } types/B#``(). => primary ctor (): B types/C# => class C extends Object { self: C => +1 decls } @@ -3998,12 +3998,12 @@ types/Test.C#RepeatedType.unapplySeq().(x$1) => param x$1: RepeatedType types/Test.C#TypeType. => final object TypeType extends Object { self: .TypeType.type => +6 decls } types/Test.C#TypeType.T1# => type T1 types/Test.C#TypeType.T4# => type T4 = C -types/Test.C#TypeType.T5# => type T5 [typeparam U ] = +types/Test.C#TypeType.T5# => type T5 [typeparam U ] = U types/Test.C#TypeType.T5#[U] => typeparam U types/Test.C#TypeType.m2(). => method m2 [] => Nothing types/Test.C#TypeType.m2().[T2] => typeparam T2 = C types/Test.C#TypeType.m3(). => method m3 [] => Nothing -types/Test.C#TypeType.m3().[M3] => typeparam M3 [unknown _$2: ] +types/Test.C#TypeType.m3().[M3] => typeparam M3 types/Test.C#``(). => primary ctor (): C types/Test.C#annType1. => val method annType1 T @ann[T] types/Test.C#annType2. => val method annType2 T @ann1 @ann2 @@ -4025,7 +4025,7 @@ types/Test.C#superType3. => val method superType3 Int types/Test.C#thisType1. => val method thisType1 C.this.type types/Test.C#thisType2. => val method thisType2 C.this.type types/Test.C#typeLambda1(). => method typeLambda1 [] => Nothing -types/Test.C#typeLambda1().[M] => typeparam M [unknown _$1: ] +types/Test.C#typeLambda1().[M] => typeparam M types/Test.C#typeRef1. => val method typeRef1 C types/Test.C#typeRef2. => val method typeRef2 .p.C types/Test.C#typeRef3. => val method typeRef3 T#C @@ -4076,13 +4076,13 @@ Occurrences: [5:33..5:43): annotation -> scala/annotation/ [5:44..5:60): StaticAnnotation -> scala/annotation/StaticAnnotation# [6:6..6:10): ann1 <- types/ann1# -[6:19..6:19): <- types/ann1#``(). [6:19..6:24): scala -> scala/ +[6:19..6:19): <- types/ann1#``(). [6:25..6:35): annotation -> scala/annotation/ [6:36..6:52): StaticAnnotation -> scala/annotation/StaticAnnotation# [7:6..7:10): ann2 <- types/ann2# -[7:19..7:19): <- types/ann2#``(). [7:19..7:24): scala -> scala/ +[7:19..7:19): <- types/ann2#``(). [7:25..7:35): annotation -> scala/annotation/ [7:36..7:52): StaticAnnotation -> scala/annotation/StaticAnnotation# [9:0..9:0): <- types/B#``(). @@ -4090,8 +4090,8 @@ Occurrences: [11:0..11:0): <- types/C#``(). [11:6..11:7): C <- types/C# [13:6..13:7): P <- types/P# -[14:2..14:2): <- types/P#``(). [14:2..14:2): <- types/P#C#``(). +[14:2..14:2): <- types/P#``(). [14:8..14:9): C <- types/P#C# [15:2..15:2): <- types/P#X#``(). [15:8..15:9): X <- types/P#X# @@ -4099,8 +4099,8 @@ Occurrences: [16:14..16:15): X -> types/P#X# [16:15..16:15): -> types/P#X#``(). [19:6..19:7): T <- types/T# -[20:2..20:2): <- types/T#``(). [20:2..20:2): <- types/T#C#``(). +[20:2..20:2): <- types/T#``(). [20:8..20:9): C <- types/T#C# [21:2..21:2): <- types/T#X#``(). [21:8..21:9): X <- types/T#X# @@ -4127,8 +4127,8 @@ Occurrences: [38:11..38:14): Int -> scala/Int# [38:17..38:20): ??? -> scala/Predef.`???`(). [41:8..41:9): C <- types/Test.C# -[41:18..41:18): <- types/Test.C#``(). [41:18..41:19): M -> types/Test.M# +[41:18..41:18): <- types/Test.C#``(). [41:19..41:19): -> types/Test.M#``(). [42:8..42:9): p <- types/Test.C#p. [42:16..42:17): P -> types/P# @@ -4173,7 +4173,7 @@ Occurrences: [59:8..59:18): superType3 <- types/Test.C#superType3. [59:32..59:33): m -> types/Test.M#m(). [61:8..61:21): compoundType1 <- types/Test.C#compoundType1. -[61:29..61:30): k <- local1 +[61:29..61:30): k <- local0 [61:32..61:35): Int -> scala/Int# [61:40..61:43): ??? -> scala/Predef.`???`(). [62:8..62:21): compoundType2 <- types/Test.C#compoundType2. @@ -4183,11 +4183,11 @@ Occurrences: [63:8..63:21): compoundType3 <- types/Test.C#compoundType3. [63:23..63:24): M -> types/Test.M# [63:30..63:31): N -> types/Test.N# -[63:38..63:39): k <- local3 +[63:38..63:39): k <- local2 [63:41..63:44): Int -> scala/Int# [63:49..63:52): ??? -> scala/Predef.`???`(). [64:8..64:21): compoundType4 <- types/Test.C#compoundType4. -[64:34..64:35): k <- local6 +[64:34..64:35): k <- local4 [64:37..64:40): Int -> scala/Int# [64:43..64:46): ??? -> scala/Predef.`???`(). [65:8..65:21): compoundType5 <- types/Test.C#compoundType5. @@ -4198,7 +4198,7 @@ Occurrences: [66:28..66:29): M -> types/Test.M# [66:29..66:29): -> types/Test.M#``(). [66:35..66:36): N -> types/Test.N# -[66:43..66:44): k <- local11 +[66:43..66:44): k <- local9 [66:46..66:49): Int -> scala/Int# [66:52..66:55): ??? -> scala/Predef.`???`(). [68:8..68:16): annType1 <- types/Test.C#annType1. @@ -4222,14 +4222,14 @@ Occurrences: [75:20..75:21): M <- types/Test.C#typeLambda1().[M] [75:28..75:31): ??? -> scala/Predef.`???`(). [76:4..76:15): typeLambda1 -> types/Test.C#typeLambda1(). -[76:24..76:25): L <- local12 -[76:26..76:27): T <- local14 +[76:24..76:25): L <- local13 +[76:26..76:27): T <- local12 [76:31..76:35): List -> scala/package.List# -[76:36..76:37): T -> local14 +[76:36..76:37): T -> local12 [78:11..78:25): ClassInfoType1 <- types/Test.C#ClassInfoType1. [79:10..79:24): ClassInfoType2 <- types/Test.C#ClassInfoType2# -[79:33..79:33): <- types/Test.C#ClassInfoType2#``(). [79:33..79:34): B -> types/B# +[79:33..79:33): <- types/Test.C#ClassInfoType2#``(). [79:34..79:34): -> types/B#``(). [79:41..79:42): x <- types/Test.C#ClassInfoType2#x(). [80:10..80:24): ClassInfoType3 <- types/Test.C#ClassInfoType3# @@ -4422,14 +4422,14 @@ Occurrences: [2:46..2:47): z -> _empty_/toplevel$package.combine(+1).(z) [3:4..3:11): combine <- _empty_/toplevel$package.combine(+2). [4:4..4:7): foo <- _empty_/toplevel$package.foo(). -[5:0..5:0): <- _empty_/MyProgram# -[5:0..5:0): <- _empty_/MyProgram#``(). [5:0..5:0): -> _empty_/toplevel$package.MyProgram(). [5:0..5:0): -> scala/util/CommandLineParser.parseArgument(). [5:0..5:0): -> _empty_/MyProgram#main().(args) [5:0..5:0): -> scala/util/CommandLineParser.FromString.given_FromString_Int. [5:0..5:0): -> scala/util/CommandLineParser.showError(). [5:0..5:0): -> local0 +[5:0..5:0): <- _empty_/MyProgram#``(). +[5:0..5:0): <- _empty_/MyProgram# [5:1..5:5): main -> scala/main# [5:10..5:19): MyProgram <- _empty_/toplevel$package.MyProgram(). [5:20..5:25): times <- _empty_/toplevel$package.MyProgram().(times) From 226e26f8b2f5481729cab745f27b0873a634cab3 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Tue, 29 Jun 2021 23:23:33 +0900 Subject: [PATCH 07/25] Lookup symbols for refinements in RefinedType and RecType --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 71 ++- tests/semanticdb/expect/Advanced.expect.scala | 9 +- tests/semanticdb/expect/Advanced.scala | 1 + tests/semanticdb/expect/Methods.expect.scala | 1 + tests/semanticdb/expect/Methods.scala | 1 + .../expect/RecOrRefined.expect.scala | 18 + tests/semanticdb/expect/RecOrRefined.scala | 18 + .../expect/semanticdb-Types.expect.scala | 8 +- tests/semanticdb/metac.expect | 419 +++++++++++------- 9 files changed, 372 insertions(+), 174 deletions(-) create mode 100644 tests/semanticdb/expect/RecOrRefined.expect.scala create mode 100644 tests/semanticdb/expect/RecOrRefined.scala diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index d62018d9f8a8..cfbb968a3678 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -8,6 +8,7 @@ import core.Types._ import core.Annotations.Annotation import core.Flags import core.Names.Name +import core.StdNames.tpnme import ast.tpd._ import collection.mutable @@ -16,29 +17,69 @@ import dotty.tools.dotc.{semanticdb => s} class TypeOps: import SymbolScopeOps._ - private val symtab = mutable.Map[(LambdaType, Name), Symbol]() + private val paramRefSymtab = mutable.Map[(LambdaType, Name), Symbol]() + private val refinementSymtab = mutable.Map[(RefinedType, Name), Symbol]() given typeOps: TypeOps = this extension (tpe: Type) def toSemanticSig(using LinkMode, Context, SemanticSymbolBuilder)(sym: Symbol): s.Signature = - - def enter(keyTpe: Type): Unit = - keyTpe match { + def enterParamRef(tpe: Type): Unit = + tpe match { case lam: LambdaType => - symtab((lam, sym.name)) = sym + paramRefSymtab((lam, sym.name)) = sym // for class constructor + // class C[T] { ... } case cls: ClassInfo if sym.info.isInstanceOf[LambdaType] => val lam = sym.info.asInstanceOf[LambdaType] cls.cls.typeParams.foreach { param => - symtab((lam, param.name)) = param + paramRefSymtab((lam, param.name)) = param } + // type X[T] = ... case tb: TypeBounds => - enter(tb.lo) - enter(tb.hi) + enterParamRef(tb.lo) + enterParamRef(tb.hi) + case _ => () } - enter(sym.owner.info) + + def enterRefined(tpe: Type): Unit = + tpe match { + case refined: RefinedType => + val key = (refined, sym.name) + refinementSymtab(key) = sym + + case rec: RecType => + enterRefined(rec.parent) + + case cls: ClassInfo + if (cls.cls.name == tpnme.REFINE_CLASS) => + sym.owner.owner.info match { + // def foo(x: Parent { refinement }) = ... + case refined: RefinedType => + val key = (refined, sym.name) + refinementSymtab(key) = sym + + // type x = Person { refinement } + case tb: TypeBounds => + // tb = TypeBounds( + // lo = RefinedType(...) + // hi = RefinedType(...) + // ) + enterRefined(tb.lo) + enterRefined(tb.hi) + + // def s(x: Int): { refinement } = ... + case expr: ExprType => + enterRefined(expr.resType) + case m: MethodType => + enterRefined(m.resType) + case _ => () + } + case _ => () + } + enterParamRef(sym.owner.info) + enterRefined(sym.owner.info) def loop(tpe: Type): s.Signature = tpe match { case mt: MethodType => @@ -67,8 +108,7 @@ class TypeOps: def tparams(tpe: Type): (Type, List[Symbol]) = tpe match { case lambda: HKTypeLambda => val paramSyms = lambda.paramNames.flatMap { paramName => - val key = (lambda, paramName) - symtab.get(key) + paramRefSymtab.get((lambda, paramName)) } (lambda.resType, paramSyms) case _ => (tpe, Nil) @@ -124,7 +164,7 @@ class TypeOps: case tref: ParamRef => val key = (tref.binder, tref.paramName) - symtab.get(key) match { + paramRefSymtab.get(key) match { case Some(ref) => val ssym = ref.symbolName tref match { @@ -182,10 +222,9 @@ class TypeOps: val (parent, refinedInfos) = flatten(rt, List.empty) val stpe = s.WithType(flattenParent(parent)) - // Create dummy symbols for refinements - // since there's no way to retrieve symbols of refinements from RefinedType at this moment. - val decls = for (name, info) <- refinedInfos - yield newSymbol(sym, name, Flags.EmptyFlags, info) + val decls = refinedInfos.flatMap { (name, _) => + refinementSymtab.get((rt, name)) + } val sdecls = decls.sscope(using LinkMode.HardlinkChildren) s.StructuralType(stpe, Some(sdecls)) diff --git a/tests/semanticdb/expect/Advanced.expect.scala b/tests/semanticdb/expect/Advanced.expect.scala index 7a6a1e3ed3e3..7b8b3dea9121 100644 --- a/tests/semanticdb/expect/Advanced.expect.scala +++ b/tests/semanticdb/expect/Advanced.expect.scala @@ -11,8 +11,9 @@ class C/*<-advanced::C#*/[T/*<-advanced::C#[T]*/] { class Structural/*<-advanced::Structural#*/ { def s1/*<-advanced::Structural#s1().*/: { val x/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ - def s2/*<-advanced::Structural#s2().*/: { val x/*<-local2*/: Int/*->scala::Int#*/ } = new { val x/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } - def s3/*<-advanced::Structural#s3().*/: { def m/*<-local8*/(x/*<-local7*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local10*/(x/*<-local9*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s2/*<-advanced::Structural#s2().*/: { val x/*<-local1*/: Int/*->scala::Int#*/ } = new { val x/*<-local2*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s3/*<-advanced::Structural#s3().*/: { def m/*<-local6*/(x/*<-local5*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local8*/(x/*<-local7*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + def s4/*<-advanced::Structural#s4().*/(a/*<-advanced::Structural#s4().(a)*/: Int/*->scala::Int#*/): { val x/*<-local11*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ } class Wildcards/*<-advanced::Wildcards#*/ { @@ -34,8 +35,8 @@ object Test/*<-advanced::Test.*/ { { (???/*->scala::Predef.`???`().*/ : Any/*->scala::Any#*/) match { - case e3/*<-local19*/: List/*->scala::package.List#*/[_] => - val e3x/*<-local21*/ = e3/*->local19*/.head/*->scala::collection::IterableOps#head().*/ + case e3/*<-local12*/: List/*->scala::package.List#*/[_] => + val e3x/*<-local14*/ = e3/*->local12*/.head/*->scala::collection::IterableOps#head().*/ () } } diff --git a/tests/semanticdb/expect/Advanced.scala b/tests/semanticdb/expect/Advanced.scala index 3e14a46cb194..d40aebcc3efc 100644 --- a/tests/semanticdb/expect/Advanced.scala +++ b/tests/semanticdb/expect/Advanced.scala @@ -13,6 +13,7 @@ class Structural { def s1: { val x: Int } = ??? def s2: { val x: Int } = new { val x: Int = ??? } def s3: { def m(x: Int): Int } = new { def m(x: Int): Int = ??? } + def s4(a: Int): { val x: Int } = ??? } class Wildcards { diff --git a/tests/semanticdb/expect/Methods.expect.scala b/tests/semanticdb/expect/Methods.expect.scala index 8190bf0308d1..a36aba16ff73 100644 --- a/tests/semanticdb/expect/Methods.expect.scala +++ b/tests/semanticdb/expect/Methods.expect.scala @@ -24,6 +24,7 @@ class Methods/*<-example::Methods#*/[T/*<-example::Methods#[T]*/] { def m11/*<-example::Methods#m11(+1).*/(x/*<-example::Methods#m11(+1).(x)*/: Example/*->example::Example.*/.type) = ???/*->scala::Predef.`???`().*/ def m12a/*<-example::Methods#m12a().*/(x/*<-example::Methods#m12a().(x)*/: {}) = ???/*->scala::Predef.`???`().*/ def m12b/*<-example::Methods#m12b().*/(x/*<-example::Methods#m12b().(x)*/: { val x/*<-local0*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ + def m12c/*<-example::Methods#m12c().*/(x/*<-example::Methods#m12c().(x)*/: { val x/*<-local1*/: Int/*->scala::Int#*/; def y/*<-local2*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ def m13/*<-example::Methods#m13().*/(x/*<-example::Methods#m13().(x)*/: Int/*->scala::Int#*/ @unchecked/*->scala::unchecked#*/) = ???/*->scala::Predef.`???`().*/ def m15/*<-example::Methods#m15().*/(x/*<-example::Methods#m15().(x)*/: => Int/*->scala::Int#*/) = ???/*->scala::Predef.`???`().*/ def m16/*<-example::Methods#m16().*/(x/*<-example::Methods#m16().(x)*/: Int/*->scala::Int#*/*) = ???/*->scala::Predef.`???`().*/ diff --git a/tests/semanticdb/expect/Methods.scala b/tests/semanticdb/expect/Methods.scala index d588d3df2e55..f07dea11752d 100644 --- a/tests/semanticdb/expect/Methods.scala +++ b/tests/semanticdb/expect/Methods.scala @@ -24,6 +24,7 @@ class Methods[T] { def m11(x: Example.type) = ??? def m12a(x: {}) = ??? def m12b(x: { val x: Int }) = ??? + def m12c(x: { val x: Int; def y: Int }) = ??? def m13(x: Int @unchecked) = ??? def m15(x: => Int) = ??? def m16(x: Int*) = ??? diff --git a/tests/semanticdb/expect/RecOrRefined.expect.scala b/tests/semanticdb/expect/RecOrRefined.expect.scala new file mode 100644 index 000000000000..7edd0b030c2c --- /dev/null +++ b/tests/semanticdb/expect/RecOrRefined.expect.scala @@ -0,0 +1,18 @@ +package example + +def m1/*<-example::RecOrRefined$package.m1().*/(a/*<-example::RecOrRefined$package.m1().(a)*/: Int/*->scala::Int#*/ { val x/*<-local0*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ +def m2/*<-example::RecOrRefined$package.m2().*/(x/*<-example::RecOrRefined$package.m2().(x)*/: { val x/*<-local1*/: Int/*->scala::Int#*/; def y/*<-local2*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/ +def m3/*<-example::RecOrRefined$package.m3().*/(x/*<-example::RecOrRefined$package.m3().(x)*/: { val x/*<-local3*/: Int/*->scala::Int#*/; def y/*<-local4*/: Int/*->scala::Int#*/; type z/*<-local5*/ }) = ???/*->scala::Predef.`???`().*/ + +class Record/*<-example::Record#*/(elems/*<-example::Record#elems.*/: (String/*->scala::Predef.String#*/, Any/*->scala::Any#*/)*) extends Selectable/*->scala::Selectable#*/: + private val fields/*<-example::Record#fields.*/ = elems/*->example::Record#elems.*/.toMap/*->scala::collection::IterableOnceOps#toMap().*//*->scala::`<:<`.refl().*/ + def selectDynamic/*<-example::Record#selectDynamic().*/(name/*<-example::Record#selectDynamic().(name)*/: String/*->scala::Predef.String#*/): Any/*->scala::Any#*/ = fields/*->example::Record#fields.*//*->scala::collection::MapOps#apply().*/(name/*->example::Record#selectDynamic().(name)*/) + +type Person/*<-example::RecOrRefined$package.Person#*/ = Record/*->example::Record#*/ { + val name/*<-local6*/: String/*->scala::Predef.String#*/ + val age/*<-local7*/: Int/*->scala::Int#*/ +} + +// RecType +class C/*<-example::C#*/ { type T1/*<-example::C#T1#*/; type T2/*<-example::C#T2#*/ } +type C2/*<-example::RecOrRefined$package.C2#*/ = C/*->example::C#*/ { type T1/*<-local8*/; type T2/*<-local9*/ = T1/*->local8*/ } diff --git a/tests/semanticdb/expect/RecOrRefined.scala b/tests/semanticdb/expect/RecOrRefined.scala new file mode 100644 index 000000000000..75e95065981f --- /dev/null +++ b/tests/semanticdb/expect/RecOrRefined.scala @@ -0,0 +1,18 @@ +package example + +def m1(a: Int { val x: Int }) = ??? +def m2(x: { val x: Int; def y: Int }) = ??? +def m3(x: { val x: Int; def y: Int; type z }) = ??? + +class Record(elems: (String, Any)*) extends Selectable: + private val fields = elems.toMap + def selectDynamic(name: String): Any = fields(name) + +type Person = Record { + val name: String + val age: Int +} + +// RecType +class C { type T1; type T2 } +type C2 = C { type T1; type T2 = T1 } diff --git a/tests/semanticdb/expect/semanticdb-Types.expect.scala b/tests/semanticdb/expect/semanticdb-Types.expect.scala index b7a203d9c74e..b39d7aad59af 100644 --- a/tests/semanticdb/expect/semanticdb-Types.expect.scala +++ b/tests/semanticdb/expect/semanticdb-Types.expect.scala @@ -61,10 +61,10 @@ object Test/*<-types::Test.*/ { val compoundType1/*<-types::Test.C#compoundType1.*/: { def k/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ val compoundType2/*<-types::Test.C#compoundType2.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ = ???/*->scala::Predef.`???`().*/ - val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local2*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ - val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local4*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/ + val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local2*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } val compoundType5/*<-types::Test.C#compoundType5.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ - val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local9*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } + val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local7*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ } val annType1/*<-types::Test.C#annType1.*/: T/*->types::T#*/ @ann(42) = ???/*->scala::Predef.`???`().*/ val annType2/*<-types::Test.C#annType2.*/: T/*->types::T#*/ @ann1/*->types::ann1#*/ @ann2/*->types::ann2#*/ = ???/*->scala::Predef.`???`().*/ @@ -74,7 +74,7 @@ object Test/*<-types::Test.*/ { val existentialType4/*<-types::Test.C#existentialType4.*/ = Class/*->java::lang::Class#*/.forName/*->java::lang::Class#forName().*/("foo.Bar") def typeLambda1/*<-types::Test.C#typeLambda1().*/[M/*<-types::Test.C#typeLambda1().[M]*/[_]] = ???/*->scala::Predef.`???`().*/ - typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local13*/[T/*<-local12*/] = List/*->scala::package.List#*/[T/*->local12*/] })#L] + typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local11*/[T/*<-local10*/] = List/*->scala::package.List#*/[T/*->local10*/] })#L] object ClassInfoType1/*<-types::Test.C#ClassInfoType1.*/ class ClassInfoType2/*<-types::Test.C#ClassInfoType2#*/ extends B/*->types::B#*/ { def x/*<-types::Test.C#ClassInfoType2#x().*/ = 42 } diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 8e8a8cd57183..288017168674 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -49,44 +49,47 @@ Schema => SemanticDB v4 Uri => Advanced.scala Text => empty Language => Scala -Symbols => 34 entries -Occurrences => 90 entries +Symbols => 37 entries +Occurrences => 96 entries Symbols: advanced/C# => class C [typeparam T ] extends Object { self: C[T] => +3 decls } advanced/C#[T] => typeparam T advanced/C#``(). => primary ctor [unknown T: ](unknown T: ): C[T] advanced/C#t(). => method t => T -advanced/Structural# => class Structural extends Object { self: Structural => +4 decls } +advanced/Structural# => class Structural extends Object { self: Structural => +5 decls } advanced/Structural#``(). => primary ctor (): Structural -advanced/Structural#s1(). => method s1 => Object { local x: Int } -advanced/Structural#s2(). => method s2 => Object { local x: Int } -advanced/Structural#s3(). => method s3 => Object { local m: (param x: Int): Int } +advanced/Structural#s1(). => method s1 => Object { abstract val method x Int } +advanced/Structural#s2(). => method s2 => Object { abstract val method x Int } +advanced/Structural#s3(). => method s3 => Object { abstract method m (param x: Int): Int } +advanced/Structural#s4(). => method s4 (param a: Int): Object { abstract val method x Int } +advanced/Structural#s4().(a) => param a: Int advanced/Test. => final object Test extends Object { self: .Test.type => +11 decls } advanced/Test.e. => val method e Wildcards advanced/Test.e1. => val method e1 List[] advanced/Test.e1x. => val method e1x Any advanced/Test.s. => val method s Structural -advanced/Test.s1. => val method s1 Object { local x: Int } +advanced/Test.s1. => val method s1 Object { abstract val method x Int } advanced/Test.s1x. => val method s1x Int -advanced/Test.s2. => val method s2 Object { local x: Int } +advanced/Test.s2. => val method s2 Object { abstract val method x Int } advanced/Test.s2x. => val method s2x Int -advanced/Test.s3. => val method s3 Object { local m: (param x: Int): Int } +advanced/Test.s3. => val method s3 Object { abstract method m (param x: Int): Int } advanced/Test.s3x. => val method s3x Int advanced/Wildcards# => class Wildcards extends Object { self: Wildcards => +2 decls } advanced/Wildcards#``(). => primary ctor (): Wildcards advanced/Wildcards#e1(). => method e1 => List[] local0 => abstract val method x Int -local2 => abstract val method x Int -local3 => val method x Int -local4 => final class $anon extends Object { self: $anon => +2 decls } +local1 => abstract val method x Int +local2 => val method x Int +local3 => final class $anon extends Object { self: $anon => +2 decls } +local5 => param x: Int +local6 => abstract method m (param x: Int): Int local7 => param x: Int -local8 => abstract method m (param x: Int): Int -local9 => param x: Int -local10 => method m (param x: Int): Int -local11 => final class $anon extends Object { self: $anon => +2 decls } -local19 => val local e3: List[local20] -local21 => val local e3x: local20 +local8 => method m (param x: Int): Int +local9 => final class $anon extends Object { self: $anon => +2 decls } +local11 => abstract val method x Int +local12 => val local e3: List[local13] +local14 => val local e3x: local13 Occurrences: [0:8..0:16): advanced <- advanced/ @@ -113,72 +116,78 @@ Occurrences: [12:19..12:22): Int -> scala/Int# [12:27..12:30): ??? -> scala/Predef.`???`(). [13:6..13:8): s2 <- advanced/Structural#s2(). -[13:16..13:17): x <- local2 +[13:16..13:17): x <- local1 [13:19..13:22): Int -> scala/Int# -[13:37..13:38): x <- local3 +[13:37..13:38): x <- local2 [13:40..13:43): Int -> scala/Int# [13:46..13:49): ??? -> scala/Predef.`???`(). [14:6..14:8): s3 <- advanced/Structural#s3(). -[14:16..14:17): m <- local8 -[14:18..14:19): x <- local7 +[14:16..14:17): m <- local6 +[14:18..14:19): x <- local5 [14:21..14:24): Int -> scala/Int# [14:27..14:30): Int -> scala/Int# -[14:45..14:46): m <- local10 -[14:47..14:48): x <- local9 +[14:45..14:46): m <- local8 +[14:47..14:48): x <- local7 [14:50..14:53): Int -> scala/Int# [14:56..14:59): Int -> scala/Int# [14:62..14:65): ??? -> scala/Predef.`???`(). -[17:6..17:15): Wildcards <- advanced/Wildcards# -[18:2..18:2): <- advanced/Wildcards#``(). -[18:6..18:8): e1 <- advanced/Wildcards#e1(). -[18:10..18:14): List -> scala/package.List# -[18:20..18:23): ??? -> scala/Predef.`???`(). -[21:7..21:11): Test <- advanced/Test. -[22:6..22:7): s <- advanced/Test.s. -[22:14..22:24): Structural -> advanced/Structural# -[22:24..22:24): -> advanced/Structural#``(). -[23:6..23:8): s1 <- advanced/Test.s1. -[23:11..23:12): s -> advanced/Test.s. -[23:13..23:15): s1 -> advanced/Structural#s1(). -[24:6..24:9): s1x <- advanced/Test.s1x. -[24:12..24:12): -> scala/reflect/Selectable.reflectiveSelectable(). -[24:12..24:13): s -> advanced/Test.s. -[24:14..24:16): s1 -> advanced/Structural#s1(). -[24:16..24:16): -> scala/reflect/Selectable#selectDynamic(). -[25:6..25:8): s2 <- advanced/Test.s2. -[25:11..25:12): s -> advanced/Test.s. -[25:13..25:15): s2 -> advanced/Structural#s2(). -[26:6..26:9): s2x <- advanced/Test.s2x. -[26:12..26:12): -> scala/reflect/Selectable.reflectiveSelectable(). -[26:12..26:13): s -> advanced/Test.s. -[26:14..26:16): s2 -> advanced/Structural#s2(). -[26:16..26:16): -> scala/reflect/Selectable#selectDynamic(). -[27:6..27:8): s3 <- advanced/Test.s3. -[27:11..27:12): s -> advanced/Test.s. -[27:13..27:15): s3 -> advanced/Structural#s3(). -[28:6..28:9): s3x <- advanced/Test.s3x. -[28:12..28:12): -> scala/reflect/Selectable.reflectiveSelectable(). -[28:12..28:13): s -> advanced/Test.s. -[28:14..28:16): s3 -> advanced/Structural#s3(). -[28:16..28:16): -> scala/reflect/Selectable#applyDynamic(). -[28:19..28:22): ??? -> scala/Predef.`???`(). -[30:6..30:7): e <- advanced/Test.e. -[30:14..30:23): Wildcards -> advanced/Wildcards# -[30:23..30:23): -> advanced/Wildcards#``(). -[31:6..31:8): e1 <- advanced/Test.e1. -[31:11..31:12): e -> advanced/Test.e. -[31:13..31:15): e1 -> advanced/Wildcards#e1(). -[32:6..32:9): e1x <- advanced/Test.e1x. -[32:12..32:13): e -> advanced/Test.e. -[32:14..32:16): e1 -> advanced/Wildcards#e1(). -[32:17..32:21): head -> scala/collection/IterableOps#head(). -[35:5..35:8): ??? -> scala/Predef.`???`(). -[35:11..35:14): Any -> scala/Any# -[36:11..36:13): e3 <- local19 -[36:15..36:19): List -> scala/package.List# -[37:12..37:15): e3x <- local21 -[37:18..37:20): e3 -> local19 -[37:21..37:25): head -> scala/collection/IterableOps#head(). +[15:6..15:8): s4 <- advanced/Structural#s4(). +[15:9..15:10): a <- advanced/Structural#s4().(a) +[15:12..15:15): Int -> scala/Int# +[15:24..15:25): x <- local11 +[15:27..15:30): Int -> scala/Int# +[15:35..15:38): ??? -> scala/Predef.`???`(). +[18:6..18:15): Wildcards <- advanced/Wildcards# +[19:2..19:2): <- advanced/Wildcards#``(). +[19:6..19:8): e1 <- advanced/Wildcards#e1(). +[19:10..19:14): List -> scala/package.List# +[19:20..19:23): ??? -> scala/Predef.`???`(). +[22:7..22:11): Test <- advanced/Test. +[23:6..23:7): s <- advanced/Test.s. +[23:14..23:24): Structural -> advanced/Structural# +[23:24..23:24): -> advanced/Structural#``(). +[24:6..24:8): s1 <- advanced/Test.s1. +[24:11..24:12): s -> advanced/Test.s. +[24:13..24:15): s1 -> advanced/Structural#s1(). +[25:6..25:9): s1x <- advanced/Test.s1x. +[25:12..25:12): -> scala/reflect/Selectable.reflectiveSelectable(). +[25:12..25:13): s -> advanced/Test.s. +[25:14..25:16): s1 -> advanced/Structural#s1(). +[25:16..25:16): -> scala/reflect/Selectable#selectDynamic(). +[26:6..26:8): s2 <- advanced/Test.s2. +[26:11..26:12): s -> advanced/Test.s. +[26:13..26:15): s2 -> advanced/Structural#s2(). +[27:6..27:9): s2x <- advanced/Test.s2x. +[27:12..27:12): -> scala/reflect/Selectable.reflectiveSelectable(). +[27:12..27:13): s -> advanced/Test.s. +[27:14..27:16): s2 -> advanced/Structural#s2(). +[27:16..27:16): -> scala/reflect/Selectable#selectDynamic(). +[28:6..28:8): s3 <- advanced/Test.s3. +[28:11..28:12): s -> advanced/Test.s. +[28:13..28:15): s3 -> advanced/Structural#s3(). +[29:6..29:9): s3x <- advanced/Test.s3x. +[29:12..29:12): -> scala/reflect/Selectable.reflectiveSelectable(). +[29:12..29:13): s -> advanced/Test.s. +[29:14..29:16): s3 -> advanced/Structural#s3(). +[29:16..29:16): -> scala/reflect/Selectable#applyDynamic(). +[29:19..29:22): ??? -> scala/Predef.`???`(). +[31:6..31:7): e <- advanced/Test.e. +[31:14..31:23): Wildcards -> advanced/Wildcards# +[31:23..31:23): -> advanced/Wildcards#``(). +[32:6..32:8): e1 <- advanced/Test.e1. +[32:11..32:12): e -> advanced/Test.e. +[32:13..32:15): e1 -> advanced/Wildcards#e1(). +[33:6..33:9): e1x <- advanced/Test.e1x. +[33:12..33:13): e -> advanced/Test.e. +[33:14..33:16): e1 -> advanced/Wildcards#e1(). +[33:17..33:21): head -> scala/collection/IterableOps#head(). +[36:5..36:8): ??? -> scala/Predef.`???`(). +[36:11..36:14): Any -> scala/Any# +[37:11..37:13): e3 <- local12 +[37:15..37:19): List -> scala/package.List# +[38:12..38:15): e3x <- local14 +[38:18..38:20): e3 -> local12 +[38:21..38:25): head -> scala/collection/IterableOps#head(). expect/Annotations.scala ------------------------ @@ -2184,11 +2193,11 @@ Schema => SemanticDB v4 Uri => Methods.scala Text => empty Language => Scala -Symbols => 77 entries -Occurrences => 149 entries +Symbols => 81 entries +Occurrences => 156 entries Symbols: -example/Methods# => class Methods [typeparam T ] extends Object { self: Methods[T] => +43 decls } +example/Methods# => class Methods [typeparam T ] extends Object { self: Methods[T] => +44 decls } example/Methods#AList# => type AList [typeparam T ] = List[T] example/Methods#AList#[T] => typeparam T example/Methods#List# => class List [typeparam T ] extends Object { self: List[T] => +2 decls } @@ -2232,8 +2241,10 @@ example/Methods#m11(+1). => method m11 (param x: .Example.type): Nothing example/Methods#m11(+1).(x) => param x: .Example.type example/Methods#m12a(). => method m12a (param x: Object): Nothing example/Methods#m12a().(x) => param x: Object -example/Methods#m12b(). => method m12b (param x: Object { local x: Int }): Nothing -example/Methods#m12b().(x) => param x: Object { local x: Int } +example/Methods#m12b(). => method m12b (param x: Object { abstract val method x Int }): Nothing +example/Methods#m12b().(x) => param x: Object { abstract val method x Int } +example/Methods#m12c(). => method m12c (param x: Object { abstract method y => Int; abstract val method x Int }): Nothing +example/Methods#m12c().(x) => param x: Object { abstract method y => Int; abstract val method x Int } example/Methods#m13(). => method m13 (param x: Int @unchecked): Nothing example/Methods#m13().(x) => param x: Int @unchecked example/Methods#m15(). => method m15 (param x: => Int): Nothing @@ -2265,6 +2276,8 @@ example/Methods#m20(+1). => method m20 (param b: String): Nothing example/Methods#m20(+1).(b) => param b: String example/Methods#m20(+2). => var method m20 .m17.type local0 => abstract val method x Int +local1 => abstract val method x Int +local2 => abstract method y => Int Occurrences: [0:8..0:15): example <- example/ @@ -2362,60 +2375,67 @@ Occurrences: [25:20..25:21): x <- local0 [25:23..25:26): Int -> scala/Int# [25:32..25:35): ??? -> scala/Predef.`???`(). -[26:6..26:9): m13 <- example/Methods#m13(). -[26:10..26:11): x <- example/Methods#m13().(x) -[26:13..26:16): Int -> scala/Int# -[26:18..26:27): unchecked -> scala/unchecked# -[26:31..26:34): ??? -> scala/Predef.`???`(). -[27:6..27:9): m15 <- example/Methods#m15(). -[27:10..27:11): x <- example/Methods#m15().(x) -[27:16..27:19): Int -> scala/Int# -[27:23..27:26): ??? -> scala/Predef.`???`(). -[28:6..28:9): m16 <- example/Methods#m16(). -[28:10..28:11): x <- example/Methods#m16().(x) -[28:13..28:16): Int -> scala/Int# -[28:21..28:24): ??? -> scala/Predef.`???`(). -[29:9..29:12): m17 <- example/Methods#m17. -[29:19..29:20): m <- example/Methods#m17.m(). -[29:25..29:28): ??? -> scala/Predef.`???`(). -[30:6..30:9): m17 <- example/Methods#m17(). -[30:10..30:11): a <- example/Methods#m17().(a) -[30:13..30:16): Int -> scala/Int# -[30:20..30:23): ??? -> scala/Predef.`???`(). -[31:6..31:9): m17 <- example/Methods#m17(+1). -[31:10..31:11): b <- example/Methods#m17(+1).(b) -[31:13..31:19): String -> scala/Predef.String# -[31:23..31:26): ??? -> scala/Predef.`???`(). -[32:6..32:9): m18 <- example/Methods#m18. -[32:12..32:15): m17 -> example/Methods#m17. -[33:6..33:9): m18 <- example/Methods#m18(). -[33:10..33:11): a <- example/Methods#m18().(a) -[33:13..33:16): Int -> scala/Int# -[33:20..33:23): ??? -> scala/Predef.`???`(). -[34:6..34:9): m18 <- example/Methods#m18(+1). -[34:10..34:11): b <- example/Methods#m18(+1).(b) -[34:13..34:19): String -> scala/Predef.String# -[34:23..34:26): ??? -> scala/Predef.`???`(). -[35:6..35:9): m19 <- example/Methods#m19(). -[35:10..35:11): x <- example/Methods#m19().(x) -[35:10..35:11): x <- example/Methods#m19$default$3().(x) -[35:13..35:16): Int -> scala/Int# -[35:18..35:19): y <- example/Methods#m19().(y) -[35:18..35:19): y <- example/Methods#m19$default$3().(y) -[35:21..35:24): Int -> scala/Int# -[35:30..35:31): z <- example/Methods#m19().(z) -[35:33..35:36): Int -> scala/Int# -[35:44..35:47): ??? -> scala/Predef.`???`(). -[36:6..36:9): m20 <- example/Methods#m20(). -[36:10..36:11): a <- example/Methods#m20().(a) +[26:6..26:10): m12c <- example/Methods#m12c(). +[26:11..26:12): x <- example/Methods#m12c().(x) +[26:20..26:21): x <- local1 +[26:23..26:26): Int -> scala/Int# +[26:32..26:33): y <- local2 +[26:35..26:38): Int -> scala/Int# +[26:44..26:47): ??? -> scala/Predef.`???`(). +[27:6..27:9): m13 <- example/Methods#m13(). +[27:10..27:11): x <- example/Methods#m13().(x) +[27:13..27:16): Int -> scala/Int# +[27:18..27:27): unchecked -> scala/unchecked# +[27:31..27:34): ??? -> scala/Predef.`???`(). +[28:6..28:9): m15 <- example/Methods#m15(). +[28:10..28:11): x <- example/Methods#m15().(x) +[28:16..28:19): Int -> scala/Int# +[28:23..28:26): ??? -> scala/Predef.`???`(). +[29:6..29:9): m16 <- example/Methods#m16(). +[29:10..29:11): x <- example/Methods#m16().(x) +[29:13..29:16): Int -> scala/Int# +[29:21..29:24): ??? -> scala/Predef.`???`(). +[30:9..30:12): m17 <- example/Methods#m17. +[30:19..30:20): m <- example/Methods#m17.m(). +[30:25..30:28): ??? -> scala/Predef.`???`(). +[31:6..31:9): m17 <- example/Methods#m17(). +[31:10..31:11): a <- example/Methods#m17().(a) +[31:13..31:16): Int -> scala/Int# +[31:20..31:23): ??? -> scala/Predef.`???`(). +[32:6..32:9): m17 <- example/Methods#m17(+1). +[32:10..32:11): b <- example/Methods#m17(+1).(b) +[32:13..32:19): String -> scala/Predef.String# +[32:23..32:26): ??? -> scala/Predef.`???`(). +[33:6..33:9): m18 <- example/Methods#m18. +[33:12..33:15): m17 -> example/Methods#m17. +[34:6..34:9): m18 <- example/Methods#m18(). +[34:10..34:11): a <- example/Methods#m18().(a) +[34:13..34:16): Int -> scala/Int# +[34:20..34:23): ??? -> scala/Predef.`???`(). +[35:6..35:9): m18 <- example/Methods#m18(+1). +[35:10..35:11): b <- example/Methods#m18(+1).(b) +[35:13..35:19): String -> scala/Predef.String# +[35:23..35:26): ??? -> scala/Predef.`???`(). +[36:6..36:9): m19 <- example/Methods#m19(). +[36:10..36:11): x <- example/Methods#m19().(x) +[36:10..36:11): x <- example/Methods#m19$default$3().(x) [36:13..36:16): Int -> scala/Int# -[36:20..36:23): ??? -> scala/Predef.`???`(). -[37:6..37:9): m20 <- example/Methods#m20(+1). -[37:10..37:11): b <- example/Methods#m20(+1).(b) -[37:13..37:19): String -> scala/Predef.String# -[37:23..37:26): ??? -> scala/Predef.`???`(). -[38:6..38:9): m20 <- example/Methods#m20(+2). -[38:12..38:15): m17 -> example/Methods#m17. +[36:18..36:19): y <- example/Methods#m19().(y) +[36:18..36:19): y <- example/Methods#m19$default$3().(y) +[36:21..36:24): Int -> scala/Int# +[36:30..36:31): z <- example/Methods#m19().(z) +[36:33..36:36): Int -> scala/Int# +[36:44..36:47): ??? -> scala/Predef.`???`(). +[37:6..37:9): m20 <- example/Methods#m20(). +[37:10..37:11): a <- example/Methods#m20().(a) +[37:13..37:16): Int -> scala/Int# +[37:20..37:23): ??? -> scala/Predef.`???`(). +[38:6..38:9): m20 <- example/Methods#m20(+1). +[38:10..38:11): b <- example/Methods#m20(+1).(b) +[38:13..38:19): String -> scala/Predef.String# +[38:23..38:26): ??? -> scala/Predef.`???`(). +[39:6..39:9): m20 <- example/Methods#m20(+2). +[39:12..39:15): m17 -> example/Methods#m17. expect/NamedApplyBlock.scala ---------------------------- @@ -2574,7 +2594,7 @@ Symbols => 3 entries Occurrences => 4 entries Symbols: -_empty_/NewModifiers. => final object NewModifiers extends Object { self: .NewModifiers.type { type A } => +3 decls } +_empty_/NewModifiers. => final object NewModifiers extends Object { self: .NewModifiers.type {} => +3 decls } _empty_/NewModifiers.A# => type A _empty_/NewModifiers.foo. => val method foo "foo" @@ -2718,6 +2738,105 @@ Occurrences: [31:10..31:11): T -> prefixes/M.T# [31:14..31:17): ??? -> scala/Predef.`???`(). +expect/RecOrRefined.scala +------------------------- + +Summary: +Schema => SemanticDB v4 +Uri => RecOrRefined.scala +Text => empty +Language => Scala +Symbols => 30 entries +Occurrences => 54 entries + +Symbols: +example/C# => class C extends Object { self: C => +3 decls } +example/C#T1# => type T1 +example/C#T2# => type T2 +example/C#``(). => primary ctor (): C +example/RecOrRefined$package. => final package object example extends Object { self: .example.type => +6 decls } +example/RecOrRefined$package.C2# => type C2 = C { type T2 = T1; type T1 } +example/RecOrRefined$package.Person# => type Person = Record { abstract val method age Int; abstract val method name String } +example/RecOrRefined$package.m1(). => method m1 (param a: Int { abstract val method x Int }): Nothing +example/RecOrRefined$package.m1().(a) => param a: Int { abstract val method x Int } +example/RecOrRefined$package.m2(). => method m2 (param x: Object { abstract method y => Int; abstract val method x Int }): Nothing +example/RecOrRefined$package.m2().(x) => param x: Object { abstract method y => Int; abstract val method x Int } +example/RecOrRefined$package.m3(). => method m3 (param x: Object { type z ; abstract method y => Int; abstract val method x Int }): Nothing +example/RecOrRefined$package.m3().(x) => param x: Object { type z ; abstract method y => Int; abstract val method x Int } +example/Record# => class Record extends Object with Selectable { self: Record => +4 decls } +example/Record#``(). => primary ctor (param elems: Tuple2[String, Any]*): Record +example/Record#``().(elems) => param elems: Tuple2[String, Any]* +example/Record#elems. => val method elems Tuple2[String, Any]* +example/Record#fields. => val method fields Map[String, Any] +example/Record#selectDynamic(). => method selectDynamic (param name: String): Any +example/Record#selectDynamic().(name) => param name: String +local0 => abstract val method x Int +local1 => abstract val method x Int +local2 => abstract method y => Int +local3 => abstract val method x Int +local4 => abstract method y => Int +local5 => type z +local6 => abstract val method name String +local7 => abstract val method age Int +local8 => type T1 +local9 => type T2 = T1 + +Occurrences: +[0:8..0:15): example <- example/ +[2:4..2:6): m1 <- example/RecOrRefined$package.m1(). +[2:7..2:8): a <- example/RecOrRefined$package.m1().(a) +[2:10..2:13): Int -> scala/Int# +[2:20..2:21): x <- local0 +[2:23..2:26): Int -> scala/Int# +[2:32..2:35): ??? -> scala/Predef.`???`(). +[3:4..3:6): m2 <- example/RecOrRefined$package.m2(). +[3:7..3:8): x <- example/RecOrRefined$package.m2().(x) +[3:16..3:17): x <- local1 +[3:19..3:22): Int -> scala/Int# +[3:28..3:29): y <- local2 +[3:31..3:34): Int -> scala/Int# +[3:40..3:43): ??? -> scala/Predef.`???`(). +[4:4..4:6): m3 <- example/RecOrRefined$package.m3(). +[4:7..4:8): x <- example/RecOrRefined$package.m3().(x) +[4:16..4:17): x <- local3 +[4:19..4:22): Int -> scala/Int# +[4:28..4:29): y <- local4 +[4:31..4:34): Int -> scala/Int# +[4:41..4:42): z <- local5 +[4:48..4:51): ??? -> scala/Predef.`???`(). +[6:6..6:12): Record <- example/Record# +[6:12..6:12): <- example/Record#``(). +[6:13..6:18): elems <- example/Record#elems. +[6:21..6:27): String -> scala/Predef.String# +[6:29..6:32): Any -> scala/Any# +[6:44..6:54): Selectable -> scala/Selectable# +[7:14..7:20): fields <- example/Record#fields. +[7:23..7:28): elems -> example/Record#elems. +[7:29..7:34): toMap -> scala/collection/IterableOnceOps#toMap(). +[7:34..7:34): -> scala/`<:<`.refl(). +[8:6..8:19): selectDynamic <- example/Record#selectDynamic(). +[8:20..8:24): name <- example/Record#selectDynamic().(name) +[8:26..8:32): String -> scala/Predef.String# +[8:35..8:38): Any -> scala/Any# +[8:41..8:47): fields -> example/Record#fields. +[8:47..8:47): -> scala/collection/MapOps#apply(). +[8:48..8:52): name -> example/Record#selectDynamic().(name) +[10:5..10:11): Person <- example/RecOrRefined$package.Person# +[10:14..10:20): Record -> example/Record# +[11:6..11:10): name <- local6 +[11:12..11:18): String -> scala/Predef.String# +[12:6..12:9): age <- local7 +[12:11..12:14): Int -> scala/Int# +[16:6..16:7): C <- example/C# +[16:10..16:10): <- example/C#``(). +[16:15..16:17): T1 <- example/C#T1# +[16:24..16:26): T2 <- example/C#T2# +[17:5..17:7): C2 <- example/RecOrRefined$package.C2# +[17:10..17:11): C -> example/C# +[17:19..17:21): T1 <- local8 +[17:28..17:30): T2 <- local9 +[17:33..17:35): T1 -> local8 + expect/RightAssociativeExtension.scala -------------------------------------- @@ -3917,14 +4036,14 @@ Occurrences => 250 entries Symbols: local0 => abstract method k => Int -local2 => abstract method k => Int -local4 => method k => Int -local5 => final class $anon extends Object { self: $anon => +2 decls } -local7 => final class $anon extends M with N { self: $anon => +1 decls } -local9 => method k => Int -local10 => final class $anon extends M with N { self: $anon => +2 decls } -local12 => typeparam T -local13 => type L [typeparam T ] = List[T] +local1 => abstract method k => Int +local2 => method k => Int +local3 => final class $anon extends Object { self: $anon => +2 decls } +local5 => final class $anon extends M with N { self: $anon => +1 decls } +local7 => method k => Int +local8 => final class $anon extends M with N { self: $anon => +2 decls } +local10 => typeparam T +local11 => type L [typeparam T ] = List[T] types/B# => class B extends Object { self: B => +1 decls } types/B#``(). => primary ctor (): B types/C# => class C extends Object { self: C => +1 decls } @@ -4007,9 +4126,9 @@ types/Test.C#TypeType.m3().[M3] => typeparam M3 types/Test.C#``(). => primary ctor (): C types/Test.C#annType1. => val method annType1 T @ann[T] types/Test.C#annType2. => val method annType2 T @ann1 @ann2 -types/Test.C#compoundType1. => val method compoundType1 Object { local k: => Int } +types/Test.C#compoundType1. => val method compoundType1 Object { abstract method k => Int } types/Test.C#compoundType2. => val method compoundType2 M with N -types/Test.C#compoundType3. => val method compoundType3 M with N { local k: => Int } +types/Test.C#compoundType3. => val method compoundType3 M with N { abstract method k => Int } types/Test.C#compoundType4. => val method compoundType4 Object types/Test.C#compoundType5. => val method compoundType5 M with N types/Test.C#compoundType6. => val method compoundType6 M with N @@ -4183,11 +4302,11 @@ Occurrences: [63:8..63:21): compoundType3 <- types/Test.C#compoundType3. [63:23..63:24): M -> types/Test.M# [63:30..63:31): N -> types/Test.N# -[63:38..63:39): k <- local2 +[63:38..63:39): k <- local1 [63:41..63:44): Int -> scala/Int# [63:49..63:52): ??? -> scala/Predef.`???`(). [64:8..64:21): compoundType4 <- types/Test.C#compoundType4. -[64:34..64:35): k <- local4 +[64:34..64:35): k <- local2 [64:37..64:40): Int -> scala/Int# [64:43..64:46): ??? -> scala/Predef.`???`(). [65:8..65:21): compoundType5 <- types/Test.C#compoundType5. @@ -4198,7 +4317,7 @@ Occurrences: [66:28..66:29): M -> types/Test.M# [66:29..66:29): -> types/Test.M#``(). [66:35..66:36): N -> types/Test.N# -[66:43..66:44): k <- local9 +[66:43..66:44): k <- local7 [66:46..66:49): Int -> scala/Int# [66:52..66:55): ??? -> scala/Predef.`???`(). [68:8..68:16): annType1 <- types/Test.C#annType1. @@ -4222,10 +4341,10 @@ Occurrences: [75:20..75:21): M <- types/Test.C#typeLambda1().[M] [75:28..75:31): ??? -> scala/Predef.`???`(). [76:4..76:15): typeLambda1 -> types/Test.C#typeLambda1(). -[76:24..76:25): L <- local13 -[76:26..76:27): T <- local12 +[76:24..76:25): L <- local11 +[76:26..76:27): T <- local10 [76:31..76:35): List -> scala/package.List# -[76:36..76:37): T -> local12 +[76:36..76:37): T -> local10 [78:11..78:25): ClassInfoType1 <- types/Test.C#ClassInfoType1. [79:10..79:24): ClassInfoType2 <- types/Test.C#ClassInfoType2# [79:33..79:34): B -> types/B# From 58fd3d581bba5a5190d7a0f6a1f5ab538b1b8612 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Tue, 29 Jun 2021 23:27:40 +0900 Subject: [PATCH 08/25] Re-insert assertion to localIdx Previously, there were the risks that localIdx receives the symbol that doens't have `span` because `TypeOps` generates dummy symbols for refinements in `RefinedType` and `RecType`. However, with the following commits, https://github.com/lampepfl/dotty/pull/12885/commits/7dd91ad1f8cc1cc3247a8522d9230e91db193548 https://github.com/lampepfl/dotty/pull/12885/commits/226e26f8b2f5481729cab745f27b0873a634cab3 now we never generate dummy symbol in `TypeOps`. So re-insert the assertion we deleted when copying this method from `ExtractSemanticDB`. see: https://github.com/lampepfl/dotty/pull/12885/files#r658150249 --- .../dotc/semanticdb/SemanticSymbolBuilder.scala | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala index 31f38f2d1027..52cf40fb01f6 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala @@ -94,22 +94,18 @@ class SemanticSymbolBuilder: */ def localIdx(sym: Symbol)(using Context): Int = val startPos = - if sym.span.exists then Some(sym.span.start) else None - // assert(sym.span.exists, s"$sym should have a span") + assert(sym.span.exists, s"$sym should have a span") + sym.span.start @tailrec def computeLocalIdx(sym: Symbol): Int = locals get sym match case Some(idx) => idx - case None => (for { - pos <- startPos - samePosSyms <- symsAtOffset.get(pos) - sameName <- samePosSyms.find(_.name == sym.name) - } yield sameName) match + case None => symsAtOffset(startPos).find(_.name == sym.name) match case Some(other) => computeLocalIdx(other) case None => val idx = nextLocalIdx nextLocalIdx += 1 locals(sym) = idx - startPos.foreach(pos => symsAtOffset(pos) += sym) + symsAtOffset(startPos) += sym idx end computeLocalIdx computeLocalIdx(sym) From 0325a22e735ff46a210fc64f9fa98b57620f0125 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Fri, 2 Jul 2021 22:18:02 +0900 Subject: [PATCH 09/25] Convert AndType to IntersectionType --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 2 +- tests/semanticdb/metac.expect | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index cfbb968a3678..74f3fb8f448e 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -264,7 +264,7 @@ class TypeOps: case AndType(ct1, ct2) => flatten(ct1) ++ flatten(ct2) case other => List(other) val stpes = flatten(and).map(loop) - s.WithType(stpes) + s.IntersectionType(stpes) case or: OrType => def flatten(child: Type): List[Type] = child match diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 288017168674..a5714acc37ac 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -203,7 +203,7 @@ Occurrences => 52 entries Symbols: annot/Alias. => final object Alias extends Object { self: .Alias.type => +2 decls } annot/Alias.A# => type A = ClassAnnotation @param -annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef with Annotations[T] => +6 decls } +annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef & Annotations[T] => +6 decls } annot/Annotations#S# => type S annot/Annotations#[T] => typeparam T annot/Annotations#``(). => primary ctor [unknown T: ](unknown T: )(param x: T): Annotations[T] @@ -290,7 +290,7 @@ Symbols => 13 entries Occurrences => 32 entries Symbols: -example/Anonymous# => class Anonymous extends Object { self: Anonymous with Anonymous => +6 decls } +example/Anonymous# => class Anonymous extends Object { self: Anonymous & Anonymous => +6 decls } example/Anonymous#Foo# => trait Foo extends Object { self: Foo => +1 decls } example/Anonymous#Foo#``(). => primary ctor (): Foo example/Anonymous#``(). => primary ctor (): Anonymous @@ -790,7 +790,7 @@ enumVal/Color#rgb. => val method rgb Int enumVal/Color. => final object Color extends Object { self: .Color.type => +8 decls } enumVal/Color.$values. => val method $values Array[Color] enumVal/Color.Blue. => case val static enum method Blue Color -enumVal/Color.Green. => case val static enum method Green Color with A +enumVal/Color.Green. => case val static enum method Green Color & A enumVal/Color.Red. => case val static enum method Red Color enumVal/Color.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Color enumVal/Color.fromOrdinal().(ordinal) => param ordinal: Int @@ -1678,7 +1678,7 @@ Symbols => 8 entries Occurrences => 55 entries Symbols: -example/InstrumentTyper# => class InstrumentTyper extends Object { self: AnyRef with InstrumentTyper => +5 decls } +example/InstrumentTyper# => class InstrumentTyper extends Object { self: AnyRef & InstrumentTyper => +5 decls } example/InstrumentTyper#AnnotatedType# => type AnnotatedType = Int @param example/InstrumentTyper#``(). => primary ctor (): InstrumentTyper example/InstrumentTyper#all(). => method all => List[Matchable] @@ -2884,16 +2884,16 @@ Occurrences => 26 entries Symbols: local0 => selfparam self: C1 local1 => selfparam self: B -local2 => selfparam self: B with C1 +local2 => selfparam self: B & C1 selfs/B# => class B extends Object { self: B => +1 decls } selfs/B#``(). => primary ctor (): B -selfs/C1# => class C1 extends B { self: C1 with C1 => +1 decls } +selfs/C1# => class C1 extends B { self: C1 & C1 => +1 decls } selfs/C1#``(). => primary ctor (): C1 -selfs/C2# => class C2 extends B { self: B with C2 => +1 decls } +selfs/C2# => class C2 extends B { self: B & C2 => +1 decls } selfs/C2#``(). => primary ctor (): C2 -selfs/C3# => class C3 extends B { self: B with C1 with C3 => +1 decls } +selfs/C3# => class C3 extends B { self: B & C1 & C3 => +1 decls } selfs/C3#``(). => primary ctor (): C3 -selfs/C6# => class C6 extends B { self: B with C6 => +1 decls } +selfs/C6# => class C6 extends B { self: B & C6 => +1 decls } selfs/C6#``(). => primary ctor (): C6 Occurrences: @@ -3162,7 +3162,7 @@ traits/U# => sealed trait U extends Object { self: U => +1 decls } traits/U#``(). => primary ctor (): U traits/U. => final object U extends Object { self: .U.type => +2 decls } traits/U.u(). => method u => U -traits/V# => trait V extends Object { self: C with V => +1 decls } +traits/V# => trait V extends Object { self: C & V => +1 decls } traits/V#``(). => primary ctor (): V Occurrences: @@ -4127,11 +4127,11 @@ types/Test.C#``(). => primary ctor (): C types/Test.C#annType1. => val method annType1 T @ann[T] types/Test.C#annType2. => val method annType2 T @ann1 @ann2 types/Test.C#compoundType1. => val method compoundType1 Object { abstract method k => Int } -types/Test.C#compoundType2. => val method compoundType2 M with N +types/Test.C#compoundType2. => val method compoundType2 M & N types/Test.C#compoundType3. => val method compoundType3 M with N { abstract method k => Int } types/Test.C#compoundType4. => val method compoundType4 Object -types/Test.C#compoundType5. => val method compoundType5 M with N -types/Test.C#compoundType6. => val method compoundType6 M with N +types/Test.C#compoundType5. => val method compoundType5 M & N +types/Test.C#compoundType6. => val method compoundType6 M & N types/Test.C#existentialType2. => val method existentialType2 List[] types/Test.C#existentialType3. => val method existentialType3 Class[] types/Test.C#existentialType4. => val method existentialType4 Class[] From 3cad5f33d80a7bb7a6c8001bf4531ccb61c12d9d Mon Sep 17 00:00:00 2001 From: tanishiking Date: Sat, 3 Jul 2021 16:30:08 +0900 Subject: [PATCH 10/25] Refactor enterRefined --- compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 74f3fb8f448e..86d2ae43e4f6 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -57,8 +57,7 @@ class TypeOps: sym.owner.owner.info match { // def foo(x: Parent { refinement }) = ... case refined: RefinedType => - val key = (refined, sym.name) - refinementSymtab(key) = sym + enterRefined(refined) // type x = Person { refinement } case tb: TypeBounds => From a3e1f538bf7ac2dc70a9591001887e007e864ba3 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Sat, 3 Jul 2021 18:15:38 +0900 Subject: [PATCH 11/25] Refactor: move all extension (of Symbol) method into Scala3 --- .../dotc/semanticdb/ExtractSemanticDB.scala | 9 +++---- .../dotty/tools/dotc/semanticdb/Scala3.scala | 9 ++++++- .../semanticdb/SemanticSymbolBuilder.scala | 26 +++++++++---------- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 1 + 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala index 9134057ed542..1c5ac7247b9f 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/ExtractSemanticDB.scala @@ -22,8 +22,7 @@ import scala.collection.mutable import scala.annotation.{ threadUnsafe => tu, tailrec } import scala.PartialFunction.condOpt -import dotty.tools.dotc.semanticdb.SemanticSymbolBuilder -import dotty.tools.dotc.semanticdb.{TypeOps => TOps} +import dotty.tools.dotc.{semanticdb => s} /** Extract symbol references and uses to semanticdb files. * See https://scalameta.org/docs/semanticdb/specification.html#symbol-1 @@ -50,8 +49,8 @@ class ExtractSemanticDB extends Phase: /** Extractor of symbol occurrences from trees */ class Extractor extends TreeTraverser: - given builder: SemanticSymbolBuilder = SemanticSymbolBuilder() - given typeOps: TOps = TOps() + given builder: s.SemanticSymbolBuilder = s.SemanticSymbolBuilder() + val converter = s.TypeOps() /** The bodies of synthetic locals */ private val localBodies = mutable.HashMap[Symbol, Tree]() @@ -285,7 +284,7 @@ class ExtractSemanticDB extends Phase: if !isLocal || !localNames.contains(sname) then if isLocal then localNames += sname - symbolInfos += sym.symbolInfo(symkinds)(using LinkMode.SymlinkChildren) + symbolInfos += sym.symbolInfo(symkinds)(using LinkMode.SymlinkChildren, converter) private def registerSymbolSimple(sym: Symbol)(using Context): Unit = registerSymbol(sym, Set.empty) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala index f1fab5a152a9..81e69529c9a0 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala @@ -126,7 +126,7 @@ object Scala3: def isSyntheticWithIdent(using Context): Boolean = sym.is(Synthetic) && !sym.isAnonymous && !sym.name.isEmptyNumbered - def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, Context, SemanticSymbolBuilder, TypeOps): SymbolInformation = + def symbolInfo(symkinds: Set[SymbolKind])(using LinkMode, TypeOps, SemanticSymbolBuilder, Context): SymbolInformation = val sname = sym.symbolName val signature = sym.info.toSemanticSig(sym) SymbolInformation( @@ -138,6 +138,13 @@ object Scala3: signature = signature, ) + /** The semanticdb name of the given symbol */ + def symbolName(using builder: SemanticSymbolBuilder)(using Context): String = + builder.symbolName(sym) + + def funParamSymbol(using builder: SemanticSymbolBuilder)(using Context): Name => String = + builder.funParamSymbol(sym) + private def symbolKind(symkinds: Set[SymbolKind])(using Context): SymbolInformation.Kind = if sym.isTypeParam then SymbolInformation.Kind.TYPE_PARAMETER diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala index 52cf40fb01f6..0446d86bc4bb 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala @@ -23,20 +23,18 @@ class SemanticSymbolBuilder: private val symsAtOffset = new mutable.HashMap[Int, Set[Symbol]](): override def default(key: Int) = Set[Symbol]() - extension (sym: Symbol) - /** The semanticdb name of the given symbol */ - def symbolName(using Context): String = - val b = StringBuilder(20) - addSymName(b, sym) - b.toString - - def funParamSymbol(using Context): Name => String = - if sym.isGlobal then - val funSymbol = sym.symbolName - name => s"$funSymbol($name)" - else - name => locals.keys.find(local => local.isTerm && local.owner == sym && local.name == name) - .fold("")(Symbols.LocalPrefix + _) + def symbolName(sym: Symbol)(using Context): String = + val b = StringBuilder(20) + addSymName(b, sym) + b.toString + + def funParamSymbol(sym: Symbol)(using Context): Name => String = + if sym.isGlobal then + val funSymbol = symbolName(sym) + name => s"$funSymbol($name)" + else + name => locals.keys.find(local => local.isTerm && local.owner == sym && local.name == name) + .fold("")(Symbols.LocalPrefix + _) /** Add semanticdb name of the given symbol to string builder */ private def addSymName(b: StringBuilder, sym: Symbol)(using Context): Unit = diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 86d2ae43e4f6..334c61f41bae 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -17,6 +17,7 @@ import dotty.tools.dotc.{semanticdb => s} class TypeOps: import SymbolScopeOps._ + import Scala3.given private val paramRefSymtab = mutable.Map[(LambdaType, Name), Symbol]() private val refinementSymtab = mutable.Map[(RefinedType, Name), Symbol]() given typeOps: TypeOps = this From 75bc739cbeae088a2a0604b924ce8c6eaeaa86cc Mon Sep 17 00:00:00 2001 From: tanishiking Date: Sat, 3 Jul 2021 18:41:59 +0900 Subject: [PATCH 12/25] Don't add type parameters as parameters to MethodSignature --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 3 +- tests/semanticdb/metac.expect | 86 +++++++++---------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 334c61f41bae..6047d459cc80 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -86,7 +86,8 @@ class TypeOps: val stparams = Some(s.Scope()) val paramss = if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss - val sparamss = paramss.map(_.sscope) + val termParamss = paramss.filter(ps => ps.forall(!_.isTypeParam)) + val sparamss = termParamss.map(_.sscope) s.MethodSignature( stparams, sparamss, diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index a5714acc37ac..8dca6e17c5d3 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -55,7 +55,7 @@ Occurrences => 96 entries Symbols: advanced/C# => class C [typeparam T ] extends Object { self: C[T] => +3 decls } advanced/C#[T] => typeparam T -advanced/C#``(). => primary ctor [unknown T: ](unknown T: ): C[T] +advanced/C#``(). => primary ctor [unknown T: ]: C[T] advanced/C#t(). => method t => T advanced/Structural# => class Structural extends Object { self: Structural => +5 decls } advanced/Structural#``(). => primary ctor (): Structural @@ -206,7 +206,7 @@ annot/Alias.A# => type A = ClassAnnotation @param annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef & Annotations[T] => +6 decls } annot/Annotations#S# => type S annot/Annotations#[T] => typeparam T -annot/Annotations#``(). => primary ctor [unknown T: ](unknown T: )(param x: T): Annotations[T] +annot/Annotations#``(). => primary ctor [unknown T: ](param x: T): Annotations[T] annot/Annotations#``().(x) => param x: T annot/Annotations#field. => val method field Int annot/Annotations#method(). => method method => Int @@ -295,7 +295,7 @@ example/Anonymous#Foo# => trait Foo extends Object { self: Foo => +1 decls } example/Anonymous#Foo#``(). => primary ctor (): Foo example/Anonymous#``(). => primary ctor (): Anonymous example/Anonymous#foo. => val method foo Foo -example/Anonymous#locally(). => method locally [typeparam A ](typeparam A )(param x: A): A +example/Anonymous#locally(). => method locally [typeparam A ](param x: A): A example/Anonymous#locally().(x) => param x: A example/Anonymous#locally().[A] => typeparam A example/Anonymous#m1(). => method m1 [] => Nothing @@ -883,26 +883,26 @@ _empty_/Enums.Directions.valueOf().($name) => param $name: String _empty_/Enums.Directions.values(). => method values => Array[Directions] _empty_/Enums.Maybe# => abstract sealed enum class Maybe [covariant typeparam A ] extends Object with Enum { self: Maybe[A] => +2 decls } _empty_/Enums.Maybe#[A] => covariant typeparam A -_empty_/Enums.Maybe#``(). => primary ctor [unknown A: ](unknown A: ): Maybe[A] +_empty_/Enums.Maybe#``(). => primary ctor [unknown A: ]: Maybe[A] _empty_/Enums.Maybe. => final object Maybe extends Object { self: .Maybe.type => +6 decls } _empty_/Enums.Maybe.Just# => final case enum class Just [covariant typeparam A ] extends Maybe[A] { self: Just[A] => +7 decls } _empty_/Enums.Maybe.Just#[A] => covariant typeparam A _empty_/Enums.Maybe.Just#_1(). => method _1 => A -_empty_/Enums.Maybe.Just#``(). => primary ctor [unknown A: ](unknown A: )(val param value: A): Just[A] +_empty_/Enums.Maybe.Just#``(). => primary ctor [unknown A: ](val param value: A): Just[A] _empty_/Enums.Maybe.Just#``().(value) => val param value: A _empty_/Enums.Maybe.Just#copy$default$1(). => method copy$default$1 [] => A _empty_/Enums.Maybe.Just#copy$default$1().[A] => typeparam A -_empty_/Enums.Maybe.Just#copy(). => method copy [typeparam A ](typeparam A )(param value: A): Just[A] +_empty_/Enums.Maybe.Just#copy(). => method copy [typeparam A ](param value: A): Just[A] _empty_/Enums.Maybe.Just#copy().(value) => param value: A _empty_/Enums.Maybe.Just#copy().[A] => typeparam A _empty_/Enums.Maybe.Just#ordinal(). => method ordinal => Int _empty_/Enums.Maybe.Just#value. => val method value A _empty_/Enums.Maybe.Just. => final object Just extends Object { self: .Just.type => +4 decls } -_empty_/Enums.Maybe.Just.apply(). => method apply [typeparam A ](typeparam A )(param value: A): Just[A] +_empty_/Enums.Maybe.Just.apply(). => method apply [typeparam A ](param value: A): Just[A] _empty_/Enums.Maybe.Just.apply().(value) => param value: A _empty_/Enums.Maybe.Just.apply().[A] => typeparam A _empty_/Enums.Maybe.Just.toString(). => method toString => String -_empty_/Enums.Maybe.Just.unapply(). => method unapply [typeparam A ](typeparam A )(param x$1: Just[A]): Just[A] +_empty_/Enums.Maybe.Just.unapply(). => method unapply [typeparam A ](param x$1: Just[A]): Just[A] _empty_/Enums.Maybe.Just.unapply().(x$1) => param x$1: Just[A] _empty_/Enums.Maybe.Just.unapply().[A] => typeparam A _empty_/Enums.Maybe.None. => case val static enum method None Maybe[Nothing] @@ -956,7 +956,7 @@ _empty_/Enums.Suits.valueOf().($name) => param $name: String _empty_/Enums.Suits.values(). => method values => Array[Suits] _empty_/Enums.Tag# => abstract sealed enum class Tag [typeparam A ] extends Object with Enum { self: Tag[A] => +2 decls } _empty_/Enums.Tag#[A] => typeparam A -_empty_/Enums.Tag#``(). => primary ctor [unknown A: ](unknown A: ): Tag[A] +_empty_/Enums.Tag#``(). => primary ctor [unknown A: ]: Tag[A] _empty_/Enums.Tag. => final object Tag extends Object { self: .Tag.type => +7 decls } _empty_/Enums.Tag.$values. => val method $values Array[Tag[]] _empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag Tag[Boolean] @@ -988,19 +988,19 @@ _empty_/Enums.WeekDays.values(). => method values => Array[WeekDays] _empty_/Enums.`<:<`# => abstract sealed enum class <:< [contravariant typeparam A , typeparam B ] extends Object with Enum { self: <:<[A, B] => +3 decls } _empty_/Enums.`<:<`#[A] => contravariant typeparam A _empty_/Enums.`<:<`#[B] => typeparam B -_empty_/Enums.`<:<`#``(). => primary ctor [unknown A: , unknown B: ](unknown A: , unknown B: ): <:<[A, B] +_empty_/Enums.`<:<`#``(). => primary ctor [unknown A: , unknown B: ]: <:<[A, B] _empty_/Enums.`<:<`. => final object <:< extends Object { self: .<:<.type => +6 decls } _empty_/Enums.`<:<`.Refl# => final case enum class Refl [typeparam C ] extends <:<[C, C] { self: Refl[C] => +4 decls } _empty_/Enums.`<:<`.Refl#[C] => typeparam C -_empty_/Enums.`<:<`.Refl#``(). => primary ctor [unknown C: ](unknown C: ): Refl[C] -_empty_/Enums.`<:<`.Refl#copy(). => method copy [typeparam C ](typeparam C ): Refl[C] +_empty_/Enums.`<:<`.Refl#``(). => primary ctor [unknown C: ]: Refl[C] +_empty_/Enums.`<:<`.Refl#copy(). => method copy [typeparam C ]: Refl[C] _empty_/Enums.`<:<`.Refl#copy().[C] => typeparam C _empty_/Enums.`<:<`.Refl#ordinal(). => method ordinal => Int _empty_/Enums.`<:<`.Refl. => final object Refl extends Object { self: .Refl.type => +4 decls } -_empty_/Enums.`<:<`.Refl.apply(). => method apply [typeparam C ](typeparam C ): Refl[C] +_empty_/Enums.`<:<`.Refl.apply(). => method apply [typeparam C ]: Refl[C] _empty_/Enums.`<:<`.Refl.apply().[C] => typeparam C _empty_/Enums.`<:<`.Refl.toString(). => method toString => String -_empty_/Enums.`<:<`.Refl.unapply(). => method unapply [typeparam C ](typeparam C )(param x$1: Refl[C]): true +_empty_/Enums.`<:<`.Refl.unapply(). => method unapply [typeparam C ](param x$1: Refl[C]): true _empty_/Enums.`<:<`.Refl.unapply().(x$1) => param x$1: Refl[C] _empty_/Enums.`<:<`.Refl.unapply().[C] => typeparam C _empty_/Enums.`<:<`.`given_<:<_T_T`(). => final implicit method given_<:<_T_T [] => <:<[T, T] @@ -1008,7 +1008,7 @@ _empty_/Enums.`<:<`.`given_<:<_T_T`().[T] => typeparam T _empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal (param ordinal: Int): <:<[, ] _empty_/Enums.`<:<`.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.some1. => val method some1 Option[Int] -_empty_/Enums.unwrap(). => method unwrap [typeparam A , typeparam B ](typeparam A , typeparam B )(param opt: Option[A])(implicit param ev: <:<[A, Option[B]]): +_empty_/Enums.unwrap(). => method unwrap [typeparam A , typeparam B ](param opt: Option[A])(implicit param ev: <:<[A, Option[B]]): _empty_/Enums.unwrap().(ev) => implicit param ev: <:<[A, Option[B]] _empty_/Enums.unwrap().(opt) => param opt: Option[A] _empty_/Enums.unwrap().[A] => typeparam A @@ -1448,12 +1448,12 @@ Symbols: a/b/Givens. => final object Givens extends Object { self: .Givens.type => +12 decls } a/b/Givens.Monoid# => trait Monoid [typeparam A ] extends Object { self: Monoid[A] => +4 decls } a/b/Givens.Monoid#[A] => typeparam A -a/b/Givens.Monoid#``(). => primary ctor [unknown A: ](unknown A: ): Monoid[A] +a/b/Givens.Monoid#``(). => primary ctor [unknown A: ]: Monoid[A] a/b/Givens.Monoid#combine(). => abstract method combine (param x: A)(param y: A): a/b/Givens.Monoid#combine().(x) => param x: A a/b/Givens.Monoid#combine().(y) => param y: A a/b/Givens.Monoid#empty(). => abstract method empty => A -a/b/Givens.foo(). => method foo [typeparam A ](typeparam A )(implicit param A: Monoid[A]): A +a/b/Givens.foo(). => method foo [typeparam A ](implicit param A: Monoid[A]): A a/b/Givens.foo().(A) => implicit param A: Monoid[A] a/b/Givens.foo().[A] => typeparam A a/b/Givens.given_Monoid_String. => final implicit object given_Monoid_String extends Object with Monoid[String] { self: .given_Monoid_String.type => +3 decls } @@ -1464,13 +1464,13 @@ a/b/Givens.given_Monoid_String.empty(). => method empty => String a/b/Givens.goodbye1. => val method goodbye1 String a/b/Givens.hello1. => val method hello1 String a/b/Givens.int2String(). => final implicit macro int2String => Conversion[Int, String] -a/b/Givens.sayGoodbye(). => method sayGoodbye [typeparam B ](typeparam B )(param any: B): String +a/b/Givens.sayGoodbye(). => method sayGoodbye [typeparam B ](param any: B): String a/b/Givens.sayGoodbye().(any) => param any: B a/b/Givens.sayGoodbye().[B] => typeparam B -a/b/Givens.sayHello(). => method sayHello [typeparam A ](typeparam A )(param any: A): String +a/b/Givens.sayHello(). => method sayHello [typeparam A ](param any: A): String a/b/Givens.sayHello().(any) => param any: A a/b/Givens.sayHello().[A] => typeparam A -a/b/Givens.saySoLong(). => method saySoLong [typeparam B ](typeparam B )(param any: B): String +a/b/Givens.saySoLong(). => method saySoLong [typeparam B ](param any: B): String a/b/Givens.saySoLong().(any) => param any: B a/b/Givens.saySoLong().[B] => typeparam B a/b/Givens.soLong1. => val method soLong1 String @@ -1575,10 +1575,10 @@ example/ImplicitConversion.newAny2stringadd# => final class newAny2stringadd [ty example/ImplicitConversion.newAny2stringadd#[A] => typeparam A example/ImplicitConversion.newAny2stringadd#`+`(). => method + (param other: String): String example/ImplicitConversion.newAny2stringadd#`+`().(other) => param other: String -example/ImplicitConversion.newAny2stringadd#``(). => primary ctor [unknown A: ](unknown A: )(param self: A): newAny2stringadd[A] +example/ImplicitConversion.newAny2stringadd#``(). => primary ctor [unknown A: ](param self: A): newAny2stringadd[A] example/ImplicitConversion.newAny2stringadd#``().(self) => param self: A example/ImplicitConversion.newAny2stringadd#self. => val method self A -example/ImplicitConversion.newAny2stringadd(). => final implicit method newAny2stringadd [typeparam A ](typeparam A )(param self: A): newAny2stringadd[A] +example/ImplicitConversion.newAny2stringadd(). => final implicit method newAny2stringadd [typeparam A ](param self: A): newAny2stringadd[A] example/ImplicitConversion.newAny2stringadd().(self) => param self: A example/ImplicitConversion.newAny2stringadd().[A] => typeparam A example/ImplicitConversion.newAny2stringadd. => final object newAny2stringadd extends Object { self: .newAny2stringadd.type => +2 decls } @@ -1783,7 +1783,7 @@ givens/InventedNames$package.given_Y(). => final implicit method given_Y (implic givens/InventedNames$package.given_Y().(x$1) => implicit param x$1: X givens/InventedNames$package.given_Z_T# => class given_Z_T [typeparam T ] extends Object with Z[T] { self: given_Z_T[T] => +3 decls } givens/InventedNames$package.given_Z_T#[T] => typeparam T -givens/InventedNames$package.given_Z_T#``(). => primary ctor [unknown T: ](unknown T: ): given_Z_T[T] +givens/InventedNames$package.given_Z_T#``(). => primary ctor [unknown T: ]: given_Z_T[T] givens/InventedNames$package.given_Z_T#doZ(). => method doZ => List[T] givens/InventedNames$package.given_Z_T(). => final implicit method given_Z_T [] => given_Z_T[T] givens/InventedNames$package.given_Z_T().[T] => typeparam T @@ -1799,7 +1799,7 @@ givens/Y#``(). => primary ctor (): Y givens/Y#doY(). => abstract method doY => String givens/Z# => trait Z [typeparam T ] extends Object { self: Z[T] => +3 decls } givens/Z#[T] => typeparam T -givens/Z#``(). => primary ctor [unknown T: ](unknown T: ): Z[T] +givens/Z#``(). => primary ctor [unknown T: ]: Z[T] givens/Z#doZ(). => abstract method doZ => List[T] Occurrences: @@ -1945,7 +1945,7 @@ example/Local#``(). => primary ctor (): Local example/Local#a(). => method a (): Int local0 => typeparam A local1 => param a: A -local2 => local id: [typeparam A ](typeparam A )(param a: A): A +local2 => local id: [typeparam A ](param a: A): A Occurrences: [0:8..0:15): example <- example/ @@ -2202,9 +2202,9 @@ example/Methods#AList# => type AList [typeparam T ] = List[T] example/Methods#AList#[T] => typeparam T example/Methods#List# => class List [typeparam T ] extends Object { self: List[T] => +2 decls } example/Methods#List#[T] => typeparam T -example/Methods#List#``(). => primary ctor [unknown T: ](unknown T: ): List[T] +example/Methods#List#``(). => primary ctor [unknown T: ]: List[T] example/Methods#[T] => typeparam T -example/Methods#``(). => primary ctor [unknown T: ](unknown T: ): Methods[T] +example/Methods#``(). => primary ctor [unknown T: ]: Methods[T] example/Methods#`m8().`(). => method m8(). (): Nothing example/Methods#`m9().`# => class m9(). extends Object { self: m9(). => +1 decls } example/Methods#`m9().`#``(). => primary ctor (): m9(). @@ -2227,7 +2227,7 @@ example/Methods#m6(+1). => method m6 (param x: List[T]): Nothing example/Methods#m6(+1).(x) => param x: List[T] example/Methods#m6(+2). => method m6 (param x: List[T]): Nothing example/Methods#m6(+2).(x) => param x: List[T] -example/Methods#m7(). => method m7 [typeparam U ](typeparam U )(param c: Methods[T], param l: List[U])(unknown evidence$1: ): +example/Methods#m7(). => method m7 [typeparam U ](param c: Methods[T], param l: List[U])(unknown evidence$1: ): example/Methods#m7().(c) => param c: Methods[T] example/Methods#m7().(l) => param l: List[U] example/Methods#m7().[U] => typeparam U @@ -2941,7 +2941,7 @@ example/Synthetic#F# => class F extends Object { self: F => +1 decls } example/Synthetic#F#``(). => primary ctor (): F example/Synthetic#J# => class J [typeparam T ] extends Object { self: J[T] => +4 decls } example/Synthetic#J#[T] => typeparam T -example/Synthetic#J#``(). => primary ctor [unknown T: ](unknown T: )(unknown evidence$1: ): +example/Synthetic#J#``(). => primary ctor [unknown T: ](unknown evidence$1: ): example/Synthetic#J#arr. => val method arr Array[T] example/Synthetic#Name. => val method Name Regex example/Synthetic#``(). => primary ctor (): Synthetic @@ -3515,7 +3515,7 @@ Occurrences => 39 entries Symbols: exports/example/Codec# => trait Codec [typeparam T ] extends Object with Decoder[T] with Encoder[T] { self: Codec[T] => +6 decls } exports/example/Codec#[T] => typeparam T -exports/example/Codec#``(). => primary ctor [unknown T: ](unknown T: )(param decode: Decoder[T], param encode: Encoder[T]): Codec[T] +exports/example/Codec#``(). => primary ctor [unknown T: ](param decode: Decoder[T], param encode: Encoder[T]): Codec[T] exports/example/Codec#``().(decode) => param decode: Decoder[T] exports/example/Codec#``().(encode) => param encode: Encoder[T] exports/example/Codec#decode(). => final method decode (param a: Array[Byte]): T @@ -3526,12 +3526,12 @@ exports/example/Codec#encode().(t) => param t: T exports/example/Codec#encode. => val method encode Encoder[T] exports/example/Decoder# => trait Decoder [covariant typeparam T ] extends Object { self: Decoder[T] => +3 decls } exports/example/Decoder#[T] => covariant typeparam T -exports/example/Decoder#``(). => primary ctor [unknown T: ](unknown T: ): Decoder[T] +exports/example/Decoder#``(). => primary ctor [unknown T: ]: Decoder[T] exports/example/Decoder#decode(). => abstract method decode (param a: Array[Byte]): T exports/example/Decoder#decode().(a) => param a: Array[Byte] exports/example/Encoder# => trait Encoder [contravariant typeparam T ] extends Object { self: Encoder[T] => +3 decls } exports/example/Encoder#[T] => contravariant typeparam T -exports/example/Encoder#``(). => primary ctor [unknown T: ](unknown T: ): Encoder[T] +exports/example/Encoder#``(). => primary ctor [unknown T: ]: Encoder[T] exports/example/Encoder#encode(). => abstract method encode (param t: T): Array[Byte] exports/example/Encoder#encode().(t) => param t: T @@ -3763,20 +3763,20 @@ recursion/Nats.Nat#``(). => primary ctor (): Nat recursion/Nats.Succ# => case class Succ [typeparam N ] extends Object with Nat with Product with Serializable { self: Succ[N] => +6 decls } recursion/Nats.Succ#[N] => typeparam N recursion/Nats.Succ#_1(). => method _1 => N -recursion/Nats.Succ#``(). => primary ctor [unknown N: ](unknown N: )(val param p: N): Succ[N] +recursion/Nats.Succ#``(). => primary ctor [unknown N: ](val param p: N): Succ[N] recursion/Nats.Succ#``().(p) => val param p: N recursion/Nats.Succ#copy$default$1(). => method copy$default$1 [] => N recursion/Nats.Succ#copy$default$1().[N] => typeparam N -recursion/Nats.Succ#copy(). => method copy [typeparam N ](typeparam N )(param p: N): Succ[N] +recursion/Nats.Succ#copy(). => method copy [typeparam N ](param p: N): Succ[N] recursion/Nats.Succ#copy().(p) => param p: N recursion/Nats.Succ#copy().[N] => typeparam N recursion/Nats.Succ#p. => val method p N recursion/Nats.Succ. => final object Succ extends Object { self: .Succ.type => +4 decls } -recursion/Nats.Succ.apply(). => method apply [typeparam N ](typeparam N )(param p: N): Succ[N] +recursion/Nats.Succ.apply(). => method apply [typeparam N ](param p: N): Succ[N] recursion/Nats.Succ.apply().(p) => param p: N recursion/Nats.Succ.apply().[N] => typeparam N recursion/Nats.Succ.toString(). => method toString => String -recursion/Nats.Succ.unapply(). => method unapply [typeparam N ](typeparam N )(param x$1: Succ[N]): Succ[N] +recursion/Nats.Succ.unapply(). => method unapply [typeparam N ](param x$1: Succ[N]): Succ[N] recursion/Nats.Succ.unapply().(x$1) => param x$1: Succ[N] recursion/Nats.Succ.unapply().[N] => typeparam N recursion/Nats.Zero. => final case object Zero extends Object with Nat with Product with Serializable { self: .Zero.type => +1 decls } @@ -3903,12 +3903,12 @@ flags/p/package.C# => abstract class C [covariant typeparam T , contravariant ty flags/p/package.C#[T] => covariant typeparam T flags/p/package.C#[U] => contravariant typeparam U flags/p/package.C#[V] => typeparam V -flags/p/package.C#``(). => primary ctor [unknown T: , unknown U: , unknown V: ](unknown T: , unknown U: , unknown V: )(param x: T, param y: U, param z: V): C[T, U, V] +flags/p/package.C#``(). => primary ctor [unknown T: , unknown U: , unknown V: ](param x: T, param y: U, param z: V): C[T, U, V] flags/p/package.C#``().(x) => param x: T flags/p/package.C#``().(y) => param y: U flags/p/package.C#``().(z) => param z: V -flags/p/package.C#``(+1). => ctor [unknown T: , unknown U: , unknown V: ](unknown T: , unknown U: , unknown V: ): C[T, U, V] -flags/p/package.C#``(+2). => ctor [unknown T: , unknown U: , unknown V: ](unknown T: , unknown U: , unknown V: )(param t: T): C[T, U, V] +flags/p/package.C#``(+1). => ctor [unknown T: , unknown U: , unknown V: ]: C[T, U, V] +flags/p/package.C#``(+2). => ctor [unknown T: , unknown U: , unknown V: ](param t: T): C[T, U, V] flags/p/package.C#``(+2).(t) => param t: T flags/p/package.C#w(). => abstract method w => Int flags/p/package.C#x. => val method x T @@ -3916,7 +3916,7 @@ flags/p/package.C#y. => val method y U flags/p/package.C#z. => val method z V flags/p/package.S# => class S [typeparam T ] extends Object { self: S[T] => +2 decls } flags/p/package.S#[T] => typeparam T -flags/p/package.S#``(). => primary ctor [unknown T: ](unknown T: ): S[T] +flags/p/package.S#``(). => primary ctor [unknown T: ]: S[T] flags/p/package.T1# => type T1 = Int flags/p/package.T2# => type T2 [typeparam T ] = S[T] flags/p/package.T2#[T] => typeparam T @@ -4089,14 +4089,14 @@ types/Test.C#ClassInfoType2#``(). => primary ctor (): ClassInfoType types/Test.C#ClassInfoType2#x(). => method x => Int types/Test.C#ClassInfoType3# => trait ClassInfoType3 [typeparam T ] extends Object { self: ClassInfoType3[T] => +2 decls } types/Test.C#ClassInfoType3#[T] => typeparam T -types/Test.C#ClassInfoType3#``(). => primary ctor [unknown T: ](unknown T: ): ClassInfoType3[T] +types/Test.C#ClassInfoType3#``(). => primary ctor [unknown T: ]: ClassInfoType3[T] types/Test.C#Either. => val method Either .Either.type types/Test.C#MethodType. => final object MethodType extends Object { self: .MethodType.type => +7 decls } types/Test.C#MethodType.m3(). => method m3 => Int types/Test.C#MethodType.m4(). => method m4 (): Int types/Test.C#MethodType.m5(). => method m5 (param x: Int): Int types/Test.C#MethodType.m5().(x) => param x: Int -types/Test.C#MethodType.m6(). => method m6 [typeparam T ](typeparam T )(param x: T): T +types/Test.C#MethodType.m6(). => method m6 [typeparam T ](param x: T): T types/Test.C#MethodType.m6().(x) => param x: T types/Test.C#MethodType.m6().[T] => typeparam T types/Test.C#MethodType.x1(). => method x1 => Int @@ -4170,7 +4170,7 @@ types/Test.N#``(). => primary ctor (): N types/Test.N#n(). => method n => Int types/ann# => class ann [typeparam T ] extends Annotation with StaticAnnotation { self: ann[T] => +3 decls } types/ann#[T] => typeparam T -types/ann#``(). => primary ctor [unknown T: ](unknown T: )(param x: T): ann[T] +types/ann#``(). => primary ctor [unknown T: ](param x: T): ann[T] types/ann#``().(x) => param x: T types/ann#x. => val method x T types/ann1# => class ann1 extends Annotation with StaticAnnotation { self: ann1 => +1 decls } From e99daa77527663bfd3c08bc7f17c47693e2f768e Mon Sep 17 00:00:00 2001 From: tanishiking Date: Thu, 1 Jul 2021 19:09:21 +0900 Subject: [PATCH 13/25] TypeLambda --- .../dotty/tools/dotc/semanticdb/Type.scala | 255 ++++++++++++++++++ .../dotty/tools/dotc/semanticdb/TypeOps.scala | 57 ++-- .../semanticdb/expect/TypeLambda.expect.scala | 20 ++ tests/semanticdb/expect/TypeLambda.scala | 20 ++ tests/semanticdb/metac.expect | 120 ++++++++- 5 files changed, 448 insertions(+), 24 deletions(-) create mode 100644 tests/semanticdb/expect/TypeLambda.expect.scala create mode 100644 tests/semanticdb/expect/TypeLambda.scala diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala index 17d2d28bcf36..43bd59978ae4 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala @@ -38,6 +38,8 @@ object Type { case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.UniversalType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType => __v.value + case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda => __v.value + case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType => __v.value case dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty => Empty } override def toBase(__custom: dotty.tools.dotc.semanticdb.Type): dotty.tools.dotc.semanticdb.TypeMessage = dotty.tools.dotc.semanticdb.TypeMessage(__custom match { @@ -55,6 +57,8 @@ object Type { case __v: dotty.tools.dotc.semanticdb.UniversalType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.UniversalType(__v) case __v: dotty.tools.dotc.semanticdb.ByNameType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType(__v) case __v: dotty.tools.dotc.semanticdb.RepeatedType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__v) + case __v: dotty.tools.dotc.semanticdb.TypeLambda => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v) + case __v: dotty.tools.dotc.semanticdb.MatchType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v) case Empty => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty }) } @@ -123,6 +127,14 @@ final case class TypeMessage( val __value = sealedValue.repeatedType.get __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize }; + if (sealedValue.typeLambda.isDefined) { + val __value = sealedValue.typeLambda.get + __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + if (sealedValue.matchType.isDefined) { + val __value = sealedValue.matchType.get + __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; __size } override def serializedSize: _root_.scala.Int = { @@ -218,6 +230,18 @@ final case class TypeMessage( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; + sealedValue.typeLambda.foreach { __v => + val __m = __v + _output__.writeTag(24, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + sealedValue.matchType.foreach { __v => + val __m = __v + _output__.writeTag(25, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; } def getTypeRef: dotty.tools.dotc.semanticdb.TypeRef = sealedValue.typeRef.getOrElse(dotty.tools.dotc.semanticdb.TypeRef.defaultInstance) def withTypeRef(__v: dotty.tools.dotc.semanticdb.TypeRef): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeRef(__v)) @@ -247,6 +271,10 @@ final case class TypeMessage( def withByNameType(__v: dotty.tools.dotc.semanticdb.ByNameType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType(__v)) def getRepeatedType: dotty.tools.dotc.semanticdb.RepeatedType = sealedValue.repeatedType.getOrElse(dotty.tools.dotc.semanticdb.RepeatedType.defaultInstance) def withRepeatedType(__v: dotty.tools.dotc.semanticdb.RepeatedType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__v)) + def getTypeLambda: dotty.tools.dotc.semanticdb.TypeLambda = sealedValue.typeLambda.getOrElse(dotty.tools.dotc.semanticdb.TypeLambda.defaultInstance) + def withTypeLambda(__v: dotty.tools.dotc.semanticdb.TypeLambda): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v)) + def getMatchType: dotty.tools.dotc.semanticdb.MatchType = sealedValue.matchType.getOrElse(dotty.tools.dotc.semanticdb.MatchType.defaultInstance) + def withMatchType(__v: dotty.tools.dotc.semanticdb.MatchType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v)) def clearSealedValue: TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty) def withSealedValue(__v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue): TypeMessage = copy(sealedValue = __v) @@ -294,6 +322,10 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType(__sealedValue.byNameType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.ByNameType](_input__))(LiteParser.readMessage(_input__, _))) case 114 => __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__sealedValue.repeatedType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.RepeatedType](_input__))(LiteParser.readMessage(_input__, _))) + case 194 => + __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__sealedValue.typeLambda.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeLambda](_input__))(LiteParser.readMessage(_input__, _))) + case 202 => + __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__sealedValue.matchType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.MatchType](_input__))(LiteParser.readMessage(_input__, _))) case tag => _input__.skipField(tag) } } @@ -327,6 +359,8 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def isUniversalType: _root_.scala.Boolean = false def isByNameType: _root_.scala.Boolean = false def isRepeatedType: _root_.scala.Boolean = false + def isTypeLambda: _root_.scala.Boolean = false + def isMatchType: _root_.scala.Boolean = false def typeRef: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeRef] = _root_.scala.None def singleType: _root_.scala.Option[dotty.tools.dotc.semanticdb.SingleType] = _root_.scala.None def thisType: _root_.scala.Option[dotty.tools.dotc.semanticdb.ThisType] = _root_.scala.None @@ -341,6 +375,8 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def universalType: _root_.scala.Option[dotty.tools.dotc.semanticdb.UniversalType] = _root_.scala.None def byNameType: _root_.scala.Option[dotty.tools.dotc.semanticdb.ByNameType] = _root_.scala.None def repeatedType: _root_.scala.Option[dotty.tools.dotc.semanticdb.RepeatedType] = _root_.scala.None + def typeLambda: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeLambda] = _root_.scala.None + def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = _root_.scala.None } object SealedValue { @SerialVersionUID(0L) @@ -450,6 +486,20 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc override def repeatedType: _root_.scala.Option[dotty.tools.dotc.semanticdb.RepeatedType] = Some(value) override def number: _root_.scala.Int = 14 } + @SerialVersionUID(0L) + final case class TypeLambda(value: dotty.tools.dotc.semanticdb.TypeLambda) extends dotty.tools.dotc.semanticdb.TypeMessage.SealedValue derives CanEqual { + type ValueType = dotty.tools.dotc.semanticdb.TypeLambda + override def isTypeLambda: _root_.scala.Boolean = true + override def typeLambda: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeLambda] = Some(value) + override def number: _root_.scala.Int = 24 + } + @SerialVersionUID(0L) + final case class MatchType(value: dotty.tools.dotc.semanticdb.MatchType) extends dotty.tools.dotc.semanticdb.TypeMessage.SealedValue derives CanEqual { + type ValueType = dotty.tools.dotc.semanticdb.MatchType + override def isMatchType: _root_.scala.Boolean = true + override def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = Some(value) + override def number: _root_.scala.Int = 25 + } } final val TYPE_REF_FIELD_NUMBER = 2 final val SINGLE_TYPE_FIELD_NUMBER = 20 @@ -465,6 +515,8 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc final val UNIVERSAL_TYPE_FIELD_NUMBER = 10 final val BY_NAME_TYPE_FIELD_NUMBER = 13 final val REPEATED_TYPE_FIELD_NUMBER = 14 + final val TYPE_LAMBDA_FIELD_NUMBER = 24 + final val MATCH_TYPE_FIELD_NUMBER = 25 def of( sealedValue: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue ): _root_.dotty.tools.dotc.semanticdb.TypeMessage = _root_.dotty.tools.dotc.semanticdb.TypeMessage( @@ -1779,3 +1831,206 @@ object RepeatedType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dot ) // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.RepeatedType]) } + +@SerialVersionUID(0L) +final case class TypeLambda( + parameters: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.Seq.empty, + returnType: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { + @transient @sharable + private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 + private[this] def __computeSerializedValue(): _root_.scala.Int = { + var __size = 0 + parameters.foreach { __item => + val __value = __item + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + + { + val __value = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toBase(returnType) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + }; + __size + } + override def serializedSize: _root_.scala.Int = { + var read = __serializedSizeCachedValue + if (read == 0) { + read = __computeSerializedValue() + __serializedSizeCachedValue = read + } + read + } + def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = { + parameters.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toBase(returnType) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } + }; + } + def clearParameters = copy(parameters = _root_.scala.Seq.empty) + def addParameters(__vs: dotty.tools.dotc.semanticdb.Scope*): TypeLambda = addAllParameters(__vs) + def addAllParameters(__vs: Iterable[dotty.tools.dotc.semanticdb.Scope]): TypeLambda = copy(parameters = parameters ++ __vs) + def withParameters(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Scope]): TypeLambda = copy(parameters = __v) + def withReturnType(__v: dotty.tools.dotc.semanticdb.Type): TypeLambda = copy(returnType = __v) + + + + + // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.TypeLambda]) +} + +object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda] { + implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda] = this + def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.TypeLambda = { + val __parameters: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.Scope] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.Scope] + var __returnType: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __parameters += LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__) + case 18 => + __returnType = _root_.scala.Some(__returnType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) + case tag => _input__.skipField(tag) + } + } + dotty.tools.dotc.semanticdb.TypeLambda( + parameters = __parameters.result(), + returnType = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(__returnType.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) + ) + } + + + + + + + lazy val defaultInstance = dotty.tools.dotc.semanticdb.TypeLambda( + parameters = _root_.scala.Seq.empty, + returnType = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + ) + final val PARAMETERS_FIELD_NUMBER = 1 + final val RETURN_TYPE_FIELD_NUMBER = 2 + @transient @sharable + private[semanticdb] val _typemapper_returnType: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + def of( + parameters: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Scope], + returnType: dotty.tools.dotc.semanticdb.Type + ): _root_.dotty.tools.dotc.semanticdb.TypeLambda = _root_.dotty.tools.dotc.semanticdb.TypeLambda( + parameters, + returnType + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda]) +} + +@SerialVersionUID(0L) +final case class MatchType( + `match`: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None, + cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.TypeLambda] = _root_.scala.Seq.empty + ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { + @transient @sharable + private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 + private[this] def __computeSerializedValue(): _root_.scala.Int = { + var __size = 0 + if (`match`.isDefined) { + val __value = `match`.get + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + cases.foreach { __item => + val __value = __item + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + __size + } + override def serializedSize: _root_.scala.Int = { + var read = __serializedSizeCachedValue + if (read == 0) { + read = __computeSerializedValue() + __serializedSizeCachedValue = read + } + read + } + def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = { + `match`.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + cases.foreach { __v => + val __m = __v + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + } + def getMatch: dotty.tools.dotc.semanticdb.Scope = `match`.getOrElse(dotty.tools.dotc.semanticdb.Scope.defaultInstance) + def clearMatch: MatchType = copy(`match` = _root_.scala.None) + def withMatch(__v: dotty.tools.dotc.semanticdb.Scope): MatchType = copy(`match` = Option(__v)) + def clearCases = copy(cases = _root_.scala.Seq.empty) + def addCases(__vs: dotty.tools.dotc.semanticdb.TypeLambda*): MatchType = addAllCases(__vs) + def addAllCases(__vs: Iterable[dotty.tools.dotc.semanticdb.TypeLambda]): MatchType = copy(cases = cases ++ __vs) + def withCases(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.TypeLambda]): MatchType = copy(cases = __v) + + + + + // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.MatchType]) +} + +object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType] { + implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType] = this + def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.MatchType = { + var __match: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None + val __cases: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.TypeLambda] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.TypeLambda] + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __match = Option(__match.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__))(LiteParser.readMessage(_input__, _))) + case 18 => + __cases += LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeLambda](_input__) + case tag => _input__.skipField(tag) + } + } + dotty.tools.dotc.semanticdb.MatchType( + `match` = __match, + cases = __cases.result() + ) + } + + + + + + + lazy val defaultInstance = dotty.tools.dotc.semanticdb.MatchType( + `match` = _root_.scala.None, + cases = _root_.scala.Seq.empty + ) + final val MATCH_FIELD_NUMBER = 1 + final val CASES_FIELD_NUMBER = 2 + def of( + `match`: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope], + cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.TypeLambda] + ): _root_.dotty.tools.dotc.semanticdb.MatchType = _root_.dotty.tools.dotc.semanticdb.MatchType( + `match`, + cases + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType]) +} diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 6047d459cc80..419785211c95 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -7,7 +7,7 @@ import core.Contexts.Context import core.Types._ import core.Annotations.Annotation import core.Flags -import core.Names.Name +import core.Names.{Name, TypeName} import core.StdNames.tpnme import ast.tpd._ @@ -105,22 +105,29 @@ class TypeOps: s.ClassSignature(stparams, sparents, sself, Some(decls)) case TypeBounds(lo, hi) => + // oops we have no way to distinguish + // type X[T] = T and type X = [T] =>> T + // for `type X[T] = T` is equivalent to `[T] =>> T` - def tparams(tpe: Type): (Type, List[Symbol]) = tpe match { - case lambda: HKTypeLambda => - val paramSyms = lambda.paramNames.flatMap { paramName => - paramRefSymtab.get((lambda, paramName)) - } - (lambda.resType, paramSyms) - case _ => (tpe, Nil) - } - val (loRes, loParams) = tparams(lo) - val (hiRes, hiParams) = tparams(hi) - val params = (loParams ++ hiParams).distinctBy(_.name) - val slo = loRes.toSemanticType(sym) - val shi = hiRes.toSemanticType(sym) - val stparams = params.sscope - s.TypeSignature(Some(stparams), slo, shi) + // println("===") + // println(sym) + // println(sym.flagsString) + // def tparams(tpe: Type): (Type, List[Symbol]) = tpe match { + // case lambda: HKTypeLambda => + // lambda.dealias + // val paramSyms = lambda.paramNames.flatMap { paramName => + // paramRefSymtab.get((lambda, paramName)) + // } + // (lambda.resType, paramSyms) + // case _ => (tpe, Nil) + // } + // val (loRes, loParams) = tparams(lo) + // val (hiRes, hiParams) = tparams(hi) + // val params = (loParams ++ hiParams).distinctBy(_.name) + val slo = lo.toSemanticType(sym) + val shi = hi.toSemanticType(sym) + // val stparams = params.sscope + s.TypeSignature(Some(s.Scope()), slo, shi) case pt: PolyType => loop(pt.resType) match { @@ -192,6 +199,24 @@ class TypeOps: case ConstantType(const) => s.ConstantType(const.toSemanticConst) + case lam: HKTypeLambda => + def flatten(lambda: HKTypeLambda, acc: List[List[TypeName]]): (List[List[TypeName]], Type) = { + lambda.resType match { + case res: HKTypeLambda => flatten(res, acc :+ res.paramNames) + case other => (acc, other) + } + } + val (paramNamess, resType) = flatten(lam, Nil) + val paramSymss = paramNamess.map { paramNames => + paramNames.flatMap { paramName => + val key = (lam, paramName) + paramRefSymtab.get(key) + } + } + val stparamss = paramSymss.map(_.sscope) + val sresTpe = loop(resType) + s.TypeLambda(stparamss, sresTpe) + case rt @ RefinedType(parent, name, info) => // `X { def x: Int; def y: Int }` // RefinedType( diff --git a/tests/semanticdb/expect/TypeLambda.expect.scala b/tests/semanticdb/expect/TypeLambda.expect.scala new file mode 100644 index 000000000000..bae1140363b5 --- /dev/null +++ b/tests/semanticdb/expect/TypeLambda.expect.scala @@ -0,0 +1,20 @@ +package example + +type T1/*<-example::TypeLambda$package.T1#*/ = [X/*<-example::TypeLambda$package.T1#[X]*/] =>> X/*->example::TypeLambda$package.T1#[X]*/ +type T2/*<-example::TypeLambda$package.T2#*/ = [X/*<-example::TypeLambda$package.T2#[X]*/] =>> List/*->scala::package.List#*/[X/*->example::TypeLambda$package.T2#[X]*/] +type T3/*<-example::TypeLambda$package.T3#*/ = [X/*<-example::TypeLambda$package.T3#[X]*/] =>> Map/*->scala::Predef.Map#*/[String/*->scala::Predef.String#*/, X/*->example::TypeLambda$package.T3#[X]*/] +type T4/*<-example::TypeLambda$package.T4#*/ = [X/*<-example::TypeLambda$package.T4#[X]*/, Y/*<-example::TypeLambda$package.T4#[Y]*/] =>> Map/*->scala::Predef.Map#*/[Y/*->example::TypeLambda$package.T4#[Y]*/, X/*->example::TypeLambda$package.T4#[X]*/] + +type B1/*<-example::TypeLambda$package.B1#*/[X/*<-example::TypeLambda$package.B1#[X]*/ <: String/*->scala::Predef.String#*/] = X/*->example::TypeLambda$package.B1#[X]*/ +type B2/*<-example::TypeLambda$package.B2#*/[X/*<-example::TypeLambda$package.B2#[X]*/ >: Int/*->scala::Int#*/] = Any/*->scala::Any#*/ + +type V1/*<-example::TypeLambda$package.V1#*/[+X/*<-example::TypeLambda$package.V1#[X]*/ <: X/*->example::TypeLambda$package.V1#[X]*/ => X/*->example::TypeLambda$package.V1#[X]*/] = Any/*->scala::Any#*/ + +type AList/*<-example::TypeLambda$package.AList#*/[X/*<-example::TypeLambda$package.AList#[X]*/] = List/*->scala::package.List#*/[X/*->example::TypeLambda$package.AList#[X]*/] // AList = [X] =>> List[X] + +type Union/*<-example::TypeLambda$package.Union#*/ = [A/*<-example::TypeLambda$package.Union#[A]*/] =>> [B/*<-example::TypeLambda$package.Union#[B]*/] =>> [C/*<-example::TypeLambda$package.Union#[C]*/] =>> A/*->example::TypeLambda$package.Union#[A]*/ |/*->scala::`|`#*/ B/*->example::TypeLambda$package.Union#[B]*/ |/*->scala::`|`#*/ C/*->example::TypeLambda$package.Union#[C]*/ +type MapKV/*<-example::TypeLambda$package.MapKV#*/ = [K/*<-example::TypeLambda$package.MapKV#[K]*/] =>> [V/*<-example::TypeLambda$package.MapKV#[V]*/] =>> Map/*->scala::Predef.Map#*/[K/*->example::TypeLambda$package.MapKV#[K]*/, V/*->example::TypeLambda$package.MapKV#[V]*/] + +type Tuple/*<-example::TypeLambda$package.Tuple#*/ = [X/*<-example::TypeLambda$package.Tuple#[X]*/] =>> [Y/*<-example::TypeLambda$package.Tuple#[Y]*/] =>> (X/*->example::TypeLambda$package.Tuple#[X]*/, Y/*->example::TypeLambda$package.Tuple#[Y]*/) +type TupleIntString/*<-example::TypeLambda$package.TupleIntString#*/ = Tuple/*->example::TypeLambda$package.Tuple#*/[Int/*->scala::Int#*/][String/*->scala::Predef.String#*/] + diff --git a/tests/semanticdb/expect/TypeLambda.scala b/tests/semanticdb/expect/TypeLambda.scala new file mode 100644 index 000000000000..7e6ed0764da0 --- /dev/null +++ b/tests/semanticdb/expect/TypeLambda.scala @@ -0,0 +1,20 @@ +package example + +type T1 = [X] =>> X +type T2 = [X] =>> List[X] +type T3 = [X] =>> Map[String, X] +type T4 = [X, Y] =>> Map[Y, X] + +type B1[X <: String] = X +type B2[X >: Int] = Any + +type V1[+X <: X => X] = Any + +type AList[X] = List[X] // AList = [X] =>> List[X] + +type Union = [A] =>> [B] =>> [C] =>> A | B | C +type MapKV = [K] =>> [V] =>> Map[K, V] + +type Tuple = [X] =>> [Y] =>> (X, Y) +type TupleIntString = Tuple[Int][String] + diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 8dca6e17c5d3..d74164039316 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -449,7 +449,7 @@ classes/C11#foo(). => macro foo => Int classes/C11#foo(). => macro foo => Int classes/C12# => class C12 extends Object { self: C12 => +8 decls } classes/C12#Context# => class Context extends Object { self: Context => +2 decls } -classes/C12#Context#Expr# => type Expr [typeparam T ] +classes/C12#Context#Expr# => type Expr classes/C12#Context#Expr#[T] => typeparam T classes/C12#Context#``(). => primary ctor (): Context classes/C12#``(). => primary ctor (): C12 @@ -2198,7 +2198,7 @@ Occurrences => 156 entries Symbols: example/Methods# => class Methods [typeparam T ] extends Object { self: Methods[T] => +44 decls } -example/Methods#AList# => type AList [typeparam T ] = List[T] +example/Methods#AList# => type AList = example/Methods#AList#[T] => typeparam T example/Methods#List# => class List [typeparam T ] extends Object { self: List[T] => +2 decls } example/Methods#List#[T] => typeparam T @@ -3183,6 +3183,110 @@ Occurrences: [12:10..12:10): <- traits/V#``(). [12:16..12:17): C -> traits/C# +expect/TypeLambda.scala +----------------------- + +Summary: +Schema => SemanticDB v4 +Uri => TypeLambda.scala +Text => empty +Language => Scala +Symbols => 29 entries +Occurrences => 60 entries + +Symbols: +example/TypeLambda$package. => final package object example extends Object { self: .example.type => +13 decls } +example/TypeLambda$package.AList# => type AList = +example/TypeLambda$package.AList#[X] => typeparam X +example/TypeLambda$package.B1# => type B1 = +example/TypeLambda$package.B1#[X] => typeparam X +example/TypeLambda$package.B2# => type B2 = +example/TypeLambda$package.B2#[X] => typeparam X >: Int +example/TypeLambda$package.MapKV# => type MapKV = +example/TypeLambda$package.MapKV#[K] => typeparam K +example/TypeLambda$package.MapKV#[V] => typeparam V +example/TypeLambda$package.T1# => type T1 = +example/TypeLambda$package.T1#[X] => typeparam X +example/TypeLambda$package.T2# => type T2 = +example/TypeLambda$package.T2#[X] => typeparam X +example/TypeLambda$package.T3# => type T3 = +example/TypeLambda$package.T3#[X] => typeparam X +example/TypeLambda$package.T4# => type T4 = +example/TypeLambda$package.T4#[X] => typeparam X +example/TypeLambda$package.T4#[Y] => typeparam Y +example/TypeLambda$package.Tuple# => type Tuple = +example/TypeLambda$package.Tuple#[X] => typeparam X +example/TypeLambda$package.Tuple#[Y] => typeparam Y +example/TypeLambda$package.TupleIntString# => type TupleIntString = Tuple[String] +example/TypeLambda$package.Union# => type Union = +example/TypeLambda$package.Union#[A] => typeparam A +example/TypeLambda$package.Union#[B] => typeparam B +example/TypeLambda$package.Union#[C] => typeparam C +example/TypeLambda$package.V1# => type V1 = +example/TypeLambda$package.V1#[X] => covariant typeparam X + +Occurrences: +[0:8..0:15): example <- example/ +[2:5..2:7): T1 <- example/TypeLambda$package.T1# +[2:11..2:12): X <- example/TypeLambda$package.T1#[X] +[2:18..2:19): X -> example/TypeLambda$package.T1#[X] +[3:5..3:7): T2 <- example/TypeLambda$package.T2# +[3:11..3:12): X <- example/TypeLambda$package.T2#[X] +[3:18..3:22): List -> scala/package.List# +[3:23..3:24): X -> example/TypeLambda$package.T2#[X] +[4:5..4:7): T3 <- example/TypeLambda$package.T3# +[4:11..4:12): X <- example/TypeLambda$package.T3#[X] +[4:18..4:21): Map -> scala/Predef.Map# +[4:22..4:28): String -> scala/Predef.String# +[4:30..4:31): X -> example/TypeLambda$package.T3#[X] +[5:5..5:7): T4 <- example/TypeLambda$package.T4# +[5:11..5:12): X <- example/TypeLambda$package.T4#[X] +[5:14..5:15): Y <- example/TypeLambda$package.T4#[Y] +[5:21..5:24): Map -> scala/Predef.Map# +[5:25..5:26): Y -> example/TypeLambda$package.T4#[Y] +[5:28..5:29): X -> example/TypeLambda$package.T4#[X] +[7:5..7:7): B1 <- example/TypeLambda$package.B1# +[7:8..7:9): X <- example/TypeLambda$package.B1#[X] +[7:13..7:19): String -> scala/Predef.String# +[7:23..7:24): X -> example/TypeLambda$package.B1#[X] +[8:5..8:7): B2 <- example/TypeLambda$package.B2# +[8:8..8:9): X <- example/TypeLambda$package.B2#[X] +[8:13..8:16): Int -> scala/Int# +[8:20..8:23): Any -> scala/Any# +[10:5..10:7): V1 <- example/TypeLambda$package.V1# +[10:9..10:10): X <- example/TypeLambda$package.V1#[X] +[10:14..10:15): X -> example/TypeLambda$package.V1#[X] +[10:19..10:20): X -> example/TypeLambda$package.V1#[X] +[10:24..10:27): Any -> scala/Any# +[12:5..12:10): AList <- example/TypeLambda$package.AList# +[12:11..12:12): X <- example/TypeLambda$package.AList#[X] +[12:16..12:20): List -> scala/package.List# +[12:21..12:22): X -> example/TypeLambda$package.AList#[X] +[14:5..14:10): Union <- example/TypeLambda$package.Union# +[14:14..14:15): A <- example/TypeLambda$package.Union#[A] +[14:22..14:23): B <- example/TypeLambda$package.Union#[B] +[14:30..14:31): C <- example/TypeLambda$package.Union#[C] +[14:37..14:38): A -> example/TypeLambda$package.Union#[A] +[14:39..14:40): | -> scala/`|`# +[14:41..14:42): B -> example/TypeLambda$package.Union#[B] +[14:43..14:44): | -> scala/`|`# +[14:45..14:46): C -> example/TypeLambda$package.Union#[C] +[15:5..15:10): MapKV <- example/TypeLambda$package.MapKV# +[15:14..15:15): K <- example/TypeLambda$package.MapKV#[K] +[15:22..15:23): V <- example/TypeLambda$package.MapKV#[V] +[15:29..15:32): Map -> scala/Predef.Map# +[15:33..15:34): K -> example/TypeLambda$package.MapKV#[K] +[15:36..15:37): V -> example/TypeLambda$package.MapKV#[V] +[17:5..17:10): Tuple <- example/TypeLambda$package.Tuple# +[17:14..17:15): X <- example/TypeLambda$package.Tuple#[X] +[17:22..17:23): Y <- example/TypeLambda$package.Tuple#[Y] +[17:30..17:31): X -> example/TypeLambda$package.Tuple#[X] +[17:33..17:34): Y -> example/TypeLambda$package.Tuple#[Y] +[18:5..18:19): TupleIntString <- example/TypeLambda$package.TupleIntString# +[18:22..18:27): Tuple -> example/TypeLambda$package.Tuple# +[18:28..18:31): Int -> scala/Int# +[18:33..18:39): String -> scala/Predef.String# + expect/ValPattern.scala ----------------------- @@ -3589,9 +3693,9 @@ Occurrences => 5 entries Symbols: exports/`exports-package$package`. => final package object exports extends Object { self: .exports.type => +4 decls } -exports/`exports-package$package`.Codec# => final type Codec = Codec[] -exports/`exports-package$package`.Decoder# => final type Decoder = Decoder[] -exports/`exports-package$package`.Encoder# => final type Encoder = Encoder[] +exports/`exports-package$package`.Codec# => final type Codec = +exports/`exports-package$package`.Decoder# => final type Decoder = +exports/`exports-package$package`.Encoder# => final type Encoder = Occurrences: [0:8..0:15): exports <- exports/ @@ -3918,7 +4022,7 @@ flags/p/package.S# => class S [typeparam T ] extends Object { self: S[T] => +2 d flags/p/package.S#[T] => typeparam T flags/p/package.S#``(). => primary ctor [unknown T: ]: S[T] flags/p/package.T1# => type T1 = Int -flags/p/package.T2# => type T2 [typeparam T ] = S[T] +flags/p/package.T2# => type T2 = flags/p/package.T2#[T] => typeparam T flags/p/package.U# => type U flags/p/package.V# => type V >: Int @@ -4043,7 +4147,7 @@ local5 => final class $anon extends M with N { self: $anon => +1 decls } local7 => method k => Int local8 => final class $anon extends M with N { self: $anon => +2 decls } local10 => typeparam T -local11 => type L [typeparam T ] = List[T] +local11 => type L = types/B# => class B extends Object { self: B => +1 decls } types/B#``(). => primary ctor (): B types/C# => class C extends Object { self: C => +1 decls } @@ -4117,7 +4221,7 @@ types/Test.C#RepeatedType.unapplySeq().(x$1) => param x$1: RepeatedType types/Test.C#TypeType. => final object TypeType extends Object { self: .TypeType.type => +6 decls } types/Test.C#TypeType.T1# => type T1 types/Test.C#TypeType.T4# => type T4 = C -types/Test.C#TypeType.T5# => type T5 [typeparam U ] = U +types/Test.C#TypeType.T5# => type T5 = types/Test.C#TypeType.T5#[U] => typeparam U types/Test.C#TypeType.m2(). => method m2 [] => Nothing types/Test.C#TypeType.m2().[T2] => typeparam T2 = C From f13b2d1ab0dccbd8a56161efd5e1f42daa2986d1 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Fri, 2 Jul 2021 19:12:12 +0900 Subject: [PATCH 14/25] MatchType --- .../dotty/tools/dotc/semanticdb/Scala3.scala | 2 +- .../dotty/tools/dotc/semanticdb/Type.scala | 244 ++++++++++++++++-- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 38 ++- .../semanticdb/expect/MatchType.expect.scala | 11 + tests/semanticdb/expect/MatchType.scala | 11 + tests/semanticdb/metac.expect | 127 ++++++--- 6 files changed, 366 insertions(+), 67 deletions(-) create mode 100644 tests/semanticdb/expect/MatchType.expect.scala create mode 100644 tests/semanticdb/expect/MatchType.scala diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala index 81e69529c9a0..129fdafab809 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Scala3.scala @@ -195,7 +195,7 @@ object Scala3: props |= SymbolInformation.Property.IMPLICIT.value if sym.is(Lazy, butNot=Module) then props |= SymbolInformation.Property.LAZY.value - if sym.isAllOf(Case | Module) || sym.is(CaseClass) || sym.isAllOf(EnumCase) then + if sym.isAllOf(Case | Module) || sym.is(CaseClass) then props |= SymbolInformation.Property.CASE.value if sym.is(Covariant) then props |= SymbolInformation.Property.COVARIANT.value diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala index 43bd59978ae4..5558d6a9ef87 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala @@ -40,6 +40,7 @@ object Type { case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType => __v.value + case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType => __v.value case dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty => Empty } override def toBase(__custom: dotty.tools.dotc.semanticdb.Type): dotty.tools.dotc.semanticdb.TypeMessage = dotty.tools.dotc.semanticdb.TypeMessage(__custom match { @@ -59,6 +60,7 @@ object Type { case __v: dotty.tools.dotc.semanticdb.RepeatedType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__v) case __v: dotty.tools.dotc.semanticdb.TypeLambda => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v) case __v: dotty.tools.dotc.semanticdb.MatchType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v) + case __v: dotty.tools.dotc.semanticdb.CaseType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType(__v) case Empty => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty }) } @@ -135,6 +137,10 @@ final case class TypeMessage( val __value = sealedValue.matchType.get __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize }; + if (sealedValue.caseType.isDefined) { + val __value = sealedValue.caseType.get + __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; __size } override def serializedSize: _root_.scala.Int = { @@ -242,6 +248,12 @@ final case class TypeMessage( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; + sealedValue.caseType.foreach { __v => + val __m = __v + _output__.writeTag(26, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; } def getTypeRef: dotty.tools.dotc.semanticdb.TypeRef = sealedValue.typeRef.getOrElse(dotty.tools.dotc.semanticdb.TypeRef.defaultInstance) def withTypeRef(__v: dotty.tools.dotc.semanticdb.TypeRef): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeRef(__v)) @@ -275,6 +287,8 @@ final case class TypeMessage( def withTypeLambda(__v: dotty.tools.dotc.semanticdb.TypeLambda): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v)) def getMatchType: dotty.tools.dotc.semanticdb.MatchType = sealedValue.matchType.getOrElse(dotty.tools.dotc.semanticdb.MatchType.defaultInstance) def withMatchType(__v: dotty.tools.dotc.semanticdb.MatchType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v)) + def getCaseType: dotty.tools.dotc.semanticdb.CaseType = sealedValue.caseType.getOrElse(dotty.tools.dotc.semanticdb.CaseType.defaultInstance) + def withCaseType(__v: dotty.tools.dotc.semanticdb.CaseType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType(__v)) def clearSealedValue: TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty) def withSealedValue(__v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue): TypeMessage = copy(sealedValue = __v) @@ -326,6 +340,8 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__sealedValue.typeLambda.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeLambda](_input__))(LiteParser.readMessage(_input__, _))) case 202 => __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__sealedValue.matchType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.MatchType](_input__))(LiteParser.readMessage(_input__, _))) + case 210 => + __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType(__sealedValue.caseType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.CaseType](_input__))(LiteParser.readMessage(_input__, _))) case tag => _input__.skipField(tag) } } @@ -361,6 +377,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def isRepeatedType: _root_.scala.Boolean = false def isTypeLambda: _root_.scala.Boolean = false def isMatchType: _root_.scala.Boolean = false + def isCaseType: _root_.scala.Boolean = false def typeRef: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeRef] = _root_.scala.None def singleType: _root_.scala.Option[dotty.tools.dotc.semanticdb.SingleType] = _root_.scala.None def thisType: _root_.scala.Option[dotty.tools.dotc.semanticdb.ThisType] = _root_.scala.None @@ -377,6 +394,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def repeatedType: _root_.scala.Option[dotty.tools.dotc.semanticdb.RepeatedType] = _root_.scala.None def typeLambda: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeLambda] = _root_.scala.None def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = _root_.scala.None + def caseType: _root_.scala.Option[dotty.tools.dotc.semanticdb.CaseType] = _root_.scala.None } object SealedValue { @SerialVersionUID(0L) @@ -500,6 +518,13 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc override def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = Some(value) override def number: _root_.scala.Int = 25 } + @SerialVersionUID(0L) + final case class CaseType(value: dotty.tools.dotc.semanticdb.CaseType) extends dotty.tools.dotc.semanticdb.TypeMessage.SealedValue derives CanEqual { + type ValueType = dotty.tools.dotc.semanticdb.CaseType + override def isCaseType: _root_.scala.Boolean = true + override def caseType: _root_.scala.Option[dotty.tools.dotc.semanticdb.CaseType] = Some(value) + override def number: _root_.scala.Int = 26 + } } final val TYPE_REF_FIELD_NUMBER = 2 final val SINGLE_TYPE_FIELD_NUMBER = 20 @@ -517,6 +542,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc final val REPEATED_TYPE_FIELD_NUMBER = 14 final val TYPE_LAMBDA_FIELD_NUMBER = 24 final val MATCH_TYPE_FIELD_NUMBER = 25 + final val CASE_TYPE_FIELD_NUMBER = 26 def of( sealedValue: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue ): _root_.dotty.tools.dotc.semanticdb.TypeMessage = _root_.dotty.tools.dotc.semanticdb.TypeMessage( @@ -1938,16 +1964,27 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. @SerialVersionUID(0L) final case class MatchType( - `match`: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None, - cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.TypeLambda] = _root_.scala.Seq.empty + scrutinee: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + bound: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.CaseType] = _root_.scala.Seq.empty ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { @transient @sharable private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 private[this] def __computeSerializedValue(): _root_.scala.Int = { var __size = 0 - if (`match`.isDefined) { - val __value = `match`.get - __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + + { + val __value = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toBase(scrutinee) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + }; + + { + val __value = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toBase(bound) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } }; cases.foreach { __item => val __value = __item @@ -1964,26 +2001,35 @@ final case class MatchType( read } def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = { - `match`.foreach { __v => - val __m = __v - _output__.writeTag(1, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) + { + val __v = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toBase(scrutinee) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } + }; + { + val __v = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toBase(bound) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } }; cases.foreach { __v => val __m = __v - _output__.writeTag(2, 2) + _output__.writeTag(3, 2) _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; } - def getMatch: dotty.tools.dotc.semanticdb.Scope = `match`.getOrElse(dotty.tools.dotc.semanticdb.Scope.defaultInstance) - def clearMatch: MatchType = copy(`match` = _root_.scala.None) - def withMatch(__v: dotty.tools.dotc.semanticdb.Scope): MatchType = copy(`match` = Option(__v)) + def withScrutinee(__v: dotty.tools.dotc.semanticdb.Type): MatchType = copy(scrutinee = __v) + def withBound(__v: dotty.tools.dotc.semanticdb.Type): MatchType = copy(bound = __v) def clearCases = copy(cases = _root_.scala.Seq.empty) - def addCases(__vs: dotty.tools.dotc.semanticdb.TypeLambda*): MatchType = addAllCases(__vs) - def addAllCases(__vs: Iterable[dotty.tools.dotc.semanticdb.TypeLambda]): MatchType = copy(cases = cases ++ __vs) - def withCases(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.TypeLambda]): MatchType = copy(cases = __v) + def addCases(__vs: dotty.tools.dotc.semanticdb.CaseType*): MatchType = addAllCases(__vs) + def addAllCases(__vs: Iterable[dotty.tools.dotc.semanticdb.CaseType]): MatchType = copy(cases = cases ++ __vs) + def withCases(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.CaseType]): MatchType = copy(cases = __v) @@ -1994,22 +2040,26 @@ final case class MatchType( object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType] { implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType] = this def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.MatchType = { - var __match: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None - val __cases: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.TypeLambda] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.TypeLambda] + var __scrutinee: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + var __bound: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + val __cases: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.CaseType] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.CaseType] var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() _tag__ match { case 0 => _done__ = true case 10 => - __match = Option(__match.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__))(LiteParser.readMessage(_input__, _))) + __scrutinee = _root_.scala.Some(__scrutinee.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) case 18 => - __cases += LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeLambda](_input__) + __bound = _root_.scala.Some(__bound.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) + case 26 => + __cases += LiteParser.readMessage[dotty.tools.dotc.semanticdb.CaseType](_input__) case tag => _input__.skipField(tag) } } dotty.tools.dotc.semanticdb.MatchType( - `match` = __match, + scrutinee = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(__scrutinee.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), + bound = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(__bound.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), cases = __cases.result() ) } @@ -2020,17 +2070,155 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s lazy val defaultInstance = dotty.tools.dotc.semanticdb.MatchType( - `match` = _root_.scala.None, + scrutinee = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + bound = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), cases = _root_.scala.Seq.empty ) - final val MATCH_FIELD_NUMBER = 1 - final val CASES_FIELD_NUMBER = 2 + final val SCRUTINEE_FIELD_NUMBER = 1 + final val BOUND_FIELD_NUMBER = 2 + final val CASES_FIELD_NUMBER = 3 + @transient @sharable + private[semanticdb] val _typemapper_scrutinee: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + @transient @sharable + private[semanticdb] val _typemapper_bound: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] def of( - `match`: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope], - cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.TypeLambda] + scrutinee: dotty.tools.dotc.semanticdb.Type, + bound: dotty.tools.dotc.semanticdb.Type, + cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.CaseType] ): _root_.dotty.tools.dotc.semanticdb.MatchType = _root_.dotty.tools.dotc.semanticdb.MatchType( - `match`, + scrutinee, + bound, cases ) // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType]) } + +@SerialVersionUID(0L) +final case class CaseType( + typeParameter: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None, + key: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + body: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { + @transient @sharable + private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 + private[this] def __computeSerializedValue(): _root_.scala.Int = { + var __size = 0 + if (typeParameter.isDefined) { + val __value = typeParameter.get + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + }; + + { + val __value = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toBase(key) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + }; + + { + val __value = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toBase(body) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + }; + __size + } + override def serializedSize: _root_.scala.Int = { + var read = __serializedSizeCachedValue + if (read == 0) { + read = __computeSerializedValue() + __serializedSizeCachedValue = read + } + read + } + def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = { + typeParameter.foreach { __v => + val __m = __v + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__m.serializedSize) + __m.writeTo(_output__) + }; + { + val __v = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toBase(key) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } + }; + { + val __v = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toBase(body) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(3, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } + }; + } + def getTypeParameter: dotty.tools.dotc.semanticdb.Scope = typeParameter.getOrElse(dotty.tools.dotc.semanticdb.Scope.defaultInstance) + def clearTypeParameter: CaseType = copy(typeParameter = _root_.scala.None) + def withTypeParameter(__v: dotty.tools.dotc.semanticdb.Scope): CaseType = copy(typeParameter = Option(__v)) + def withKey(__v: dotty.tools.dotc.semanticdb.Type): CaseType = copy(key = __v) + def withBody(__v: dotty.tools.dotc.semanticdb.Type): CaseType = copy(body = __v) + + + + + // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.CaseType]) +} + +object CaseType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.CaseType] { + implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.CaseType] = this + def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.CaseType = { + var __typeParameter: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None + var __key: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + var __body: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __typeParameter = Option(__typeParameter.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__))(LiteParser.readMessage(_input__, _))) + case 18 => + __key = _root_.scala.Some(__key.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) + case 26 => + __body = _root_.scala.Some(__body.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) + case tag => _input__.skipField(tag) + } + } + dotty.tools.dotc.semanticdb.CaseType( + typeParameter = __typeParameter, + key = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toCustom(__key.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), + body = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toCustom(__body.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) + ) + } + + + + + + + lazy val defaultInstance = dotty.tools.dotc.semanticdb.CaseType( + typeParameter = _root_.scala.None, + key = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + body = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + ) + final val TYPE_PARAMETER_FIELD_NUMBER = 1 + final val KEY_FIELD_NUMBER = 2 + final val BODY_FIELD_NUMBER = 3 + @transient @sharable + private[semanticdb] val _typemapper_key: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + @transient @sharable + private[semanticdb] val _typemapper_body: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + def of( + typeParameter: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope], + key: dotty.tools.dotc.semanticdb.Type, + body: dotty.tools.dotc.semanticdb.Type + ): _root_.dotty.tools.dotc.semanticdb.CaseType = _root_.dotty.tools.dotc.semanticdb.CaseType( + typeParameter, + key, + body + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.CaseType]) +} diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 419785211c95..9a2144ae5386 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -215,7 +215,43 @@ class TypeOps: } val stparamss = paramSymss.map(_.sscope) val sresTpe = loop(resType) - s.TypeLambda(stparamss, sresTpe) + val res = s.TypeLambda(stparamss, sresTpe) + println("===") + println(sym) + println(lam) + println(res) + res + + case matchType: MatchType => + val scases = matchType.cases.map { caseType => caseType match { + case lam: HKTypeLambda => + val paramSyms = lam.paramNames.flatMap { paramName => + val key = (lam, paramName) + val get = paramRefSymtab.get(key) + get + }.sscope + lam.resType match { + case defn.MatchCase(key, body) => + s.CaseType( + Some(paramSyms), + loop(key), + loop(body) + ) + case _ => s.CaseType() // shouldn't happen + } + case defn.MatchCase(key, body) => + val skey = loop(key) + val sbody = loop(body) + s.CaseType(Some(s.Scope()), skey, sbody) + case _ => s.CaseType() // shouldn't happen + }} + val sscrutinee = loop(matchType.scrutinee) + val sbound = loop(matchType.bound) + val t = s.MatchType(sscrutinee, sbound, scases) + // println(s"===${sym}===") + // println(matchType) + // println(t) + t case rt @ RefinedType(parent, name, info) => // `X { def x: Int; def y: Int }` diff --git a/tests/semanticdb/expect/MatchType.expect.scala b/tests/semanticdb/expect/MatchType.expect.scala new file mode 100644 index 000000000000..260063856b5f --- /dev/null +++ b/tests/semanticdb/expect/MatchType.expect.scala @@ -0,0 +1,11 @@ + + +type Elem/*<-_empty_::MatchType$package.Elem#*/[X/*<-_empty_::MatchType$package.Elem#[X]*/] = X/*->_empty_::MatchType$package.Elem#[X]*/ match + case String/*->scala::Predef.String#*/ => Char/*->scala::Char#*/ + case Array/*->scala::Array#*/[t/*<-local0*/] => t/*->local0*/ + case Iterable/*->scala::package.Iterable#*/[t/*<-local1*/] => t/*->local1*/ + +type Concat/*<-_empty_::MatchType$package.Concat#*/[Xs/*<-_empty_::MatchType$package.Concat#[Xs]*/ <: Tuple/*->scala::Tuple#*/, +Ys/*<-_empty_::MatchType$package.Concat#[Ys]*/ <: Tuple/*->scala::Tuple#*/] <: Tuple/*->scala::Tuple#*/ = Xs/*->_empty_::MatchType$package.Concat#[Xs]*/ match + case EmptyTuple/*->scala::Tuple$package.EmptyTuple#*/ => Ys/*->_empty_::MatchType$package.Concat#[Ys]*/ + case x/*<-local2*/ *:/*->scala::`*:`#*/ xs/*<-local3*/ => x/*->local2*/ *:/*->scala::`*:`#*/ Concat/*->_empty_::MatchType$package.Concat#*/[xs/*->local3*/, Ys/*->_empty_::MatchType$package.Concat#[Ys]*/] + diff --git a/tests/semanticdb/expect/MatchType.scala b/tests/semanticdb/expect/MatchType.scala new file mode 100644 index 000000000000..1e155bda412a --- /dev/null +++ b/tests/semanticdb/expect/MatchType.scala @@ -0,0 +1,11 @@ + + +type Elem[X] = X match + case String => Char + case Array[t] => t + case Iterable[t] => t + +type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match + case EmptyTuple => Ys + case x *: xs => x *: Concat[xs, Ys] + diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index d74164039316..cff129adda44 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -789,9 +789,9 @@ enumVal/Color#``().(rgb) => val param rgb: Int enumVal/Color#rgb. => val method rgb Int enumVal/Color. => final object Color extends Object { self: .Color.type => +8 decls } enumVal/Color.$values. => val method $values Array[Color] -enumVal/Color.Blue. => case val static enum method Blue Color -enumVal/Color.Green. => case val static enum method Green Color & A -enumVal/Color.Red. => case val static enum method Red Color +enumVal/Color.Blue. => val static enum method Blue Color +enumVal/Color.Green. => val static enum method Green Color & A +enumVal/Color.Red. => val static enum method Red Color enumVal/Color.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Color enumVal/Color.fromOrdinal().(ordinal) => param ordinal: Int enumVal/Color.valueOf(). => method valueOf (param $name: String): Color @@ -840,11 +840,11 @@ _empty_/Enums.Coin#``().(value) => param value: Int _empty_/Enums.Coin#value. => val method value Int _empty_/Enums.Coin. => final object Coin extends Object { self: .Coin.type => +10 decls } _empty_/Enums.Coin.$values. => val method $values Array[Coin] -_empty_/Enums.Coin.Dime. => case val static enum method Dime Coin -_empty_/Enums.Coin.Dollar. => case val static enum method Dollar Coin -_empty_/Enums.Coin.Nickel. => case val static enum method Nickel Coin -_empty_/Enums.Coin.Penny. => case val static enum method Penny Coin -_empty_/Enums.Coin.Quarter. => case val static enum method Quarter Coin +_empty_/Enums.Coin.Dime. => val static enum method Dime Coin +_empty_/Enums.Coin.Dollar. => val static enum method Dollar Coin +_empty_/Enums.Coin.Nickel. => val static enum method Nickel Coin +_empty_/Enums.Coin.Penny. => val static enum method Penny Coin +_empty_/Enums.Coin.Quarter. => val static enum method Quarter Coin _empty_/Enums.Coin.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Coin _empty_/Enums.Coin.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Coin.valueOf(). => method valueOf (param $name: String): Coin @@ -857,9 +857,9 @@ _empty_/Enums.Colour.$new(). => method $new (param _$ordinal: Int, param $name: _empty_/Enums.Colour.$new().($name) => param $name: String _empty_/Enums.Colour.$new().(_$ordinal) => param _$ordinal: Int _empty_/Enums.Colour.$values. => val method $values Array[Colour] -_empty_/Enums.Colour.Blue. => case val static enum method Blue Colour -_empty_/Enums.Colour.Green. => case val static enum method Green Colour -_empty_/Enums.Colour.Red. => case val static enum method Red Colour +_empty_/Enums.Colour.Blue. => val static enum method Blue Colour +_empty_/Enums.Colour.Green. => val static enum method Green Colour +_empty_/Enums.Colour.Red. => val static enum method Red Colour _empty_/Enums.Colour.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Colour _empty_/Enums.Colour.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Colour.valueOf(). => method valueOf (param $name: String): Colour @@ -872,10 +872,10 @@ _empty_/Enums.Directions.$new(). => method $new (param _$ordinal: Int, param $na _empty_/Enums.Directions.$new().($name) => param $name: String _empty_/Enums.Directions.$new().(_$ordinal) => param _$ordinal: Int _empty_/Enums.Directions.$values. => val method $values Array[Directions] -_empty_/Enums.Directions.East. => case val static enum method East Directions -_empty_/Enums.Directions.North. => case val static enum method North Directions -_empty_/Enums.Directions.South. => case val static enum method South Directions -_empty_/Enums.Directions.West. => case val static enum method West Directions +_empty_/Enums.Directions.East. => val static enum method East Directions +_empty_/Enums.Directions.North. => val static enum method North Directions +_empty_/Enums.Directions.South. => val static enum method South Directions +_empty_/Enums.Directions.West. => val static enum method West Directions _empty_/Enums.Directions.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Directions _empty_/Enums.Directions.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Directions.valueOf(). => method valueOf (param $name: String): Directions @@ -905,7 +905,7 @@ _empty_/Enums.Maybe.Just.toString(). => method toString => String _empty_/Enums.Maybe.Just.unapply(). => method unapply [typeparam A ](param x$1: Just[A]): Just[A] _empty_/Enums.Maybe.Just.unapply().(x$1) => param x$1: Just[A] _empty_/Enums.Maybe.Just.unapply().[A] => typeparam A -_empty_/Enums.Maybe.None. => case val static enum method None Maybe[Nothing] +_empty_/Enums.Maybe.None. => val static enum method None Maybe[Nothing] _empty_/Enums.Maybe.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Maybe[] _empty_/Enums.Maybe.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Planet# => abstract sealed enum class Planet extends Enum[Planet] with Enum { self: Planet => +6 decls } @@ -920,14 +920,14 @@ _empty_/Enums.Planet#surfaceWeight(). => method surfaceWeight (param otherMass: _empty_/Enums.Planet#surfaceWeight().(otherMass) => param otherMass: Double _empty_/Enums.Planet. => final object Planet extends Object { self: .Planet.type => +13 decls } _empty_/Enums.Planet.$values. => val method $values Array[Planet] -_empty_/Enums.Planet.Earth. => case val static enum method Earth Planet -_empty_/Enums.Planet.Jupiter. => case val static enum method Jupiter Planet -_empty_/Enums.Planet.Mars. => case val static enum method Mars Planet -_empty_/Enums.Planet.Mercury. => case val static enum method Mercury Planet -_empty_/Enums.Planet.Neptune. => case val static enum method Neptune Planet -_empty_/Enums.Planet.Saturn. => case val static enum method Saturn Planet -_empty_/Enums.Planet.Uranus. => case val static enum method Uranus Planet -_empty_/Enums.Planet.Venus. => case val static enum method Venus Planet +_empty_/Enums.Planet.Earth. => val static enum method Earth Planet +_empty_/Enums.Planet.Jupiter. => val static enum method Jupiter Planet +_empty_/Enums.Planet.Mars. => val static enum method Mars Planet +_empty_/Enums.Planet.Mercury. => val static enum method Mercury Planet +_empty_/Enums.Planet.Neptune. => val static enum method Neptune Planet +_empty_/Enums.Planet.Saturn. => val static enum method Saturn Planet +_empty_/Enums.Planet.Uranus. => val static enum method Uranus Planet +_empty_/Enums.Planet.Venus. => val static enum method Venus Planet _empty_/Enums.Planet.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Planet _empty_/Enums.Planet.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Planet.valueOf(). => method valueOf (param $name: String): Planet @@ -940,10 +940,10 @@ _empty_/Enums.Suits.$new(). => method $new (param _$ordinal: Int, param $name: S _empty_/Enums.Suits.$new().($name) => param $name: String _empty_/Enums.Suits.$new().(_$ordinal) => param _$ordinal: Int _empty_/Enums.Suits.$values. => val method $values Array[Suits] -_empty_/Enums.Suits.Clubs. => case val static enum method Clubs Suits -_empty_/Enums.Suits.Diamonds. => case val static enum method Diamonds Suits -_empty_/Enums.Suits.Hearts. => case val static enum method Hearts Suits -_empty_/Enums.Suits.Spades. => case val static enum method Spades Suits +_empty_/Enums.Suits.Clubs. => val static enum method Clubs Suits +_empty_/Enums.Suits.Diamonds. => val static enum method Diamonds Suits +_empty_/Enums.Suits.Hearts. => val static enum method Hearts Suits +_empty_/Enums.Suits.Spades. => val static enum method Spades Suits _empty_/Enums.Suits.derived$CanEqual. => implicit lazy val method derived$CanEqual CanEqual[Suits, Suits] _empty_/Enums.Suits.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Suits _empty_/Enums.Suits.fromOrdinal().(ordinal) => param ordinal: Int @@ -959,8 +959,8 @@ _empty_/Enums.Tag#[A] => typeparam A _empty_/Enums.Tag#``(). => primary ctor [unknown A: ]: Tag[A] _empty_/Enums.Tag. => final object Tag extends Object { self: .Tag.type => +7 decls } _empty_/Enums.Tag.$values. => val method $values Array[Tag[]] -_empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag Tag[Boolean] -_empty_/Enums.Tag.IntTag. => case val static enum method IntTag Tag[Int] +_empty_/Enums.Tag.BooleanTag. => val static enum method BooleanTag Tag[Boolean] +_empty_/Enums.Tag.IntTag. => val static enum method IntTag Tag[Int] _empty_/Enums.Tag.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Tag[] _empty_/Enums.Tag.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Tag.valueOf(). => method valueOf (param $name: String): Tag[] @@ -973,13 +973,13 @@ _empty_/Enums.WeekDays.$new(). => method $new (param _$ordinal: Int, param $name _empty_/Enums.WeekDays.$new().($name) => param $name: String _empty_/Enums.WeekDays.$new().(_$ordinal) => param _$ordinal: Int _empty_/Enums.WeekDays.$values. => val method $values Array[WeekDays] -_empty_/Enums.WeekDays.Friday. => case val static enum method Friday WeekDays -_empty_/Enums.WeekDays.Monday. => case val static enum method Monday WeekDays -_empty_/Enums.WeekDays.Saturday. => case val static enum method Saturday WeekDays -_empty_/Enums.WeekDays.Sunday. => case val static enum method Sunday WeekDays -_empty_/Enums.WeekDays.Thursday. => case val static enum method Thursday WeekDays -_empty_/Enums.WeekDays.Tuesday. => case val static enum method Tuesday WeekDays -_empty_/Enums.WeekDays.Wednesday. => case val static enum method Wednesday WeekDays +_empty_/Enums.WeekDays.Friday. => val static enum method Friday WeekDays +_empty_/Enums.WeekDays.Monday. => val static enum method Monday WeekDays +_empty_/Enums.WeekDays.Saturday. => val static enum method Saturday WeekDays +_empty_/Enums.WeekDays.Sunday. => val static enum method Sunday WeekDays +_empty_/Enums.WeekDays.Thursday. => val static enum method Thursday WeekDays +_empty_/Enums.WeekDays.Tuesday. => val static enum method Tuesday WeekDays +_empty_/Enums.WeekDays.Wednesday. => val static enum method Wednesday WeekDays _empty_/Enums.WeekDays.fromOrdinal(). => method fromOrdinal (param ordinal: Int): WeekDays _empty_/Enums.WeekDays.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.WeekDays.valueOf(). => method valueOf (param $name: String): WeekDays @@ -1985,6 +1985,59 @@ Occurrences: [5:8..5:8): -> scala/collection/IterableFactory#apply(). [5:9..5:10): x -> local0 +expect/MatchType.scala +---------------------- + +Summary: +Schema => SemanticDB v4 +Uri => MatchType.scala +Text => empty +Language => Scala +Symbols => 10 entries +Occurrences => 28 entries + +Symbols: +_empty_/MatchType$package. => final package object _empty_ extends Object { self: ._empty_.type => +3 decls } +_empty_/MatchType$package.Concat# => type Concat = +_empty_/MatchType$package.Concat#[Xs] => typeparam Xs +_empty_/MatchType$package.Concat#[Ys] => covariant typeparam Ys +_empty_/MatchType$package.Elem# => type Elem = +_empty_/MatchType$package.Elem#[X] => typeparam X +local0 => case val method t +local1 => case val method t +local2 => case val method x = +local3 => case val method xs = + +Occurrences: +[2:5..2:9): Elem <- _empty_/MatchType$package.Elem# +[2:10..2:11): X <- _empty_/MatchType$package.Elem#[X] +[2:15..2:16): X -> _empty_/MatchType$package.Elem#[X] +[3:7..3:13): String -> scala/Predef.String# +[3:17..3:21): Char -> scala/Char# +[4:7..4:12): Array -> scala/Array# +[4:13..4:14): t <- local0 +[4:19..4:20): t -> local0 +[5:7..5:15): Iterable -> scala/package.Iterable# +[5:16..5:17): t <- local1 +[5:22..5:23): t -> local1 +[7:5..7:11): Concat <- _empty_/MatchType$package.Concat# +[7:12..7:14): Xs <- _empty_/MatchType$package.Concat#[Xs] +[7:18..7:23): Tuple -> scala/Tuple# +[7:26..7:28): Ys <- _empty_/MatchType$package.Concat#[Ys] +[7:32..7:37): Tuple -> scala/Tuple# +[7:42..7:47): Tuple -> scala/Tuple# +[7:50..7:52): Xs -> _empty_/MatchType$package.Concat#[Xs] +[8:7..8:17): EmptyTuple -> scala/Tuple$package.EmptyTuple# +[8:21..8:23): Ys -> _empty_/MatchType$package.Concat#[Ys] +[9:7..9:8): x <- local2 +[9:9..9:11): *: -> scala/`*:`# +[9:12..9:14): xs <- local3 +[9:18..9:19): x -> local2 +[9:20..9:22): *: -> scala/`*:`# +[9:23..9:29): Concat -> _empty_/MatchType$package.Concat# +[9:30..9:32): xs -> local3 +[9:34..9:36): Ys -> _empty_/MatchType$package.Concat#[Ys] + expect/MetacJava.scala ---------------------- From 233c851cab57e1f9d4e8aca5324ab6d8cee3e493 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Mon, 5 Jul 2021 17:34:42 +0900 Subject: [PATCH 15/25] Update the protobuf schema for TypeLambda and MatchType --- .../dotty/tools/dotc/semanticdb/Type.scala | 303 ++++++++---------- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 66 ++-- project/Build.scala | 1 + tests/semanticdb/expect/MatchType.scala | 9 +- 4 files changed, 164 insertions(+), 215 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala index 5558d6a9ef87..7df765af6c83 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala @@ -40,7 +40,6 @@ object Type { case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType => __v.value - case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType => __v.value case dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty => Empty } override def toBase(__custom: dotty.tools.dotc.semanticdb.Type): dotty.tools.dotc.semanticdb.TypeMessage = dotty.tools.dotc.semanticdb.TypeMessage(__custom match { @@ -60,7 +59,6 @@ object Type { case __v: dotty.tools.dotc.semanticdb.RepeatedType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__v) case __v: dotty.tools.dotc.semanticdb.TypeLambda => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v) case __v: dotty.tools.dotc.semanticdb.MatchType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v) - case __v: dotty.tools.dotc.semanticdb.CaseType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType(__v) case Empty => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty }) } @@ -137,10 +135,6 @@ final case class TypeMessage( val __value = sealedValue.matchType.get __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize }; - if (sealedValue.caseType.isDefined) { - val __value = sealedValue.caseType.get - __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize - }; __size } override def serializedSize: _root_.scala.Int = { @@ -248,12 +242,6 @@ final case class TypeMessage( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; - sealedValue.caseType.foreach { __v => - val __m = __v - _output__.writeTag(26, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; } def getTypeRef: dotty.tools.dotc.semanticdb.TypeRef = sealedValue.typeRef.getOrElse(dotty.tools.dotc.semanticdb.TypeRef.defaultInstance) def withTypeRef(__v: dotty.tools.dotc.semanticdb.TypeRef): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeRef(__v)) @@ -287,8 +275,6 @@ final case class TypeMessage( def withTypeLambda(__v: dotty.tools.dotc.semanticdb.TypeLambda): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v)) def getMatchType: dotty.tools.dotc.semanticdb.MatchType = sealedValue.matchType.getOrElse(dotty.tools.dotc.semanticdb.MatchType.defaultInstance) def withMatchType(__v: dotty.tools.dotc.semanticdb.MatchType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v)) - def getCaseType: dotty.tools.dotc.semanticdb.CaseType = sealedValue.caseType.getOrElse(dotty.tools.dotc.semanticdb.CaseType.defaultInstance) - def withCaseType(__v: dotty.tools.dotc.semanticdb.CaseType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType(__v)) def clearSealedValue: TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty) def withSealedValue(__v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue): TypeMessage = copy(sealedValue = __v) @@ -340,8 +326,6 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__sealedValue.typeLambda.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeLambda](_input__))(LiteParser.readMessage(_input__, _))) case 202 => __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__sealedValue.matchType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.MatchType](_input__))(LiteParser.readMessage(_input__, _))) - case 210 => - __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.CaseType(__sealedValue.caseType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.CaseType](_input__))(LiteParser.readMessage(_input__, _))) case tag => _input__.skipField(tag) } } @@ -377,7 +361,6 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def isRepeatedType: _root_.scala.Boolean = false def isTypeLambda: _root_.scala.Boolean = false def isMatchType: _root_.scala.Boolean = false - def isCaseType: _root_.scala.Boolean = false def typeRef: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeRef] = _root_.scala.None def singleType: _root_.scala.Option[dotty.tools.dotc.semanticdb.SingleType] = _root_.scala.None def thisType: _root_.scala.Option[dotty.tools.dotc.semanticdb.ThisType] = _root_.scala.None @@ -394,7 +377,6 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def repeatedType: _root_.scala.Option[dotty.tools.dotc.semanticdb.RepeatedType] = _root_.scala.None def typeLambda: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeLambda] = _root_.scala.None def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = _root_.scala.None - def caseType: _root_.scala.Option[dotty.tools.dotc.semanticdb.CaseType] = _root_.scala.None } object SealedValue { @SerialVersionUID(0L) @@ -518,13 +500,6 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc override def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = Some(value) override def number: _root_.scala.Int = 25 } - @SerialVersionUID(0L) - final case class CaseType(value: dotty.tools.dotc.semanticdb.CaseType) extends dotty.tools.dotc.semanticdb.TypeMessage.SealedValue derives CanEqual { - type ValueType = dotty.tools.dotc.semanticdb.CaseType - override def isCaseType: _root_.scala.Boolean = true - override def caseType: _root_.scala.Option[dotty.tools.dotc.semanticdb.CaseType] = Some(value) - override def number: _root_.scala.Int = 26 - } } final val TYPE_REF_FIELD_NUMBER = 2 final val SINGLE_TYPE_FIELD_NUMBER = 20 @@ -542,7 +517,6 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc final val REPEATED_TYPE_FIELD_NUMBER = 14 final val TYPE_LAMBDA_FIELD_NUMBER = 24 final val MATCH_TYPE_FIELD_NUMBER = 25 - final val CASE_TYPE_FIELD_NUMBER = 26 def of( sealedValue: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue ): _root_.dotty.tools.dotc.semanticdb.TypeMessage = _root_.dotty.tools.dotc.semanticdb.TypeMessage( @@ -1860,17 +1834,17 @@ object RepeatedType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dot @SerialVersionUID(0L) final case class TypeLambda( - parameters: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.Seq.empty, + parameters: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None, returnType: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { @transient @sharable private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 private[this] def __computeSerializedValue(): _root_.scala.Int = { var __size = 0 - parameters.foreach { __item => - val __value = __item + if (parameters.isDefined) { + val __value = parameters.get __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize - } + }; { val __value = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toBase(returnType) @@ -1904,10 +1878,9 @@ final case class TypeLambda( } }; } - def clearParameters = copy(parameters = _root_.scala.Seq.empty) - def addParameters(__vs: dotty.tools.dotc.semanticdb.Scope*): TypeLambda = addAllParameters(__vs) - def addAllParameters(__vs: Iterable[dotty.tools.dotc.semanticdb.Scope]): TypeLambda = copy(parameters = parameters ++ __vs) - def withParameters(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Scope]): TypeLambda = copy(parameters = __v) + def getParameters: dotty.tools.dotc.semanticdb.Scope = parameters.getOrElse(dotty.tools.dotc.semanticdb.Scope.defaultInstance) + def clearParameters: TypeLambda = copy(parameters = _root_.scala.None) + def withParameters(__v: dotty.tools.dotc.semanticdb.Scope): TypeLambda = copy(parameters = Option(__v)) def withReturnType(__v: dotty.tools.dotc.semanticdb.Type): TypeLambda = copy(returnType = __v) @@ -1919,7 +1892,7 @@ final case class TypeLambda( object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda] { implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda] = this def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.TypeLambda = { - val __parameters: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.Scope] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.Scope] + var __parameters: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None var __returnType: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None var _done__ = false while (!_done__) { @@ -1927,14 +1900,14 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. _tag__ match { case 0 => _done__ = true case 10 => - __parameters += LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__) + __parameters = Option(__parameters.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__))(LiteParser.readMessage(_input__, _))) case 18 => __returnType = _root_.scala.Some(__returnType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) case tag => _input__.skipField(tag) } } dotty.tools.dotc.semanticdb.TypeLambda( - parameters = __parameters.result(), + parameters = __parameters, returnType = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(__returnType.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) ) } @@ -1945,7 +1918,7 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. lazy val defaultInstance = dotty.tools.dotc.semanticdb.TypeLambda( - parameters = _root_.scala.Seq.empty, + parameters = _root_.scala.None, returnType = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) ) final val PARAMETERS_FIELD_NUMBER = 1 @@ -1953,7 +1926,7 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. @transient @sharable private[semanticdb] val _typemapper_returnType: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] def of( - parameters: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Scope], + parameters: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope], returnType: dotty.tools.dotc.semanticdb.Type ): _root_.dotty.tools.dotc.semanticdb.TypeLambda = _root_.dotty.tools.dotc.semanticdb.TypeLambda( parameters, @@ -1966,7 +1939,7 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. final case class MatchType( scrutinee: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), bound: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), - cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.CaseType] = _root_.scala.Seq.empty + cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.MatchType.CaseType] = _root_.scala.Seq.empty ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { @transient @sharable private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 @@ -2027,9 +2000,9 @@ final case class MatchType( def withScrutinee(__v: dotty.tools.dotc.semanticdb.Type): MatchType = copy(scrutinee = __v) def withBound(__v: dotty.tools.dotc.semanticdb.Type): MatchType = copy(bound = __v) def clearCases = copy(cases = _root_.scala.Seq.empty) - def addCases(__vs: dotty.tools.dotc.semanticdb.CaseType*): MatchType = addAllCases(__vs) - def addAllCases(__vs: Iterable[dotty.tools.dotc.semanticdb.CaseType]): MatchType = copy(cases = cases ++ __vs) - def withCases(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.CaseType]): MatchType = copy(cases = __v) + def addCases(__vs: dotty.tools.dotc.semanticdb.MatchType.CaseType*): MatchType = addAllCases(__vs) + def addAllCases(__vs: Iterable[dotty.tools.dotc.semanticdb.MatchType.CaseType]): MatchType = copy(cases = cases ++ __vs) + def withCases(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.MatchType.CaseType]): MatchType = copy(cases = __v) @@ -2042,7 +2015,7 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.MatchType = { var __scrutinee: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None var __bound: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None - val __cases: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.CaseType] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.CaseType] + val __cases: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.MatchType.CaseType] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.MatchType.CaseType] var _done__ = false while (!_done__) { val _tag__ = _input__.readTag() @@ -2053,7 +2026,7 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s case 18 => __bound = _root_.scala.Some(__bound.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) case 26 => - __cases += LiteParser.readMessage[dotty.tools.dotc.semanticdb.CaseType](_input__) + __cases += LiteParser.readMessage[dotty.tools.dotc.semanticdb.MatchType.CaseType](_input__) case tag => _input__.skipField(tag) } } @@ -2074,151 +2047,129 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s bound = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), cases = _root_.scala.Seq.empty ) - final val SCRUTINEE_FIELD_NUMBER = 1 - final val BOUND_FIELD_NUMBER = 2 - final val CASES_FIELD_NUMBER = 3 - @transient @sharable - private[semanticdb] val _typemapper_scrutinee: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] - @transient @sharable - private[semanticdb] val _typemapper_bound: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] - def of( - scrutinee: dotty.tools.dotc.semanticdb.Type, - bound: dotty.tools.dotc.semanticdb.Type, - cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.CaseType] - ): _root_.dotty.tools.dotc.semanticdb.MatchType = _root_.dotty.tools.dotc.semanticdb.MatchType( - scrutinee, - bound, - cases - ) - // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType]) -} - -@SerialVersionUID(0L) -final case class CaseType( - typeParameter: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None, - key: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), - body: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) - ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { - @transient @sharable - private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 - private[this] def __computeSerializedValue(): _root_.scala.Int = { - var __size = 0 - if (typeParameter.isDefined) { - val __value = typeParameter.get - __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize - }; - - { - val __value = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toBase(key) - if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { - __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + @SerialVersionUID(0L) + final case class CaseType( + key: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_key.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + body: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_body.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + ) extends SemanticdbGeneratedMessage derives CanEqual { + @transient @sharable + private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 + private[this] def __computeSerializedValue(): _root_.scala.Int = { + var __size = 0 + + { + val __value = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_key.toBase(key) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + }; + + { + val __value = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_body.toBase(body) + if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + } + }; + __size + } + override def serializedSize: _root_.scala.Int = { + var read = __serializedSizeCachedValue + if (read == 0) { + read = __computeSerializedValue() + __serializedSizeCachedValue = read } - }; + read + } + def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = { + { + val __v = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_key.toBase(key) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(1, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } + }; + { + val __v = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_body.toBase(body) + if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { + _output__.writeTag(2, 2) + _output__.writeUInt32NoTag(__v.serializedSize) + __v.writeTo(_output__) + } + }; + } + def withKey(__v: dotty.tools.dotc.semanticdb.Type): CaseType = copy(key = __v) + def withBody(__v: dotty.tools.dotc.semanticdb.Type): CaseType = copy(body = __v) - { - val __value = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toBase(body) - if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { - __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize + + + + // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.MatchType.CaseType]) + } + + object CaseType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType.CaseType] { + implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType.CaseType] = this + def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.MatchType.CaseType = { + var __key: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + var __body: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None + var _done__ = false + while (!_done__) { + val _tag__ = _input__.readTag() + _tag__ match { + case 0 => _done__ = true + case 10 => + __key = _root_.scala.Some(__key.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) + case 18 => + __body = _root_.scala.Some(__body.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) + case tag => _input__.skipField(tag) } - }; - __size - } - override def serializedSize: _root_.scala.Int = { - var read = __serializedSizeCachedValue - if (read == 0) { - read = __computeSerializedValue() - __serializedSizeCachedValue = read } - read - } - def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = { - typeParameter.foreach { __v => - val __m = __v - _output__.writeTag(1, 2) - _output__.writeUInt32NoTag(__m.serializedSize) - __m.writeTo(_output__) - }; - { - val __v = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toBase(key) - if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { - _output__.writeTag(2, 2) - _output__.writeUInt32NoTag(__v.serializedSize) - __v.writeTo(_output__) - } - }; - { - val __v = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toBase(body) - if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { - _output__.writeTag(3, 2) - _output__.writeUInt32NoTag(__v.serializedSize) - __v.writeTo(_output__) - } - }; + dotty.tools.dotc.semanticdb.MatchType.CaseType( + key = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_key.toCustom(__key.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), + body = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_body.toCustom(__body.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) + ) } - def getTypeParameter: dotty.tools.dotc.semanticdb.Scope = typeParameter.getOrElse(dotty.tools.dotc.semanticdb.Scope.defaultInstance) - def clearTypeParameter: CaseType = copy(typeParameter = _root_.scala.None) - def withTypeParameter(__v: dotty.tools.dotc.semanticdb.Scope): CaseType = copy(typeParameter = Option(__v)) - def withKey(__v: dotty.tools.dotc.semanticdb.Type): CaseType = copy(key = __v) - def withBody(__v: dotty.tools.dotc.semanticdb.Type): CaseType = copy(body = __v) - // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.CaseType]) -} - -object CaseType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.CaseType] { - implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.CaseType] = this - def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.CaseType = { - var __typeParameter: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None - var __key: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None - var __body: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None - var _done__ = false - while (!_done__) { - val _tag__ = _input__.readTag() - _tag__ match { - case 0 => _done__ = true - case 10 => - __typeParameter = Option(__typeParameter.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Scope](_input__))(LiteParser.readMessage(_input__, _))) - case 18 => - __key = _root_.scala.Some(__key.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) - case 26 => - __body = _root_.scala.Some(__body.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) - case tag => _input__.skipField(tag) - } - } - dotty.tools.dotc.semanticdb.CaseType( - typeParameter = __typeParameter, - key = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toCustom(__key.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), - body = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toCustom(__body.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) + + + lazy val defaultInstance = dotty.tools.dotc.semanticdb.MatchType.CaseType( + key = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_key.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), + body = dotty.tools.dotc.semanticdb.MatchType.CaseType._typemapper_body.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) ) + final val KEY_FIELD_NUMBER = 1 + final val BODY_FIELD_NUMBER = 2 + @transient @sharable + private[semanticdb] val _typemapper_key: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + @transient @sharable + private[semanticdb] val _typemapper_body: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + def of( + key: dotty.tools.dotc.semanticdb.Type, + body: dotty.tools.dotc.semanticdb.Type + ): _root_.dotty.tools.dotc.semanticdb.MatchType.CaseType = _root_.dotty.tools.dotc.semanticdb.MatchType.CaseType( + key, + body + ) + // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType.CaseType]) } - - - - - - lazy val defaultInstance = dotty.tools.dotc.semanticdb.CaseType( - typeParameter = _root_.scala.None, - key = dotty.tools.dotc.semanticdb.CaseType._typemapper_key.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), - body = dotty.tools.dotc.semanticdb.CaseType._typemapper_body.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) - ) - final val TYPE_PARAMETER_FIELD_NUMBER = 1 - final val KEY_FIELD_NUMBER = 2 - final val BODY_FIELD_NUMBER = 3 + final val SCRUTINEE_FIELD_NUMBER = 1 + final val BOUND_FIELD_NUMBER = 2 + final val CASES_FIELD_NUMBER = 3 @transient @sharable - private[semanticdb] val _typemapper_key: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + private[semanticdb] val _typemapper_scrutinee: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] @transient @sharable - private[semanticdb] val _typemapper_body: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] + private[semanticdb] val _typemapper_bound: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] def of( - typeParameter: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope], - key: dotty.tools.dotc.semanticdb.Type, - body: dotty.tools.dotc.semanticdb.Type - ): _root_.dotty.tools.dotc.semanticdb.CaseType = _root_.dotty.tools.dotc.semanticdb.CaseType( - typeParameter, - key, - body + scrutinee: dotty.tools.dotc.semanticdb.Type, + bound: dotty.tools.dotc.semanticdb.Type, + cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.MatchType.CaseType] + ): _root_.dotty.tools.dotc.semanticdb.MatchType = _root_.dotty.tools.dotc.semanticdb.MatchType( + scrutinee, + bound, + cases ) - // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.CaseType]) + // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType]) } diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 9a2144ae5386..19a5ae4a3c86 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -26,7 +26,15 @@ class TypeOps: def enterParamRef(tpe: Type): Unit = tpe match { case lam: LambdaType => - paramRefSymtab((lam, sym.name)) = sym + // find the real owner type + if lam.paramNames.contains(sym.name) then + paramRefSymtab((lam, sym.name)) = sym + else + enterParamRef(lam.resType) + + // for CaseType `case Array[t] => t` which is represented as [t] =>> MatchCase[Array[t], t] + case m: MatchType => + m.cases.foreach(enterParamRef) // for class constructor // class C[T] { ... } @@ -172,6 +180,8 @@ class TypeOps: case tref: ParamRef => val key = (tref.binder, tref.paramName) + pprint.pprintln(key) + pprint.pprintln(paramRefSymtab) paramRefSymtab.get(key) match { case Some(ref) => val ssym = ref.symbolName @@ -200,57 +210,45 @@ class TypeOps: s.ConstantType(const.toSemanticConst) case lam: HKTypeLambda => - def flatten(lambda: HKTypeLambda, acc: List[List[TypeName]]): (List[List[TypeName]], Type) = { - lambda.resType match { - case res: HKTypeLambda => flatten(res, acc :+ res.paramNames) - case other => (acc, other) - } - } - val (paramNamess, resType) = flatten(lam, Nil) - val paramSymss = paramNamess.map { paramNames => - paramNames.flatMap { paramName => - val key = (lam, paramName) - paramRefSymtab.get(key) - } - } - val stparamss = paramSymss.map(_.sscope) - val sresTpe = loop(resType) - val res = s.TypeLambda(stparamss, sresTpe) - println("===") - println(sym) - println(lam) - println(res) + val stparams = lam.paramNames.flatMap { paramName => + val key = (lam, paramName) + val got = paramRefSymtab.get(key) + got + }.sscope + val sresTpe = loop(lam.resType) + val res = s.TypeLambda(Some(stparams), sresTpe) res case matchType: MatchType => val scases = matchType.cases.map { caseType => caseType match { case lam: HKTypeLambda => - val paramSyms = lam.paramNames.flatMap { paramName => - val key = (lam, paramName) - val get = paramRefSymtab.get(key) - get - }.sscope + // val paramSyms = lam.paramNames.flatMap { paramName => + // val key = (lam, paramName) + // val get = paramRefSymtab.get(key) + // get + // }.sscope lam.resType match { case defn.MatchCase(key, body) => - s.CaseType( - Some(paramSyms), + pprint.pprintln(key) + pprint.pprintln(body) + s.MatchType.CaseType( loop(key), loop(body) ) - case _ => s.CaseType() // shouldn't happen + case _ => s.MatchType.CaseType() // shouldn't happen } case defn.MatchCase(key, body) => val skey = loop(key) val sbody = loop(body) - s.CaseType(Some(s.Scope()), skey, sbody) - case _ => s.CaseType() // shouldn't happen + s.MatchType.CaseType(skey, sbody) + case _ => s.MatchType.CaseType() // shouldn't happen }} val sscrutinee = loop(matchType.scrutinee) val sbound = loop(matchType.bound) val t = s.MatchType(sscrutinee, sbound, scases) - // println(s"===${sym}===") - // println(matchType) - // println(t) + println(s"===${sym}===") + pprint.pprintln(matchType) + pprint.pprintln(t) t case rt @ RefinedType(parent, name, info) => diff --git a/project/Build.scala b/project/Build.scala index fc89ad68e251..cd880fb509c5 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -503,6 +503,7 @@ object Build { // get libraries onboard libraryDependencies ++= Seq( + "com.lihaoyi" %% "pprint" % "0.6.6", "org.scala-lang.modules" % "scala-asm" % "9.1.0-scala-1", // used by the backend Dependencies.oldCompilerInterface, // we stick to the old version to avoid deprecation warnings "org.jline" % "jline-reader" % "3.19.0", // used by the REPL diff --git a/tests/semanticdb/expect/MatchType.scala b/tests/semanticdb/expect/MatchType.scala index 1e155bda412a..3d141d651c60 100644 --- a/tests/semanticdb/expect/MatchType.scala +++ b/tests/semanticdb/expect/MatchType.scala @@ -1,11 +1,10 @@ -type Elem[X] = X match +type Elem[X] <: Any = X match case String => Char case Array[t] => t - case Iterable[t] => t -type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match - case EmptyTuple => Ys - case x *: xs => x *: Concat[xs, Ys] +// type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match +// case EmptyTuple => Ys +// case x *: xs => x *: Concat[xs, Ys] From 56f8fc8fd1c721932388346c960204e3f7976370 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Mon, 5 Jul 2021 17:50:39 +0900 Subject: [PATCH 16/25] updateExpect --- .../semanticdb/expect/MatchType.expect.scala | 9 +++-- tests/semanticdb/metac.expect | 35 +++---------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/tests/semanticdb/expect/MatchType.expect.scala b/tests/semanticdb/expect/MatchType.expect.scala index 260063856b5f..5e6edef47909 100644 --- a/tests/semanticdb/expect/MatchType.expect.scala +++ b/tests/semanticdb/expect/MatchType.expect.scala @@ -1,11 +1,10 @@ -type Elem/*<-_empty_::MatchType$package.Elem#*/[X/*<-_empty_::MatchType$package.Elem#[X]*/] = X/*->_empty_::MatchType$package.Elem#[X]*/ match +type Elem/*<-_empty_::MatchType$package.Elem#*/[X/*<-_empty_::MatchType$package.Elem#[X]*/] <: Any/*->scala::Any#*/ = X/*->_empty_::MatchType$package.Elem#[X]*/ match case String/*->scala::Predef.String#*/ => Char/*->scala::Char#*/ case Array/*->scala::Array#*/[t/*<-local0*/] => t/*->local0*/ - case Iterable/*->scala::package.Iterable#*/[t/*<-local1*/] => t/*->local1*/ -type Concat/*<-_empty_::MatchType$package.Concat#*/[Xs/*<-_empty_::MatchType$package.Concat#[Xs]*/ <: Tuple/*->scala::Tuple#*/, +Ys/*<-_empty_::MatchType$package.Concat#[Ys]*/ <: Tuple/*->scala::Tuple#*/] <: Tuple/*->scala::Tuple#*/ = Xs/*->_empty_::MatchType$package.Concat#[Xs]*/ match - case EmptyTuple/*->scala::Tuple$package.EmptyTuple#*/ => Ys/*->_empty_::MatchType$package.Concat#[Ys]*/ - case x/*<-local2*/ *:/*->scala::`*:`#*/ xs/*<-local3*/ => x/*->local2*/ *:/*->scala::`*:`#*/ Concat/*->_empty_::MatchType$package.Concat#*/[xs/*->local3*/, Ys/*->_empty_::MatchType$package.Concat#[Ys]*/] +// type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match +// case EmptyTuple => Ys +// case x *: xs => x *: Concat[xs, Ys] diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index cff129adda44..daa987819804 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -1993,50 +1993,25 @@ Schema => SemanticDB v4 Uri => MatchType.scala Text => empty Language => Scala -Symbols => 10 entries -Occurrences => 28 entries +Symbols => 4 entries +Occurrences => 9 entries Symbols: -_empty_/MatchType$package. => final package object _empty_ extends Object { self: ._empty_.type => +3 decls } -_empty_/MatchType$package.Concat# => type Concat = -_empty_/MatchType$package.Concat#[Xs] => typeparam Xs -_empty_/MatchType$package.Concat#[Ys] => covariant typeparam Ys +_empty_/MatchType$package. => final package object _empty_ extends Object { self: ._empty_.type => +2 decls } _empty_/MatchType$package.Elem# => type Elem = _empty_/MatchType$package.Elem#[X] => typeparam X local0 => case val method t -local1 => case val method t -local2 => case val method x = -local3 => case val method xs = Occurrences: [2:5..2:9): Elem <- _empty_/MatchType$package.Elem# [2:10..2:11): X <- _empty_/MatchType$package.Elem#[X] -[2:15..2:16): X -> _empty_/MatchType$package.Elem#[X] +[2:16..2:19): Any -> scala/Any# +[2:22..2:23): X -> _empty_/MatchType$package.Elem#[X] [3:7..3:13): String -> scala/Predef.String# [3:17..3:21): Char -> scala/Char# [4:7..4:12): Array -> scala/Array# [4:13..4:14): t <- local0 [4:19..4:20): t -> local0 -[5:7..5:15): Iterable -> scala/package.Iterable# -[5:16..5:17): t <- local1 -[5:22..5:23): t -> local1 -[7:5..7:11): Concat <- _empty_/MatchType$package.Concat# -[7:12..7:14): Xs <- _empty_/MatchType$package.Concat#[Xs] -[7:18..7:23): Tuple -> scala/Tuple# -[7:26..7:28): Ys <- _empty_/MatchType$package.Concat#[Ys] -[7:32..7:37): Tuple -> scala/Tuple# -[7:42..7:47): Tuple -> scala/Tuple# -[7:50..7:52): Xs -> _empty_/MatchType$package.Concat#[Xs] -[8:7..8:17): EmptyTuple -> scala/Tuple$package.EmptyTuple# -[8:21..8:23): Ys -> _empty_/MatchType$package.Concat#[Ys] -[9:7..9:8): x <- local2 -[9:9..9:11): *: -> scala/`*:`# -[9:12..9:14): xs <- local3 -[9:18..9:19): x -> local2 -[9:20..9:22): *: -> scala/`*:`# -[9:23..9:29): Concat -> _empty_/MatchType$package.Concat# -[9:30..9:32): xs -> local3 -[9:34..9:36): Ys -> _empty_/MatchType$package.Concat#[Ys] expect/MetacJava.scala ---------------------- From fa167bc38d29a2d67450f795744565f3fd828a6b Mon Sep 17 00:00:00 2001 From: tanishiking Date: Tue, 6 Jul 2021 15:48:50 +0900 Subject: [PATCH 17/25] Refactor not to use isInstanceOf for designator of TypeRef and TermRef --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 6047d459cc80..ebd12eecb444 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -153,14 +153,14 @@ class TypeOps: val stpe = loop(tpe) s.ByNameType(stpe) - case TypeRef(pre, desig) if desig.isInstanceOf[Symbol] => + case TypeRef(pre, sym: Symbol) => val spre = if(tpe.hasTrivialPrefix) s.Type.Empty else loop(pre) - val ssym = desig.asInstanceOf[Symbol].symbolName + val ssym = sym.symbolName s.TypeRef(spre, ssym, Seq.empty) - case TermRef(pre, desig) if desig.isInstanceOf[Symbol] => + case TermRef(pre, sym: Symbol) => val spre = if(tpe.hasTrivialPrefix) s.Type.Empty else loop(pre) - val ssym = desig.asInstanceOf[Symbol].symbolName + val ssym = sym.symbolName s.SingleType(spre, ssym) case tref: ParamRef => @@ -176,9 +176,8 @@ class TypeOps: s.Type.Empty } - case ThisType(TypeRef(_, desig)) if desig.isInstanceOf[Symbol] => - val ssym = desig.asInstanceOf[Symbol].symbolName - s.ThisType(ssym) + case ThisType(TypeRef(_, sym: Symbol)) => + s.ThisType(sym.symbolName) case SuperType(thistpe, supertpe) => val spre = loop(thistpe.typeSymbol.info) @@ -286,10 +285,10 @@ class TypeOps: def checkTrivialPrefix(pre: Type, sym: Symbol)(using Context): Boolean = pre =:= sym.owner.thisType tpe match { - case TypeRef(pre, desig) if desig.isInstanceOf[Symbol] => - checkTrivialPrefix(pre, desig.asInstanceOf[Symbol]) - case TermRef(pre, desig) if desig.isInstanceOf[Symbol] => - checkTrivialPrefix(pre, desig.asInstanceOf[Symbol]) + case TypeRef(pre, sym: Symbol) => + checkTrivialPrefix(pre, sym) + case TermRef(pre, sym: Symbol) => + checkTrivialPrefix(pre, sym) case _ => false } From 5af073764d338ae5ef5525c4f2803a6751f29936 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Tue, 6 Jul 2021 16:18:47 +0900 Subject: [PATCH 18/25] Use intersection type for the parent of RefinedType --- compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index ebd12eecb444..58c32f30ea80 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -220,7 +220,7 @@ class TypeOps: } val (parent, refinedInfos) = flatten(rt, List.empty) - val stpe = s.WithType(flattenParent(parent)) + val stpe = s.IntersectionType(flattenParent(parent)) val decls = refinedInfos.flatMap { (name, _) => refinementSymtab.get((rt, name)) From f509613cfd5ece7bd31789c57c907d2388040763 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Tue, 6 Jul 2021 19:52:32 +0900 Subject: [PATCH 19/25] Convert wildcard type as ExistentialType For wildcard type `C[_ <: T]`, it's internal type representation will be `AppliedType(TypeBounds(lo = , hi = ))`. As scalameta for Scala2 does, we'll convert the wildcard type to `ExistentialType(TypeRef(NoPrefix, C, ), Scope(hardlinks = List()))` where `` has - display_name: "_" and, - signature: type_signature(..., lo = , hi = ) See: https://github.com/lampepfl/dotty/pull/12885/files#r663797616 https://scalameta.org/docs/semanticdb/specification.html#type-2 Now, when we compile the following Scala program to semanticdb ```scala class Wildcards { def e1: List[_ <: Int] = ??? } ``` The semanticdb's SymbolInformation for `e1` looks like: From scala3 ``` symbols { symbol: "advanced/Wildcards#e1()." kind: METHOD display_name: "e1" language: SCALA signature { value_signature { tpe { by_name_type { tpe { existential_type { tpe { type_ref { symbol: "scala/collection/immutable/List#" type_arguments { type_ref { symbol: "local0" } } } } declarations { hardlinks { symbol: "local0" kind: TYPE display_name: "_" language: SCALA signature { type_signature { type_parameters { } lower_bound { type_ref { symbol: "scala/Nothing#" } } upper_bound { type_ref { symbol: "scala/Int#" } } } } } } } } } } } } } ``` On the other hand, generated from scalameta's metac with scalac 2.13.6 ```sh $ metac --version Scala compiler version 2.13.6 -- Copyright 2002-2021, LAMP/EPFL and Lightbend, Inc. ``` ``` symbols { symbol: "advanced/Wildcards#e()." kind: METHOD display_name: "e" language: SCALA signature { method_signature { type_parameters { } return_type { existential_type { tpe { type_ref { symbol: "scala/package.List#" type_arguments { type_ref { symbol: "local0" } } } } declarations { hardlinks { symbol: "local0" kind: TYPE properties: 4 display_name: "_" language: SCALA signature { type_signature { type_parameters { } lower_bound { type_ref { symbol: "scala/Nothing#" } } upper_bound { type_ref { symbol: "scala/Int#" } } } } access { public_access { } } } } } } } } access { public_access { } } } ``` --- .../dotty/tools/dotc/semanticdb/PPrint.scala | 5 +- .../semanticdb/SemanticSymbolBuilder.scala | 25 +-- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 31 +++- tests/semanticdb/expect/Advanced.expect.scala | 5 +- tests/semanticdb/expect/Advanced.scala | 1 + .../semanticdb/expect/Anonymous.expect.scala | 2 +- tests/semanticdb/expect/Enums.expect.scala | 2 +- .../expect/semanticdb-Types.expect.scala | 2 +- tests/semanticdb/metac.expect | 155 +++++++++--------- 9 files changed, 134 insertions(+), 94 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala b/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala index f1dde00c038f..5553468f8682 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala @@ -161,7 +161,10 @@ class SymbolInfomationPrinter (symtab: PrinterSymtab): s"${normal(utpe)} ${declsStr}" case AnnotatedType(anns, utpe) => s"${normal(utpe)} ${anns.map(pprint).mkString(" ")}" - // case ExistentialType(utpe, decls) => // Scala3 shouldn't emit ExistentialType + case ExistentialType(utpe, decls) => + val sdecls = decls.infos.map(_.displayName).mkString("; ") + val sutpe = normal(utpe) + s"${sutpe} forSome { ${sdecls} }" case UniversalType(tparams, utpe) => val params = tparams.infos.map(_.displayName).mkString("[", ", ", "]") val resType = normal(utpe) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala index 0446d86bc4bb..9297fa6ec5f1 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala @@ -92,19 +92,24 @@ class SemanticSymbolBuilder: */ def localIdx(sym: Symbol)(using Context): Int = val startPos = - assert(sym.span.exists, s"$sym should have a span") - sym.span.start + // assert(sym.span.exists, s"$sym should have a span") + if (sym.span.exists) Some(sym.span.start) else None @tailrec def computeLocalIdx(sym: Symbol): Int = locals get sym match case Some(idx) => idx - case None => symsAtOffset(startPos).find(_.name == sym.name) match - case Some(other) => computeLocalIdx(other) - case None => - val idx = nextLocalIdx - nextLocalIdx += 1 - locals(sym) = idx - symsAtOffset(startPos) += sym - idx + case None => + (for { + pos <- startPos + syms <- symsAtOffset.get(pos) + found <- syms.find(_.name == sym.name) + } yield found) match + case Some(other) => computeLocalIdx(other) + case None => + val idx = nextLocalIdx + nextLocalIdx += 1 + locals(sym) = idx + startPos.foreach(pos => symsAtOffset(pos) += sym) + idx end computeLocalIdx computeLocalIdx(sym) end localIdx diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 58c32f30ea80..72c28a90762b 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -253,12 +253,37 @@ class TypeOps: s.AnnotatedType(sannots, sparent) case app @ AppliedType(tycon, args) => - val sargs = args.map(loop) - loop(tycon) match + val targs = args.map { arg => + arg match + // For wildcard type C[_ <: T], it's internal type representation will be + // `AppliedType(TypeBounds(lo = , hi = ))`. + // + // As scalameta for Scala2 does, we'll convert the wildcard type to + // `ExistentialType(TypeRef(NoPrefix, C, ), Scope(hardlinks = List()))` + // where `` has + // display_name: "_" and, + // signature: type_signature(..., lo = , hi = ) + case bounds: TypeBounds => + val wildcardSym = newSymbol(NoSymbol, tpnme.WILDCARD, Flags.EmptyFlags, bounds) + val ssym = wildcardSym.symbolName + (Some(wildcardSym), s.TypeRef(s.Type.Empty, ssym, Seq.empty)) + case other => + val sarg = loop(other) + (None, sarg) + } + val wildcardSyms = targs.flatMap(_._1) + val sargs = targs.map(_._2) + + val applied = loop(tycon) match case ref: s.TypeRef => ref.copy(typeArguments = sargs) - // is there any other cases? case _ => s.Type.Empty + if (wildcardSyms.isEmpty) applied + else s.ExistentialType( + applied, + Some(wildcardSyms.sscope(using LinkMode.HardlinkChildren)) + ) + case and: AndType => def flatten(child: Type): List[Type] = child match case AndType(ct1, ct2) => flatten(ct1) ++ flatten(ct2) diff --git a/tests/semanticdb/expect/Advanced.expect.scala b/tests/semanticdb/expect/Advanced.expect.scala index 7b8b3dea9121..9dea20965e18 100644 --- a/tests/semanticdb/expect/Advanced.expect.scala +++ b/tests/semanticdb/expect/Advanced.expect.scala @@ -18,6 +18,7 @@ class Structural/*<-advanced::Structural#*/ { class Wildcards/*<-advanced::Wildcards#*/ { def e1/*<-advanced::Wildcards#e1().*/: List/*->scala::package.List#*/[_] = ???/*->scala::Predef.`???`().*/ + def e2/*<-advanced::Wildcards#e2().*/: List/*->scala::package.List#*/[_ <: Int/*->scala::Int#*/] = ???/*->scala::Predef.`???`().*/ } object Test/*<-advanced::Test.*/ { @@ -35,8 +36,8 @@ object Test/*<-advanced::Test.*/ { { (???/*->scala::Predef.`???`().*/ : Any/*->scala::Any#*/) match { - case e3/*<-local12*/: List/*->scala::package.List#*/[_] => - val e3x/*<-local14*/ = e3/*->local12*/.head/*->scala::collection::IterableOps#head().*/ + case e3/*<-local15*/: List/*->scala::package.List#*/[_] => + val e3x/*<-local17*/ = e3/*->local15*/.head/*->scala::collection::IterableOps#head().*/ () } } diff --git a/tests/semanticdb/expect/Advanced.scala b/tests/semanticdb/expect/Advanced.scala index d40aebcc3efc..15b1b2c12b43 100644 --- a/tests/semanticdb/expect/Advanced.scala +++ b/tests/semanticdb/expect/Advanced.scala @@ -18,6 +18,7 @@ class Structural { class Wildcards { def e1: List[_] = ??? + def e2: List[_ <: Int] = ??? } object Test { diff --git a/tests/semanticdb/expect/Anonymous.expect.scala b/tests/semanticdb/expect/Anonymous.expect.scala index 655bafc719a0..69c31ee59111 100644 --- a/tests/semanticdb/expect/Anonymous.expect.scala +++ b/tests/semanticdb/expect/Anonymous.expect.scala @@ -12,7 +12,7 @@ class Anonymous/*<-example::Anonymous#*/ { ???/*->scala::Predef.`???`().*/ match { case _: List/*->scala::package.List#*/[_] => } } locally/*->example::Anonymous#locally().*/ { - val x/*<-local0*/: Int/*->scala::Int#*/ => Int/*->scala::Int#*/ = _ => ???/*->scala::Predef.`???`().*/ + val x/*<-local2*/: Int/*->scala::Int#*/ => Int/*->scala::Int#*/ = _ => ???/*->scala::Predef.`???`().*/ } trait Foo/*<-example::Anonymous#Foo#*/ diff --git a/tests/semanticdb/expect/Enums.expect.scala b/tests/semanticdb/expect/Enums.expect.scala index 8d99d98fc6da..057344d99169 100644 --- a/tests/semanticdb/expect/Enums.expect.scala +++ b/tests/semanticdb/expect/Enums.expect.scala @@ -50,7 +50,7 @@ object Enums/*<-_empty_::Enums.*/: given /*<-_empty_::Enums.`<:<`.`given_<:<_T_T`().*/[T/*<-_empty_::Enums.`<:<`.`given_<:<_T_T`().[T]*/]: (T/*->_empty_::Enums.`<:<`.`given_<:<_T_T`().[T]*/ <:_empty_::Enums.`<:<`#*/ T/*->_empty_::Enums.`<:<`.`given_<:<_T_T`().[T]*/) = Refl/*->_empty_::Enums.`<:<`.Refl.*//*->_empty_::Enums.`<:<`.Refl.apply().*/() extension [A/*<-_empty_::Enums.unwrap().[A]*/, B/*<-_empty_::Enums.unwrap().[B]*/](opt/*<-_empty_::Enums.unwrap().(opt)*/: Option/*->scala::Option#*/[A/*->_empty_::Enums.unwrap().[A]*/]) def unwrap/*<-_empty_::Enums.unwrap().*/(using ev/*<-_empty_::Enums.unwrap().(ev)*/: A/*->_empty_::Enums.unwrap().[A]*/ <:_empty_::Enums.`<:<`#*/ Option/*->scala::Option#*/[B/*->_empty_::Enums.unwrap().[B]*/]): Option/*->scala::Option#*/[B/*->_empty_::Enums.unwrap().[B]*/] = ev/*->_empty_::Enums.unwrap().(ev)*/ match - case Refl/*->_empty_::Enums.`<:<`.Refl.*//*->_empty_::Enums.`<:<`.Refl.unapply().*/() => opt/*->_empty_::Enums.unwrap().(opt)*/.flatMap/*->scala::Option#flatMap().*/(identity/*->scala::Predef.identity().*//*->local0*/[Option/*->scala::Option#*/[B/*->_empty_::Enums.unwrap().[B]*/]]) + case Refl/*->_empty_::Enums.`<:<`.Refl.*//*->_empty_::Enums.`<:<`.Refl.unapply().*/() => opt/*->_empty_::Enums.unwrap().(opt)*/.flatMap/*->scala::Option#flatMap().*/(identity/*->scala::Predef.identity().*//*->local7*/[Option/*->scala::Option#*/[B/*->_empty_::Enums.unwrap().[B]*/]]) val some1/*<-_empty_::Enums.some1.*/ = Some/*->scala::Some.*//*->scala::Some.apply().*/(Some/*->scala::Some.*//*->scala::Some.apply().*/(1)).unwrap/*->_empty_::Enums.unwrap().*//*->_empty_::Enums.`<:<`.`given_<:<_T_T`().*/ diff --git a/tests/semanticdb/expect/semanticdb-Types.expect.scala b/tests/semanticdb/expect/semanticdb-Types.expect.scala index b39d7aad59af..47dd297c07df 100644 --- a/tests/semanticdb/expect/semanticdb-Types.expect.scala +++ b/tests/semanticdb/expect/semanticdb-Types.expect.scala @@ -74,7 +74,7 @@ object Test/*<-types::Test.*/ { val existentialType4/*<-types::Test.C#existentialType4.*/ = Class/*->java::lang::Class#*/.forName/*->java::lang::Class#forName().*/("foo.Bar") def typeLambda1/*<-types::Test.C#typeLambda1().*/[M/*<-types::Test.C#typeLambda1().[M]*/[_]] = ???/*->scala::Predef.`???`().*/ - typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local11*/[T/*<-local10*/] = List/*->scala::package.List#*/[T/*->local10*/] })#L] + typeLambda1/*->types::Test.C#typeLambda1().*/[({ type L/*<-local14*/[T/*<-local13*/] = List/*->scala::package.List#*/[T/*->local13*/] })#L] object ClassInfoType1/*<-types::Test.C#ClassInfoType1.*/ class ClassInfoType2/*<-types::Test.C#ClassInfoType2#*/ extends B/*->types::B#*/ { def x/*<-types::Test.C#ClassInfoType2#x().*/ = 42 } diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 8dca6e17c5d3..7ba0543cd3ab 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -49,8 +49,8 @@ Schema => SemanticDB v4 Uri => Advanced.scala Text => empty Language => Scala -Symbols => 37 entries -Occurrences => 96 entries +Symbols => 38 entries +Occurrences => 100 entries Symbols: advanced/C# => class C [typeparam T ] extends Object { self: C[T] => +3 decls } @@ -66,7 +66,7 @@ advanced/Structural#s4(). => method s4 (param a: Int): Object { abstract val met advanced/Structural#s4().(a) => param a: Int advanced/Test. => final object Test extends Object { self: .Test.type => +11 decls } advanced/Test.e. => val method e Wildcards -advanced/Test.e1. => val method e1 List[] +advanced/Test.e1. => val method e1 List[local14] forSome { _ } advanced/Test.e1x. => val method e1x Any advanced/Test.s. => val method s Structural advanced/Test.s1. => val method s1 Object { abstract val method x Int } @@ -75,9 +75,10 @@ advanced/Test.s2. => val method s2 Object { abstract val method x Int } advanced/Test.s2x. => val method s2x Int advanced/Test.s3. => val method s3 Object { abstract method m (param x: Int): Int } advanced/Test.s3x. => val method s3x Int -advanced/Wildcards# => class Wildcards extends Object { self: Wildcards => +2 decls } +advanced/Wildcards# => class Wildcards extends Object { self: Wildcards => +3 decls } advanced/Wildcards#``(). => primary ctor (): Wildcards -advanced/Wildcards#e1(). => method e1 => List[] +advanced/Wildcards#e1(). => method e1 => List[local12] forSome { _ } +advanced/Wildcards#e2(). => method e2 => List[local13] forSome { _ } local0 => abstract val method x Int local1 => abstract val method x Int local2 => val method x Int @@ -88,8 +89,8 @@ local7 => param x: Int local8 => method m (param x: Int): Int local9 => final class $anon extends Object { self: $anon => +2 decls } local11 => abstract val method x Int -local12 => val local e3: List[local13] -local14 => val local e3x: local13 +local15 => val local e3: List[local16] +local17 => val local e3x: local16 Occurrences: [0:8..0:16): advanced <- advanced/ @@ -142,52 +143,56 @@ Occurrences: [19:6..19:8): e1 <- advanced/Wildcards#e1(). [19:10..19:14): List -> scala/package.List# [19:20..19:23): ??? -> scala/Predef.`???`(). -[22:7..22:11): Test <- advanced/Test. -[23:6..23:7): s <- advanced/Test.s. -[23:14..23:24): Structural -> advanced/Structural# -[23:24..23:24): -> advanced/Structural#``(). -[24:6..24:8): s1 <- advanced/Test.s1. -[24:11..24:12): s -> advanced/Test.s. -[24:13..24:15): s1 -> advanced/Structural#s1(). -[25:6..25:9): s1x <- advanced/Test.s1x. -[25:12..25:12): -> scala/reflect/Selectable.reflectiveSelectable(). -[25:12..25:13): s -> advanced/Test.s. -[25:14..25:16): s1 -> advanced/Structural#s1(). -[25:16..25:16): -> scala/reflect/Selectable#selectDynamic(). -[26:6..26:8): s2 <- advanced/Test.s2. -[26:11..26:12): s -> advanced/Test.s. -[26:13..26:15): s2 -> advanced/Structural#s2(). -[27:6..27:9): s2x <- advanced/Test.s2x. -[27:12..27:12): -> scala/reflect/Selectable.reflectiveSelectable(). -[27:12..27:13): s -> advanced/Test.s. -[27:14..27:16): s2 -> advanced/Structural#s2(). -[27:16..27:16): -> scala/reflect/Selectable#selectDynamic(). -[28:6..28:8): s3 <- advanced/Test.s3. -[28:11..28:12): s -> advanced/Test.s. -[28:13..28:15): s3 -> advanced/Structural#s3(). -[29:6..29:9): s3x <- advanced/Test.s3x. -[29:12..29:12): -> scala/reflect/Selectable.reflectiveSelectable(). -[29:12..29:13): s -> advanced/Test.s. -[29:14..29:16): s3 -> advanced/Structural#s3(). -[29:16..29:16): -> scala/reflect/Selectable#applyDynamic(). -[29:19..29:22): ??? -> scala/Predef.`???`(). -[31:6..31:7): e <- advanced/Test.e. -[31:14..31:23): Wildcards -> advanced/Wildcards# -[31:23..31:23): -> advanced/Wildcards#``(). -[32:6..32:8): e1 <- advanced/Test.e1. -[32:11..32:12): e -> advanced/Test.e. -[32:13..32:15): e1 -> advanced/Wildcards#e1(). -[33:6..33:9): e1x <- advanced/Test.e1x. -[33:12..33:13): e -> advanced/Test.e. -[33:14..33:16): e1 -> advanced/Wildcards#e1(). -[33:17..33:21): head -> scala/collection/IterableOps#head(). -[36:5..36:8): ??? -> scala/Predef.`???`(). -[36:11..36:14): Any -> scala/Any# -[37:11..37:13): e3 <- local12 -[37:15..37:19): List -> scala/package.List# -[38:12..38:15): e3x <- local14 -[38:18..38:20): e3 -> local12 -[38:21..38:25): head -> scala/collection/IterableOps#head(). +[20:6..20:8): e2 <- advanced/Wildcards#e2(). +[20:10..20:14): List -> scala/package.List# +[20:20..20:23): Int -> scala/Int# +[20:27..20:30): ??? -> scala/Predef.`???`(). +[23:7..23:11): Test <- advanced/Test. +[24:6..24:7): s <- advanced/Test.s. +[24:14..24:24): Structural -> advanced/Structural# +[24:24..24:24): -> advanced/Structural#``(). +[25:6..25:8): s1 <- advanced/Test.s1. +[25:11..25:12): s -> advanced/Test.s. +[25:13..25:15): s1 -> advanced/Structural#s1(). +[26:6..26:9): s1x <- advanced/Test.s1x. +[26:12..26:12): -> scala/reflect/Selectable.reflectiveSelectable(). +[26:12..26:13): s -> advanced/Test.s. +[26:14..26:16): s1 -> advanced/Structural#s1(). +[26:16..26:16): -> scala/reflect/Selectable#selectDynamic(). +[27:6..27:8): s2 <- advanced/Test.s2. +[27:11..27:12): s -> advanced/Test.s. +[27:13..27:15): s2 -> advanced/Structural#s2(). +[28:6..28:9): s2x <- advanced/Test.s2x. +[28:12..28:12): -> scala/reflect/Selectable.reflectiveSelectable(). +[28:12..28:13): s -> advanced/Test.s. +[28:14..28:16): s2 -> advanced/Structural#s2(). +[28:16..28:16): -> scala/reflect/Selectable#selectDynamic(). +[29:6..29:8): s3 <- advanced/Test.s3. +[29:11..29:12): s -> advanced/Test.s. +[29:13..29:15): s3 -> advanced/Structural#s3(). +[30:6..30:9): s3x <- advanced/Test.s3x. +[30:12..30:12): -> scala/reflect/Selectable.reflectiveSelectable(). +[30:12..30:13): s -> advanced/Test.s. +[30:14..30:16): s3 -> advanced/Structural#s3(). +[30:16..30:16): -> scala/reflect/Selectable#applyDynamic(). +[30:19..30:22): ??? -> scala/Predef.`???`(). +[32:6..32:7): e <- advanced/Test.e. +[32:14..32:23): Wildcards -> advanced/Wildcards# +[32:23..32:23): -> advanced/Wildcards#``(). +[33:6..33:8): e1 <- advanced/Test.e1. +[33:11..33:12): e -> advanced/Test.e. +[33:13..33:15): e1 -> advanced/Wildcards#e1(). +[34:6..34:9): e1x <- advanced/Test.e1x. +[34:12..34:13): e -> advanced/Test.e. +[34:14..34:16): e1 -> advanced/Wildcards#e1(). +[34:17..34:21): head -> scala/collection/IterableOps#head(). +[37:5..37:8): ??? -> scala/Predef.`???`(). +[37:11..37:14): Any -> scala/Any# +[38:11..38:13): e3 <- local15 +[38:15..38:19): List -> scala/package.List# +[39:12..39:15): e3x <- local17 +[39:18..39:20): e3 -> local15 +[39:21..39:25): head -> scala/collection/IterableOps#head(). expect/Annotations.scala ------------------------ @@ -300,9 +305,9 @@ example/Anonymous#locally().(x) => param x: A example/Anonymous#locally().[A] => typeparam A example/Anonymous#m1(). => method m1 [] => Nothing example/Anonymous#m1().[T] => typeparam T -example/Anonymous#m2(). => method m2 => Map[, List[]] -local0 => val local x: Function1[Int, Int] -local1 => final class $anon extends Object with Foo { self: $anon => +1 decls } +example/Anonymous#m2(). => method m2 => Map[local0, List[local1] forSome { _ }] forSome { _ } +local2 => val local x: Function1[Int, Int] +local3 => final class $anon extends Object with Foo { self: $anon => +1 decls } Occurrences: [0:8..0:15): example <- example/ @@ -329,7 +334,7 @@ Occurrences: [11:4..11:7): ??? -> scala/Predef.`???`(). [11:24..11:28): List -> scala/package.List# [13:2..13:9): locally -> example/Anonymous#locally(). -[14:8..14:9): x <- local0 +[14:8..14:9): x <- local2 [14:11..14:14): Int -> scala/Int# [14:18..14:21): Int -> scala/Int# [14:29..14:32): ??? -> scala/Predef.`???`(). @@ -906,7 +911,7 @@ _empty_/Enums.Maybe.Just.unapply(). => method unapply [typeparam A ](param x$1: _empty_/Enums.Maybe.Just.unapply().(x$1) => param x$1: Just[A] _empty_/Enums.Maybe.Just.unapply().[A] => typeparam A _empty_/Enums.Maybe.None. => case val static enum method None Maybe[Nothing] -_empty_/Enums.Maybe.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Maybe[] +_empty_/Enums.Maybe.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Maybe[local0] forSome { _ } _empty_/Enums.Maybe.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.Planet# => abstract sealed enum class Planet extends Enum[Planet] with Enum { self: Planet => +6 decls } _empty_/Enums.Planet#G. => final val method G 6.673E-11 @@ -958,14 +963,14 @@ _empty_/Enums.Tag# => abstract sealed enum class Tag [typeparam A ] extends Obje _empty_/Enums.Tag#[A] => typeparam A _empty_/Enums.Tag#``(). => primary ctor [unknown A: ]: Tag[A] _empty_/Enums.Tag. => final object Tag extends Object { self: .Tag.type => +7 decls } -_empty_/Enums.Tag.$values. => val method $values Array[Tag[]] +_empty_/Enums.Tag.$values. => val method $values Array[Tag[local1] forSome { _ }] _empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag Tag[Boolean] _empty_/Enums.Tag.IntTag. => case val static enum method IntTag Tag[Int] -_empty_/Enums.Tag.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Tag[] +_empty_/Enums.Tag.fromOrdinal(). => method fromOrdinal (param ordinal: Int): Tag[local4] forSome { _ } _empty_/Enums.Tag.fromOrdinal().(ordinal) => param ordinal: Int -_empty_/Enums.Tag.valueOf(). => method valueOf (param $name: String): Tag[] +_empty_/Enums.Tag.valueOf(). => method valueOf (param $name: String): Tag[local3] forSome { _ } _empty_/Enums.Tag.valueOf().($name) => param $name: String -_empty_/Enums.Tag.values(). => method values => Array[Tag[]] +_empty_/Enums.Tag.values(). => method values => Array[Tag[local2] forSome { _ }] _empty_/Enums.WeekDays# => abstract sealed enum class WeekDays extends Object with Enum { self: WeekDays => +1 decls } _empty_/Enums.WeekDays#``(). => primary ctor (): WeekDays _empty_/Enums.WeekDays. => final object WeekDays extends Object { self: .WeekDays.type => +13 decls } @@ -1005,7 +1010,7 @@ _empty_/Enums.`<:<`.Refl.unapply().(x$1) => param x$1: Refl[C] _empty_/Enums.`<:<`.Refl.unapply().[C] => typeparam C _empty_/Enums.`<:<`.`given_<:<_T_T`(). => final implicit method given_<:<_T_T [] => <:<[T, T] _empty_/Enums.`<:<`.`given_<:<_T_T`().[T] => typeparam T -_empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal (param ordinal: Int): <:<[, ] +_empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal (param ordinal: Int): <:<[local5, local6] forSome { _; _ } _empty_/Enums.`<:<`.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.some1. => val method some1 Option[Int] _empty_/Enums.unwrap(). => method unwrap [typeparam A , typeparam B ](param opt: Option[A])(implicit param ev: <:<[A, Option[B]]): @@ -1013,7 +1018,7 @@ _empty_/Enums.unwrap().(ev) => implicit param ev: <:<[A, Option[B]] _empty_/Enums.unwrap().(opt) => param opt: Option[A] _empty_/Enums.unwrap().[A] => typeparam A _empty_/Enums.unwrap().[B] => typeparam B -local0 => param x: Option[B] +local7 => param x: Option[B] Occurrences: [0:7..0:12): Enums <- _empty_/Enums. @@ -1142,7 +1147,7 @@ Occurrences: [52:19..52:22): opt -> _empty_/Enums.unwrap().(opt) [52:23..52:30): flatMap -> scala/Option#flatMap(). [52:31..52:39): identity -> scala/Predef.identity(). -[52:31..52:31): -> local0 +[52:31..52:31): -> local7 [52:40..52:46): Option -> scala/Option# [52:47..52:48): B -> _empty_/Enums.unwrap().[B] [54:6..54:11): some1 <- _empty_/Enums.some1. @@ -3753,7 +3758,7 @@ local2 => case val method N$2 local3 => val local p: N$2 local4 => val local Nat_this: .Zero.type local5 => val local Nat_this: Succ[.Zero.type] -local6 => val local Nat_this: Succ[] +local6 => val local Nat_this: Succ[local7] forSome { _ } recursion/Nats. => final object Nats extends Object { self: .Nats.type => +9 decls } recursion/Nats.Nat# => sealed trait Nat extends Object { self: Nat => +3 decls } recursion/Nats.Nat#`++`(). => macro ++ => Succ[Nat.this.type] @@ -4042,8 +4047,8 @@ local3 => final class $anon extends Object { self: $anon => +2 decls } local5 => final class $anon extends M with N { self: $anon => +1 decls } local7 => method k => Int local8 => final class $anon extends M with N { self: $anon => +2 decls } -local10 => typeparam T -local11 => type L [typeparam T ] = List[T] +local13 => typeparam T +local14 => type L [typeparam T ] = List[T] types/B# => class B extends Object { self: B => +1 decls } types/B#``(). => primary ctor (): B types/C# => class C extends Object { self: C => +1 decls } @@ -4128,13 +4133,13 @@ types/Test.C#annType1. => val method annType1 T @ann[T] types/Test.C#annType2. => val method annType2 T @ann1 @ann2 types/Test.C#compoundType1. => val method compoundType1 Object { abstract method k => Int } types/Test.C#compoundType2. => val method compoundType2 M & N -types/Test.C#compoundType3. => val method compoundType3 M with N { abstract method k => Int } +types/Test.C#compoundType3. => val method compoundType3 M & N { abstract method k => Int } types/Test.C#compoundType4. => val method compoundType4 Object types/Test.C#compoundType5. => val method compoundType5 M & N types/Test.C#compoundType6. => val method compoundType6 M & N -types/Test.C#existentialType2. => val method existentialType2 List[] -types/Test.C#existentialType3. => val method existentialType3 Class[] -types/Test.C#existentialType4. => val method existentialType4 Class[] +types/Test.C#existentialType2. => val method existentialType2 List[local10] forSome { _ } +types/Test.C#existentialType3. => val method existentialType3 Class[local11] forSome { _ } +types/Test.C#existentialType4. => val method existentialType4 Class[local12] forSome { _ } types/Test.C#p. => val method p P types/Test.C#singleType1. => val method singleType1 .x.type types/Test.C#singleType2. => val method singleType2 .p.x.type @@ -4341,10 +4346,10 @@ Occurrences: [75:20..75:21): M <- types/Test.C#typeLambda1().[M] [75:28..75:31): ??? -> scala/Predef.`???`(). [76:4..76:15): typeLambda1 -> types/Test.C#typeLambda1(). -[76:24..76:25): L <- local11 -[76:26..76:27): T <- local10 +[76:24..76:25): L <- local14 +[76:26..76:27): T <- local13 [76:31..76:35): List -> scala/package.List# -[76:36..76:37): T -> local10 +[76:36..76:37): T -> local13 [78:11..78:25): ClassInfoType1 <- types/Test.C#ClassInfoType1. [79:10..79:24): ClassInfoType2 <- types/Test.C#ClassInfoType2# [79:33..79:34): B -> types/B# From 139491bf42806215007d785d7995ae9e6615b402 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Wed, 7 Jul 2021 11:18:44 +0900 Subject: [PATCH 20/25] Use finalResultType for MethodSignature to get actual return type. --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 2 +- tests/semanticdb/metac.expect | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 72c28a90762b..7e2f321320e9 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -91,7 +91,7 @@ class TypeOps: s.MethodSignature( stparams, sparamss, - mt.resType.toSemanticType(sym) + mt.finalResultType.toSemanticType(sym) ) case cls: ClassInfo => diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 7ba0543cd3ab..947c2725cbfe 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -462,7 +462,7 @@ classes/C12#foo1(). => macro foo1 (param x: Int): Int classes/C12#foo1(). => method foo1 (param x: Int): Int classes/C12#foo1().(x) => param x: Int classes/C12#foo1().(x) => param x: Int -classes/C12#foo1Impl(). => method foo1Impl (param context: Context)(param x: .context.Expr[Int]): +classes/C12#foo1Impl(). => method foo1Impl (param context: Context)(param x: .context.Expr[Int]): .context.Expr[Int] classes/C12#foo1Impl().(context) => param context: Context classes/C12#foo1Impl().(x) => param x: .context.Expr[Int] classes/C12#foo2(). => macro foo2 (param x: Int, param y: String): Int @@ -471,7 +471,7 @@ classes/C12#foo2().(x) => param x: Int classes/C12#foo2().(x) => param x: Int classes/C12#foo2().(y) => param y: String classes/C12#foo2().(y) => param y: String -classes/C12#foo2Impl(). => method foo2Impl (param context: Context)(param x: .context.Expr[Int], param y: .context.Expr[String]): +classes/C12#foo2Impl(). => method foo2Impl (param context: Context)(param x: .context.Expr[Int], param y: .context.Expr[String]): .context.Expr[Int] classes/C12#foo2Impl().(context) => param context: Context classes/C12#foo2Impl().(x) => param x: .context.Expr[Int] classes/C12#foo2Impl().(y) => param y: .context.Expr[String] @@ -1013,7 +1013,7 @@ _empty_/Enums.`<:<`.`given_<:<_T_T`().[T] => typeparam T _empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal (param ordinal: Int): <:<[local5, local6] forSome { _; _ } _empty_/Enums.`<:<`.fromOrdinal().(ordinal) => param ordinal: Int _empty_/Enums.some1. => val method some1 Option[Int] -_empty_/Enums.unwrap(). => method unwrap [typeparam A , typeparam B ](param opt: Option[A])(implicit param ev: <:<[A, Option[B]]): +_empty_/Enums.unwrap(). => method unwrap [typeparam A , typeparam B ](param opt: Option[A])(implicit param ev: <:<[A, Option[B]]): Option[B] _empty_/Enums.unwrap().(ev) => implicit param ev: <:<[A, Option[B]] _empty_/Enums.unwrap().(opt) => param opt: Option[A] _empty_/Enums.unwrap().[A] => typeparam A @@ -1294,7 +1294,7 @@ Occurrences => 18 entries Symbols: ext/Extension$package. => final package object ext extends Object { self: .ext.type => +5 decls } -ext/Extension$package.`#*#`(). => method #*# (param s: String)(param i: Int): +ext/Extension$package.`#*#`(). => method #*# (param s: String)(param i: Int): Tuple2[String, Int] ext/Extension$package.`#*#`().(i) => param i: Int ext/Extension$package.`#*#`().(s) => param s: String ext/Extension$package.a. => val method a Int @@ -1454,7 +1454,7 @@ a/b/Givens. => final object Givens extends Object { self: .Givens.type => +12 a/b/Givens.Monoid# => trait Monoid [typeparam A ] extends Object { self: Monoid[A] => +4 decls } a/b/Givens.Monoid#[A] => typeparam A a/b/Givens.Monoid#``(). => primary ctor [unknown A: ]: Monoid[A] -a/b/Givens.Monoid#combine(). => abstract method combine (param x: A)(param y: A): +a/b/Givens.Monoid#combine(). => abstract method combine (param x: A)(param y: A): A a/b/Givens.Monoid#combine().(x) => param x: A a/b/Givens.Monoid#combine().(y) => param y: A a/b/Givens.Monoid#empty(). => abstract method empty => A @@ -1462,7 +1462,7 @@ a/b/Givens.foo(). => method foo [typeparam A ](implicit param A: Monoid[A]): A a/b/Givens.foo().(A) => implicit param A: Monoid[A] a/b/Givens.foo().[A] => typeparam A a/b/Givens.given_Monoid_String. => final implicit object given_Monoid_String extends Object with Monoid[String] { self: .given_Monoid_String.type => +3 decls } -a/b/Givens.given_Monoid_String.combine(). => method combine (param x: String)(param y: String): +a/b/Givens.given_Monoid_String.combine(). => method combine (param x: String)(param y: String): String a/b/Givens.given_Monoid_String.combine().(x) => param x: String a/b/Givens.given_Monoid_String.combine().(y) => param y: String a/b/Givens.given_Monoid_String.empty(). => method empty => String @@ -1780,7 +1780,7 @@ givens/InventedNames$package.given_String. => final implicit lazy val method giv givens/InventedNames$package.given_X. => final implicit object given_X extends Object with X { self: .given_X.type => +2 decls } givens/InventedNames$package.given_X.doX(). => method doX => Int givens/InventedNames$package.given_Y# => class given_Y extends Object with Y { self: given_Y => +3 decls } -givens/InventedNames$package.given_Y#``(). => primary ctor (implicit val param x$1: X): +givens/InventedNames$package.given_Y#``(). => primary ctor (implicit val param x$1: X): given_Y givens/InventedNames$package.given_Y#``().(x$1) => implicit val param x$1: X givens/InventedNames$package.given_Y#doY(). => method doY => String givens/InventedNames$package.given_Y#x$1. => implicit val method x$1 X @@ -2219,7 +2219,7 @@ example/Methods#m1(). => method m1 => Nothing example/Methods#m2(). => method m2 (): Nothing example/Methods#m3(). => method m3 (param x: Int): Nothing example/Methods#m3().(x) => param x: Int -example/Methods#m4(). => method m4 (param x: Int)(param y: Int): +example/Methods#m4(). => method m4 (param x: Int)(param y: Int): Nothing example/Methods#m4().(x) => param x: Int example/Methods#m4().(y) => param y: Int example/Methods#m5(). => method m5 (param x: String): Nothing @@ -2232,7 +2232,7 @@ example/Methods#m6(+1). => method m6 (param x: List[T]): Nothing example/Methods#m6(+1).(x) => param x: List[T] example/Methods#m6(+2). => method m6 (param x: List[T]): Nothing example/Methods#m6(+2).(x) => param x: List[T] -example/Methods#m7(). => method m7 [typeparam U ](param c: Methods[T], param l: List[U])(unknown evidence$1: ): +example/Methods#m7(). => method m7 [typeparam U ](param c: Methods[T], param l: List[U])(unknown evidence$1: ): Nothing example/Methods#m7().(c) => param c: Methods[T] example/Methods#m7().(l) => param l: List[U] example/Methods#m7().[U] => typeparam U @@ -2271,7 +2271,7 @@ example/Methods#m19$default$2(). => method m19$default$2 => Int @uncheckedVarian example/Methods#m19$default$3(). => method m19$default$3 (param x: Int, param y: Int): Int @uncheckedVariance example/Methods#m19$default$3().(x) => param x: Int example/Methods#m19$default$3().(y) => param y: Int -example/Methods#m19(). => method m19 (param x: Int, param y: Int)(param z: Int): +example/Methods#m19(). => method m19 (param x: Int, param y: Int)(param z: Int): Nothing example/Methods#m19().(x) => param x: Int example/Methods#m19().(y) => param y: Int example/Methods#m19().(z) => param z: Int @@ -2855,7 +2855,7 @@ Occurrences => 13 entries Symbols: ext/RightAssociativeExtension$package. => final package object ext extends Object { self: .ext.type => +3 decls } -ext/RightAssociativeExtension$package.`:*:`(). => method :*: (param i: Int)(param s: String): +ext/RightAssociativeExtension$package.`:*:`(). => method :*: (param i: Int)(param s: String): Tuple2[String, Int] ext/RightAssociativeExtension$package.`:*:`().(i) => param i: Int ext/RightAssociativeExtension$package.`:*:`().(s) => param s: String ext/RightAssociativeExtension$package.b. => val method b Tuple2[String, Int] @@ -2946,7 +2946,7 @@ example/Synthetic#F# => class F extends Object { self: F => +1 decls } example/Synthetic#F#``(). => primary ctor (): F example/Synthetic#J# => class J [typeparam T ] extends Object { self: J[T] => +4 decls } example/Synthetic#J#[T] => typeparam T -example/Synthetic#J#``(). => primary ctor [unknown T: ](unknown evidence$1: ): +example/Synthetic#J#``(). => primary ctor [unknown T: ](unknown evidence$1: ): J[T] example/Synthetic#J#arr. => val method arr Array[T] example/Synthetic#Name. => val method Name Regex example/Synthetic#``(). => primary ctor (): Synthetic @@ -4510,7 +4510,7 @@ _empty_/toplevel$package. => final package object _empty_ extends Object { self: _empty_/toplevel$package.MyProgram(). => method MyProgram (param times: Int): Unit _empty_/toplevel$package.MyProgram().(times) => param times: Int _empty_/toplevel$package.a. => val method a "" -_empty_/toplevel$package.combine(). => method combine (param x: Int)(param y: Int): +_empty_/toplevel$package.combine(). => method combine (param x: Int)(param y: Int): Int _empty_/toplevel$package.combine().(x) => param x: Int _empty_/toplevel$package.combine().(y) => param y: Int _empty_/toplevel$package.combine(+1). => method combine (param x: Int, param y: Int, param z: Int): Int From a8a137c36977125b3d65e2c2289268961ce2db14 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Wed, 7 Jul 2021 13:13:30 +0900 Subject: [PATCH 21/25] Register the symbol of nested method with "actual" binder For example: `def foo(x: T)(y: T): T` and for `.owner.info` would be like `MethodType(..., resType = MethodType(..., resType = ))`. (Let's say the outer `MethodType` "outer", and `MethodType` who is `resType` of outer "inner") Before this commit, we register to the symbol table with `(, outer)`, which should be `(, inner)`. For such a nested method signature, we have to find the "actual" binder for parameters and register them to the symbol table. --- .../dotty/tools/dotc/semanticdb/TypeOps.scala | 65 ++++++---- .../semanticdb/expect/Extension.expect.scala | 8 +- tests/semanticdb/expect/Extension.scala | 8 +- tests/semanticdb/metac.expect | 117 +++++++++++------- 4 files changed, 128 insertions(+), 70 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 7e2f321320e9..7016d90cc49d 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -26,7 +26,19 @@ class TypeOps: def enterParamRef(tpe: Type): Unit = tpe match { case lam: LambdaType => - paramRefSymtab((lam, sym.name)) = sym + // Find the "actual" binder type for nested LambdaType + // For example, `def foo(x: T)(y: T): T` and for `.owner.info` would be like + // `MethodType(..., resType = MethodType(..., resType = ))`. + // (Let's say the outer `MethodType` "outer", and `MethodType` who is + // `resType` of outer "inner") + // + // We try to find the "actual" binder of : `inner`, + // and register them to the symbol table with `(, inner) -> ` + // instead of `("y", outer) -> ` + if lam.paramNames.contains(sym.name) then + paramRefSymtab((lam, sym.name)) = sym + else + enterParamRef(lam.resType) // for class constructor // class C[T] { ... } @@ -82,16 +94,36 @@ class TypeOps: enterRefined(sym.owner.info) def loop(tpe: Type): s.Signature = tpe match { - case mt: MethodType => - val stparams = Some(s.Scope()) - val paramss = - if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss - val termParamss = paramss.filter(ps => ps.forall(!_.isTypeParam)) - val sparamss = termParamss.map(_.sscope) + case mp: MethodOrPoly => + def flatten( + t: Type, + paramss: List[List[Symbol]], + tparams: List[Symbol] + ): (Type, List[List[Symbol]], List[Symbol]) = t match { + case mt: MethodType => + val syms = mt.paramNames.flatMap { paramName => + val key = (mt, paramName) + paramRefSymtab.get(key) + } + flatten(mt.resType, paramss :+ syms, tparams) + case pt: PolyType => + val syms = pt.paramNames.flatMap { paramName => + val key = (pt, paramName) + paramRefSymtab.get(key) + } + // there shouldn't multiple type params + flatten(pt.resType, paramss, syms) + case other => + (other, paramss, tparams) + } + val (resType, paramss, tparams) = flatten(mp, Nil, Nil) + + val sparamss = paramss.map(_.sscope) + val stparams = Some(tparams.sscope) s.MethodSignature( stparams, sparamss, - mt.finalResultType.toSemanticType(sym) + resType.toSemanticType(sym) ) case cls: ClassInfo => @@ -122,23 +154,6 @@ class TypeOps: val stparams = params.sscope s.TypeSignature(Some(stparams), slo, shi) - case pt: PolyType => - loop(pt.resType) match { - case m: s.MethodSignature => - val paramss = - if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss - val tparamss = paramss.filter(ps => ps.forall(_.isTypeParam)) - val stparams = tparamss.flatten.sscope - m.copy(typeParameters = Some(stparams)) - case v: s.ValueSignature => - val paramss = - if (sym.rawParamss.nonEmpty) sym.rawParamss else sym.paramSymss - val tparamss = paramss.filter(ps => ps.forall(_.isTypeParam)) - val stparams = tparamss.flatten.sscope - s.ValueSignature(s.UniversalType(Some(stparams), v.tpe)) - case _ => s.Signature.Empty - } - case other => s.ValueSignature( other.toSemanticType(sym) diff --git a/tests/semanticdb/expect/Extension.expect.scala b/tests/semanticdb/expect/Extension.expect.scala index 536886368502..1af765e2e888 100644 --- a/tests/semanticdb/expect/Extension.expect.scala +++ b/tests/semanticdb/expect/Extension.expect.scala @@ -6,4 +6,10 @@ extension (s/*<-ext::Extension$package.foo().(s)*//*<-ext::Extension$package.`#* val a/*<-ext::Extension$package.a.*/ = "asd".foo/*->ext::Extension$package.foo().*/ -val c/*<-ext::Extension$package.c.*/ = "foo" #*#/*->ext::Extension$package.`#*#`().*/ 23 \ No newline at end of file +val c/*<-ext::Extension$package.c.*/ = "foo" #*#/*->ext::Extension$package.`#*#`().*/ 23 + +trait Read/*<-ext::Read#*/[+T/*<-ext::Read#[T]*/]: + def fromString/*<-ext::Read#fromString().*/(s/*<-ext::Read#fromString().(s)*/: String/*->scala::Predef.String#*/): Option/*->scala::Option#*/[T/*->ext::Read#[T]*/] + +extension (s/*<-ext::Extension$package.readInto().(s)*/: String/*->scala::Predef.String#*/) + def readInto/*<-ext::Extension$package.readInto().*/[T/*<-ext::Extension$package.readInto().[T]*/](using Read/*->ext::Read#*/[T/*->ext::Extension$package.readInto().[T]*/]): Option/*->scala::Option#*/[T/*->ext::Extension$package.readInto().[T]*/] = summon/*->scala::Predef.summon().*/[Read/*->ext::Read#*/[T/*->ext::Extension$package.readInto().[T]*/]]/*->ext::Extension$package.readInto().(x$2)*/.fromString/*->ext::Read#fromString().*/(s/*->ext::Extension$package.readInto().(s)*/) diff --git a/tests/semanticdb/expect/Extension.scala b/tests/semanticdb/expect/Extension.scala index 5b9c3e5f21ab..c887e1ced9e2 100644 --- a/tests/semanticdb/expect/Extension.scala +++ b/tests/semanticdb/expect/Extension.scala @@ -6,4 +6,10 @@ extension (s: String) val a = "asd".foo -val c = "foo" #*# 23 \ No newline at end of file +val c = "foo" #*# 23 + +trait Read[+T]: + def fromString(s: String): Option[T] + +extension (s: String) + def readInto[T](using Read[T]): Option[T] = summon[Read[T]].fromString(s) diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 947c2725cbfe..ba93a2b8bb02 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -55,7 +55,7 @@ Occurrences => 100 entries Symbols: advanced/C# => class C [typeparam T ] extends Object { self: C[T] => +3 decls } advanced/C#[T] => typeparam T -advanced/C#``(). => primary ctor [unknown T: ]: C[T] +advanced/C#``(). => primary ctor [typeparam T ](): C[T] advanced/C#t(). => method t => T advanced/Structural# => class Structural extends Object { self: Structural => +5 decls } advanced/Structural#``(). => primary ctor (): Structural @@ -211,7 +211,7 @@ annot/Alias.A# => type A = ClassAnnotation @param annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef & Annotations[T] => +6 decls } annot/Annotations#S# => type S annot/Annotations#[T] => typeparam T -annot/Annotations#``(). => primary ctor [unknown T: ](param x: T): Annotations[T] +annot/Annotations#``(). => primary ctor [typeparam T ](param x: T): Annotations[T] annot/Annotations#``().(x) => param x: T annot/Annotations#field. => val method field Int annot/Annotations#method(). => method method => Int @@ -222,7 +222,7 @@ annot/B#``().(x) => param x: Int annot/B#``(+1). => ctor (): B annot/B#x. => val method x Int annot/M. => final object M extends Object { self: .M.type => +1 decls } -annot/M.m(). => macro m [] => Int +annot/M.m(). => macro m [typeparam TT ]: Int annot/M.m().[TT] => typeparam TT annot/T# => trait T extends Object { self: T => +1 decls } annot/T#``(). => primary ctor (): T @@ -303,7 +303,7 @@ example/Anonymous#foo. => val method foo Foo example/Anonymous#locally(). => method locally [typeparam A ](param x: A): A example/Anonymous#locally().(x) => param x: A example/Anonymous#locally().[A] => typeparam A -example/Anonymous#m1(). => method m1 [] => Nothing +example/Anonymous#m1(). => method m1 [typeparam T ]: Nothing example/Anonymous#m1().[T] => typeparam T example/Anonymous#m2(). => method m2 => Map[local0, List[local1] forSome { _ }] forSome { _ } local2 => val local x: Function1[Int, Int] @@ -888,16 +888,16 @@ _empty_/Enums.Directions.valueOf().($name) => param $name: String _empty_/Enums.Directions.values(). => method values => Array[Directions] _empty_/Enums.Maybe# => abstract sealed enum class Maybe [covariant typeparam A ] extends Object with Enum { self: Maybe[A] => +2 decls } _empty_/Enums.Maybe#[A] => covariant typeparam A -_empty_/Enums.Maybe#``(). => primary ctor [unknown A: ]: Maybe[A] +_empty_/Enums.Maybe#``(). => primary ctor [covariant typeparam A ](): Maybe[A] _empty_/Enums.Maybe. => final object Maybe extends Object { self: .Maybe.type => +6 decls } _empty_/Enums.Maybe.Just# => final case enum class Just [covariant typeparam A ] extends Maybe[A] { self: Just[A] => +7 decls } _empty_/Enums.Maybe.Just#[A] => covariant typeparam A _empty_/Enums.Maybe.Just#_1(). => method _1 => A -_empty_/Enums.Maybe.Just#``(). => primary ctor [unknown A: ](val param value: A): Just[A] +_empty_/Enums.Maybe.Just#``(). => primary ctor [covariant typeparam A ](val param value: A): Just[A] _empty_/Enums.Maybe.Just#``().(value) => val param value: A -_empty_/Enums.Maybe.Just#copy$default$1(). => method copy$default$1 [] => A +_empty_/Enums.Maybe.Just#copy$default$1(). => method copy$default$1 [covariant typeparam A ]: A _empty_/Enums.Maybe.Just#copy$default$1().[A] => typeparam A -_empty_/Enums.Maybe.Just#copy(). => method copy [typeparam A ](param value: A): Just[A] +_empty_/Enums.Maybe.Just#copy(). => method copy [covariant typeparam A ](param value: A): Just[A] _empty_/Enums.Maybe.Just#copy().(value) => param value: A _empty_/Enums.Maybe.Just#copy().[A] => typeparam A _empty_/Enums.Maybe.Just#ordinal(). => method ordinal => Int @@ -961,7 +961,7 @@ _empty_/Enums.Suits.valueOf().($name) => param $name: String _empty_/Enums.Suits.values(). => method values => Array[Suits] _empty_/Enums.Tag# => abstract sealed enum class Tag [typeparam A ] extends Object with Enum { self: Tag[A] => +2 decls } _empty_/Enums.Tag#[A] => typeparam A -_empty_/Enums.Tag#``(). => primary ctor [unknown A: ]: Tag[A] +_empty_/Enums.Tag#``(). => primary ctor [typeparam A ](): Tag[A] _empty_/Enums.Tag. => final object Tag extends Object { self: .Tag.type => +7 decls } _empty_/Enums.Tag.$values. => val method $values Array[Tag[local1] forSome { _ }] _empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag Tag[Boolean] @@ -993,22 +993,22 @@ _empty_/Enums.WeekDays.values(). => method values => Array[WeekDays] _empty_/Enums.`<:<`# => abstract sealed enum class <:< [contravariant typeparam A , typeparam B ] extends Object with Enum { self: <:<[A, B] => +3 decls } _empty_/Enums.`<:<`#[A] => contravariant typeparam A _empty_/Enums.`<:<`#[B] => typeparam B -_empty_/Enums.`<:<`#``(). => primary ctor [unknown A: , unknown B: ]: <:<[A, B] +_empty_/Enums.`<:<`#``(). => primary ctor [contravariant typeparam A , typeparam B ](): <:<[A, B] _empty_/Enums.`<:<`. => final object <:< extends Object { self: .<:<.type => +6 decls } _empty_/Enums.`<:<`.Refl# => final case enum class Refl [typeparam C ] extends <:<[C, C] { self: Refl[C] => +4 decls } _empty_/Enums.`<:<`.Refl#[C] => typeparam C -_empty_/Enums.`<:<`.Refl#``(). => primary ctor [unknown C: ]: Refl[C] -_empty_/Enums.`<:<`.Refl#copy(). => method copy [typeparam C ]: Refl[C] +_empty_/Enums.`<:<`.Refl#``(). => primary ctor [typeparam C ](): Refl[C] +_empty_/Enums.`<:<`.Refl#copy(). => method copy [typeparam C ](): Refl[C] _empty_/Enums.`<:<`.Refl#copy().[C] => typeparam C _empty_/Enums.`<:<`.Refl#ordinal(). => method ordinal => Int _empty_/Enums.`<:<`.Refl. => final object Refl extends Object { self: .Refl.type => +4 decls } -_empty_/Enums.`<:<`.Refl.apply(). => method apply [typeparam C ]: Refl[C] +_empty_/Enums.`<:<`.Refl.apply(). => method apply [typeparam C ](): Refl[C] _empty_/Enums.`<:<`.Refl.apply().[C] => typeparam C _empty_/Enums.`<:<`.Refl.toString(). => method toString => String _empty_/Enums.`<:<`.Refl.unapply(). => method unapply [typeparam C ](param x$1: Refl[C]): true _empty_/Enums.`<:<`.Refl.unapply().(x$1) => param x$1: Refl[C] _empty_/Enums.`<:<`.Refl.unapply().[C] => typeparam C -_empty_/Enums.`<:<`.`given_<:<_T_T`(). => final implicit method given_<:<_T_T [] => <:<[T, T] +_empty_/Enums.`<:<`.`given_<:<_T_T`(). => final implicit method given_<:<_T_T [typeparam T ]: <:<[T, T] _empty_/Enums.`<:<`.`given_<:<_T_T`().[T] => typeparam T _empty_/Enums.`<:<`.fromOrdinal(). => method fromOrdinal (param ordinal: Int): <:<[local5, local6] forSome { _; _ } _empty_/Enums.`<:<`.fromOrdinal().(ordinal) => param ordinal: Int @@ -1289,11 +1289,11 @@ Schema => SemanticDB v4 Uri => Extension.scala Text => empty Language => Scala -Symbols => 8 entries -Occurrences => 18 entries +Symbols => 17 entries +Occurrences => 40 entries Symbols: -ext/Extension$package. => final package object ext extends Object { self: .ext.type => +5 decls } +ext/Extension$package. => final package object ext extends Object { self: .ext.type => +6 decls } ext/Extension$package.`#*#`(). => method #*# (param s: String)(param i: Int): Tuple2[String, Int] ext/Extension$package.`#*#`().(i) => param i: Int ext/Extension$package.`#*#`().(s) => param s: String @@ -1301,6 +1301,15 @@ ext/Extension$package.a. => val method a Int ext/Extension$package.c. => val method c Tuple2[String, Int] ext/Extension$package.foo(). => method foo (param s: String): Int ext/Extension$package.foo().(s) => param s: String +ext/Extension$package.readInto(). => method readInto [typeparam T ](param s: String)(implicit param x$2: Read[T]): Option[T] +ext/Extension$package.readInto().(s) => param s: String +ext/Extension$package.readInto().(x$2) => implicit param x$2: Read[T] +ext/Extension$package.readInto().[T] => typeparam T +ext/Read# => trait Read [covariant typeparam T ] extends Object { self: Read[T] => +3 decls } +ext/Read#[T] => covariant typeparam T +ext/Read#``(). => primary ctor [covariant typeparam T ](): Read[T] +ext/Read#fromString(). => abstract method fromString (param s: String): Option[T] +ext/Read#fromString().(s) => param s: String Occurrences: [0:8..0:11): ext <- ext/ @@ -1321,6 +1330,28 @@ Occurrences: [6:14..6:17): foo -> ext/Extension$package.foo(). [8:4..8:5): c <- ext/Extension$package.c. [8:14..8:17): #*# -> ext/Extension$package.`#*#`(). +[10:6..10:10): Read <- ext/Read# +[10:10..10:10): <- ext/Read#``(). +[10:12..10:13): T <- ext/Read#[T] +[11:6..11:16): fromString <- ext/Read#fromString(). +[11:17..11:18): s <- ext/Read#fromString().(s) +[11:20..11:26): String -> scala/Predef.String# +[11:29..11:35): Option -> scala/Option# +[11:36..11:37): T -> ext/Read#[T] +[13:11..13:12): s <- ext/Extension$package.readInto().(s) +[13:14..13:20): String -> scala/Predef.String# +[14:6..14:14): readInto <- ext/Extension$package.readInto(). +[14:15..14:16): T <- ext/Extension$package.readInto().[T] +[14:24..14:28): Read -> ext/Read# +[14:29..14:30): T -> ext/Extension$package.readInto().[T] +[14:34..14:40): Option -> scala/Option# +[14:41..14:42): T -> ext/Extension$package.readInto().[T] +[14:46..14:52): summon -> scala/Predef.summon(). +[14:53..14:57): Read -> ext/Read# +[14:58..14:59): T -> ext/Extension$package.readInto().[T] +[14:61..14:61): -> ext/Extension$package.readInto().(x$2) +[14:62..14:72): fromString -> ext/Read#fromString(). +[14:73..14:74): s -> ext/Extension$package.readInto().(s) expect/ForComprehension.scala ----------------------------- @@ -1453,7 +1484,7 @@ Symbols: a/b/Givens. => final object Givens extends Object { self: .Givens.type => +12 decls } a/b/Givens.Monoid# => trait Monoid [typeparam A ] extends Object { self: Monoid[A] => +4 decls } a/b/Givens.Monoid#[A] => typeparam A -a/b/Givens.Monoid#``(). => primary ctor [unknown A: ]: Monoid[A] +a/b/Givens.Monoid#``(). => primary ctor [typeparam A ](): Monoid[A] a/b/Givens.Monoid#combine(). => abstract method combine (param x: A)(param y: A): A a/b/Givens.Monoid#combine().(x) => param x: A a/b/Givens.Monoid#combine().(y) => param y: A @@ -1580,7 +1611,7 @@ example/ImplicitConversion.newAny2stringadd# => final class newAny2stringadd [ty example/ImplicitConversion.newAny2stringadd#[A] => typeparam A example/ImplicitConversion.newAny2stringadd#`+`(). => method + (param other: String): String example/ImplicitConversion.newAny2stringadd#`+`().(other) => param other: String -example/ImplicitConversion.newAny2stringadd#``(). => primary ctor [unknown A: ](param self: A): newAny2stringadd[A] +example/ImplicitConversion.newAny2stringadd#``(). => primary ctor [typeparam A ](param self: A): newAny2stringadd[A] example/ImplicitConversion.newAny2stringadd#``().(self) => param self: A example/ImplicitConversion.newAny2stringadd#self. => val method self A example/ImplicitConversion.newAny2stringadd(). => final implicit method newAny2stringadd [typeparam A ](param self: A): newAny2stringadd[A] @@ -1774,13 +1805,13 @@ givens/InventedNames$package.given_Char. => final implicit lazy val method given givens/InventedNames$package.given_Double(). => final implicit method given_Double (implicit param x$1: Int): Double givens/InventedNames$package.given_Double().(x$1) => implicit param x$1: Int givens/InventedNames$package.given_Float. => final implicit lazy val method given_Float Float -givens/InventedNames$package.given_List_T(). => final implicit method given_List_T [] => List[T] +givens/InventedNames$package.given_List_T(). => final implicit method given_List_T [typeparam T ]: List[T] givens/InventedNames$package.given_List_T().[T] => typeparam T givens/InventedNames$package.given_String. => final implicit lazy val method given_String String givens/InventedNames$package.given_X. => final implicit object given_X extends Object with X { self: .given_X.type => +2 decls } givens/InventedNames$package.given_X.doX(). => method doX => Int givens/InventedNames$package.given_Y# => class given_Y extends Object with Y { self: given_Y => +3 decls } -givens/InventedNames$package.given_Y#``(). => primary ctor (implicit val param x$1: X): given_Y +givens/InventedNames$package.given_Y#``(). => primary ctor ()(implicit val param x$1: X): given_Y givens/InventedNames$package.given_Y#``().(x$1) => implicit val param x$1: X givens/InventedNames$package.given_Y#doY(). => method doY => String givens/InventedNames$package.given_Y#x$1. => implicit val method x$1 X @@ -1788,9 +1819,9 @@ givens/InventedNames$package.given_Y(). => final implicit method given_Y (implic givens/InventedNames$package.given_Y().(x$1) => implicit param x$1: X givens/InventedNames$package.given_Z_T# => class given_Z_T [typeparam T ] extends Object with Z[T] { self: given_Z_T[T] => +3 decls } givens/InventedNames$package.given_Z_T#[T] => typeparam T -givens/InventedNames$package.given_Z_T#``(). => primary ctor [unknown T: ]: given_Z_T[T] +givens/InventedNames$package.given_Z_T#``(). => primary ctor [typeparam T ](): given_Z_T[T] givens/InventedNames$package.given_Z_T#doZ(). => method doZ => List[T] -givens/InventedNames$package.given_Z_T(). => final implicit method given_Z_T [] => given_Z_T[T] +givens/InventedNames$package.given_Z_T(). => final implicit method given_Z_T [typeparam T ]: given_Z_T[T] givens/InventedNames$package.given_Z_T().[T] => typeparam T givens/InventedNames$package.intValue. => final implicit lazy val method intValue Int givens/InventedNames$package.x. => val method x .given_X.type @@ -1804,7 +1835,7 @@ givens/Y#``(). => primary ctor (): Y givens/Y#doY(). => abstract method doY => String givens/Z# => trait Z [typeparam T ] extends Object { self: Z[T] => +3 decls } givens/Z#[T] => typeparam T -givens/Z#``(). => primary ctor [unknown T: ]: Z[T] +givens/Z#``(). => primary ctor [typeparam T ](): Z[T] givens/Z#doZ(). => abstract method doZ => List[T] Occurrences: @@ -2207,9 +2238,9 @@ example/Methods#AList# => type AList [typeparam T ] = List[T] example/Methods#AList#[T] => typeparam T example/Methods#List# => class List [typeparam T ] extends Object { self: List[T] => +2 decls } example/Methods#List#[T] => typeparam T -example/Methods#List#``(). => primary ctor [unknown T: ]: List[T] +example/Methods#List#``(). => primary ctor [typeparam T ](): List[T] example/Methods#[T] => typeparam T -example/Methods#``(). => primary ctor [unknown T: ]: Methods[T] +example/Methods#``(). => primary ctor [typeparam T ](): Methods[T] example/Methods#`m8().`(). => method m8(). (): Nothing example/Methods#`m9().`# => class m9(). extends Object { self: m9(). => +1 decls } example/Methods#`m9().`#``(). => primary ctor (): m9(). @@ -2232,7 +2263,7 @@ example/Methods#m6(+1). => method m6 (param x: List[T]): Nothing example/Methods#m6(+1).(x) => param x: List[T] example/Methods#m6(+2). => method m6 (param x: List[T]): Nothing example/Methods#m6(+2).(x) => param x: List[T] -example/Methods#m7(). => method m7 [typeparam U ](param c: Methods[T], param l: List[U])(unknown evidence$1: ): Nothing +example/Methods#m7(). => method m7 [typeparam U ](param c: Methods[T], param l: List[U])(): Nothing example/Methods#m7().(c) => param c: Methods[T] example/Methods#m7().(l) => param l: List[U] example/Methods#m7().[U] => typeparam U @@ -2946,7 +2977,7 @@ example/Synthetic#F# => class F extends Object { self: F => +1 decls } example/Synthetic#F#``(). => primary ctor (): F example/Synthetic#J# => class J [typeparam T ] extends Object { self: J[T] => +4 decls } example/Synthetic#J#[T] => typeparam T -example/Synthetic#J#``(). => primary ctor [unknown T: ](unknown evidence$1: ): J[T] +example/Synthetic#J#``(). => primary ctor [typeparam T ]()(): J[T] example/Synthetic#J#arr. => val method arr Array[T] example/Synthetic#Name. => val method Name Regex example/Synthetic#``(). => primary ctor (): Synthetic @@ -3520,7 +3551,7 @@ Occurrences => 39 entries Symbols: exports/example/Codec# => trait Codec [typeparam T ] extends Object with Decoder[T] with Encoder[T] { self: Codec[T] => +6 decls } exports/example/Codec#[T] => typeparam T -exports/example/Codec#``(). => primary ctor [unknown T: ](param decode: Decoder[T], param encode: Encoder[T]): Codec[T] +exports/example/Codec#``(). => primary ctor [typeparam T ](param decode: Decoder[T], param encode: Encoder[T]): Codec[T] exports/example/Codec#``().(decode) => param decode: Decoder[T] exports/example/Codec#``().(encode) => param encode: Encoder[T] exports/example/Codec#decode(). => final method decode (param a: Array[Byte]): T @@ -3531,12 +3562,12 @@ exports/example/Codec#encode().(t) => param t: T exports/example/Codec#encode. => val method encode Encoder[T] exports/example/Decoder# => trait Decoder [covariant typeparam T ] extends Object { self: Decoder[T] => +3 decls } exports/example/Decoder#[T] => covariant typeparam T -exports/example/Decoder#``(). => primary ctor [unknown T: ]: Decoder[T] +exports/example/Decoder#``(). => primary ctor [covariant typeparam T ](): Decoder[T] exports/example/Decoder#decode(). => abstract method decode (param a: Array[Byte]): T exports/example/Decoder#decode().(a) => param a: Array[Byte] exports/example/Encoder# => trait Encoder [contravariant typeparam T ] extends Object { self: Encoder[T] => +3 decls } exports/example/Encoder#[T] => contravariant typeparam T -exports/example/Encoder#``(). => primary ctor [unknown T: ]: Encoder[T] +exports/example/Encoder#``(). => primary ctor [contravariant typeparam T ](): Encoder[T] exports/example/Encoder#encode(). => abstract method encode (param t: T): Array[Byte] exports/example/Encoder#encode().(t) => param t: T @@ -3768,9 +3799,9 @@ recursion/Nats.Nat#``(). => primary ctor (): Nat recursion/Nats.Succ# => case class Succ [typeparam N ] extends Object with Nat with Product with Serializable { self: Succ[N] => +6 decls } recursion/Nats.Succ#[N] => typeparam N recursion/Nats.Succ#_1(). => method _1 => N -recursion/Nats.Succ#``(). => primary ctor [unknown N: ](val param p: N): Succ[N] +recursion/Nats.Succ#``(). => primary ctor [typeparam N ](val param p: N): Succ[N] recursion/Nats.Succ#``().(p) => val param p: N -recursion/Nats.Succ#copy$default$1(). => method copy$default$1 [] => N +recursion/Nats.Succ#copy$default$1(). => method copy$default$1 [typeparam N ]: N recursion/Nats.Succ#copy$default$1().[N] => typeparam N recursion/Nats.Succ#copy(). => method copy [typeparam N ](param p: N): Succ[N] recursion/Nats.Succ#copy().(p) => param p: N @@ -3908,12 +3939,12 @@ flags/p/package.C# => abstract class C [covariant typeparam T , contravariant ty flags/p/package.C#[T] => covariant typeparam T flags/p/package.C#[U] => contravariant typeparam U flags/p/package.C#[V] => typeparam V -flags/p/package.C#``(). => primary ctor [unknown T: , unknown U: , unknown V: ](param x: T, param y: U, param z: V): C[T, U, V] +flags/p/package.C#``(). => primary ctor [covariant typeparam T , contravariant typeparam U , typeparam V ](param x: T, param y: U, param z: V): C[T, U, V] flags/p/package.C#``().(x) => param x: T flags/p/package.C#``().(y) => param y: U flags/p/package.C#``().(z) => param z: V -flags/p/package.C#``(+1). => ctor [unknown T: , unknown U: , unknown V: ]: C[T, U, V] -flags/p/package.C#``(+2). => ctor [unknown T: , unknown U: , unknown V: ](param t: T): C[T, U, V] +flags/p/package.C#``(+1). => ctor [covariant typeparam T , contravariant typeparam U , typeparam V ](): C[T, U, V] +flags/p/package.C#``(+2). => ctor [covariant typeparam T , contravariant typeparam U , typeparam V ](param t: T): C[T, U, V] flags/p/package.C#``(+2).(t) => param t: T flags/p/package.C#w(). => abstract method w => Int flags/p/package.C#x. => val method x T @@ -3921,7 +3952,7 @@ flags/p/package.C#y. => val method y U flags/p/package.C#z. => val method z V flags/p/package.S# => class S [typeparam T ] extends Object { self: S[T] => +2 decls } flags/p/package.S#[T] => typeparam T -flags/p/package.S#``(). => primary ctor [unknown T: ]: S[T] +flags/p/package.S#``(). => primary ctor [typeparam T ](): S[T] flags/p/package.T1# => type T1 = Int flags/p/package.T2# => type T2 [typeparam T ] = S[T] flags/p/package.T2#[T] => typeparam T @@ -3934,7 +3965,7 @@ flags/p/package.Z# => sealed trait Z extends Object { self: Z => +1 decls } flags/p/package.Z#``(). => primary ctor (): Z flags/p/package.`y_=`(). => var method y_= (param x$1: Int): Unit flags/p/package.`y_=`().(x$1) => param x$1: Int -flags/p/package.m(). => macro m [] => Int +flags/p/package.m(). => macro m [typeparam TT ]: Int flags/p/package.m().[TT] => typeparam TT flags/p/package.x. => lazy val method x Int flags/p/package.xs1. => val method xs1 Nothing @@ -4094,7 +4125,7 @@ types/Test.C#ClassInfoType2#``(). => primary ctor (): ClassInfoType types/Test.C#ClassInfoType2#x(). => method x => Int types/Test.C#ClassInfoType3# => trait ClassInfoType3 [typeparam T ] extends Object { self: ClassInfoType3[T] => +2 decls } types/Test.C#ClassInfoType3#[T] => typeparam T -types/Test.C#ClassInfoType3#``(). => primary ctor [unknown T: ]: ClassInfoType3[T] +types/Test.C#ClassInfoType3#``(). => primary ctor [typeparam T ](): ClassInfoType3[T] types/Test.C#Either. => val method Either .Either.type types/Test.C#MethodType. => final object MethodType extends Object { self: .MethodType.type => +7 decls } types/Test.C#MethodType.m3(). => method m3 => Int @@ -4124,9 +4155,9 @@ types/Test.C#TypeType.T1# => type T1 types/Test.C#TypeType.T4# => type T4 = C types/Test.C#TypeType.T5# => type T5 [typeparam U ] = U types/Test.C#TypeType.T5#[U] => typeparam U -types/Test.C#TypeType.m2(). => method m2 [] => Nothing +types/Test.C#TypeType.m2(). => method m2 [typeparam T2 = C]: Nothing types/Test.C#TypeType.m2().[T2] => typeparam T2 = C -types/Test.C#TypeType.m3(). => method m3 [] => Nothing +types/Test.C#TypeType.m3(). => method m3 [typeparam M3 ]: Nothing types/Test.C#TypeType.m3().[M3] => typeparam M3 types/Test.C#``(). => primary ctor (): C types/Test.C#annType1. => val method annType1 T @ann[T] @@ -4148,7 +4179,7 @@ types/Test.C#superType2. => val method superType2 Int types/Test.C#superType3. => val method superType3 Int types/Test.C#thisType1. => val method thisType1 C.this.type types/Test.C#thisType2. => val method thisType2 C.this.type -types/Test.C#typeLambda1(). => method typeLambda1 [] => Nothing +types/Test.C#typeLambda1(). => method typeLambda1 [typeparam M ]: Nothing types/Test.C#typeLambda1().[M] => typeparam M types/Test.C#typeRef1. => val method typeRef1 C types/Test.C#typeRef2. => val method typeRef2 .p.C @@ -4175,7 +4206,7 @@ types/Test.N#``(). => primary ctor (): N types/Test.N#n(). => method n => Int types/ann# => class ann [typeparam T ] extends Annotation with StaticAnnotation { self: ann[T] => +3 decls } types/ann#[T] => typeparam T -types/ann#``(). => primary ctor [unknown T: ](param x: T): ann[T] +types/ann#``(). => primary ctor [typeparam T ](param x: T): ann[T] types/ann#``().(x) => param x: T types/ann#x. => val method x T types/ann1# => class ann1 extends Annotation with StaticAnnotation { self: ann1 => +1 decls } From 5b0a5495597500892fdee61461a0d430b25b8f91 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Wed, 7 Jul 2021 13:30:20 +0900 Subject: [PATCH 22/25] Remove unused parameter sym from toSemanticType --- .../src/dotty/tools/dotc/semanticdb/TypeOps.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 7016d90cc49d..3d89578d20bf 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -123,7 +123,7 @@ class TypeOps: s.MethodSignature( stparams, sparamss, - resType.toSemanticType(sym) + resType.toSemanticType ) case cls: ClassInfo => @@ -131,8 +131,8 @@ class TypeOps: if (cls.cls.typeParams.nonEmpty) Some(cls.cls.typeParams.sscope) else None - val sparents = cls.parents.map(_.toSemanticType(sym)) - val sself = cls.selfType.toSemanticType(sym) + val sparents = cls.parents.map(_.toSemanticType) + val sself = cls.selfType.toSemanticType val decls = cls.decls.toList.sscope s.ClassSignature(stparams, sparents, sself, Some(decls)) @@ -149,19 +149,19 @@ class TypeOps: val (loRes, loParams) = tparams(lo) val (hiRes, hiParams) = tparams(hi) val params = (loParams ++ hiParams).distinctBy(_.name) - val slo = loRes.toSemanticType(sym) - val shi = hiRes.toSemanticType(sym) + val slo = loRes.toSemanticType + val shi = hiRes.toSemanticType val stparams = params.sscope s.TypeSignature(Some(stparams), slo, shi) case other => s.ValueSignature( - other.toSemanticType(sym) + other.toSemanticType ) } loop(tpe) - private def toSemanticType(using LinkMode, SemanticSymbolBuilder, Context)(sym: Symbol): s.Type = + private def toSemanticType(using LinkMode, SemanticSymbolBuilder, Context): s.Type = import ConstantOps._ def loop(tpe: Type): s.Type = tpe match { case ExprType(tpe) => From 5359f2272ac79faed51088d01c2522cecaa55261 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Wed, 7 Jul 2021 14:39:20 +0900 Subject: [PATCH 23/25] Fix pprint issue for SingleType When the prefix of SingleType is Type.Emtpy, we had been printing them as `.sym.type`, but it should be `sym.type` --- .../dotty/tools/dotc/semanticdb/PPrint.scala | 6 +- tests/semanticdb/metac.expect | 210 +++++++++--------- 2 files changed, 110 insertions(+), 106 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala b/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala index 5553468f8682..bc9832dd0028 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/PPrint.scala @@ -140,7 +140,11 @@ class SymbolInfomationPrinter (symtab: PrinterSymtab): val argsStr = if (args.nonEmpty) args.map(normal).mkString("[", ", ", "]") else "" s"${preStr}${pprintRef(sym)}${argsStr}" case SingleType(pre, sym) => - s"${prefix(pre)}.${pprintRef(sym)}" + pre match { + case Type.Empty => pprintRef(sym) + case _ => + s"${prefix(pre)}.${pprintRef(sym)}" + } case ThisType(sym) => s"${pprintRef(sym)}.this" case SuperType(pre, sym) => diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index ba93a2b8bb02..4d556f922339 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -64,7 +64,7 @@ advanced/Structural#s2(). => method s2 => Object { abstract val method x Int } advanced/Structural#s3(). => method s3 => Object { abstract method m (param x: Int): Int } advanced/Structural#s4(). => method s4 (param a: Int): Object { abstract val method x Int } advanced/Structural#s4().(a) => param a: Int -advanced/Test. => final object Test extends Object { self: .Test.type => +11 decls } +advanced/Test. => final object Test extends Object { self: Test.type => +11 decls } advanced/Test.e. => val method e Wildcards advanced/Test.e1. => val method e1 List[local14] forSome { _ } advanced/Test.e1x. => val method e1x Any @@ -206,7 +206,7 @@ Symbols => 22 entries Occurrences => 52 entries Symbols: -annot/Alias. => final object Alias extends Object { self: .Alias.type => +2 decls } +annot/Alias. => final object Alias extends Object { self: Alias.type => +2 decls } annot/Alias.A# => type A = ClassAnnotation @param annot/Annotations# => class Annotations [typeparam T ] extends Object { self: AnyRef & Annotations[T] => +6 decls } annot/Annotations#S# => type S @@ -221,7 +221,7 @@ annot/B#``(). => primary ctor (param x: Int): B annot/B#``().(x) => param x: Int annot/B#``(+1). => ctor (): B annot/B#x. => val method x Int -annot/M. => final object M extends Object { self: .M.type => +1 decls } +annot/M. => final object M extends Object { self: M.type => +1 decls } annot/M.m(). => macro m [typeparam TT ]: Int annot/M.m().[TT] => typeparam TT annot/T# => trait T extends Object { self: T => +1 decls } @@ -355,7 +355,7 @@ Symbols => 5 entries Occurrences => 5 entries Symbols: -angiven/AnonymousGiven$package. => final package object angiven extends Object { self: .angiven.type => +2 decls } +angiven/AnonymousGiven$package. => final package object angiven extends Object { self: angiven.type => +2 decls } angiven/AnonymousGiven$package.bar(). => method bar (implicit param x$1: Foo): Int angiven/AnonymousGiven$package.bar().(x$1) => implicit param x$1: Foo angiven/Foo# => trait Foo extends Object { self: Foo => +1 decls } @@ -384,12 +384,12 @@ classes/C1# => final class C1 extends AnyVal { self: C1 => +2 decls } classes/C1#``(). => primary ctor (val param x1: Int): C1 classes/C1#``().(x1) => val param x1: Int classes/C1#x1. => val method x1 Int -classes/C1. => final object C1 extends Object { self: .C1.type => +2 decls } +classes/C1. => final object C1 extends Object { self: C1.type => +2 decls } classes/C2# => final class C2 extends AnyVal { self: C2 => +2 decls } classes/C2#``(). => primary ctor (val param x2: Int): C2 classes/C2#``().(x2) => val param x2: Int classes/C2#x2. => val method x2 Int -classes/C2. => final object C2 extends Object { self: .C2.type => +2 decls } +classes/C2. => final object C2 extends Object { self: C2.type => +2 decls } classes/C3# => case class C3 extends Object with Product with Serializable { self: C3 => +5 decls } classes/C3#_1(). => method _1 => Int classes/C3#``(). => primary ctor (val param x: Int): C3 @@ -398,7 +398,7 @@ classes/C3#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance classes/C3#copy(). => method copy (param x: Int): C3 classes/C3#copy().(x) => param x: Int classes/C3#x. => val method x Int -classes/C3. => final object C3 extends Object { self: .C3.type => +4 decls } +classes/C3. => final object C3 extends Object { self: C3.type => +4 decls } classes/C3.apply(). => method apply (param x: Int): C3 classes/C3.apply().(x) => param x: Int classes/C3.toString(). => method toString => String @@ -412,7 +412,7 @@ classes/C4#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance classes/C4#copy(). => method copy (param x: Int): C4 classes/C4#copy().(x) => param x: Int classes/C4#x. => val method x Int -classes/C4. => final object C4 extends Object { self: .C4.type => +4 decls } +classes/C4. => final object C4 extends Object { self: C4.type => +4 decls } classes/C4.apply(). => method apply (param x: Int): C4 classes/C4.apply().(x) => param x: Int classes/C4.toString(). => method toString => String @@ -426,7 +426,7 @@ classes/C6#copy$default$1(). => method copy$default$1 => Int @uncheckedVariance classes/C6#copy(). => method copy (param x: Int): C6 classes/C6#copy().(x) => param x: Int classes/C6#x. => val method x Int -classes/C6. => final object C6 extends Object { self: .C6.type => +4 decls } +classes/C6. => final object C6 extends Object { self: C6.type => +4 decls } classes/C6.apply(). => method apply (param x: Int): C6 classes/C6.apply().(x) => param x: Int classes/C6.toString(). => method toString => String @@ -462,27 +462,27 @@ classes/C12#foo1(). => macro foo1 (param x: Int): Int classes/C12#foo1(). => method foo1 (param x: Int): Int classes/C12#foo1().(x) => param x: Int classes/C12#foo1().(x) => param x: Int -classes/C12#foo1Impl(). => method foo1Impl (param context: Context)(param x: .context.Expr[Int]): .context.Expr[Int] +classes/C12#foo1Impl(). => method foo1Impl (param context: Context)(param x: context.Expr[Int]): context.Expr[Int] classes/C12#foo1Impl().(context) => param context: Context -classes/C12#foo1Impl().(x) => param x: .context.Expr[Int] +classes/C12#foo1Impl().(x) => param x: context.Expr[Int] classes/C12#foo2(). => macro foo2 (param x: Int, param y: String): Int classes/C12#foo2(). => method foo2 (param x: Int, param y: String): Int classes/C12#foo2().(x) => param x: Int classes/C12#foo2().(x) => param x: Int classes/C12#foo2().(y) => param y: String classes/C12#foo2().(y) => param y: String -classes/C12#foo2Impl(). => method foo2Impl (param context: Context)(param x: .context.Expr[Int], param y: .context.Expr[String]): .context.Expr[Int] +classes/C12#foo2Impl(). => method foo2Impl (param context: Context)(param x: context.Expr[Int], param y: context.Expr[String]): context.Expr[Int] classes/C12#foo2Impl().(context) => param context: Context -classes/C12#foo2Impl().(x) => param x: .context.Expr[Int] -classes/C12#foo2Impl().(y) => param y: .context.Expr[String] -classes/M. => final object M extends Object { self: .M.type => +3 decls } +classes/C12#foo2Impl().(x) => param x: context.Expr[Int] +classes/C12#foo2Impl().(y) => param y: context.Expr[String] +classes/M. => final object M extends Object { self: M.type => +3 decls } classes/M.C5# => class C5 extends Object { self: C5 => +2 decls } classes/M.C5#``(). => primary ctor (param x: Int): C5 classes/M.C5#``().(x) => param x: Int classes/M.C5#x. => val method x Int classes/M.C5(). => final implicit method C5 (param x: Int): C5 classes/M.C5().(x) => param x: Int -classes/N. => final object N extends Object { self: .N.type => +3 decls } +classes/N. => final object N extends Object { self: N.type => +3 decls } classes/N.anonClass. => val method anonClass C7 classes/N.anonFun. => val method anonFun List[Int] local0 => val method local Nothing @@ -665,7 +665,7 @@ Symbols => 1 entries Occurrences => 2 entries Symbols: -example/EmptyObject. => final object EmptyObject extends Object { self: .EmptyObject.type => +1 decls } +example/EmptyObject. => final object EmptyObject extends Object { self: EmptyObject.type => +1 decls } Occurrences: [0:8..0:15): example <- example/ @@ -690,7 +690,7 @@ endmarkers/Container#`baz_=`().(x$1) => param x$1: Int endmarkers/Container#bar. => val method bar Tuple3[Int, Int, Int] endmarkers/Container#baz(). => var method baz Int endmarkers/Container#foo(). => method foo => Tuple3[Int, Int, Int] -endmarkers/EndMarkers$package. => final package object endmarkers extends Object { self: .endmarkers.type => +6 decls } +endmarkers/EndMarkers$package. => final package object endmarkers extends Object { self: endmarkers.type => +6 decls } endmarkers/EndMarkers$package.`topLevelVar_=`(). => var method topLevelVar_= (param x$1: String): Unit endmarkers/EndMarkers$package.`topLevelVar_=`().(x$1) => param x$1: String endmarkers/EndMarkers$package.topLevelMethod(). => method topLevelMethod => String @@ -702,7 +702,7 @@ endmarkers/MultiCtor#``(). => primary ctor (val param i: Int): Mult endmarkers/MultiCtor#``().(i) => val param i: Int endmarkers/MultiCtor#``(+1). => ctor (): MultiCtor endmarkers/MultiCtor#i. => val method i Int -endmarkers/TestObj. => final object TestObj extends Object { self: .TestObj.type => +2 decls } +endmarkers/TestObj. => final object TestObj extends Object { self: TestObj.type => +2 decls } endmarkers/TestObj.foo(). => method foo => Int local0 => val local localVal: Int local1 => var local localVar: Int @@ -764,7 +764,7 @@ Symbols => 2 entries Occurrences => 5 entries Symbols: -endmarkers2/package. => final package object endmarkers2 extends Object { self: .endmarkers2.type => +2 decls } +endmarkers2/package. => final package object endmarkers2 extends Object { self: endmarkers2.type => +2 decls } endmarkers2/package.Foo# => type Foo = Unit Occurrences: @@ -792,7 +792,7 @@ enumVal/Color# => abstract sealed enum class Color extends Object with Enum { se enumVal/Color#``(). => primary ctor (val param rgb: Int): Color enumVal/Color#``().(rgb) => val param rgb: Int enumVal/Color#rgb. => val method rgb Int -enumVal/Color. => final object Color extends Object { self: .Color.type => +8 decls } +enumVal/Color. => final object Color extends Object { self: Color.type => +8 decls } enumVal/Color.$values. => val method $values Array[Color] enumVal/Color.Blue. => case val static enum method Blue Color enumVal/Color.Green. => case val static enum method Green Color & A @@ -838,12 +838,12 @@ Symbols => 181 entries Occurrences => 184 entries Symbols: -_empty_/Enums. => final object Enums extends Object { self: .Enums.type => +30 decls } +_empty_/Enums. => final object Enums extends Object { self: Enums.type => +30 decls } _empty_/Enums.Coin# => abstract sealed enum class Coin extends Object with Enum { self: Coin => +2 decls } _empty_/Enums.Coin#``(). => primary ctor (param value: Int): Coin _empty_/Enums.Coin#``().(value) => param value: Int _empty_/Enums.Coin#value. => val method value Int -_empty_/Enums.Coin. => final object Coin extends Object { self: .Coin.type => +10 decls } +_empty_/Enums.Coin. => final object Coin extends Object { self: Coin.type => +10 decls } _empty_/Enums.Coin.$values. => val method $values Array[Coin] _empty_/Enums.Coin.Dime. => case val static enum method Dime Coin _empty_/Enums.Coin.Dollar. => case val static enum method Dollar Coin @@ -857,7 +857,7 @@ _empty_/Enums.Coin.valueOf().($name) => param $name: String _empty_/Enums.Coin.values(). => method values => Array[Coin] _empty_/Enums.Colour# => abstract sealed enum class Colour extends Object with Enum { self: Colour => +1 decls } _empty_/Enums.Colour#``(). => primary ctor (): Colour -_empty_/Enums.Colour. => final object Colour extends Object { self: .Colour.type => +9 decls } +_empty_/Enums.Colour. => final object Colour extends Object { self: Colour.type => +9 decls } _empty_/Enums.Colour.$new(). => method $new (param _$ordinal: Int, param $name: String): Colour _empty_/Enums.Colour.$new().($name) => param $name: String _empty_/Enums.Colour.$new().(_$ordinal) => param _$ordinal: Int @@ -872,7 +872,7 @@ _empty_/Enums.Colour.valueOf().($name) => param $name: String _empty_/Enums.Colour.values(). => method values => Array[Colour] _empty_/Enums.Directions# => abstract sealed enum class Directions extends Object with Enum { self: Directions => +1 decls } _empty_/Enums.Directions#``(). => primary ctor (): Directions -_empty_/Enums.Directions. => final object Directions extends Object { self: .Directions.type => +10 decls } +_empty_/Enums.Directions. => final object Directions extends Object { self: Directions.type => +10 decls } _empty_/Enums.Directions.$new(). => method $new (param _$ordinal: Int, param $name: String): Directions _empty_/Enums.Directions.$new().($name) => param $name: String _empty_/Enums.Directions.$new().(_$ordinal) => param _$ordinal: Int @@ -889,7 +889,7 @@ _empty_/Enums.Directions.values(). => method values => Array[Directions] _empty_/Enums.Maybe# => abstract sealed enum class Maybe [covariant typeparam A ] extends Object with Enum { self: Maybe[A] => +2 decls } _empty_/Enums.Maybe#[A] => covariant typeparam A _empty_/Enums.Maybe#``(). => primary ctor [covariant typeparam A ](): Maybe[A] -_empty_/Enums.Maybe. => final object Maybe extends Object { self: .Maybe.type => +6 decls } +_empty_/Enums.Maybe. => final object Maybe extends Object { self: Maybe.type => +6 decls } _empty_/Enums.Maybe.Just# => final case enum class Just [covariant typeparam A ] extends Maybe[A] { self: Just[A] => +7 decls } _empty_/Enums.Maybe.Just#[A] => covariant typeparam A _empty_/Enums.Maybe.Just#_1(). => method _1 => A @@ -902,7 +902,7 @@ _empty_/Enums.Maybe.Just#copy().(value) => param value: A _empty_/Enums.Maybe.Just#copy().[A] => typeparam A _empty_/Enums.Maybe.Just#ordinal(). => method ordinal => Int _empty_/Enums.Maybe.Just#value. => val method value A -_empty_/Enums.Maybe.Just. => final object Just extends Object { self: .Just.type => +4 decls } +_empty_/Enums.Maybe.Just. => final object Just extends Object { self: Just.type => +4 decls } _empty_/Enums.Maybe.Just.apply(). => method apply [typeparam A ](param value: A): Just[A] _empty_/Enums.Maybe.Just.apply().(value) => param value: A _empty_/Enums.Maybe.Just.apply().[A] => typeparam A @@ -923,7 +923,7 @@ _empty_/Enums.Planet#radius. => val method radius Double _empty_/Enums.Planet#surfaceGravity(). => method surfaceGravity => Double _empty_/Enums.Planet#surfaceWeight(). => method surfaceWeight (param otherMass: Double): Double _empty_/Enums.Planet#surfaceWeight().(otherMass) => param otherMass: Double -_empty_/Enums.Planet. => final object Planet extends Object { self: .Planet.type => +13 decls } +_empty_/Enums.Planet. => final object Planet extends Object { self: Planet.type => +13 decls } _empty_/Enums.Planet.$values. => val method $values Array[Planet] _empty_/Enums.Planet.Earth. => case val static enum method Earth Planet _empty_/Enums.Planet.Jupiter. => case val static enum method Jupiter Planet @@ -940,7 +940,7 @@ _empty_/Enums.Planet.valueOf().($name) => param $name: String _empty_/Enums.Planet.values(). => method values => Array[Planet] _empty_/Enums.Suits# => abstract sealed enum class Suits extends Object with Enum { self: Suits => +1 decls } _empty_/Enums.Suits#``(). => primary ctor (): Suits -_empty_/Enums.Suits. => final object Suits extends Object { self: .Suits.type => +13 decls } +_empty_/Enums.Suits. => final object Suits extends Object { self: Suits.type => +13 decls } _empty_/Enums.Suits.$new(). => method $new (param _$ordinal: Int, param $name: String): Suits _empty_/Enums.Suits.$new().($name) => param $name: String _empty_/Enums.Suits.$new().(_$ordinal) => param _$ordinal: Int @@ -962,7 +962,7 @@ _empty_/Enums.Suits.values(). => method values => Array[Suits] _empty_/Enums.Tag# => abstract sealed enum class Tag [typeparam A ] extends Object with Enum { self: Tag[A] => +2 decls } _empty_/Enums.Tag#[A] => typeparam A _empty_/Enums.Tag#``(). => primary ctor [typeparam A ](): Tag[A] -_empty_/Enums.Tag. => final object Tag extends Object { self: .Tag.type => +7 decls } +_empty_/Enums.Tag. => final object Tag extends Object { self: Tag.type => +7 decls } _empty_/Enums.Tag.$values. => val method $values Array[Tag[local1] forSome { _ }] _empty_/Enums.Tag.BooleanTag. => case val static enum method BooleanTag Tag[Boolean] _empty_/Enums.Tag.IntTag. => case val static enum method IntTag Tag[Int] @@ -973,7 +973,7 @@ _empty_/Enums.Tag.valueOf().($name) => param $name: String _empty_/Enums.Tag.values(). => method values => Array[Tag[local2] forSome { _ }] _empty_/Enums.WeekDays# => abstract sealed enum class WeekDays extends Object with Enum { self: WeekDays => +1 decls } _empty_/Enums.WeekDays#``(). => primary ctor (): WeekDays -_empty_/Enums.WeekDays. => final object WeekDays extends Object { self: .WeekDays.type => +13 decls } +_empty_/Enums.WeekDays. => final object WeekDays extends Object { self: WeekDays.type => +13 decls } _empty_/Enums.WeekDays.$new(). => method $new (param _$ordinal: Int, param $name: String): WeekDays _empty_/Enums.WeekDays.$new().($name) => param $name: String _empty_/Enums.WeekDays.$new().(_$ordinal) => param _$ordinal: Int @@ -994,14 +994,14 @@ _empty_/Enums.`<:<`# => abstract sealed enum class <:< [contravariant typeparam _empty_/Enums.`<:<`#[A] => contravariant typeparam A _empty_/Enums.`<:<`#[B] => typeparam B _empty_/Enums.`<:<`#``(). => primary ctor [contravariant typeparam A , typeparam B ](): <:<[A, B] -_empty_/Enums.`<:<`. => final object <:< extends Object { self: .<:<.type => +6 decls } +_empty_/Enums.`<:<`. => final object <:< extends Object { self: <:<.type => +6 decls } _empty_/Enums.`<:<`.Refl# => final case enum class Refl [typeparam C ] extends <:<[C, C] { self: Refl[C] => +4 decls } _empty_/Enums.`<:<`.Refl#[C] => typeparam C _empty_/Enums.`<:<`.Refl#``(). => primary ctor [typeparam C ](): Refl[C] _empty_/Enums.`<:<`.Refl#copy(). => method copy [typeparam C ](): Refl[C] _empty_/Enums.`<:<`.Refl#copy().[C] => typeparam C _empty_/Enums.`<:<`.Refl#ordinal(). => method ordinal => Int -_empty_/Enums.`<:<`.Refl. => final object Refl extends Object { self: .Refl.type => +4 decls } +_empty_/Enums.`<:<`.Refl. => final object Refl extends Object { self: Refl.type => +4 decls } _empty_/Enums.`<:<`.Refl.apply(). => method apply [typeparam C ](): Refl[C] _empty_/Enums.`<:<`.Refl.apply().[C] => typeparam C _empty_/Enums.`<:<`.Refl.toString(). => method toString => String @@ -1248,11 +1248,11 @@ Symbols => 5 entries Occurrences => 25 entries Symbols: -example/Example. => final object Example extends Object { self: .Example.type => +3 decls } +example/Example. => final object Example extends Object { self: Example.type => +3 decls } example/Example.main(). => method main (param args: Array[String]): Unit example/Example.main().(args) => param args: Array[String] example/Example.x. => val method x ClassTag[Int] -local0 => selfparam self: .Example.type +local0 => selfparam self: Example.type Occurrences: [0:8..0:15): example <- example/ @@ -1293,7 +1293,7 @@ Symbols => 17 entries Occurrences => 40 entries Symbols: -ext/Extension$package. => final package object ext extends Object { self: .ext.type => +6 decls } +ext/Extension$package. => final package object ext extends Object { self: ext.type => +6 decls } ext/Extension$package.`#*#`(). => method #*# (param s: String)(param i: Int): Tuple2[String, Int] ext/Extension$package.`#*#`().(i) => param i: Int ext/Extension$package.`#*#`().(s) => param s: String @@ -1481,7 +1481,7 @@ Symbols => 29 entries Occurrences => 70 entries Symbols: -a/b/Givens. => final object Givens extends Object { self: .Givens.type => +12 decls } +a/b/Givens. => final object Givens extends Object { self: Givens.type => +12 decls } a/b/Givens.Monoid# => trait Monoid [typeparam A ] extends Object { self: Monoid[A] => +4 decls } a/b/Givens.Monoid#[A] => typeparam A a/b/Givens.Monoid#``(). => primary ctor [typeparam A ](): Monoid[A] @@ -1492,7 +1492,7 @@ a/b/Givens.Monoid#empty(). => abstract method empty => A a/b/Givens.foo(). => method foo [typeparam A ](implicit param A: Monoid[A]): A a/b/Givens.foo().(A) => implicit param A: Monoid[A] a/b/Givens.foo().[A] => typeparam A -a/b/Givens.given_Monoid_String. => final implicit object given_Monoid_String extends Object with Monoid[String] { self: .given_Monoid_String.type => +3 decls } +a/b/Givens.given_Monoid_String. => final implicit object given_Monoid_String extends Object with Monoid[String] { self: given_Monoid_String.type => +3 decls } a/b/Givens.given_Monoid_String.combine(). => method combine (param x: String)(param y: String): String a/b/Givens.given_Monoid_String.combine().(x) => param x: String a/b/Givens.given_Monoid_String.combine().(y) => param y: String @@ -1606,7 +1606,7 @@ example/ImplicitConversion#string2Number(). => implicit method string2Number (pa example/ImplicitConversion#string2Number().(string) => param string: String example/ImplicitConversion#tuple. => val method tuple Tuple2[Int, Int] example/ImplicitConversion#x. => val method x Int -example/ImplicitConversion. => final object ImplicitConversion extends Object { self: .ImplicitConversion.type => +6 decls } +example/ImplicitConversion. => final object ImplicitConversion extends Object { self: ImplicitConversion.type => +6 decls } example/ImplicitConversion.newAny2stringadd# => final class newAny2stringadd [typeparam A ] extends AnyVal { self: newAny2stringadd[A] => +4 decls } example/ImplicitConversion.newAny2stringadd#[A] => typeparam A example/ImplicitConversion.newAny2stringadd#`+`(). => method + (param other: String): String @@ -1617,7 +1617,7 @@ example/ImplicitConversion.newAny2stringadd#self. => val method self A example/ImplicitConversion.newAny2stringadd(). => final implicit method newAny2stringadd [typeparam A ](param self: A): newAny2stringadd[A] example/ImplicitConversion.newAny2stringadd().(self) => param self: A example/ImplicitConversion.newAny2stringadd().[A] => typeparam A -example/ImplicitConversion.newAny2stringadd. => final object newAny2stringadd extends Object { self: .newAny2stringadd.type => +2 decls } +example/ImplicitConversion.newAny2stringadd. => final object newAny2stringadd extends Object { self: newAny2stringadd.type => +2 decls } Occurrences: [0:8..0:15): example <- example/ @@ -1719,8 +1719,8 @@ example/InstrumentTyper#AnnotatedType# => type AnnotatedType = Int @param example/InstrumentTyper#``(). => primary ctor (): InstrumentTyper example/InstrumentTyper#all(). => method all => List[Matchable] example/InstrumentTyper#clazzOf. => final val method clazzOf Option[Int] -example/InstrumentTyper#singletonType(). => method singletonType (param x: .Predef.type): Nothing -example/InstrumentTyper#singletonType().(x) => param x: .Predef.type +example/InstrumentTyper#singletonType(). => method singletonType (param x: Predef.type): Nothing +example/InstrumentTyper#singletonType().(x) => param x: Predef.type local0 => selfparam self: AnyRef Occurrences: @@ -1792,7 +1792,7 @@ Symbols => 45 entries Occurrences => 72 entries Symbols: -givens/InventedNames$package. => final package object givens extends Object { self: .givens.type => +24 decls } +givens/InventedNames$package. => final package object givens extends Object { self: givens.type => +24 decls } givens/InventedNames$package.`* *`. => final implicit lazy val method * * Long givens/InventedNames$package.a. => val method a Int givens/InventedNames$package.b. => val method b String @@ -1808,7 +1808,7 @@ givens/InventedNames$package.given_Float. => final implicit lazy val method give givens/InventedNames$package.given_List_T(). => final implicit method given_List_T [typeparam T ]: List[T] givens/InventedNames$package.given_List_T().[T] => typeparam T givens/InventedNames$package.given_String. => final implicit lazy val method given_String String -givens/InventedNames$package.given_X. => final implicit object given_X extends Object with X { self: .given_X.type => +2 decls } +givens/InventedNames$package.given_X. => final implicit object given_X extends Object with X { self: given_X.type => +2 decls } givens/InventedNames$package.given_X.doX(). => method doX => Int givens/InventedNames$package.given_Y# => class given_Y extends Object with Y { self: given_Y => +3 decls } givens/InventedNames$package.given_Y#``(). => primary ctor ()(implicit val param x$1: X): given_Y @@ -1824,7 +1824,7 @@ givens/InventedNames$package.given_Z_T#doZ(). => method doZ => List[T] givens/InventedNames$package.given_Z_T(). => final implicit method given_Z_T [typeparam T ]: given_Z_T[T] givens/InventedNames$package.given_Z_T().[T] => typeparam T givens/InventedNames$package.intValue. => final implicit lazy val method intValue Int -givens/InventedNames$package.x. => val method x .given_X.type +givens/InventedNames$package.x. => val method x given_X.type givens/InventedNames$package.y. => val method y given_Y givens/InventedNames$package.z. => val method z given_Z_T[String] givens/X# => trait X extends Object { self: X => +2 decls } @@ -2009,7 +2009,7 @@ Occurrences => 7 entries Symbols: local0 => val local x: Int -locals/Test. => final object Test extends Object { self: .Test.type => +2 decls } +locals/Test. => final object Test extends Object { self: Test.type => +2 decls } locals/Test.xs. => val method xs List[Int] Occurrences: @@ -2039,9 +2039,9 @@ example/MetacJava#coin. => val method coin Coin example/MetacJava#entry. => val method entry Entry[Int, Int] example/MetacJava#inner. => val method inner MetacJava example/MetacJava#interface. => val method interface Interface -example/MetacJava#nonStatic. => val method nonStatic .staticInner.NonStatic -example/MetacJava#overload1. => val method overload1 .inner.Overload1 -example/MetacJava#overload2. => val method overload2 .inner.Overload2 +example/MetacJava#nonStatic. => val method nonStatic staticInner.NonStatic +example/MetacJava#overload1. => val method overload1 inner.Overload1 +example/MetacJava#overload2. => val method overload2 inner.Overload2 example/MetacJava#staticInner. => val method staticInner StaticInner Occurrences: @@ -2244,8 +2244,8 @@ example/Methods#``(). => primary ctor [typeparam T ](): Methods[T] example/Methods#`m8().`(). => method m8(). (): Nothing example/Methods#`m9().`# => class m9(). extends Object { self: m9(). => +1 decls } example/Methods#`m9().`#``(). => primary ctor (): m9(). -example/Methods#`m20_=`(). => var method m20_= (param x$1: .m17.type): Unit -example/Methods#`m20_=`().(x$1) => param x$1: .m17.type +example/Methods#`m20_=`(). => var method m20_= (param x$1: m17.type): Unit +example/Methods#`m20_=`().(x$1) => param x$1: m17.type example/Methods#m1(). => method m1 => Nothing example/Methods#m2(). => method m2 (): Nothing example/Methods#m3(). => method m3 (param x: Int): Nothing @@ -2271,10 +2271,10 @@ example/Methods#m9(). => method m9 (param x: m9().): Nothing example/Methods#m9().(x) => param x: m9(). example/Methods#m10(). => method m10 (param x: List[T]): Nothing example/Methods#m10().(x) => param x: List[T] -example/Methods#m11(). => method m11 (param x: .Predef.type): Nothing -example/Methods#m11().(x) => param x: .Predef.type -example/Methods#m11(+1). => method m11 (param x: .Example.type): Nothing -example/Methods#m11(+1).(x) => param x: .Example.type +example/Methods#m11(). => method m11 (param x: Predef.type): Nothing +example/Methods#m11().(x) => param x: Predef.type +example/Methods#m11(+1). => method m11 (param x: Example.type): Nothing +example/Methods#m11(+1).(x) => param x: Example.type example/Methods#m12a(). => method m12a (param x: Object): Nothing example/Methods#m12a().(x) => param x: Object example/Methods#m12b(). => method m12b (param x: Object { abstract val method x Int }): Nothing @@ -2291,13 +2291,13 @@ example/Methods#m17(). => method m17 (param a: Int): Nothing example/Methods#m17().(a) => param a: Int example/Methods#m17(+1). => method m17 (param b: String): Nothing example/Methods#m17(+1).(b) => param b: String -example/Methods#m17. => final object m17 extends Object { self: .m17.type => +2 decls } +example/Methods#m17. => final object m17 extends Object { self: m17.type => +2 decls } example/Methods#m17.m(). => method m (): Nothing example/Methods#m18(). => method m18 (param a: Int): Nothing example/Methods#m18().(a) => param a: Int example/Methods#m18(+1). => method m18 (param b: String): Nothing example/Methods#m18(+1).(b) => param b: String -example/Methods#m18. => val method m18 .m17.type +example/Methods#m18. => val method m18 m17.type example/Methods#m19$default$2(). => method m19$default$2 => Int @uncheckedVariance example/Methods#m19$default$3(). => method m19$default$3 (param x: Int, param y: Int): Int @uncheckedVariance example/Methods#m19$default$3().(x) => param x: Int @@ -2310,7 +2310,7 @@ example/Methods#m20(). => method m20 (param a: Int): Nothing example/Methods#m20().(a) => param a: Int example/Methods#m20(+1). => method m20 (param b: String): Nothing example/Methods#m20(+1).(b) => param b: String -example/Methods#m20(+2). => var method m20 .m17.type +example/Methods#m20(+2). => var method m20 m17.type local0 => abstract val method x Int local1 => abstract val method x Int local2 => abstract method y => Int @@ -2485,7 +2485,7 @@ Symbols => 43 entries Occurrences => 43 entries Symbols: -example/NamedApplyBlockCaseClassConstruction. => final object NamedApplyBlockCaseClassConstruction extends Object { self: .NamedApplyBlockCaseClassConstruction.type => +6 decls } +example/NamedApplyBlockCaseClassConstruction. => final object NamedApplyBlockCaseClassConstruction extends Object { self: NamedApplyBlockCaseClassConstruction.type => +6 decls } example/NamedApplyBlockCaseClassConstruction.Msg# => case class Msg extends Object with Product with Serializable { self: Msg => +11 decls } example/NamedApplyBlockCaseClassConstruction.Msg#_1(). => method _1 => String example/NamedApplyBlockCaseClassConstruction.Msg#_2(). => method _2 => String @@ -2504,7 +2504,7 @@ example/NamedApplyBlockCaseClassConstruction.Msg#copy().(head) => param head: St example/NamedApplyBlockCaseClassConstruction.Msg#copy().(tail) => param tail: String example/NamedApplyBlockCaseClassConstruction.Msg#head. => val method head String example/NamedApplyBlockCaseClassConstruction.Msg#tail. => val method tail String -example/NamedApplyBlockCaseClassConstruction.Msg. => final object Msg extends Object { self: .Msg.type => +5 decls } +example/NamedApplyBlockCaseClassConstruction.Msg. => final object Msg extends Object { self: Msg.type => +5 decls } example/NamedApplyBlockCaseClassConstruction.Msg.$lessinit$greater$default$2(). => method $lessinit$greater$default$2 => String @uncheckedVariance example/NamedApplyBlockCaseClassConstruction.Msg.apply(). => method apply (param body: String, param head: String, param tail: String): Msg example/NamedApplyBlockCaseClassConstruction.Msg.apply().(body) => param body: String @@ -2515,7 +2515,7 @@ example/NamedApplyBlockCaseClassConstruction.Msg.unapply(). => method unapply (p example/NamedApplyBlockCaseClassConstruction.Msg.unapply().(x$1) => param x$1: Msg example/NamedApplyBlockCaseClassConstruction.bodyText. => val method bodyText String example/NamedApplyBlockCaseClassConstruction.msg. => val method msg Msg -example/NamedApplyBlockMethods. => final object NamedApplyBlockMethods extends Object { self: .NamedApplyBlockMethods.type => +8 decls } +example/NamedApplyBlockMethods. => final object NamedApplyBlockMethods extends Object { self: NamedApplyBlockMethods.type => +8 decls } example/NamedApplyBlockMethods.baseCase(). => method baseCase => Int example/NamedApplyBlockMethods.foo$default$1(). => method foo$default$1 => Int @uncheckedVariance example/NamedApplyBlockMethods.foo$default$2(). => method foo$default$2 => Int @uncheckedVariance @@ -2595,7 +2595,7 @@ example/NamedArguments#User#copy$default$1(). => method copy$default$1 => String example/NamedArguments#User#copy(). => method copy (param name: String): User example/NamedArguments#User#copy().(name) => param name: String example/NamedArguments#User#name. => val method name String -example/NamedArguments#User. => final object User extends Object { self: .User.type => +4 decls } +example/NamedArguments#User. => final object User extends Object { self: User.type => +4 decls } example/NamedArguments#User.apply(). => method apply (param name: String): User example/NamedArguments#User.apply().(name) => param name: String example/NamedArguments#User.toString(). => method toString => String @@ -2630,7 +2630,7 @@ Symbols => 3 entries Occurrences => 4 entries Symbols: -_empty_/NewModifiers. => final object NewModifiers extends Object { self: .NewModifiers.type {} => +3 decls } +_empty_/NewModifiers. => final object NewModifiers extends Object { self: NewModifiers.type {} => +3 decls } _empty_/NewModifiers.A# => type A _empty_/NewModifiers.foo. => val method foo "foo" @@ -2652,8 +2652,8 @@ Symbols => 2 entries Occurrences => 3 entries Symbols: -objects/X. => final object X extends Object { self: .X.type => +3 decls } -objects/X.Y. => final object Y extends Object { self: .Y.type => +1 decls } +objects/X. => final object X extends Object { self: X.type => +3 decls } +objects/X.Y. => final object Y extends Object { self: Y.type => +1 decls } Occurrences: [0:8..0:15): objects <- objects/ @@ -2704,22 +2704,22 @@ Occurrences => 49 entries Symbols: prefixes/C# => class C extends Object { self: C => +6 decls } -prefixes/C#N. => final object N extends Object { self: .N.type => +2 decls } +prefixes/C#N. => final object N extends Object { self: N.type => +2 decls } prefixes/C#N.U# => type U prefixes/C#T# => type T prefixes/C#``(). => primary ctor (): C prefixes/C#k1(). => method k1 => U prefixes/C#m1(). => method m1 => T -prefixes/M. => final object M extends Object { self: .M.type => +3 decls } +prefixes/M. => final object M extends Object { self: M.type => +3 decls } prefixes/M.T# => type T prefixes/M.n1(). => method n1 => T -prefixes/O. => final object O extends C { self: .O.type => +2 decls } +prefixes/O. => final object O extends C { self: O.type => +2 decls } prefixes/O.o1(). => method o1 => O.this.T -prefixes/Test. => final object Test extends Object { self: .Test.type => +7 decls } +prefixes/Test. => final object Test extends Object { self: Test.type => +7 decls } prefixes/Test.c. => val method c C -prefixes/Test.k2(). => method k2 => .c.N.U -prefixes/Test.k3(). => method k3 => .c.N.U -prefixes/Test.m2(). => method m2 => .c.T +prefixes/Test.k2(). => method k2 => c.N.U +prefixes/Test.k3(). => method k3 => c.N.U +prefixes/Test.m2(). => method m2 => c.T prefixes/Test.n2(). => method n2 => T prefixes/Test.n3(). => method n3 => T @@ -2790,7 +2790,7 @@ example/C# => class C extends Object { self: C => +3 decls } example/C#T1# => type T1 example/C#T2# => type T2 example/C#``(). => primary ctor (): C -example/RecOrRefined$package. => final package object example extends Object { self: .example.type => +6 decls } +example/RecOrRefined$package. => final package object example extends Object { self: example.type => +6 decls } example/RecOrRefined$package.C2# => type C2 = C { type T2 = T1; type T1 } example/RecOrRefined$package.Person# => type Person = Record { abstract val method age Int; abstract val method name String } example/RecOrRefined$package.m1(). => method m1 (param a: Int { abstract val method x Int }): Nothing @@ -2885,7 +2885,7 @@ Symbols => 5 entries Occurrences => 13 entries Symbols: -ext/RightAssociativeExtension$package. => final package object ext extends Object { self: .ext.type => +3 decls } +ext/RightAssociativeExtension$package. => final package object ext extends Object { self: ext.type => +3 decls } ext/RightAssociativeExtension$package.`:*:`(). => method :*: (param i: Int)(param s: String): Tuple2[String, Int] ext/RightAssociativeExtension$package.`:*:`().(i) => param i: Int ext/RightAssociativeExtension$package.`:*:`().(s) => param s: String @@ -2988,11 +2988,11 @@ example/Synthetic#f. => val method f Ordered[F] example/Synthetic#lst. => val method lst LazyList[Int] example/Synthetic#name. => val method name String example/Synthetic#ordering. => implicit val method ordering Ordering[F] -example/Synthetic#s. => final object s extends Object { self: .s.type => +5 decls } +example/Synthetic#s. => final object s extends Object { self: s.type => +5 decls } example/Synthetic#s.Bar# => case class Bar extends Object with Product with Serializable { self: Bar => +2 decls } example/Synthetic#s.Bar#``(). => primary ctor (): Bar example/Synthetic#s.Bar#copy(). => method copy (): Bar -example/Synthetic#s.Bar. => final object Bar extends Object { self: .Bar.type => +4 decls } +example/Synthetic#s.Bar. => final object Bar extends Object { self: Bar.type => +4 decls } example/Synthetic#s.Bar.apply(). => method apply (): Bar example/Synthetic#s.Bar.toString(). => method toString => String example/Synthetic#s.Bar.unapply(). => method unapply (param x$1: Bar): true @@ -3196,7 +3196,7 @@ traits/T#``(). => primary ctor (): T traits/T#x(). => method x => Int traits/U# => sealed trait U extends Object { self: U => +1 decls } traits/U#``(). => primary ctor (): U -traits/U. => final object U extends Object { self: .U.type => +2 decls } +traits/U. => final object U extends Object { self: U.type => +2 decls } traits/U.u(). => method u => U traits/V# => trait V extends Object { self: C & V => +1 decls } traits/V#``(). => primary ctor (): V @@ -3331,7 +3331,7 @@ Symbols => 42 entries Occurrences => 129 entries Symbols: -example/ValUsages. => final object ValUsages extends Object { self: .ValUsages.type => +2 decls } +example/ValUsages. => final object ValUsages extends Object { self: ValUsages.type => +2 decls } example/ValUsages.v. => val method v Vals example/Vals# => abstract class Vals extends Object { self: Vals => +25 decls } example/Vals#_explicitSetter(). => var method _explicitSetter Int @@ -3624,7 +3624,7 @@ Symbols => 4 entries Occurrences => 5 entries Symbols: -exports/`exports-package$package`. => final package object exports extends Object { self: .exports.type => +4 decls } +exports/`exports-package$package`. => final package object exports extends Object { self: exports.type => +4 decls } exports/`exports-package$package`.Codec# => final type Codec = Codec[] exports/`exports-package$package`.Decoder# => final type Decoder = Decoder[] exports/`exports-package$package`.Encoder# => final type Encoder = Encoder[] @@ -3672,7 +3672,7 @@ i9727/Test# => class Test extends Object { self: Test => +2 decls } i9727/Test#``(). => primary ctor (param a: Int): Test i9727/Test#``().(a) => param a: Int i9727/Test#a. => val method a Int -i9727/i9727$package. => final package object i9727 extends Object { self: .i9727.type => +3 decls } +i9727/i9727$package. => final package object i9727 extends Object { self: i9727.type => +3 decls } i9727/i9727$package.a. => val method a Test i9727/i9727$package.b. => val method b Test @@ -3728,7 +3728,7 @@ Symbols => 3 entries Occurrences => 12 entries Symbols: -inlinedefs/FakePredef. => final object FakePredef extends Object { self: .FakePredef.type => +2 decls } +inlinedefs/FakePredef. => final object FakePredef extends Object { self: FakePredef.type => +2 decls } inlinedefs/FakePredef.assert(). => final macro assert (param assertion: Boolean): Unit inlinedefs/FakePredef.assert().(assertion) => param assertion: Boolean @@ -3787,10 +3787,10 @@ local0 => case val method N$1 local1 => val local p: N$1 local2 => case val method N$2 local3 => val local p: N$2 -local4 => val local Nat_this: .Zero.type -local5 => val local Nat_this: Succ[.Zero.type] +local4 => val local Nat_this: Zero.type +local5 => val local Nat_this: Succ[Zero.type] local6 => val local Nat_this: Succ[local7] forSome { _ } -recursion/Nats. => final object Nats extends Object { self: .Nats.type => +9 decls } +recursion/Nats. => final object Nats extends Object { self: Nats.type => +9 decls } recursion/Nats.Nat# => sealed trait Nat extends Object { self: Nat => +3 decls } recursion/Nats.Nat#`++`(). => macro ++ => Succ[Nat.this.type] recursion/Nats.Nat#`+`(). => macro + (param that: Nat): Nat @@ -3807,7 +3807,7 @@ recursion/Nats.Succ#copy(). => method copy [typeparam N ](param p: N): Succ[N] recursion/Nats.Succ#copy().(p) => param p: N recursion/Nats.Succ#copy().[N] => typeparam N recursion/Nats.Succ#p. => val method p N -recursion/Nats.Succ. => final object Succ extends Object { self: .Succ.type => +4 decls } +recursion/Nats.Succ. => final object Succ extends Object { self: Succ.type => +4 decls } recursion/Nats.Succ.apply(). => method apply [typeparam N ](param p: N): Succ[N] recursion/Nats.Succ.apply().(p) => param p: N recursion/Nats.Succ.apply().[N] => typeparam N @@ -3815,7 +3815,7 @@ recursion/Nats.Succ.toString(). => method toString => String recursion/Nats.Succ.unapply(). => method unapply [typeparam N ](param x$1: Succ[N]): Succ[N] recursion/Nats.Succ.unapply().(x$1) => param x$1: Succ[N] recursion/Nats.Succ.unapply().[N] => typeparam N -recursion/Nats.Zero. => final case object Zero extends Object with Nat with Product with Serializable { self: .Zero.type => +1 decls } +recursion/Nats.Zero. => final case object Zero extends Object with Nat with Product with Serializable { self: Zero.type => +1 decls } recursion/Nats.j31. => val method j31 Int recursion/Nats.toIntg(). => macro toIntg (param n: Nat): Int recursion/Nats.toIntg().(n) => param n: Nat @@ -3890,7 +3890,7 @@ Symbols => 10 entries Occurrences => 9 entries Symbols: -a/Definitions. => final object Definitions extends Object { self: .Definitions.type => +9 decls } +a/Definitions. => final object Definitions extends Object { self: Definitions.type => +9 decls } a/Definitions.D# => class D extends Object { self: D => +1 decls } a/Definitions.D#``(). => primary ctor (): D a/Definitions.E# => trait E extends Object { self: E => +1 decls } @@ -3924,7 +3924,7 @@ Symbols => 50 entries Occurrences => 82 entries Symbols: -flags/p/package. => final package object p extends Object { self: .p.type => +23 decls } +flags/p/package. => final package object p extends Object { self: p.type => +23 decls } flags/p/package.AA# => class AA extends Object { self: AA => +5 decls } flags/p/package.AA#``(). => primary ctor (param x: Int, val param y: Int, var param z: Int): AA flags/p/package.AA#``().(x) => param x: Int @@ -3958,7 +3958,7 @@ flags/p/package.T2# => type T2 [typeparam T ] = S[T] flags/p/package.T2#[T] => typeparam T flags/p/package.U# => type U flags/p/package.V# => type V >: Int -flags/p/package.X. => final case object X extends Object with Product with Serializable { self: .X.type => +1 decls } +flags/p/package.X. => final case object X extends Object with Product with Serializable { self: X.type => +1 decls } flags/p/package.Y# => final class Y extends Object { self: Y => +1 decls } flags/p/package.Y#``(). => primary ctor (): Y flags/p/package.Z# => sealed trait Z extends Object { self: Z => +1 decls } @@ -4092,7 +4092,7 @@ types/Foo#copy$default$1(). => method copy$default$1 => "abc" @uncheckedVariance types/Foo#copy(). => method copy (param s: "abc"): Foo types/Foo#copy().(s) => param s: "abc" types/Foo#s. => val method s "abc" -types/Foo. => final object Foo extends Object { self: .Foo.type => +6 decls } +types/Foo. => final object Foo extends Object { self: Foo.type => +6 decls } types/Foo.apply(). => method apply (param s: "abc"): Foo types/Foo.apply().(s) => param s: "abc" types/Foo.toString(). => method toString => String @@ -4114,20 +4114,20 @@ types/T#X# => class X extends Object { self: X => +1 decls } types/T#X#``(). => primary ctor (): X types/T#``(). => primary ctor (): T types/T#x. => val method x X -types/Test. => final object Test extends Object { self: .Test.type => +10 decls } +types/Test. => final object Test extends Object { self: Test.type => +10 decls } types/Test.C# => class C extends M { self: C => +42 decls } -types/Test.C#ByNameType. => final object ByNameType extends Object { self: .ByNameType.type => +2 decls } +types/Test.C#ByNameType. => final object ByNameType extends Object { self: ByNameType.type => +2 decls } types/Test.C#ByNameType.m1(). => method m1 (param x: => Int): Int types/Test.C#ByNameType.m1().(x) => param x: => Int -types/Test.C#ClassInfoType1. => final object ClassInfoType1 extends Object { self: .ClassInfoType1.type => +1 decls } +types/Test.C#ClassInfoType1. => final object ClassInfoType1 extends Object { self: ClassInfoType1.type => +1 decls } types/Test.C#ClassInfoType2# => class ClassInfoType2 extends B { self: ClassInfoType2 => +2 decls } types/Test.C#ClassInfoType2#``(). => primary ctor (): ClassInfoType2 types/Test.C#ClassInfoType2#x(). => method x => Int types/Test.C#ClassInfoType3# => trait ClassInfoType3 [typeparam T ] extends Object { self: ClassInfoType3[T] => +2 decls } types/Test.C#ClassInfoType3#[T] => typeparam T types/Test.C#ClassInfoType3#``(). => primary ctor [typeparam T ](): ClassInfoType3[T] -types/Test.C#Either. => val method Either .Either.type -types/Test.C#MethodType. => final object MethodType extends Object { self: .MethodType.type => +7 decls } +types/Test.C#Either. => val method Either Either.type +types/Test.C#MethodType. => final object MethodType extends Object { self: MethodType.type => +7 decls } types/Test.C#MethodType.m3(). => method m3 => Int types/Test.C#MethodType.m4(). => method m4 (): Int types/Test.C#MethodType.m5(). => method m5 (param x: Int): Int @@ -4144,13 +4144,13 @@ types/Test.C#RepeatedType#``().(s) => val param s: String* types/Test.C#RepeatedType#m1(). => method m1 (param x: Int*): Int types/Test.C#RepeatedType#m1().(x) => param x: Int* types/Test.C#RepeatedType#s. => val method s String* -types/Test.C#RepeatedType. => final object RepeatedType extends Object { self: .RepeatedType.type => +4 decls } +types/Test.C#RepeatedType. => final object RepeatedType extends Object { self: RepeatedType.type => +4 decls } types/Test.C#RepeatedType.apply(). => method apply (param s: String*): RepeatedType types/Test.C#RepeatedType.apply().(s) => param s: String* types/Test.C#RepeatedType.toString(). => method toString => String types/Test.C#RepeatedType.unapplySeq(). => method unapplySeq (param x$1: RepeatedType): RepeatedType types/Test.C#RepeatedType.unapplySeq().(x$1) => param x$1: RepeatedType -types/Test.C#TypeType. => final object TypeType extends Object { self: .TypeType.type => +6 decls } +types/Test.C#TypeType. => final object TypeType extends Object { self: TypeType.type => +6 decls } types/Test.C#TypeType.T1# => type T1 types/Test.C#TypeType.T4# => type T4 = C types/Test.C#TypeType.T5# => type T5 [typeparam U ] = U @@ -4172,8 +4172,8 @@ types/Test.C#existentialType2. => val method existentialType2 List[local10] forS types/Test.C#existentialType3. => val method existentialType3 Class[local11] forSome { _ } types/Test.C#existentialType4. => val method existentialType4 Class[local12] forSome { _ } types/Test.C#p. => val method p P -types/Test.C#singleType1. => val method singleType1 .x.type -types/Test.C#singleType2. => val method singleType2 .p.x.type +types/Test.C#singleType1. => val method singleType1 x.type +types/Test.C#singleType2. => val method singleType2 p.x.type types/Test.C#superType1. => val method superType1 Int types/Test.C#superType2. => val method superType2 Int types/Test.C#superType3. => val method superType3 Int @@ -4182,11 +4182,11 @@ types/Test.C#thisType2. => val method thisType2 C.this.type types/Test.C#typeLambda1(). => method typeLambda1 [typeparam M ]: Nothing types/Test.C#typeLambda1().[M] => typeparam M types/Test.C#typeRef1. => val method typeRef1 C -types/Test.C#typeRef2. => val method typeRef2 .p.C +types/Test.C#typeRef2. => val method typeRef2 p.C types/Test.C#typeRef3. => val method typeRef3 T#C types/Test.C#typeRef4. => val method typeRef4 List[Int] -types/Test.C#x. => val method x .p.X -types/Test.Literal. => final object Literal extends Object { self: .Literal.type => +12 decls } +types/Test.C#x. => val method x p.X +types/Test.Literal. => final object Literal extends Object { self: Literal.type => +12 decls } types/Test.Literal.bool. => final val method bool true types/Test.Literal.char. => final val method char 'a' types/Test.Literal.clazzOf. => final val method clazzOf Option[Int] @@ -4478,7 +4478,7 @@ Symbols => 18 entries Occurrences => 22 entries Symbols: -_empty_/AnObject. => final object AnObject extends Object { self: .AnObject.type => +6 decls } +_empty_/AnObject. => final object AnObject extends Object { self: AnObject.type => +6 decls } _empty_/AnObject.Foo# => case class Foo extends Object with Product with Serializable { self: Foo => +5 decls } _empty_/AnObject.Foo#_1(). => method _1 => Int _empty_/AnObject.Foo#``(). => primary ctor (val param x: Int): Foo @@ -4487,7 +4487,7 @@ _empty_/AnObject.Foo#copy$default$1(). => method copy$default$1 => Int @unchecke _empty_/AnObject.Foo#copy(). => method copy (param x: Int): Foo _empty_/AnObject.Foo#copy().(x) => param x: Int _empty_/AnObject.Foo#x. => val method x Int -_empty_/AnObject.Foo. => final object Foo extends Object { self: .Foo.type => +4 decls } +_empty_/AnObject.Foo. => final object Foo extends Object { self: Foo.type => +4 decls } _empty_/AnObject.Foo.apply(). => method apply (param x: Int): Foo _empty_/AnObject.Foo.apply().(x) => param x: Int _empty_/AnObject.Foo.toString(). => method toString => String @@ -4537,7 +4537,7 @@ _empty_/MyProgram# => final class MyProgram extends Object { self: MyProgram => _empty_/MyProgram#``(). => primary ctor (): MyProgram _empty_/MyProgram#main(). => static method main (param args: Array[String]): Unit _empty_/MyProgram#main().(args) => param args: Array[String] -_empty_/toplevel$package. => final package object _empty_ extends Object { self: ._empty_.type => +8 decls } +_empty_/toplevel$package. => final package object _empty_ extends Object { self: _empty_.type => +8 decls } _empty_/toplevel$package.MyProgram(). => method MyProgram (param times: Int): Unit _empty_/toplevel$package.MyProgram().(times) => param times: Int _empty_/toplevel$package.a. => val method a "" From 9a0d3ac86b1e9d5ece056944bb9a53cc14241658 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Wed, 7 Jul 2021 15:41:40 +0900 Subject: [PATCH 24/25] Convert symbols to local index for funParamSymbol --- .../src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala index 9297fa6ec5f1..f5b784966699 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/SemanticSymbolBuilder.scala @@ -34,7 +34,7 @@ class SemanticSymbolBuilder: name => s"$funSymbol($name)" else name => locals.keys.find(local => local.isTerm && local.owner == sym && local.name == name) - .fold("")(Symbols.LocalPrefix + _) + .fold("")(Symbols.LocalPrefix + locals(_)) /** Add semanticdb name of the given symbol to string builder */ private def addSymName(b: StringBuilder, sym: Symbol)(using Context): Unit = From b63ae56d68fdc159f07bfd502275d72ca7596262 Mon Sep 17 00:00:00 2001 From: tanishiking Date: Thu, 8 Jul 2021 02:46:57 +0900 Subject: [PATCH 25/25] Embed bound information of MatchType to TypeSignature --- .../dotty/tools/dotc/semanticdb/Type.scala | 95 +++++++------------ .../dotty/tools/dotc/semanticdb/TypeOps.scala | 27 ++++-- .../semanticdb/expect/MatchType.expect.scala | 10 +- tests/semanticdb/expect/MatchType.scala | 8 +- tests/semanticdb/metac.expect | 62 +++++++++--- 5 files changed, 114 insertions(+), 88 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala index 7df765af6c83..e82d723abef7 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/Type.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/Type.scala @@ -38,7 +38,7 @@ object Type { case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.UniversalType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType => __v.value - case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda => __v.value + case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.LambdaType => __v.value case __v: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType => __v.value case dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty => Empty } @@ -57,7 +57,7 @@ object Type { case __v: dotty.tools.dotc.semanticdb.UniversalType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.UniversalType(__v) case __v: dotty.tools.dotc.semanticdb.ByNameType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType(__v) case __v: dotty.tools.dotc.semanticdb.RepeatedType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__v) - case __v: dotty.tools.dotc.semanticdb.TypeLambda => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v) + case __v: dotty.tools.dotc.semanticdb.LambdaType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.LambdaType(__v) case __v: dotty.tools.dotc.semanticdb.MatchType => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v) case Empty => dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty }) @@ -127,8 +127,8 @@ final case class TypeMessage( val __value = sealedValue.repeatedType.get __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize }; - if (sealedValue.typeLambda.isDefined) { - val __value = sealedValue.typeLambda.get + if (sealedValue.lambdaType.isDefined) { + val __value = sealedValue.lambdaType.get __size += 2 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize }; if (sealedValue.matchType.isDefined) { @@ -230,7 +230,7 @@ final case class TypeMessage( _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; - sealedValue.typeLambda.foreach { __v => + sealedValue.lambdaType.foreach { __v => val __m = __v _output__.writeTag(24, 2) _output__.writeUInt32NoTag(__m.serializedSize) @@ -271,8 +271,8 @@ final case class TypeMessage( def withByNameType(__v: dotty.tools.dotc.semanticdb.ByNameType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.ByNameType(__v)) def getRepeatedType: dotty.tools.dotc.semanticdb.RepeatedType = sealedValue.repeatedType.getOrElse(dotty.tools.dotc.semanticdb.RepeatedType.defaultInstance) def withRepeatedType(__v: dotty.tools.dotc.semanticdb.RepeatedType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__v)) - def getTypeLambda: dotty.tools.dotc.semanticdb.TypeLambda = sealedValue.typeLambda.getOrElse(dotty.tools.dotc.semanticdb.TypeLambda.defaultInstance) - def withTypeLambda(__v: dotty.tools.dotc.semanticdb.TypeLambda): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__v)) + def getLambdaType: dotty.tools.dotc.semanticdb.LambdaType = sealedValue.lambdaType.getOrElse(dotty.tools.dotc.semanticdb.LambdaType.defaultInstance) + def withLambdaType(__v: dotty.tools.dotc.semanticdb.LambdaType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.LambdaType(__v)) def getMatchType: dotty.tools.dotc.semanticdb.MatchType = sealedValue.matchType.getOrElse(dotty.tools.dotc.semanticdb.MatchType.defaultInstance) def withMatchType(__v: dotty.tools.dotc.semanticdb.MatchType): TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__v)) def clearSealedValue: TypeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.Empty) @@ -323,7 +323,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc case 114 => __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.RepeatedType(__sealedValue.repeatedType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.RepeatedType](_input__))(LiteParser.readMessage(_input__, _))) case 194 => - __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.TypeLambda(__sealedValue.typeLambda.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeLambda](_input__))(LiteParser.readMessage(_input__, _))) + __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.LambdaType(__sealedValue.lambdaType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.LambdaType](_input__))(LiteParser.readMessage(_input__, _))) case 202 => __sealedValue = dotty.tools.dotc.semanticdb.TypeMessage.SealedValue.MatchType(__sealedValue.matchType.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.MatchType](_input__))(LiteParser.readMessage(_input__, _))) case tag => _input__.skipField(tag) @@ -359,7 +359,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def isUniversalType: _root_.scala.Boolean = false def isByNameType: _root_.scala.Boolean = false def isRepeatedType: _root_.scala.Boolean = false - def isTypeLambda: _root_.scala.Boolean = false + def isLambdaType: _root_.scala.Boolean = false def isMatchType: _root_.scala.Boolean = false def typeRef: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeRef] = _root_.scala.None def singleType: _root_.scala.Option[dotty.tools.dotc.semanticdb.SingleType] = _root_.scala.None @@ -375,7 +375,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc def universalType: _root_.scala.Option[dotty.tools.dotc.semanticdb.UniversalType] = _root_.scala.None def byNameType: _root_.scala.Option[dotty.tools.dotc.semanticdb.ByNameType] = _root_.scala.None def repeatedType: _root_.scala.Option[dotty.tools.dotc.semanticdb.RepeatedType] = _root_.scala.None - def typeLambda: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeLambda] = _root_.scala.None + def lambdaType: _root_.scala.Option[dotty.tools.dotc.semanticdb.LambdaType] = _root_.scala.None def matchType: _root_.scala.Option[dotty.tools.dotc.semanticdb.MatchType] = _root_.scala.None } object SealedValue { @@ -487,10 +487,10 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc override def number: _root_.scala.Int = 14 } @SerialVersionUID(0L) - final case class TypeLambda(value: dotty.tools.dotc.semanticdb.TypeLambda) extends dotty.tools.dotc.semanticdb.TypeMessage.SealedValue derives CanEqual { - type ValueType = dotty.tools.dotc.semanticdb.TypeLambda - override def isTypeLambda: _root_.scala.Boolean = true - override def typeLambda: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeLambda] = Some(value) + final case class LambdaType(value: dotty.tools.dotc.semanticdb.LambdaType) extends dotty.tools.dotc.semanticdb.TypeMessage.SealedValue derives CanEqual { + type ValueType = dotty.tools.dotc.semanticdb.LambdaType + override def isLambdaType: _root_.scala.Boolean = true + override def lambdaType: _root_.scala.Option[dotty.tools.dotc.semanticdb.LambdaType] = Some(value) override def number: _root_.scala.Int = 24 } @SerialVersionUID(0L) @@ -515,7 +515,7 @@ object TypeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc final val UNIVERSAL_TYPE_FIELD_NUMBER = 10 final val BY_NAME_TYPE_FIELD_NUMBER = 13 final val REPEATED_TYPE_FIELD_NUMBER = 14 - final val TYPE_LAMBDA_FIELD_NUMBER = 24 + final val LAMBDA_TYPE_FIELD_NUMBER = 24 final val MATCH_TYPE_FIELD_NUMBER = 25 def of( sealedValue: dotty.tools.dotc.semanticdb.TypeMessage.SealedValue @@ -1833,9 +1833,9 @@ object RepeatedType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dot } @SerialVersionUID(0L) -final case class TypeLambda( +final case class LambdaType( parameters: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None, - returnType: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + returnType: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.LambdaType._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { @transient @sharable private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0 @@ -1847,7 +1847,7 @@ final case class TypeLambda( }; { - val __value = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toBase(returnType) + val __value = dotty.tools.dotc.semanticdb.LambdaType._typemapper_returnType.toBase(returnType) if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize } @@ -1870,7 +1870,7 @@ final case class TypeLambda( __m.writeTo(_output__) }; { - val __v = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toBase(returnType) + val __v = dotty.tools.dotc.semanticdb.LambdaType._typemapper_returnType.toBase(returnType) if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { _output__.writeTag(2, 2) _output__.writeUInt32NoTag(__v.serializedSize) @@ -1879,19 +1879,19 @@ final case class TypeLambda( }; } def getParameters: dotty.tools.dotc.semanticdb.Scope = parameters.getOrElse(dotty.tools.dotc.semanticdb.Scope.defaultInstance) - def clearParameters: TypeLambda = copy(parameters = _root_.scala.None) - def withParameters(__v: dotty.tools.dotc.semanticdb.Scope): TypeLambda = copy(parameters = Option(__v)) - def withReturnType(__v: dotty.tools.dotc.semanticdb.Type): TypeLambda = copy(returnType = __v) + def clearParameters: LambdaType = copy(parameters = _root_.scala.None) + def withParameters(__v: dotty.tools.dotc.semanticdb.Scope): LambdaType = copy(parameters = Option(__v)) + def withReturnType(__v: dotty.tools.dotc.semanticdb.Type): LambdaType = copy(returnType = __v) - // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.TypeLambda]) + // @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.LambdaType]) } -object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda] { - implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda] = this - def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.TypeLambda = { +object LambdaType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.LambdaType] { + implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.LambdaType] = this + def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.LambdaType = { var __parameters: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope] = _root_.scala.None var __returnType: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None var _done__ = false @@ -1906,9 +1906,9 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. case tag => _input__.skipField(tag) } } - dotty.tools.dotc.semanticdb.TypeLambda( + dotty.tools.dotc.semanticdb.LambdaType( parameters = __parameters, - returnType = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(__returnType.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) + returnType = dotty.tools.dotc.semanticdb.LambdaType._typemapper_returnType.toCustom(__returnType.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)) ) } @@ -1917,9 +1917,9 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. - lazy val defaultInstance = dotty.tools.dotc.semanticdb.TypeLambda( + lazy val defaultInstance = dotty.tools.dotc.semanticdb.LambdaType( parameters = _root_.scala.None, - returnType = dotty.tools.dotc.semanticdb.TypeLambda._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) + returnType = dotty.tools.dotc.semanticdb.LambdaType._typemapper_returnType.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) ) final val PARAMETERS_FIELD_NUMBER = 1 final val RETURN_TYPE_FIELD_NUMBER = 2 @@ -1928,17 +1928,16 @@ object TypeLambda extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc. def of( parameters: _root_.scala.Option[dotty.tools.dotc.semanticdb.Scope], returnType: dotty.tools.dotc.semanticdb.Type - ): _root_.dotty.tools.dotc.semanticdb.TypeLambda = _root_.dotty.tools.dotc.semanticdb.TypeLambda( + ): _root_.dotty.tools.dotc.semanticdb.LambdaType = _root_.dotty.tools.dotc.semanticdb.LambdaType( parameters, returnType ) - // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeLambda]) + // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.LambdaType]) } @SerialVersionUID(0L) final case class MatchType( scrutinee: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), - bound: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.MatchType.CaseType] = _root_.scala.Seq.empty ) extends dotty.tools.dotc.semanticdb.Type.NonEmpty with SemanticdbGeneratedMessage derives CanEqual { @transient @sharable @@ -1952,13 +1951,6 @@ final case class MatchType( __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize } }; - - { - val __value = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toBase(bound) - if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { - __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize - } - }; cases.foreach { __item => val __value = __item __size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize @@ -1982,23 +1974,14 @@ final case class MatchType( __v.writeTo(_output__) } }; - { - val __v = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toBase(bound) - if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) { - _output__.writeTag(2, 2) - _output__.writeUInt32NoTag(__v.serializedSize) - __v.writeTo(_output__) - } - }; cases.foreach { __v => val __m = __v - _output__.writeTag(3, 2) + _output__.writeTag(2, 2) _output__.writeUInt32NoTag(__m.serializedSize) __m.writeTo(_output__) }; } def withScrutinee(__v: dotty.tools.dotc.semanticdb.Type): MatchType = copy(scrutinee = __v) - def withBound(__v: dotty.tools.dotc.semanticdb.Type): MatchType = copy(bound = __v) def clearCases = copy(cases = _root_.scala.Seq.empty) def addCases(__vs: dotty.tools.dotc.semanticdb.MatchType.CaseType*): MatchType = addAllCases(__vs) def addAllCases(__vs: Iterable[dotty.tools.dotc.semanticdb.MatchType.CaseType]): MatchType = copy(cases = cases ++ __vs) @@ -2014,7 +1997,6 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType] = this def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.MatchType = { var __scrutinee: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None - var __bound: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None val __cases: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.MatchType.CaseType] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.MatchType.CaseType] var _done__ = false while (!_done__) { @@ -2024,15 +2006,12 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s case 10 => __scrutinee = _root_.scala.Some(__scrutinee.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) case 18 => - __bound = _root_.scala.Some(__bound.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _))) - case 26 => __cases += LiteParser.readMessage[dotty.tools.dotc.semanticdb.MatchType.CaseType](_input__) case tag => _input__.skipField(tag) } } dotty.tools.dotc.semanticdb.MatchType( scrutinee = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(__scrutinee.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), - bound = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(__bound.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)), cases = __cases.result() ) } @@ -2044,7 +2023,6 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s lazy val defaultInstance = dotty.tools.dotc.semanticdb.MatchType( scrutinee = dotty.tools.dotc.semanticdb.MatchType._typemapper_scrutinee.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), - bound = dotty.tools.dotc.semanticdb.MatchType._typemapper_bound.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance), cases = _root_.scala.Seq.empty ) @SerialVersionUID(0L) @@ -2156,19 +2134,14 @@ object MatchType extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.s } final val SCRUTINEE_FIELD_NUMBER = 1 - final val BOUND_FIELD_NUMBER = 2 - final val CASES_FIELD_NUMBER = 3 + final val CASES_FIELD_NUMBER = 2 @transient @sharable private[semanticdb] val _typemapper_scrutinee: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] - @transient @sharable - private[semanticdb] val _typemapper_bound: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TypeMessage, dotty.tools.dotc.semanticdb.Type]] def of( scrutinee: dotty.tools.dotc.semanticdb.Type, - bound: dotty.tools.dotc.semanticdb.Type, cases: _root_.scala.Seq[dotty.tools.dotc.semanticdb.MatchType.CaseType] ): _root_.dotty.tools.dotc.semanticdb.MatchType = _root_.dotty.tools.dotc.semanticdb.MatchType( scrutinee, - bound, cases ) // @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.MatchType]) diff --git a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala index 394d4f6ddede..74bac5b1973d 100644 --- a/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/semanticdb/TypeOps.scala @@ -160,10 +160,22 @@ class TypeOps: // val (loRes, loParams) = tparams(lo) // val (hiRes, hiParams) = tparams(hi) // val params = (loParams ++ hiParams).distinctBy(_.name) - val slo = lo.toSemanticType - val shi = hi.toSemanticType - // val stparams = params.sscope - s.TypeSignature(Some(s.Scope()), slo, shi) + val sig = lo match + case lam: HKTypeLambda if lo == hi && lam.finalResultType.isInstanceOf[MatchType] => + val paramSyms = lam.paramNames.flatMap { paramName => + val key = (lam, paramName) + paramRefSymtab.get(key) + } + val stparams = Some(paramSyms.sscope) + val slo = lam.finalResultType.toSemanticType + val shi = lam.finalResultType.asInstanceOf[MatchType].bound.toSemanticType + s.TypeSignature(stparams, slo, shi) + case _ => + val slo = lo.toSemanticType + val shi = hi.toSemanticType + s.TypeSignature(Some(s.Scope()), slo, shi) + println(sig) + sig case other => s.ValueSignature( @@ -224,7 +236,7 @@ class TypeOps: got }.sscope val sresTpe = loop(lam.resType) - val res = s.TypeLambda(Some(stparams), sresTpe) + val res = s.LambdaType(Some(stparams), sresTpe) res case matchType: MatchType => @@ -251,7 +263,10 @@ class TypeOps: }} val sscrutinee = loop(matchType.scrutinee) val sbound = loop(matchType.bound) - s.MatchType(sscrutinee, sbound, scases) + val m = s.MatchType(sscrutinee, scases) + println(sbound) + println(m) + m case rt @ RefinedType(parent, name, info) => // `X { def x: Int; def y: Int }` diff --git a/tests/semanticdb/expect/MatchType.expect.scala b/tests/semanticdb/expect/MatchType.expect.scala index 5e6edef47909..32f2ee5b934a 100644 --- a/tests/semanticdb/expect/MatchType.expect.scala +++ b/tests/semanticdb/expect/MatchType.expect.scala @@ -1,10 +1,12 @@ +package matchtype +def matchRes/*<-matchtype::MatchType$package.matchRes().*/[T/*<-matchtype::MatchType$package.matchRes().[T]*/](x/*<-matchtype::MatchType$package.matchRes().(x)*/: T/*->matchtype::MatchType$package.matchRes().[T]*/): T/*->matchtype::MatchType$package.matchRes().[T]*/ match { case String/*->scala::Predef.String#*/ => Char/*->scala::Char#*/ } = ???/*->scala::Predef.`???`().*/ -type Elem/*<-_empty_::MatchType$package.Elem#*/[X/*<-_empty_::MatchType$package.Elem#[X]*/] <: Any/*->scala::Any#*/ = X/*->_empty_::MatchType$package.Elem#[X]*/ match +type Elem/*<-matchtype::MatchType$package.Elem#*/[X/*<-matchtype::MatchType$package.Elem#[X]*/] <: Any/*->scala::Any#*/ = X/*->matchtype::MatchType$package.Elem#[X]*/ match case String/*->scala::Predef.String#*/ => Char/*->scala::Char#*/ case Array/*->scala::Array#*/[t/*<-local0*/] => t/*->local0*/ -// type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match -// case EmptyTuple => Ys -// case x *: xs => x *: Concat[xs, Ys] +type Concat/*<-matchtype::MatchType$package.Concat#*/[Xs/*<-matchtype::MatchType$package.Concat#[Xs]*/ <: Tuple/*->scala::Tuple#*/, +Ys/*<-matchtype::MatchType$package.Concat#[Ys]*/ <: Tuple/*->scala::Tuple#*/] <: Tuple/*->scala::Tuple#*/ = Xs/*->matchtype::MatchType$package.Concat#[Xs]*/ match + case EmptyTuple/*->scala::Tuple$package.EmptyTuple#*/ => Ys/*->matchtype::MatchType$package.Concat#[Ys]*/ + case x/*<-local1*/ *:/*->scala::`*:`#*/ xs/*<-local2*/ => x/*->local1*/ *:/*->scala::`*:`#*/ Concat/*->matchtype::MatchType$package.Concat#*/[xs/*->local2*/, Ys/*->matchtype::MatchType$package.Concat#[Ys]*/] diff --git a/tests/semanticdb/expect/MatchType.scala b/tests/semanticdb/expect/MatchType.scala index 3d141d651c60..ee1ff1496d7f 100644 --- a/tests/semanticdb/expect/MatchType.scala +++ b/tests/semanticdb/expect/MatchType.scala @@ -1,10 +1,12 @@ +package matchtype +def matchRes[T](x: T): T match { case String => Char } = ??? type Elem[X] <: Any = X match case String => Char case Array[t] => t -// type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match -// case EmptyTuple => Ys -// case x *: xs => x *: Concat[xs, Ys] +type Concat[Xs <: Tuple, +Ys <: Tuple] <: Tuple = Xs match + case EmptyTuple => Ys + case x *: xs => x *: Concat[xs, Ys] diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect index 369dd6fb6d54..2c52286c9903 100644 --- a/tests/semanticdb/metac.expect +++ b/tests/semanticdb/metac.expect @@ -2029,25 +2029,59 @@ Schema => SemanticDB v4 Uri => MatchType.scala Text => empty Language => Scala -Symbols => 4 entries -Occurrences => 9 entries +Symbols => 12 entries +Occurrences => 35 entries Symbols: -_empty_/MatchType$package. => final package object _empty_ extends Object { self: _empty_.type => +2 decls } -_empty_/MatchType$package.Elem# => type Elem = -_empty_/MatchType$package.Elem#[X] => typeparam X local0 => case val method t +local1 => case val method x = +local2 => case val method xs = +matchtype/MatchType$package. => final package object matchtype extends Object { self: matchtype.type => +4 decls } +matchtype/MatchType$package.Concat# => type Concat [typeparam Xs , covariant typeparam Ys ] >: +matchtype/MatchType$package.Concat#[Xs] => typeparam Xs +matchtype/MatchType$package.Concat#[Ys] => covariant typeparam Ys +matchtype/MatchType$package.Elem# => type Elem [typeparam X ] >: +matchtype/MatchType$package.Elem#[X] => typeparam X +matchtype/MatchType$package.matchRes(). => method matchRes [typeparam T ](param x: T): +matchtype/MatchType$package.matchRes().(x) => param x: T +matchtype/MatchType$package.matchRes().[T] => typeparam T Occurrences: -[2:5..2:9): Elem <- _empty_/MatchType$package.Elem# -[2:10..2:11): X <- _empty_/MatchType$package.Elem#[X] -[2:16..2:19): Any -> scala/Any# -[2:22..2:23): X -> _empty_/MatchType$package.Elem#[X] -[3:7..3:13): String -> scala/Predef.String# -[3:17..3:21): Char -> scala/Char# -[4:7..4:12): Array -> scala/Array# -[4:13..4:14): t <- local0 -[4:19..4:20): t -> local0 +[0:8..0:17): matchtype <- matchtype/ +[2:4..2:12): matchRes <- matchtype/MatchType$package.matchRes(). +[2:13..2:14): T <- matchtype/MatchType$package.matchRes().[T] +[2:16..2:17): x <- matchtype/MatchType$package.matchRes().(x) +[2:19..2:20): T -> matchtype/MatchType$package.matchRes().[T] +[2:23..2:24): T -> matchtype/MatchType$package.matchRes().[T] +[2:38..2:44): String -> scala/Predef.String# +[2:48..2:52): Char -> scala/Char# +[2:57..2:60): ??? -> scala/Predef.`???`(). +[4:5..4:9): Elem <- matchtype/MatchType$package.Elem# +[4:10..4:11): X <- matchtype/MatchType$package.Elem#[X] +[4:16..4:19): Any -> scala/Any# +[4:22..4:23): X -> matchtype/MatchType$package.Elem#[X] +[5:7..5:13): String -> scala/Predef.String# +[5:17..5:21): Char -> scala/Char# +[6:7..6:12): Array -> scala/Array# +[6:13..6:14): t <- local0 +[6:19..6:20): t -> local0 +[8:5..8:11): Concat <- matchtype/MatchType$package.Concat# +[8:12..8:14): Xs <- matchtype/MatchType$package.Concat#[Xs] +[8:18..8:23): Tuple -> scala/Tuple# +[8:26..8:28): Ys <- matchtype/MatchType$package.Concat#[Ys] +[8:32..8:37): Tuple -> scala/Tuple# +[8:42..8:47): Tuple -> scala/Tuple# +[8:50..8:52): Xs -> matchtype/MatchType$package.Concat#[Xs] +[9:7..9:17): EmptyTuple -> scala/Tuple$package.EmptyTuple# +[9:21..9:23): Ys -> matchtype/MatchType$package.Concat#[Ys] +[10:7..10:8): x <- local1 +[10:9..10:11): *: -> scala/`*:`# +[10:12..10:14): xs <- local2 +[10:18..10:19): x -> local1 +[10:20..10:22): *: -> scala/`*:`# +[10:23..10:29): Concat -> matchtype/MatchType$package.Concat# +[10:30..10:32): xs -> local2 +[10:34..10:36): Ys -> matchtype/MatchType$package.Concat#[Ys] expect/MetacJava.scala ----------------------