Skip to content

Commit 4a3071f

Browse files
committed
syntax changes and test result improvements
1 parent 0bf31a9 commit 4a3071f

File tree

9 files changed

+38
-32
lines changed

9 files changed

+38
-32
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class ScalaSettings extends Settings.SettingGroup {
1717
val javabootclasspath: Setting[String] = PathSetting("-javabootclasspath", "Override java boot classpath.", Defaults.javaBootClassPath) withAbbreviation "--java-boot-class-path"
1818
val javaextdirs: Setting[String] = PathSetting("-javaextdirs", "Override java extdirs classpath.", Defaults.javaExtDirs) withAbbreviation "--java-extension-directories"
1919
val sourcepath: Setting[String] = PathSetting("-sourcepath", "Specify location(s) of source files.", Defaults.scalaSourcePath) withAbbreviation "--source-path"
20+
val scansource: Setting[Boolean] = BooleanSetting("-scansource", "Scan source files to locate classes for which class-name != file-name") withAbbreviation "--scan-source"
21+
val sourceroot: Setting[String] = PathSetting("-sourceroot", "Specify workspace root directory", ".")
22+
val targetroot: Setting[String] = PathSetting("-targetroot", "Specify output directory", "")
2023

2124
val classpath: Setting[String] = PathSetting("-classpath", "Specify where to find user class files.", defaultClasspath) withAbbreviation "-cp" withAbbreviation "--class-path"
2225
val outputDir: Setting[AbstractFile] = OutputSetting("-d", "directory|jar", "destination for generated classfiles.",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,10 @@ class ExtractSemanticDB extends Phase with
511511
else limit
512512
Span(start max limit, end)
513513

514-
private given spanOps: (span: Span) with
514+
private given extension (span: Span) with
515515
def hasLength: Boolean = span.start != span.end
516516
def zeroLength: Boolean = span.start == span.end
517+
end given
517518

518519
/**Consume head while not an import statement.
519520
* Returns the rest of the list after the first import, or else the empty list

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ object Scala3 with
6767

6868
end Symbols
6969

70-
given NameOps: (name: Name) with
70+
given NameOps: extension (name: Name) with
7171

7272
def isWildcard = name match
7373
case nme.WILDCARD | WILDCARDTypeName => true
@@ -89,7 +89,7 @@ object Scala3 with
8989

9090
end NameOps
9191

92-
given SymbolOps: (sym: Symbol) with
92+
given SymbolOps: extension (sym: Symbol) with
9393

9494
def ifExists(given Context): Option[Symbol] = if sym.exists then Some(sym) else None
9595

@@ -146,7 +146,7 @@ object Scala3 with
146146
case '/' | '.' | '#' | ']' | ')' => true
147147
case _ => false
148148

149-
given StringOps: (symbol: String) with
149+
given StringOps: extension (symbol: String) with
150150

151151
def isSymbol: Boolean = !symbol.isEmpty
152152
def isRootPackage: Boolean = RootPackage == symbol
@@ -171,7 +171,7 @@ object Scala3 with
171171

172172
end StringOps
173173

174-
given InfoOps: (info: SymbolInformation) with
174+
given InfoOps: extension (info: SymbolInformation) with
175175

176176
def isAbstract: Boolean = (info.properties & SymbolInformation.Property.ABSTRACT.value) != 0
177177
def isFinal: Boolean = (info.properties & SymbolInformation.Property.FINAL.value) != 0
@@ -207,7 +207,7 @@ object Scala3 with
207207

208208
end InfoOps
209209

210-
given RangeOps: (range: Range) with
210+
given RangeOps: extension (range: Range) with
211211
def hasLength = range.endLine > range.startLine || range.endCharacter > range.startCharacter
212212
end RangeOps
213213

tests/semanticdb/expect/Givens.expect.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package b
33

44
object Givens/*<-a::b::Givens.*/
55

6-
given :[A](any: A)
7-
de/*<-a::b::Givens.given_sayHello_of_A.*//*<-a::b::Givens.given_sayHello_of_A.sayHello().[A]*//*<-a::b::Givens.given_sayHello_of_A.sayHello().(any)*//*->a::b::Givens.given_sayHello_of_A.sayHello().[A]*/f sayHello/*<-a::b::Givens.given_sayHello_of_A.sayHello().*/ = s"/*->scala::StringContext.apply().*/Hello, I am $any/*->a::b::Givens.given_sayHello_of_A.sayHello().(any)*//*->scala::StringContext#s().*/"
6+
given extension [A](any: /*<-a::b::Givens.given_sayHello_of_A.*//*<-a::b::Givens.given_sayHello_of_A.sayHello().[A]*//*<-a::b::Givens.given_sayHello_of_A.sayHello().(any)*/A/*->a::b::Givens.given_sayHello_of_A.sayHello().[A]*/)
7+
def sayHello/*<-a::b::Givens.given_sayHello_of_A.sayHello().*/ = s"/*->scala::StringContext.apply().*/Hello, I am $any/*->a::b::Givens.given_sayHello_of_A.sayHello().(any)*//*->scala::StringContext#s().*/"
88

9-
given :[B](any: B)
10-
def /*<-a::b::Givens.given_sayGoodbye_of_B.*//*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().[B]*//*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().[B]*//*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().(any)*//*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().(any)*//*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().[B]*//*->a::b::Givens.given_sayGoodbye_of_B.saySoLong().[B]*/sayGoodbye/*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().*/ = s"/*->scala::StringContext.apply().*/Goodbye, from $any/*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().(any)*//*->scala::StringContext#s().*/"
9+
given extension [B](any: B)/*<-a::b::Givens.given_sayGoodbye_of_B.*//*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().[B]*//*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().[B]*//*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().(any)*//*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().(any)*//*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().[B]*//*->a::b::Givens.given_sayGoodbye_of_B.saySoLong().[B]*/
10+
def sayGoodbye/*<-a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().*/ = s"/*->scala::StringContext.apply().*/Goodbye, from $any/*->a::b::Givens.given_sayGoodbye_of_B.sayGoodbye().(any)*//*->scala::StringContext#s().*/"
1111
def saySoLong/*<-a::b::Givens.given_sayGoodbye_of_B.saySoLong().*/ = s"/*->scala::StringContext.apply().*/So Long, from $any/*->a::b::Givens.given_sayGoodbye_of_B.saySoLong().(any)*//*->scala::StringContext#s().*/"
1212

1313
val hello1/*<-a::b::Givens.hello1.*/ = /*->a::b::Givens.given_sayHello_of_A.sayHello().*/1.sayHello

tests/semanticdb/expect/Givens.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package b
33

44
object Givens
55

6-
given :[A](any: A)
6+
given extension [A](any: A)
77
def sayHello = s"Hello, I am $any"
88

9-
given :[B](any: B)
9+
given extension [B](any: B)
1010
def sayGoodbye = s"Goodbye, from $any"
1111
def saySoLong = s"So Long, from $any"
1212

tests/semanticdb/expect/MethodUsages.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MethodUsages/*<-example::MethodUsages#*/ {
1313
m/*->example::MethodUsages#m.*/.m6/*->example::Methods#m6(+2).*/(Nil/*->scala::package.Nil.*/)
1414
m/*->example::MethodUsages#m.*/.m7/*->example::Methods#m7().*/(m/*->example::MethodUsages#m.*/, new m/*->example::MethodUsages#m.*/.List/*->example::Methods#List#*/[Int/*->scala::Int#*/]/*->example::Methods#List#`<init>`().*/)/*->scala::math::Ordering.Int.*/
1515
m/*->example::MethodUsages#m.*/.`m8().`/*->example::Methods#`m8().`().*/()
16-
// m.m9(null) suspended due to issue https://github.com/lampepfl/dotty/issues/7514
16+
m/*->example::MethodUsages#m.*/.m9/*->example::Methods#m9().*/(null)
1717
m/*->example::MethodUsages#m.*/.m10/*->example::Methods#m10().*/(null)
1818
m/*->example::MethodUsages#m.*/.m11/*->example::Methods#m11().*/(Predef/*->scala::Predef.*/)
1919
m/*->example::MethodUsages#m.*/.m11/*->example::Methods#m11(+1).*/(Example/*->example::Example.*/)

tests/semanticdb/expect/MethodUsages.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MethodUsages {
1313
m.m6(Nil)
1414
m.m7(m, new m.List[Int])
1515
m.`m8().`()
16-
// m.m9(null) suspended due to issue https://github.com/lampepfl/dotty/issues/7514
16+
m.m9(null)
1717
m.m10(null)
1818
m.m11(Predef)
1919
m.m11(Example)

tests/semanticdb/expect/Methods.expect.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class Methods/*<-example::Methods#*/[T/*<-example::Methods#[T]*/] {
1616
def m6/*<-example::Methods#m6(+1).*/(x/*<-example::Methods#m6(+1).(x)*/: List/*->example::Methods#List#*/[T/*->example::Methods#[T]*/]) = ???/*->scala::Predef.`???`().*/
1717
def m6/*<-example::Methods#m6(+2).*/(x/*<-example::Methods#m6(+2).(x)*/: scala.List/*->scala::package.List#*/[T/*->example::Methods#[T]*/]) = ???/*->scala::Predef.`???`().*/
1818
def m7/*<-example::Methods#m7().*/[U/*<-example::Methods#m7().[U]*/: Ordering/*->scala::math::Ordering#*//*->example::Methods#m7().[U]*/](c/*<-example::Methods#m7().(c)*/: Methods/*->example::Methods#*/[T/*->example::Methods#[T]*/], l/*<-example::Methods#m7().(l)*/: List/*->example::Methods#List#*/[U/*->example::Methods#m7().[U]*/]) = ???/*->scala::Predef.`???`().*/
19-
def `m8().`() =/*<-example::Methods#`m8().`().*/ ???/*->scala::Predef.`???`().*/
20-
class `m9().`
21-
d/*<-example::Methods#`m9().`#*/ef m9/*<-example::Methods#m9().*/(x/*<-example::Methods#m9().(x)*/: `m9().`/*->example::Methods#`m9().`#*/) = ???/*->scala::Predef.`???`().*/
19+
def `m8()./*<-example::Methods#`m8().`().*/`() = ???/*->scala::Predef.`???`().*/
20+
class `m9()./*<-example::Methods#`m9().`#*/`
21+
def m9/*<-example::Methods#m9().*/(x/*<-example::Methods#m9().(x)*/: `m9().`/*->example::Methods#`m9().`#*/) = ???/*->scala::Predef.`???`().*/
2222
def m10/*<-example::Methods#m10().*/(x/*<-example::Methods#m10().(x)*/: AList/*->example::Methods#AList#*/[T/*->example::Methods#[T]*/]) = ???/*->scala::Predef.`???`().*/
2323
def m11/*<-example::Methods#m11().*/(x/*<-example::Methods#m11().(x)*/: Predef/*->scala::Predef.*/.type) = ???/*->scala::Predef.`???`().*/
2424
def m11/*<-example::Methods#m11(+1).*/(x/*<-example::Methods#m11(+1).(x)*/: Example/*->example::Example.*/.type) = ???/*->scala::Predef.`???`().*/

tests/semanticdb/metac.expect

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,21 +1311,21 @@ Occurrences:
13111311
[0:8..0:9): a <- a/
13121312
[1:8..1:9): b <- a/b/
13131313
[3:7..3:13): Givens <- a/b/Givens.
1314-
[5:8..6:6): <- a/b/Givens.given_sayHello_of_A.
1315-
[5:10..5:11): A <- a/b/Givens.given_sayHello_of_A.sayHello().[A]
1316-
[5:13..5:16): any <- a/b/Givens.given_sayHello_of_A.sayHello().(any)
1317-
[5:18..5:19): A -> a/b/Givens.given_sayHello_of_A.sayHello().[A]
1314+
[5:8..5:27): extension [A](any: <- a/b/Givens.given_sayHello_of_A.
1315+
[5:19..5:20): A <- a/b/Givens.given_sayHello_of_A.sayHello().[A]
1316+
[5:22..5:25): any <- a/b/Givens.given_sayHello_of_A.sayHello().(any)
1317+
[5:27..5:28): A -> a/b/Givens.given_sayHello_of_A.sayHello().[A]
13181318
[6:8..6:16): sayHello <- a/b/Givens.given_sayHello_of_A.sayHello().
13191319
[6:21..6:21): -> scala/StringContext.apply().
13201320
[6:34..6:37): any -> a/b/Givens.given_sayHello_of_A.sayHello().(any)
13211321
[6:37..6:37): -> scala/StringContext#s().
1322-
[8:8..9:8): <- a/b/Givens.given_sayGoodbye_of_B.
1323-
[8:10..8:11): B <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B]
1324-
[8:10..8:11): B <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B]
1325-
[8:13..8:16): any <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().(any)
1326-
[8:13..8:16): any <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().(any)
1327-
[8:18..8:19): B -> a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B]
1328-
[8:18..8:19): B -> a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B]
1322+
[8:8..8:29): extension [B](any: B) <- a/b/Givens.given_sayGoodbye_of_B.
1323+
[8:19..8:20): B <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B]
1324+
[8:19..8:20): B <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B]
1325+
[8:22..8:25): any <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().(any)
1326+
[8:22..8:25): any <- a/b/Givens.given_sayGoodbye_of_B.saySoLong().(any)
1327+
[8:27..8:28): B -> a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().[B]
1328+
[8:27..8:28): B -> a/b/Givens.given_sayGoodbye_of_B.saySoLong().[B]
13291329
[9:8..9:18): sayGoodbye <- a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().
13301330
[9:23..9:23): -> scala/StringContext.apply().
13311331
[9:38..9:41): any -> a/b/Givens.given_sayGoodbye_of_B.sayGoodbye().(any)
@@ -1792,7 +1792,7 @@ Uri => MethodUsages.scala
17921792
Text => empty
17931793
Language => Scala
17941794
Symbols => 3 entries
1795-
Occurrences => 74 entries
1795+
Occurrences => 76 entries
17961796

