Skip to content

Commit 0215e18

Browse files
committed
Delete dead code (scala#26227)
Mostly worksheets that in part didn't even compile, I salvaged some of it into two new unit tests. ## How much have you relied on LLM-based tools in this contribution? Not at all ## How was the solution tested? New automated tests (including the issue's reproducer, if applicable) Covered by existing tests (this is a refactoring) [Cherry-picked cd567b0][modified]
1 parent c9ac8e1 commit 0215e18

13 files changed

Lines changed: 49 additions & 291 deletions

File tree

compiler/src/dotty/tools/dotc/transform/Pickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Symbols.*
1414
import Flags.Module
1515
import reporting.{ThrowingReporter, Profile, Message}
1616
import collection.mutable
17-
import util.concurrent.{Executor, Future}
17+
import util.concurrent.Executor
1818
import compiletime.uninitialized
1919

2020
object Pickler {

compiler/src/dotty/tools/dotc/util/optional.scala

Lines changed: 0 additions & 19 deletions
This file was deleted.

compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import dotty.tools.dotc.core.Mode.GadtConstraintInference
1010
import dotty.tools.dotc.core.Types.*
1111
import dotty.tools.dotc.core.StdNames.nme
1212
import dotty.tools.dotc.core.Symbols.*
13-
import dotty.tools.dotc.util.optional
13+
14+
import scala.util.boundary
1415

1516
/** Matches a quoted tree against a quoted pattern tree.
1617
* A quoted pattern tree may have type and term holes in addition to normal terms.
@@ -110,6 +111,9 @@ class QuoteMatcher(debug: Boolean) {
110111
*/
111112
type MatchingExprs = Seq[MatchResult]
112113

114+
/** Return type that indicates that the method returns a T or aborts to the enclosing boundary with a `None` */
115+
private type optional[T] = boundary.Label[None.type] ?=> T
116+
113117
/** A map relating equivalent symbols from the scrutinee and the pattern
114118
* For example in
115119
* ```
@@ -127,10 +131,10 @@ class QuoteMatcher(debug: Boolean) {
127131
def treeMatch(scrutinee: Tree, pattern: Tree)(using Context): Option[Tuple] = {
128132
val (pat1, typeHoles, ctx1) = instrumentTypeHoles(pattern)
129133
inContext(ctx1) {
130-
optional {
134+
boundary(Some {
131135
given Env = Map.empty
132136
scrutinee =?= pat1
133-
}.map { matchings =>
137+
}).map { matchings =>
134138
lazy val spliceScope = SpliceScope.getCurrent
135139
// After matching and doing all subtype checks, we have to approximate all the type bindings
136140
// that we have found, seal them in a quoted.Type and add them to the result
@@ -541,7 +545,7 @@ class QuoteMatcher(debug: Boolean) {
541545
new ExprImpl(hoasClosure, spliceScope)
542546

543547
private inline def notMatched: optional[MatchingExprs] =
544-
optional.break()
548+
boundary.break(None)
545549

546550
private inline def matched: MatchingExprs =
547551
Seq.empty

compiler/test/dotc/comptest.scala

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package dotty.tools.dotc.core
2+
3+
import Flags.*
4+
5+
import org.junit.Test
6+
import org.junit.Assert.*
7+
8+
class FlagsTest:
9+
private val pri = Private
10+
private val pro = Protected
11+
private val pripro = pri | pro
12+
13+
@Test def test(): Unit =
14+
assertTrue(pripro.is(pri))
15+
assertTrue(pripro.is(pro))
16+
assertFalse(pripro.is(Local))
17+
18+
val pp = pri | pro
19+
assertTrue(pripro.isAllOf(pp))
20+
assertFalse(pri.isAllOf(pp))
21+
assertFalse(pri.isAllOf(pripro))
22+
23+
assertFalse(Method == Abstract)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package dotty.tools.dotc.core
2+
3+
import Names.*
4+
import Decorators.*
5+
6+
import org.junit.Test
7+
import org.junit.Assert.*
8+
9+
class NameTest:
10+
@Test def test(): Unit = {
11+
val n = termName("hello")
12+
val tn = n.toTypeName
13+
assert(tn.toTermName eq n)
14+
assertFalse(n == tn)
15+
assertFalse(n eq tn)
16+
assertFalse(n == EmptyTermName)
17+
}

compiler/test/worksheets/baseTypetest.sc

Lines changed: 0 additions & 26 deletions
This file was deleted.

compiler/test/worksheets/denotTest.sc

Lines changed: 0 additions & 55 deletions
This file was deleted.

compiler/test/worksheets/flagtest.sc

Lines changed: 0 additions & 27 deletions
This file was deleted.

compiler/test/worksheets/nesting.sc

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)