Skip to content

Commit d602f2f

Browse files
authored
Merge branch 'main' into drop-stdlib-plugin
2 parents 2775ade + 4dc7db7 commit d602f2f

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,13 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
716716
if passesConditionForErroringBestEffortCode(tree.hasType) then pickleType(tree.tpe)
717717
else pickleErrorType()
718718
case SingletonTypeTree(ref) =>
719-
writeByte(SINGLETONtpt)
720-
pickleTree(ref)
719+
val tp = ref.tpe
720+
val tp1 = tp.deskolemized
721+
if tp1 ne tp then
722+
pickleType(tp1)
723+
else
724+
writeByte(SINGLETONtpt)
725+
pickleTree(ref)
721726
case RefinedTypeTree(parent, refinements) =>
722727
if (refinements.isEmpty) pickleTree(parent)
723728
else {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
20302030
case mt: MethodType =>
20312031
pt.findFunctionType match {
20322032
case SAMType(samMeth, samParent)
2033-
if !defn.isFunctionNType(samParent) && mt <:< samMeth =>
2033+
if !ctx.erasedTypes && !defn.isFunctionNType(samParent)
2034+
&& mt <:< samMeth && !mt.isImplicitMethod =>
20342035
if defn.isContextFunctionType(mt.resultType) then
20352036
report.error(
20362037
em"""Implementation restriction: cannot convert this expression to `$samParent`

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ object Build {
102102
*
103103
* Warning: Change of this variable needs to be consulted with `expectedTastyVersion`
104104
*/
105-
val referenceVersion = "3.7.1-RC1"
105+
val referenceVersion = "3.7.1-RC2"
106106

107107
/** Version of the Scala compiler targeted in the current release cycle
108108
* Contains a version without RC/SNAPSHOT/NIGHTLY specific suffixes
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
abstract class MyFun:
2+
def apply(x: Int): Int
3+
4+
object Test:
5+
val myFun: MyFun = (x: Int) ?=> x + 10 // error

tests/pos/i23194.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class R[T] extends annotation.StaticAnnotation
2+
3+
class A[T]:
4+
val next: A[T] = null
5+
val self: this.type = this
6+
val selfnext: this.next.type = this.next
7+
def f: (A[T] @R[this.type], A[T] @R[this.next.type]) = ???
8+
def g: (A[T] @R[self.type], A[T] @R[selfnext.type]) = ???
9+
10+
class Test:
11+
def test =
12+
val (a, b) = A[String]().f
13+
val (a2, b2) = A[String]().g
14+

0 commit comments

Comments
 (0)