Skip to content

Commit 351709d

Browse files
authored
Merge branch 'lampepfl:main' into dotty-scaladoc
2 parents 9521429 + 895598f commit 351709d

File tree

8 files changed

+51
-10
lines changed

8 files changed

+51
-10
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ object SymDenotations {
13881388
final def accessBoundary(base: Symbol)(using Context): Symbol =
13891389
if (this.is(Private)) owner
13901390
else if (this.isAllOf(StaticProtected)) defn.RootClass
1391-
else if (privateWithin.exists && !ctx.phase.erasedTypes) privateWithin
1391+
else if (privateWithin.exists && (!ctx.phase.erasedTypes || this.is(JavaDefined))) privateWithin
13921392
else if (this.is(Protected)) base
13931393
else defn.RootClass
13941394

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,7 +3014,7 @@ object Types {
30143014
private[Types] var opened: Boolean = false
30153015
private[Types] var openedTwice: Boolean = false
30163016

3017-
val parent: Type = parentExp(this)
3017+
val parent: Type = parentExp(this: @unchecked)
30183018

30193019
private var myRecThis: RecThis | Null = null
30203020

@@ -3705,8 +3705,8 @@ object Types {
37053705

37063706
type This = MethodType
37073707

3708-
val paramInfos: List[Type] = paramInfosExp(this)
3709-
val resType: Type = resultTypeExp(this)
3708+
val paramInfos: List[Type] = paramInfosExp(this: @unchecked)
3709+
val resType: Type = resultTypeExp(this: @unchecked)
37103710
assert(resType.exists)
37113711

37123712
def companion: MethodTypeCompanion
@@ -3879,8 +3879,8 @@ object Types {
38793879
type This = HKTypeLambda
38803880
def companion: HKTypeLambda.type = HKTypeLambda
38813881

3882-
val paramInfos: List[TypeBounds] = paramInfosExp(this)
3883-
val resType: Type = resultTypeExp(this)
3882+
val paramInfos: List[TypeBounds] = paramInfosExp(this: @unchecked)
3883+
val resType: Type = resultTypeExp(this: @unchecked)
38843884

38853885
private def setVariances(tparams: List[LambdaParam], vs: List[Variance]): Unit =
38863886
if tparams.nonEmpty then
@@ -3948,8 +3948,8 @@ object Types {
39483948
type This = PolyType
39493949
def companion: PolyType.type = PolyType
39503950

3951-
val paramInfos: List[TypeBounds] = paramInfosExp(this)
3952-
val resType: Type = resultTypeExp(this)
3951+
val paramInfos: List[TypeBounds] = paramInfosExp(this: @unchecked)
3952+
val resType: Type = resultTypeExp(this: @unchecked)
39533953

39543954
assert(resType.isInstanceOf[TermType], this)
39553955
assert(paramNames.nonEmpty)

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ object RefChecks {
305305
def info = self.memberInfo(sym1)
306306
val infoStr =
307307
if (sym1.isAliasType) i", which equals ${info.bounds.hi}"
308-
else if (sym1.isAbstractOrParamType) i" with bounds$info"
308+
else if (sym1.isAbstractOrParamType && info != TypeBounds.empty) i" with bounds$info"
309309
else if (sym1.is(Module)) ""
310310
else if (sym1.isTerm) i" of type $info"
311311
else ""
@@ -430,6 +430,10 @@ object RefChecks {
430430
// direct overrides were already checked on completion (see Checking.chckWellFormed)
431431
// the test here catches indirect overriddes between two inherited base types.
432432
overrideError("cannot be used here - class definitions cannot be overridden")
433+
else if (other.isOpaqueAlias)
434+
// direct overrides were already checked on completion (see Checking.chckWellFormed)
435+
// the test here catches indirect overriddes between two inherited base types.
436+
overrideError("cannot be used here - opaque type aliases cannot be overridden")
433437
else if (!other.is(Deferred) && member.isClass)
434438
overrideError("cannot be used here - classes can only override abstract types")
435439
else if other.isEffectivelyFinal then // (1.2)

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object DottyJSPlugin extends AutoPlugin {
5757
object Build {
5858
import ScaladocConfigs._
5959

60-
val referenceVersion = "3.1.2-RC1"
60+
val referenceVersion = "3.1.2-RC2"
6161

6262
val baseVersion = "3.1.3-RC1"
6363

tests/neg/i14659.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
trait Foo {
2+
opaque type Out = Int
3+
def out1: Out
4+
def out2: Out = out1
5+
}
6+
7+
object Bar extends Foo {
8+
override opaque type Out = String // error
9+
override def out1 = "abc"
10+
}
11+
12+
@main def run() =
13+
val x = Bar.out2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public static java.lang.String scalapackage.Foo.publicMethod()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package javapackage;
2+
3+
public class Base_1 {
4+
int packagePrivateMethod() {
5+
return 42;
6+
}
7+
8+
public String publicMethod() {
9+
return "foo";
10+
}
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package scalapackage:
2+
object Foo extends javapackage.Base_1
3+
end scalapackage
4+
5+
object Test {
6+
def main(args: Array[String]): Unit = {
7+
println(
8+
Class.forName("scalapackage.Foo").getMethods
9+
.filter(m => (m.getModifiers & java.lang.reflect.Modifier.STATIC) != 0)
10+
.mkString("\n"))
11+
}
12+
}

0 commit comments

Comments
 (0)