-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
09046fe
Add Semanticdb data models generated from semanticdb.proto
tanishiking b2af77f
Keep @SerialVersionUID and @transient
tanishiking 6a534f2
Add comments indicates generated codes are from tanishiking/semanticd…
tanishiking 47c9b4f
Remove the TODO comment and replace it with original one
tanishiking File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Generated by https://github.com/tanishiking/semanticdb-for-scala3 | ||
// 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 | ||
|
||
@SerialVersionUID(0L) | ||
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 { | ||
@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.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 | ||
@transient @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,171 changes: 1,171 additions & 0 deletions
1,171
compiler/src/dotty/tools/dotc/semanticdb/Constant.scala
Large diffs are not rendered by default.
Oops, something went wrong.
195 changes: 195 additions & 0 deletions
195
compiler/src/dotty/tools/dotc/semanticdb/Diagnostic.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
// Generated by https://github.com/tanishiking/semanticdb-for-scala3 | ||
// 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 | ||
|
||
@SerialVersionUID(0L) | ||
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 { | ||
@transient @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 | ||
|
||
@SerialVersionUID(0L) | ||
case object UNKNOWN_SEVERITY extends Severity(0) with Severity.Recognized { | ||
val index = 0 | ||
val name = "UNKNOWN_SEVERITY" | ||
override def isUnknownSeverity: _root_.scala.Boolean = true | ||
} | ||
|
||
@SerialVersionUID(0L) | ||
case object ERROR extends Severity(1) with Severity.Recognized { | ||
val index = 1 | ||
val name = "ERROR" | ||
override def isError: _root_.scala.Boolean = true | ||
} | ||
|
||
@SerialVersionUID(0L) | ||
case object WARNING extends Severity(2) with Severity.Recognized { | ||
val index = 2 | ||
val name = "WARNING" | ||
override def isWarning: _root_.scala.Boolean = true | ||
} | ||
|
||
@SerialVersionUID(0L) | ||
case object INFORMATION extends Severity(3) with Severity.Recognized { | ||
val index = 3 | ||
val name = "INFORMATION" | ||
override def isInformation: _root_.scala.Boolean = true | ||
} | ||
|
||
@SerialVersionUID(0L) | ||
case object HINT extends Severity(4) with Severity.Recognized { | ||
val index = 4 | ||
val name = "HINT" | ||
override def isHint: _root_.scala.Boolean = true | ||
} | ||
|
||
@SerialVersionUID(0L) | ||
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]) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
?