Skip to content

Commit

Permalink
Revert "Followup fix to transparent inline conversion (#18130)"
Browse files Browse the repository at this point in the history
This reverts commit 3de184c.
  • Loading branch information
nicolasstucki committed Mar 11, 2024
1 parent f1e3dff commit 2421581
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 78 deletions.
20 changes: 3 additions & 17 deletions compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import ErrorReporting.*
import util.SourceFile
import TypeComparer.necessarySubType
import dotty.tools.dotc.core.Flags.Transparent
import dotty.tools.dotc.config.{ Feature, SourceVersion }

import scala.annotation.internal.sharable
import dotty.tools.dotc.util.Spans.{NoSpan, Span}
Expand Down Expand Up @@ -115,22 +114,9 @@ object ProtoTypes {
* achieved by replacing expected type parameters with wildcards.
*/
def constrainResult(meth: Symbol, mt: Type, pt: Type)(using Context): Boolean =
if (Inlines.isInlineable(meth)) {
// Stricter behaviour in 3.4+: do not apply `wildApprox` to non-transparent inlines
if (Feature.sourceVersion.isAtLeast(SourceVersion.`3.4`)) {
if (meth.is(Transparent)) {
constrainResult(mt, wildApprox(pt))
// do not constrain the result type of transparent inline methods
true
} else {
constrainResult(mt, pt)
}
} else {
// Best-effort to fix https://github.com/scala/scala3/issues/9685 in the 3.3.x series
// while preserving source compatibility as much as possible
val methodMatchedType = constrainResult(mt, wildApprox(pt))
meth.is(Transparent) || methodMatchedType
}
if (Inlines.isInlineable(meth) && meth.is(Transparent)) {
constrainResult(mt, wildApprox(pt))
true
}
else constrainResult(mt, pt)
}
Expand Down
9 changes: 0 additions & 9 deletions tests/neg/i9685bis.check

This file was deleted.

25 changes: 0 additions & 25 deletions tests/neg/i9685bis.scala

This file was deleted.

27 changes: 0 additions & 27 deletions tests/pos-macros/i18123.scala

This file was deleted.

0 comments on commit 2421581

Please sign in to comment.