Skip to content

WIP - Fix 11924 #11925

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 4 additions & 5 deletions compiler/src/dotty/tools/dotc/typer/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,9 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
}
val argtpe = arg.tpe.dealiasKeepAnnots.translateFromRepeated(toArray = false)
val argIsBottom = argtpe.isBottomTypeAfterErasure
val bindingType =
if argIsBottom then formal
else if isByName then ExprType(argtpe.widen)
else argtpe.widen
val bindingType = formal.dealias match
case ExprType(formal) => ExprType(AndType.make(formal, argtpe))
case _ => AndType.make(formal, argtpe)
var bindingFlags: FlagSet = InlineProxy
if formal.widenExpr.hasAnnotation(defn.InlineParamAnnot) then
bindingFlags |= Inline
Expand Down Expand Up @@ -503,7 +502,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
tp.paramNames.lazyZip(formalss.head).lazyZip(argss.head).foreach { (name, formal, arg) =>
paramSpan(name) = arg.span
paramBinding(name) = arg.tpe.dealias match
case _: SingletonType if isIdempotentPath(arg) =>
case _: SingletonType if isIdempotentPath(arg) && ctx.phase == Phases.typerPhase =>
arg.tpe
case _ =>
paramBindingDef(name, formal, arg, bindingsBuf).symbol.termRef
Expand Down
10 changes: 10 additions & 0 deletions tests/pos/i11924.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
object i11924:
type A
class B { def foo = 0 }
trait Ev { type T >: A <: B }

inline def test(ev: Ev)(x: ev.T): Int = x.foo

def trial(ev: Ev, a: A) = {
test(ev)(a)
}