Skip to content

Add context parameters to SemanticDB synthetics #23381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SyntheticsExtractor:
) =>
s.Synthetic(
range(tree.span, tree.source),
s.ApplyTree(
s.ApplyContextTree(
tree.fun.toSemanticOriginal,
tree.args.map(_.toSemanticTree)
)
Expand Down
133 changes: 133 additions & 0 deletions compiler/src/dotty/tools/dotc/semanticdb/generated/Tree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ object Tree {
case __v: dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.OriginalTree => __v.value
case __v: dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.SelectTree => __v.value
case __v: dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.TypeApplyTree => __v.value
case __v: dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.ApplyContextTree => __v.value
case dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.Empty => Empty
}
override def toBase(__custom: dotty.tools.dotc.semanticdb.Tree): dotty.tools.dotc.semanticdb.TreeMessage = dotty.tools.dotc.semanticdb.TreeMessage(__custom match {
Expand All @@ -43,6 +44,7 @@ object Tree {
case __v: dotty.tools.dotc.semanticdb.OriginalTree => dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.OriginalTree(__v)
case __v: dotty.tools.dotc.semanticdb.SelectTree => dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.SelectTree(__v)
case __v: dotty.tools.dotc.semanticdb.TypeApplyTree => dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.TypeApplyTree(__v)
case __v: dotty.tools.dotc.semanticdb.ApplyContextTree => dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.ApplyContextTree(__v)
case Empty => dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.Empty
})
}
Expand Down Expand Up @@ -87,6 +89,10 @@ final case class TreeMessage(
val __value = sealedValue.typeApplyTree.get
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
if (sealedValue.applyContextTree.isDefined) {
val __value = sealedValue.applyContextTree.get
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};
__size
}
override def serializedSize: _root_.scala.Int = {
Expand Down Expand Up @@ -147,6 +153,12 @@ final case class TreeMessage(
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
sealedValue.applyContextTree.foreach { __v =>
val __m = __v
_output__.writeTag(9, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
}
def getApplyTree: dotty.tools.dotc.semanticdb.ApplyTree = sealedValue.applyTree.getOrElse(dotty.tools.dotc.semanticdb.ApplyTree.defaultInstance)
def withApplyTree(__v: dotty.tools.dotc.semanticdb.ApplyTree): TreeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.ApplyTree(__v))
Expand All @@ -164,6 +176,8 @@ final case class TreeMessage(
def withSelectTree(__v: dotty.tools.dotc.semanticdb.SelectTree): TreeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.SelectTree(__v))
def getTypeApplyTree: dotty.tools.dotc.semanticdb.TypeApplyTree = sealedValue.typeApplyTree.getOrElse(dotty.tools.dotc.semanticdb.TypeApplyTree.defaultInstance)
def withTypeApplyTree(__v: dotty.tools.dotc.semanticdb.TypeApplyTree): TreeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.TypeApplyTree(__v))
def getApplyContextTree: dotty.tools.dotc.semanticdb.ApplyContextTree = sealedValue.applyContextTree.getOrElse(dotty.tools.dotc.semanticdb.ApplyContextTree.defaultInstance)
def withApplyContextTree(__v: dotty.tools.dotc.semanticdb.ApplyContextTree): TreeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.ApplyContextTree(__v))
def clearSealedValue: TreeMessage = copy(sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.Empty)
def withSealedValue(__v: dotty.tools.dotc.semanticdb.TreeMessage.SealedValue): TreeMessage = copy(sealedValue = __v)

Expand Down Expand Up @@ -199,6 +213,8 @@ object TreeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc
__sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.SelectTree(__sealedValue.selectTree.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.SelectTree](_input__))(LiteParser.readMessage(_input__, _)))
case 66 =>
__sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.TypeApplyTree(__sealedValue.typeApplyTree.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeApplyTree](_input__))(LiteParser.readMessage(_input__, _)))
case 74 =>
__sealedValue = dotty.tools.dotc.semanticdb.TreeMessage.SealedValue.ApplyContextTree(__sealedValue.applyContextTree.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.ApplyContextTree](_input__))(LiteParser.readMessage(_input__, _)))
case tag => _input__.skipField(tag)
}
}
Expand Down Expand Up @@ -226,6 +242,7 @@ object TreeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc
def isOriginalTree: _root_.scala.Boolean = false
def isSelectTree: _root_.scala.Boolean = false
def isTypeApplyTree: _root_.scala.Boolean = false
def isApplyContextTree: _root_.scala.Boolean = false
def applyTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.ApplyTree] = _root_.scala.None
def functionTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.FunctionTree] = _root_.scala.None
def idTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.IdTree] = _root_.scala.None
Expand All @@ -234,6 +251,7 @@ object TreeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc
def originalTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.OriginalTree] = _root_.scala.None
def selectTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.SelectTree] = _root_.scala.None
def typeApplyTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeApplyTree] = _root_.scala.None
def applyContextTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.ApplyContextTree] = _root_.scala.None
}
object SealedValue {
@SerialVersionUID(0L)
Expand Down Expand Up @@ -301,6 +319,13 @@ object TreeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc
override def typeApplyTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeApplyTree] = Some(value)
override def number: _root_.scala.Int = 8
}
@SerialVersionUID(0L)
final case class ApplyContextTree(value: dotty.tools.dotc.semanticdb.ApplyContextTree) extends dotty.tools.dotc.semanticdb.TreeMessage.SealedValue derives CanEqual {
type ValueType = dotty.tools.dotc.semanticdb.ApplyContextTree
override def isApplyContextTree: _root_.scala.Boolean = true
override def applyContextTree: _root_.scala.Option[dotty.tools.dotc.semanticdb.ApplyContextTree] = Some(value)
override def number: _root_.scala.Int = 9
}
}
final val APPLY_TREE_FIELD_NUMBER = 1
final val FUNCTION_TREE_FIELD_NUMBER = 2
Expand All @@ -310,6 +335,7 @@ object TreeMessage extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc
final val ORIGINAL_TREE_FIELD_NUMBER = 6
final val SELECT_TREE_FIELD_NUMBER = 7
final val TYPE_APPLY_TREE_FIELD_NUMBER = 8
final val APPLY_CONTEXT_TREE_FIELD_NUMBER = 9
def of(
sealedValue: dotty.tools.dotc.semanticdb.TreeMessage.SealedValue
): _root_.dotty.tools.dotc.semanticdb.TreeMessage = _root_.dotty.tools.dotc.semanticdb.TreeMessage(
Expand Down Expand Up @@ -1086,3 +1112,110 @@ object TypeApplyTree extends SemanticdbGeneratedMessageCompanion[dotty.tools.do
)
// @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.TypeApplyTree])
}

