Skip to content

Preserve type bounds for inlined definitions in posttyper #17190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/transform/PostTyper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
case Inlined(call, bindings, expansion) if !call.isEmpty =>
val pos = call.sourcePos
CrossVersionChecks.checkExperimentalRef(call.symbol, pos)
super.transform(call)
val callTrace = Inlines.inlineCallTrace(call.symbol, pos)(using ctx.withSource(pos.source))
cpy.Inlined(tree)(callTrace, transformSub(bindings), transform(expansion)(using inlineContext(call)))
case templ: Template =>
Expand Down
3 changes: 3 additions & 0 deletions tests/neg/i17168.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type F[X <: String] = X

val a = summon[F[Int] =:= Int] // error
14 changes: 0 additions & 14 deletions tests/pos/i13332super.scala

This file was deleted.

6 changes: 3 additions & 3 deletions tests/run/anon-mirror-gen-local.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Outer5 { self =>
}
}

lazy val o = new Outer5() // infinite init
final lazy val o = new Outer5() // infinite init

}

Expand Down Expand Up @@ -142,7 +142,7 @@ def locally3 = {
class Bar extends Foo {

def hello =
val mQux = summon[Mirror.Of[Bar.super.foo.type]]
val mQux = summon[Mirror.Of[foo.type]]
assert(mQux.fromProduct(EmptyTuple) == Qux)
}

Expand All @@ -157,4 +157,4 @@ def locally3 = {
testOuter6
locally1
locally2
locally3
locally3
2 changes: 1 addition & 1 deletion tests/run/i13332a.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class SubUniverse extends Universe {

trait Whole {
trait MixinA {
lazy val mixinB = new MixinB() {}
final lazy val mixinB = new MixinB() {}
}
trait MixinB {
object A extends MixinB { // by inheriting `MixinB`, we should not check for inheritance from the right
Expand Down