17971797
Symbols:
17981798
example/MethodUsages# => class MethodUsages
@@ -1839,7 +1839,9 @@ Occurrences:
18391839
[13:25..13:25): -> example/Methods#List#`<init>`().
18401840
[13:26..13:26): -> scala/math/Ordering.Int.
18411841
[14:2..14:3): m -> example/MethodUsages#m.
1842-
[14:3..14:11): .`m8().` -> example/Methods#`m8().`().
1842+
[14:4..14:11): `m8().` -> example/Methods#`m8().`().
1843+
[15:2..15:3): m -> example/MethodUsages#m.
1844+
[15:4..15:6): m9 -> example/Methods#m9().
18431845
[16:2..16:3): m -> example/MethodUsages#m.
18441846
[16:4..16:7): m10 -> example/Methods#m10().
18451847
[17:2..17:3): m -> example/MethodUsages#m.
@@ -2025,10 +2027,10 @@ Occurrences:
20252027
[17:40..17:44): List -> example/Methods#List#
20262028
[17:45..17:46): U -> example/Methods#m7().[U]
20272029
[17:51..17:54): ??? -> scala/Predef.`???`().
2028-
[18:7..18:17): m8().`() = <- example/Methods#`m8().`().
2030+
[18:7..18:12): m8(). <- example/Methods#`m8().`().
20292031
[18:18..18:21): ??? -> scala/Predef.`???`().
20302032
[19:2..19:2): <- example/Methods#`m9().`#`<init>`().
2031-
[19:9..20:3): <- example/Methods#`m9().`#
2033+
[19:9..19:14): m9(). <- example/Methods#`m9().`#
20322034
[20:6..20:8): m9 <- example/Methods#m9().
20332035
[20:9..20:10): x <- example/Methods#m9().(x)
20342036
[20:12..20:19): `m9().` -> example/Methods#`m9().`#

0 commit comments

Comments
 (0)