@SerialVersionUID(0L)
final case class ApplyContextTree(
function: dotty.tools.dotc.semanticdb.Tree = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_function.toCustom(dotty.tools.dotc.semanticdb.TreeMessage.defaultInstance),
arguments: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Tree] = _root_.scala.Seq.empty
) extends dotty.tools.dotc.semanticdb.Tree.NonEmpty with SemanticdbGeneratedMessage derives CanEqual {
@transient @sharable
private var __serializedSizeMemoized: _root_.scala.Int = 0
private def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0

{
val __value = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_function.toBase(function)
if (__value.serializedSize != 0) {
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
};
arguments.foreach { __item =>
val __value = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_arguments.toBase(__item)
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
}
__size
}
override def serializedSize: _root_.scala.Int = {
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
__size - 1

}
def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = {
{
val __v = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_function.toBase(function)
if (__v.serializedSize != 0) {
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__v.serializedSize)
__v.writeTo(_output__)
}
};
arguments.foreach { __v =>
val __m = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_arguments.toBase(__v)
_output__.writeTag(2, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
}
def withFunction(__v: dotty.tools.dotc.semanticdb.Tree): ApplyContextTree = copy(function = __v)
def clearArguments = copy(arguments = _root_.scala.Seq.empty)
def addArguments(__vs: dotty.tools.dotc.semanticdb.Tree *): ApplyContextTree = addAllArguments(__vs)
def addAllArguments(__vs: Iterable[dotty.tools.dotc.semanticdb.Tree]): ApplyContextTree = copy(arguments = arguments ++ __vs)
def withArguments(__v: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Tree]): ApplyContextTree = copy(arguments = __v)




// @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.ApplyContextTree])
}

object ApplyContextTree extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.ApplyContextTree] {
implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.ApplyContextTree] = this
def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.ApplyContextTree = {
var __function: _root_.scala.Option[dotty.tools.dotc.semanticdb.TreeMessage] = _root_.scala.None
val __arguments: _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.Tree] = new _root_.scala.collection.immutable.VectorBuilder[dotty.tools.dotc.semanticdb.Tree]
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__function = _root_.scala.Some(__function.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TreeMessage](_input__))(LiteParser.readMessage(_input__, _)))
case 18 =>
__arguments += dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_arguments.toCustom(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TreeMessage](_input__))
case tag => _input__.skipField(tag)
}
}
dotty.tools.dotc.semanticdb.ApplyContextTree(
function = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_function.toCustom(__function.getOrElse(dotty.tools.dotc.semanticdb.TreeMessage.defaultInstance)),
arguments = __arguments.result()
)
}






lazy val defaultInstance = dotty.tools.dotc.semanticdb.ApplyContextTree(
function = dotty.tools.dotc.semanticdb.ApplyContextTree._typemapper_function.toCustom(dotty.tools.dotc.semanticdb.TreeMessage.defaultInstance),
arguments = _root_.scala.Seq.empty
)
final val FUNCTION_FIELD_NUMBER = 1
final val ARGUMENTS_FIELD_NUMBER = 2
@transient @sharable
private[semanticdb] val _typemapper_function: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TreeMessage, dotty.tools.dotc.semanticdb.Tree] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TreeMessage, dotty.tools.dotc.semanticdb.Tree]]
@transient @sharable
private[semanticdb] val _typemapper_arguments: SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TreeMessage, dotty.tools.dotc.semanticdb.Tree] = implicitly[SemanticdbTypeMapper[dotty.tools.dotc.semanticdb.TreeMessage, dotty.tools.dotc.semanticdb.Tree]]
def of(
function: dotty.tools.dotc.semanticdb.Tree,
arguments: _root_.scala.Seq[dotty.tools.dotc.semanticdb.Tree]
): _root_.dotty.tools.dotc.semanticdb.ApplyContextTree = _root_.dotty.tools.dotc.semanticdb.ApplyContextTree(
function,
arguments
)
// @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.ApplyContextTree])
}
Loading