Skip to content

Commit 09046fe

Browse files
committed
Add Semanticdb data models generated from semanticdb.proto
These data models are automatically generated from https://github.com/tanishiking/semanticdb-for-scala3 tanishiking/semanticdb-for-scala3@d0d04f0 which generates Scala code from semanticdb.proto using Scalapb, and adjust them using scalafix to remove the dependency to `scalapb-runtime` from generated code.
1 parent fdbb94f commit 09046fe

23 files changed

+7527
-552
lines changed

compiler/src/dotty/tools/dotc/semanticdb/Access.scala

Lines changed: 650 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
2+
// Do not edit!
3+
//
4+
// Protofile syntax: PROTO3
5+
6+
package dotty.tools.dotc.semanticdb
7+
import dotty.tools.dotc.semanticdb.internal._
8+
import scala.annotation.internal.sharable
9+
10+
11+
final case class Annotation(
12+
tpe: dotty.tools.dotc.semanticdb.Type = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)
13+
) extends SemanticdbGeneratedMessage derives CanEqual {
14+
@sharable
15+
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
16+
private[this] def __computeSerializedValue(): _root_.scala.Int = {
17+
var __size = 0
18+
19+
{
20+
val __value = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toBase(tpe)
21+
if (__value != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) {
22+
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
23+
}
24+
};
25+
__size
26+
}
27+
override def serializedSize: _root_.scala.Int = {
28+
var read = __serializedSizeCachedValue
29+
if (read == 0) {
30+
read = __computeSerializedValue()
31+
__serializedSizeCachedValue = read
32+
}
33+
read
34+
}
35+
def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = {
36+
{
37+
val __v = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toBase(tpe)
38+
if (__v != dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance) {
39+
_output__.writeTag(1, 2)
40+
_output__.writeUInt32NoTag(__v.serializedSize)
41+
__v.writeTo(_output__)
42+
}
43+
};
44+
}
45+
def withTpe(__v: dotty.tools.dotc.semanticdb.Type): Annotation = copy(tpe = __v)
46+
47+
48+
49+
50+
// @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.Annotation])
51+
}
52+
53+
object Annotation extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Annotation] {
54+
implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Annotation] = this
55+
def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.Annotation = {
56+
var __tpe: _root_.scala.Option[dotty.tools.dotc.semanticdb.TypeMessage] = _root_.scala.None
57+
var _done__ = false
58+
while (!_done__) {
59+
val _tag__ = _input__.readTag()
60+
_tag__ match {
61+
case 0 => _done__ = true
62+
case 10 =>
63+
__tpe = _root_.scala.Some(__tpe.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.TypeMessage](_input__))(LiteParser.readMessage(_input__, _)))
64+
case tag => _input__.skipField(tag)
65+
}
66+
}
67+
dotty.tools.dotc.semanticdb.Annotation(
68+
tpe = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toCustom(__tpe.getOrElse(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance))
69+
)
70+
}
71+
72+
73+
74+
75+
76+
77+
lazy val defaultInstance = dotty.tools.dotc.semanticdb.Annotation(
78+
tpe = dotty.tools.dotc.semanticdb.Annotation._typemapper_tpe.toCustom(dotty.tools.dotc.semanticdb.TypeMessage.defaultInstance)
79+
)
80+
final val TPE_FIELD_NUMBER = 1
81+
@sharable
82+
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]]
83+
def of(
84+
tpe: dotty.tools.dotc.semanticdb.Type
85+
): _root_.dotty.tools.dotc.semanticdb.Annotation = _root_.dotty.tools.dotc.semanticdb.Annotation(
86+
tpe
87+
)
88+
// @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Annotation])
89+
}

compiler/src/dotty/tools/dotc/semanticdb/Constant.scala

