Skip to content

wip: Support MatchType and LambdaType for Scala3 #1

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

Closed
wants to merge 2 commits into from
Closed
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
18 changes: 18 additions & 0 deletions generator/src/main/protobuf/scalameta.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ message Type {
UniversalType universal_type = 10;
ByNameType by_name_type = 13;
RepeatedType repeated_type = 14;
LambdaType lambda_type = 24;
MatchType match_type = 25;
}
}

Expand Down Expand Up @@ -144,6 +146,21 @@ message RepeatedType {
Type tpe = 1;
}

message LambdaType {
Scope parameters = 1;
Type return_type = 2;
}

message MatchType {
message CaseType {
Type key = 1;
Type body = 2;
}
Type scrutinee = 1;
repeated CaseType cases = 2;
}


message Constant {
oneof sealed_value {
UnitConstant unit_constant = 1;
Expand Down Expand Up @@ -421,3 +438,4 @@ message TypeApplyTree {
Tree function = 1;
repeated Type type_arguments = 2;
}

Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ final case class AccessMessage(
sealedValue: dotty.tools.dotc.semanticdb.AccessMessage.SealedValue = dotty.tools.dotc.semanticdb.AccessMessage.SealedValue.Empty
) extends SemanticdbGeneratedMessage derives CanEqual {
@transient @sharable
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
private[this] def __computeSerializedValue(): _root_.scala.Int = {
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0
if (sealedValue.privateAccess.isDefined) {
val __value = sealedValue.privateAccess.get
Expand Down Expand Up @@ -84,12 +84,13 @@ final case class AccessMessage(
__size
}
override def serializedSize: _root_.scala.Int = {
var read = __serializedSizeCachedValue
if (read == 0) {
read = __computeSerializedValue()
__serializedSizeCachedValue = read
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
read
__size - 1

}
def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = {
sealedValue.privateAccess.foreach { __v =>
Expand Down Expand Up @@ -378,8 +379,8 @@ final case class PrivateWithinAccess(
symbol: _root_.scala.Predef.String = ""
) extends dotty.tools.dotc.semanticdb.Access.NonEmpty with SemanticdbGeneratedMessage derives CanEqual {
@transient @sharable
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
private[this] def __computeSerializedValue(): _root_.scala.Int = {
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0

{
Expand All @@ -391,12 +392,13 @@ final case class PrivateWithinAccess(
__size
}
override def serializedSize: _root_.scala.Int = {
var read = __serializedSizeCachedValue
if (read == 0) {
read = __computeSerializedValue()
__serializedSizeCachedValue = read
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
read
__size - 1

}
def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = {
{
Expand Down Expand Up @@ -537,8 +539,8 @@ final case class ProtectedWithinAccess(
symbol: _root_.scala.Predef.String = ""
) extends dotty.tools.dotc.semanticdb.Access.NonEmpty with SemanticdbGeneratedMessage derives CanEqual {
@transient @sharable
private[this] var __serializedSizeCachedValue: _root_.scala.Int = 0
private[this] def __computeSerializedValue(): _root_.scala.Int = {
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _root_.scala.Int = {
var __size = 0

{
Expand All @@ -550,12 +552,13 @@ final case class ProtectedWithinAccess(
__size
}
override def serializedSize: _root_.scala.Int = {
var read = __serializedSizeCachedValue
if (read == 0) {
read = __computeSerializedValue()
__serializedSizeCachedValue = read
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
read
__size - 1

}
def writeTo(`_output__`: SemanticdbOutputStream): _root_.scala.Unit = {
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,31 @@ 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 = {
private[this] var __serializedSizeMemoized: _root_.scala.Int = 0
private[this] def __computeSerializedSize(): _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) {
if (__value.serializedSize != 0) {
__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
var __size = __serializedSizeMemoized
if (__size == 0) {
__size = __computeSerializedSize() + 1
__serializedSizeMemoized = __size
}
read
__size - 1

}
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) {
if (__v.serializedSize != 0) {
_output__.writeTag(1, 2)
_output__.writeUInt32NoTag(__v.serializedSize)
__v.writeTo(_output__)
Expand Down
Loading