Skip to content

Add Semanticdb data models generated from semanticdb.proto #12780

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

Merged
merged 4 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
650 changes: 650 additions & 0 deletions compiler/src/dotty/tools/dotc/semanticdb/Access.scala

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions compiler/src/dotty/tools/dotc/semanticdb/Annotation.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should comment it is generated from tanishiking/semanticdb-for-scala3 ?


package dotty.tools.dotc.semanticdb
import dotty.tools.dotc.semanticdb.internal._
import scala.annotation.internal.sharable


final case class Annotation(
tpe: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)
) extends SemanticdbGeneratedMessage derives CanEqual {
@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.Annotation._typemapper_tpe.toBase(tpe)
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.Annotation._typemapper_tpe.toBase(tpe)
if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) {
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__v.serializedSize)
__v.writeTo(_output__)
}
};
}
def withTpe(__v: dotty.tools.dotc.semanticdb.Type): Annotation = copy(tpe = __v)




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

object Annotation extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Annotation] {
implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Annotation] = this
def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.Annotation = {
var __tpe: _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 =>
__tpe = _root_.scala.Some(__tpe.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _)))
case tag => _input__.skipField(tag)
}
}
dotty.tools.dotc.semanticdb.Annotation(
tpe = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toCustom(__tpe.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance))
)
}






lazy val defaultInstance = dotty.tools.dotc.semanticdb.Annotation(
tpe = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)
)
final val TPE_FIELD_NUMBER = 1
@sharable
private[semanticdb] val _typemapper_tpe: 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(
tpe: dotty.tools.dotc.semanticdb.Type
): _root_.dotty.tools.dotc.semanticdb.Annotation = _root_.dotty.tools.dotc.semanticdb.Annotation(
tpe
)
// @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Annotation])
}
1,170 changes: 1,170 additions & 0 deletions compiler/src/dotty/tools/dotc/semanticdb/Constant.scala

Large diffs are not rendered by default.

194 changes: 194 additions & 0 deletions compiler/src/dotty/tools/dotc/semanticdb/Diagnostic.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
// Do not edit!
//
// Protofile syntax: PROTO3

package dotty.tools.dotc.semanticdb
import dotty.tools.dotc.semanticdb.internal._
import scala.annotation.internal.sharable


final case class Diagnostic(
range: _root_.scala.Option[dotty.tools.dotc.semanticdb.Range] = _root_.scala.None,
severity: dotty.tools.dotc.semanticdb.Diagnostic.Severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.UNKNOWN_SEVERITY,
message: _root_.scala.Predef.String = ""
) extends SemanticdbGeneratedMessage derives CanEqual {
@sharable
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
private[this] def __computeSerializedValue(): _root_.scala.Int = {
var __size = 0
if (range.isDefined) {
val __value = range.get
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
};

{
val __value = severity.value
if (__value != 0) {
__size += SemanticdbOutputStream.computeEnumSize(2, __value)
}
};

{
val __value = message
if (!__value.isEmpty) {
__size += SemanticdbOutputStream.computeStringSize(3, __value)
}
};
__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 = {
range.foreach { __v =>
val __m = __v
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__m.serializedSize)
__m.writeTo(_output__)
};
{
val __v = severity.value
if (__v != 0) {
_output__.writeEnum(2, __v)
}
};
{
val __v = message
if (!__v.isEmpty) {
_output__.writeString(3, __v)
}
};
}
def getRange: dotty.tools.dotc.semanticdb.Range = range.getOrElse(dotty.tools.dotc.semanticdb.Range.defaultInstance)
def clearRange: Diagnostic = copy(range = _root_.scala.None)
def withRange(__v: dotty.tools.dotc.semanticdb.Range): Diagnostic = copy(range = Option(__v))
def withSeverity(__v: dotty.tools.dotc.semanticdb.Diagnostic.Severity): Diagnostic = copy(severity = __v)
def withMessage(__v: _root_.scala.Predef.String): Diagnostic = copy(message = __v)




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

object Diagnostic extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Diagnostic] {
implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Diagnostic] = this
def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.Diagnostic = {
var __range: _root_.scala.Option[dotty.tools.dotc.semanticdb.Range] = _root_.scala.None
var __severity: dotty.tools.dotc.semanticdb.Diagnostic.Severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.UNKNOWN_SEVERITY
var __message: _root_.scala.Predef.String = ""
var _done__ = false
while (!_done__) {
val _tag__ = _input__.readTag()
_tag__ match {
case 0 => _done__ = true
case 10 =>
__range = Option(__range.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Range](_input__))(LiteParser.readMessage(_input__, _)))
case 16 =>
__severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.fromValue(_input__.readEnum())
case 26 =>
__message = _input__.readStringRequireUtf8()
case tag => _input__.skipField(tag)
}
}
dotty.tools.dotc.semanticdb.Diagnostic(
range = __range,
severity = __severity,
message = __message
)
}






