Skip to content

Commit dda6be5

Browse files
authored
Merge pull request #10302 from dotty-staging/reduce-dottypredef
Drop duplicate methods in DottyPredef
2 parents 1719ec6 + 9c4f6f2 commit dda6be5

File tree

7 files changed

+13
-39
lines changed

7 files changed

+13
-39
lines changed

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,7 @@ i8651b.scala
4949

5050
# uneliminated @uncheckedVariance after pickling
5151
annot-bootstrap.scala
52+
53+
# interaction with Scala-2's implicitly
54+
i9793.scala
55+

compiler/test/dotty/tools/backend/jvm/InlineBytecodeTests.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class InlineBytecodeTests extends DottyBytecodeTest {
7373
}
7474
}
7575

76-
@Test def inlineLocally = {
76+
/** Disabled since locally comes from Predef now
77+
@Test
78+
def inlineLocally = {
7779
val source =
7880
"""
7981
|class Foo {
@@ -103,6 +105,7 @@ class InlineBytecodeTests extends DottyBytecodeTest {
103105
diffInstructions(instructions1, instructions2))
104106
}
105107
}
108+
*/
106109

107110
@Test def inlineNn = {
108111
val source =

library/src/dotty/DottyPredef.scala

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,6 @@ object DottyPredef {
1313
scala.runtime.Scala3RunTime.assertFailed()
1414
}
1515

16-
inline final def implicitly[T](implicit ev: T): T = ev
17-
18-
/** Used to mark code blocks as being expressions, instead of being taken as part of anonymous classes and the like.
19-
* This is just a different name for [[identity]].
20-
*
21-
* @example Separating code blocks from `new`:
22-
* {{{
23-
* val x = new AnyRef
24-
* {
25-
* val y = ...
26-
* println(y)
27-
* }
28-
* // the { ... } block is seen as the body of an anonymous class
29-
*
30-
* val x = new AnyRef
31-
*
32-
* {
33-
* val y = ...
34-
* println(y)
35-
* }
36-
* // an empty line is a brittle "fix"
37-
*
38-
* val x = new AnyRef
39-
* locally {
40-
* val y = ...
41-
* println(y)
42-
* }
43-
* // locally guards the block and helps communicate intent
44-
* }}}
45-
* @group utilities
46-
*/
47-
inline def locally[T](inline body: T): T = body
48-
4916
/**
5017
* Retrieve the single value of a type with a unique inhabitant.
5118
*

tests/neg/implicitSearch.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
-- Error: tests/neg/implicitSearch.scala:15:38 -------------------------------------------------------------------------
1111
15 | listOrd(listOrd(implicitly[Ord[T]] /*not found*/)) // error
1212
| ^
13-
| no implicit argument of type Test.Ord[T] was found for parameter ev of method implicitly in object DottyPredef
13+
| no implicit argument of type Test.Ord[T] was found for parameter e of method implicitly in object Predef

tests/semanticdb/expect/ValPattern.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ValPattern/*<-example::ValPattern#*/ {
2323
rightVar/*->example::ValPattern#rightVar().*/
2424
)
2525
)
26-
locally/*->dotty::DottyPredef.locally().*/ {
26+
locally/*->scala::Predef.locally().*/ {
2727
val (left/*<-local0*/, right/*<-local1*/) = (/*->scala::Tuple2.apply().*/1, 2)
2828
val Some/*->scala::Some.*//*->scala::Some.unapply().*/(number1/*<-local2*/) =
2929
Some/*->scala::Some.*//*->scala::Some.apply().*/(1)

tests/semanticdb/expect/local-file.expect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package example
22

33
class `local-file/*<-example::`local-file`#*/` {
4-
locally/*->dotty::DottyPredef.locally().*/ {
4+
locally/*->scala::Predef.locally().*/ {
55
val local/*<-local0*/ = 42
66
local/*->local0*/ +/*->scala::Int#`+`(+4).*/ 4
77
}

tests/semanticdb/metac.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ Occurrences:
27762776
[20:8..20:18): number1Var -> example/ValPattern#number1Var().
27772777
[21:8..21:15): leftVar -> example/ValPattern#leftVar().
27782778
[22:8..22:16): rightVar -> example/ValPattern#rightVar().
2779-
[25:4..25:11): locally -> dotty/DottyPredef.locally().
2779+
[25:4..25:11): locally -> scala/Predef.locally().
27802780
[26:11..26:15): left <- local0
27812781
[26:17..26:22): right <- local1
27822782
[26:27..26:27): -> scala/Tuple2.apply().
@@ -3151,7 +3151,7 @@ Occurrences:
31513151
[0:8..0:15): example <- example/
31523152
[2:7..2:17): local-file <- example/`local-file`#
31533153
[3:2..3:2): <- example/`local-file`#`<init>`().
3154-
[3:2..3:9): locally -> dotty/DottyPredef.locally().
3154+
[3:2..3:9): locally -> scala/Predef.locally().
31553155
[4:8..4:13): local <- local0
31563156
[5:4..5:9): local -> local0
31573157
[5:10..5:11): + -> scala/Int#`+`(+4).

0 commit comments

Comments
 (0)