Lines changed: 1170 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
// Generated by the Scala Plugin for the Protocol Buffer Compiler.
2+
// Do not edit!
3+
//
4+
// Protofile syntax: PROTO3
5+
6+
package dotty.tools.dotc.semanticdb
7+
import dotty.tools.dotc.semanticdb.internal._
8+
import scala.annotation.internal.sharable
9+
10+
11+
final case class Diagnostic(
12+
range: _root_.scala.Option[dotty.tools.dotc.semanticdb.Range] = _root_.scala.None,
13+
severity: dotty.tools.dotc.semanticdb.Diagnostic.Severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.UNKNOWN_SEVERITY,
14+
message: _root_.scala.Predef.String = ""
15+
) extends SemanticdbGeneratedMessage derives CanEqual {
16+
@sharable
17+
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
18+
private[this] def __computeSerializedValue(): _root_.scala.Int = {
19+
var __size = 0
20+
if (range.isDefined) {
21+
val __value = range.get
22+
__size += 1 + SemanticdbOutputStream.computeUInt32SizeNoTag(__value.serializedSize) + __value.serializedSize
23+
};
24+
25+
{
26+
val __value = severity.value
27+
if (__value != 0) {
28+
__size += SemanticdbOutputStream.computeEnumSize(2, __value)
29+
}
30+
};
31+
32+
{
33+
val __value = message
34+
if (!__value.isEmpty) {
35+
__size += SemanticdbOutputStream.computeStringSize(3, __value)
36+
}
37+
};
38+
__size
39+
}
40+
override def serializedSize: _root_.scala.Int = {
41+
var read = __serializedSizeCachedValue
42+
if (read == 0) {
43+
read = __computeSerializedValue()
44+
__serializedSizeCachedValue = read
45+
}
46+
read
47+
}
48+
def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = {
49+
range.foreach { __v =>
50+
val __m = __v
51+
_output__.writeTag(1, 2)
52+
_output__.writeUInt32NoTag(__m.serializedSize)
53+
__m.writeTo(_output__)
54+
};
55+
{
56+
val __v = severity.value
57+
if (__v != 0) {
58+
_output__.writeEnum(2, __v)
59+
}
60+
};
61+
{
62+
val __v = message
63+
if (!__v.isEmpty) {
64+
_output__.writeString(3, __v)
65+
}
66+
};
67+
}
68+
def getRange: dotty.tools.dotc.semanticdb.Range = range.getOrElse(dotty.tools.dotc.semanticdb.Range.defaultInstance)
69+
def clearRange: Diagnostic = copy(range = _root_.scala.None)
70+
def withRange(__v: dotty.tools.dotc.semanticdb.Range): Diagnostic = copy(range = Option(__v))
71+
def withSeverity(__v: dotty.tools.dotc.semanticdb.Diagnostic.Severity): Diagnostic = copy(severity = __v)
72+
def withMessage(__v: _root_.scala.Predef.String): Diagnostic = copy(message = __v)
73+
74+
75+
76+
77+
// @@protoc_insertion_point(GeneratedMessage[dotty.tools.dotc.semanticdb.Diagnostic])
78+
}
79+
80+
object Diagnostic extends SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Diagnostic] {
81+
implicit def messageCompanion: SemanticdbGeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Diagnostic] = this
82+
def parseFrom(`_input__`: SemanticdbInputStream): dotty.tools.dotc.semanticdb.Diagnostic = {
83+
var __range: _root_.scala.Option[dotty.tools.dotc.semanticdb.Range] = _root_.scala.None
84+
var __severity: dotty.tools.dotc.semanticdb.Diagnostic.Severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.UNKNOWN_SEVERITY
85+
var __message: _root_.scala.Predef.String = ""
86+
var _done__ = false
87+
while (!_done__) {
88+
val _tag__ = _input__.readTag()
89+
_tag__ match {
90+
case 0 => _done__ = true
91+
case 10 =>
92+
__range = Option(__range.fold(LiteParser.readMessage[dotty.tools.dotc.semanticdb.Range](_input__))(LiteParser.readMessage(_input__, _)))
93+
case 16 =>
94+
__severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.fromValue(_input__.readEnum())
95+
case 26 =>
96+
__message = _input__.readStringRequireUtf8()
97+
case tag => _input__.skipField(tag)
98+
}
99+
}
100+
dotty.tools.dotc.semanticdb.Diagnostic(
101+
range = __range,
102+
severity = __severity,
103+
message = __message
104+
)
105+
}
106+
107+
108+
109+
110+
111+
112+
lazy val defaultInstance = dotty.tools.dotc.semanticdb.Diagnostic(
113+
range = _root_.scala.None,
114+
severity = dotty.tools.dotc.semanticdb.Diagnostic.Severity.UNKNOWN_SEVERITY,
115+
message = ""
116+
)
117+
sealed abstract class Severity(val value: _root_.scala.Int) extends SemanticdbGeneratedEnum derives CanEqual {
118+
type EnumType = Severity
119+
def isUnknownSeverity: _root_.scala.Boolean = false
120+
def isError: _root_.scala.Boolean = false
121+
def isWarning: _root_.scala.Boolean = false
122+
def isInformation: _root_.scala.Boolean = false
123+
def isHint: _root_.scala.Boolean = false
124+
125+
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])
126+
}
127+
128+
object Severity {
129+
sealed trait Recognized extends Severity
130+
131+
132+
case object UNKNOWN_SEVERITY extends Severity(0) with Severity.Recognized {
133+
val index = 0
134+
val name = "UNKNOWN_SEVERITY"
135+
override def isUnknownSeverity: _root_.scala.Boolean = true
136+
}
137+
138+
139+
case object ERROR extends Severity(1) with Severity.Recognized {
140+
val index = 1
141+
val name = "ERROR"
142+
override def isError: _root_.scala.Boolean = true
143+
}
144+
145+
146+
case object WARNING extends Severity(2) with Severity.Recognized {
147+
val index = 2
148+
val name = "WARNING"
149+
override def isWarning: _root_.scala.Boolean = true
150+
}
151+
152+
153+
case object INFORMATION extends Severity(3) with Severity.Recognized {
154+
val index = 3
155+
val name = "INFORMATION"
156+
override def isInformation: _root_.scala.Boolean = true
157+
}
158+
159+
160+
case object HINT extends Severity(4) with Severity.Recognized {
161+
val index = 4
162+
val name = "HINT"
163+
override def isHint: _root_.scala.Boolean = true
164+
}
165+
166+
167+
final case class Unrecognized(unrecognizedValue: _root_.scala.Int) extends Severity(unrecognizedValue) with SemanticdbUnrecognizedEnum
168+
169+
lazy val values = scala.collection.immutable.Seq(UNKNOWN_SEVERITY, ERROR, WARNING, INFORMATION, HINT)
170+
def fromValue(__value: _root_.scala.Int): Severity = __value match {
171+
case 0 => UNKNOWN_SEVERITY
172+
case 1 => ERROR
173+
case 2 => WARNING
174+
case 3 => INFORMATION
175+
case 4 => HINT
176+
case __other => Unrecognized(__other)
177+
}
178+
179+
180+
}
181+
final val RANGE_FIELD_NUMBER = 1
182+
final val SEVERITY_FIELD_NUMBER = 2
183+
final val MESSAGE_FIELD_NUMBER = 3
184+
def of(
185+
range: _root_.scala.Option[dotty.tools.dotc.semanticdb.Range],
186+
severity: dotty.tools.dotc.semanticdb.Diagnostic.Severity,
187+
message: _root_.scala.Predef.String
188+
): _root_.dotty.tools.dotc.semanticdb.Diagnostic = _root_.dotty.tools.dotc.semanticdb.Diagnostic(
189+
range,
190+
severity,
191+
message
192+
)
193+
// @@protoc_insertion_point(GeneratedMessageCompanion[dotty.tools.dotc.semanticdb.Diagnostic])
194+
}

0 commit comments

Comments
 (0)