Skip to content

Commit f82a8c7

Browse files
committed
remove special case for Annotated, update expect for anon class change
1 parent 196c90c commit f82a8c7

File tree

11 files changed

+27
-33
lines changed

11 files changed

+27
-33
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ class ExtractSemanticDB extends Phase with
229229
traverseChildren(tree)
230230
case tree: Inlined =>
231231
traverse(tree.call)
232-
case tree: Annotated => // skip the annotation (see `@param` in https://github.com/scalameta/scalameta/blob/633824474e99bbfefe12ad0cc73da1fe064b3e9b/tests/jvm/src/test/resources/example/Annotations.scala#L37)
233-
traverse(tree.arg)
234232
case _ =>
235233
traverseChildren(tree)
236234

compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SemanticdbTests with
3939
def runExpectTest(updateExpectFiles: Boolean): Unit =
4040
val target = generateSemanticdb()
4141
val errors = mutable.ArrayBuffer.empty[Path]
42-
given metacSb: StringBuilder = StringBuilder(5000)
42+
val metacSb: StringBuilder = StringBuilder(5000)
4343
for source <- inputFiles().sorted do
4444
val filename = source.getFileName.toString
4545
val relpath = expectSrc.relativize(source)
@@ -71,9 +71,8 @@ class SemanticdbTests with
7171
val expectName = metacExpectFile.getFileName
7272
val relExpect = rootSrc.relativize(metacExpectFile)
7373
val obtained = metacSb.toString
74-
def writeOut =
7574
collectFailingDiff(expected, obtained, s"a/$relExpect", s"b/$relExpect") {
76-
Files.write(metacExpectFile.resolveSibling("" + expectName + ".out"), obtained.getBytes(StandardCharsets.UTF_8));
75+
Files.write(metacExpectFile.resolveSibling("" + expectName + ".out"), obtained.getBytes(StandardCharsets.UTF_8))
7776
errors += metacExpectFile
7877
}
7978
errors.foreach { expect =>

tests/semanticdb/expect/Advanced.expect.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class C/*<-advanced::C#*/[T/*<-advanced::C#[T]*/] {
1111

1212
class Structural/*<-advanced::Structural#*/ {
1313
def s1/*<-advanced::Structural#s1().*/: { val x/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/
14-
def s2/*<-advanced::Structural#s2().*/: { val x/*<-local1*/: Int/*->scala::Int#*/ } = /*<-local2*/new { val x/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
15-
def s3/*<-advanced::Structural#s3().*/: { def m/*<-local4*/(x/*<-local5*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = /*<-local6*/new { def m/*<-local7*/(x/*<-local8*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
14+
def s2/*<-advanced::Structural#s2().*/: { val x/*<-local1*/: Int/*->scala::Int#*/ } = new { val x/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
15+
def s3/*<-advanced::Structural#s3().*/: { def m/*<-local4*/(x/*<-local5*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ } = new { def m/*<-local7*/(x/*<-local8*/: Int/*->scala::Int#*/): Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
1616
}
1717

1818
class Wildcards/*<-advanced::Wildcards#*/ {

tests/semanticdb/expect/Annotations.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ object M/*<-annot::M.*/ {
3434
trait T/*<-annot::T#*/
3535

3636
object Alias/*<-annot::Alias.*/ {
37-
type A/*<-annot::Alias.A#*/ = ClassAnnotation/*->com::javacp::annot::ClassAnnotation#*/ @param
37+
type A/*<-annot::Alias.A#*/ = ClassAnnotation/*->com::javacp::annot::ClassAnnotation#*/ @param/*->scala::annotation::meta::param#*/
3838
}

tests/semanticdb/expect/Anonymous.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ class Anonymous/*<-example::Anonymous#*/ {
1616
}
1717

1818
trait Foo/*<-example::Anonymous#Foo#*/
19-
val foo/*<-example::Anonymous#foo.*/ = /*<-local1*/new Foo/*->example::Anonymous#Foo#*/ {}
19+
val foo/*<-example::Anonymous#foo.*/ = new Foo/*->example::Anonymous#Foo#*/ {}
2020
}

tests/semanticdb/expect/Classes.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class C8/*<-classes::C8#*/(private[this] val x/*<-classes::C8#x.*/: Int/*->scala
2323
class C9/*<-classes::C9#*/(private[this] var x/*<-classes::C9#x().*/: Int/*->scala::Int#*/)
2424

2525
object N/*<-classes::N.*/ {
26-
val anonClass/*<-classes::N.anonClass.*/ = /*<-local0*/new C7/*->classes::C7#*/(42) {
26+
val anonClass/*<-classes::N.anonClass.*/ = new C7/*->classes::C7#*/(42) {
2727
val local/*<-local1*/ = ???/*->scala::Predef.`???`().*/
2828
}
2929
val anonFun/*<-classes::N.anonFun.*/ = List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/(1).map/*->scala::collection::immutable::List#map().*/ { i/*<-local2*/ =>

tests/semanticdb/expect/InstrumentTyper.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class InstrumentTyper/*<-example::InstrumentTyper#*/ { self/*<-local0*/: AnyRef/
2020
Literal/*->types::Test.Literal.*/.clazzOf/*->types::Test.Literal.clazzOf.*/,
2121
List/*->scala::package.List.*//*->scala::collection::IterableFactory#apply().*/()
2222
)
23-
type AnnotatedType/*<-example::InstrumentTyper#AnnotatedType#*/ = Int/*->scala::Int#*/ @param
23+
type AnnotatedType/*<-example::InstrumentTyper#AnnotatedType#*/ = Int/*->scala::Int#*/ @param/*->scala::annotation::meta::param#*/
2424
def singletonType/*<-example::InstrumentTyper#singletonType().*/(x/*<-example::InstrumentTyper#singletonType().(x)*/: Predef/*->scala::Predef.*/.type) = ???/*->scala::Predef.`???`().*/
2525
final val clazzOf/*<-example::InstrumentTyper#clazzOf.*/ = classOf/*->scala::Predef.classOf().*/[Option/*->scala::Option#*/[Int/*->scala::Int#*/]]
2626
}

tests/semanticdb/expect/Methods.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Methods/*<-example::Methods#*/[T/*<-example::Methods#[T]*/] {
2424
def m11/*<-example::Methods#m11(+1).*/(x/*<-example::Methods#m11(+1).(x)*/: Example/*->example::Example.*/.type) = ???/*->scala::Predef.`???`().*/
2525
def m12a/*<-example::Methods#m12a().*/(x/*<-example::Methods#m12a().(x)*/: {}) = ???/*->scala::Predef.`???`().*/
2626
def m12b/*<-example::Methods#m12b().*/(x/*<-example::Methods#m12b().(x)*/: { val x/*<-local0*/: Int/*->scala::Int#*/ }) = ???/*->scala::Predef.`???`().*/
27-
def m13/*<-example::Methods#m13().*/(x/*<-example::Methods#m13().(x)*/: Int/*->scala::Int#*/ @unchecked) = ???/*->scala::Predef.`???`().*/
27+
def m13/*<-example::Methods#m13().*/(x/*<-example::Methods#m13().(x)*/: Int/*->scala::Int#*/ @unchecked/*->scala::unchecked#*/) = ???/*->scala::Predef.`???`().*/
2828
def m15/*<-example::Methods#m15().*/(x/*<-example::Methods#m15().(x)*/: => Int/*->scala::Int#*/) = ???/*->scala::Predef.`???`().*/
2929
def m16/*<-example::Methods#m16().*/(x/*<-example::Methods#m16().(x)*/: Int/*->scala::Int#*/*) = ???/*->scala::Predef.`???`().*/
3030
object m17/*<-example::Methods#m17.*/ { def m/*<-example::Methods#m17.m().*/() = ???/*->scala::Predef.`???`().*/ }

tests/semanticdb/expect/Traits.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ trait T/*<-traits::T#*/ {
66

77
sealed trait U/*<-traits::U#*/
88
object U/*<-traits::U.*/ {
9-
def u/*<-traits::U.u().*/: U/*->traits::U#*/ = /*<-local0*/new U/*->traits::U#*/ {}
9+
def u/*<-traits::U.u().*/: U/*->traits::U#*/ = new U/*->traits::U#*/ {}
1010
}
1111

1212
class C/*<-traits::C#*/

tests/semanticdb/expect/Types.expect.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ object Test/*<-types::Test.*/ {
5555
val compoundType1/*<-types::Test.C#compoundType1.*/: { def k/*<-local0*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/
5656
val compoundType2/*<-types::Test.C#compoundType2.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ = ???/*->scala::Predef.`???`().*/
5757
val compoundType3/*<-types::Test.C#compoundType3.*/: M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local1*/: Int/*->scala::Int#*/ } = ???/*->scala::Predef.`???`().*/
58-
val compoundType4/*<-types::Test.C#compoundType4.*/ = /*<-local2*/new { def k/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
59-
val compoundType5/*<-types::Test.C#compoundType5.*/ = /*<-local4*/new M/*->types::Test.M#*/ with N/*->types::Test.N#*/
60-
val compoundType6/*<-types::Test.C#compoundType6.*/ = /*<-local5*/new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
58+
val compoundType4/*<-types::Test.C#compoundType4.*/ = new { def k/*<-local3*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
59+
val compoundType5/*<-types::Test.C#compoundType5.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/
60+
val compoundType6/*<-types::Test.C#compoundType6.*/ = new M/*->types::Test.M#*/ with N/*->types::Test.N#*/ { def k/*<-local6*/: Int/*->scala::Int#*/ = ???/*->scala::Predef.`???`().*/ }
6161

6262
val annType1/*<-types::Test.C#annType1.*/: T/*->types::T#*/ @ann(42) = ???/*->scala::Predef.`???`().*/
63-
val annType2/*<-types::Test.C#annType2.*/: T/*->types::T#*/ @ann1 @ann2 = ???/*->scala::Predef.`???`().*/
63+
val annType2/*<-types::Test.C#annType2.*/: T/*->types::T#*/ @ann1/*->types::ann1#*/ @ann2/*->types::ann2#*/ = ???/*->scala::Predef.`???`().*/
6464

6565
val existentialType2/*<-types::Test.C#existentialType2.*/: List/*->scala::package.List#*/[_] = ???/*->scala::Predef.`???`().*/
6666
val existentialType3/*<-types::Test.C#existentialType3.*/ = Class/*->java::lang::Class#*/.forName/*->java::lang::Class#forName().*/("foo.Bar")

0 commit comments

Comments
 (0)