lazy val defaultInstance = dotty.tools.dotc.semanticdb.Diagnostic(
range = _root_.scala.None,
severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.UNKNOWN_SEVERITY,
message = ""
)
sealed abstract class Severity(val value: _root_.scala.Int) extends SemanticdbGeneratedEnum derives CanEqual {
type EnumType = Severity
def isUnknownSeverity: _root_.scala.Boolean = false
def isError: _root_.scala.Boolean = false
def isWarning: _root_.scala.Boolean = false
def isInformation: _root_.scala.Boolean = false
def isHint: _root_.scala.Boolean = false

final def asRecognized: _root_.scala.Option[dotty.tools.dotc.semanticdb.Diagnostic.Severity.Recognized] = if (isUnrecognized) _root_.scala.None else _root_.scala.Some(this.asInstanceOf[dotty.tools.dotc.semanticdb.Diagnostic.Severity.Recognized])
}

object Severity {
sealed trait Recognized extends Severity


case object UNKNOWN_SEVERITY extends Severity(0) with Severity.Recognized {
val index = 0
val name = "UNKNOWN_SEVERITY"
override def isUnknownSeverity: _root_.scala.Boolean = true
}


case object ERROR extends Severity(1) with Severity.Recognized {
val index = 1
val name = "ERROR"
override def isError: _root_.scala.Boolean = true
}


case object WARNING extends Severity(2) with Severity.Recognized {
val index = 2
val name = "WARNING"
override def isWarning: _root_.scala.Boolean = true
}


case object INFORMATION extends Severity(3) with Severity.Recognized {
val index = 3
val name = "INFORMATION"
override def isInformation: _root_.scala.Boolean = true
}


case object HINT extends Severity(4) with Severity.Recognized {
val index = 4
val name = "HINT"
override def isHint: _root_.scala.Boolean = true
}


final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends Severity(unrecognizedValue) with SemanticdbUnrecognizedEnum

lazy val values = scala.collection.immutable.Seq(UNKNOWN_SEVERITY, ERROR, WARNING, INFORMATION, HINT)
def fromValue(__value: _root_.scala.Int): Severity = __value match {
case 0 => UNKNOWN_SEVERITY
case 1 => ERROR
case 2 => WARNING
case 3 => INFORMATION
case 4 => HINT
case __other => Unrecognized(__other)
}


}
final val RANGE_FIELD_NUMBER = 1
final val SEVERITY_FIELD_NUMBER = 2
final val MESSAGE_FIELD_NUMBER = 3
def of(
range: _root_.scala.Option[dotty.tools.dotc.semanticdb.Range],
severity: dotty.tools.dotc.semanticdb.Diagnostic.Severity,
message: _root_.scala.Predef.String
): _root_.dotty.tools.dotc.semanticdb.Diagnostic = _root_.dotty.tools.dotc.semanticdb.Diagnostic(
range,
severity,
message
)
// @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Diagnostic])
}
Loading