@@ -17,8 +17,6 @@ import Inferencing.*
1717import ErrorReporting .*
1818import util .SourceFile
1919import TypeComparer .necessarySubType
20- import dotty .tools .dotc .core .Flags .Transparent
21- import dotty .tools .dotc .config .{ Feature , SourceVersion }
2220
2321import scala .annotation .internal .sharable
2422import dotty .tools .dotc .util .Spans .{NoSpan , Span }
@@ -108,29 +106,16 @@ object ProtoTypes {
108106 if ! res then ctx.typerState.constraint = savedConstraint
109107 res
110108
111- /** Constrain result with special case if `meth` is a transparent inlineable method in an inlineable context.
109+ /** Constrain result with special case if `meth` is an inlineable method in an inlineable context.
112110 * In that case, we should always succeed and not constrain type parameters in the expected type,
113111 * because the actual return type can be a subtype of the currently known return type.
114112 * However, we should constrain parameters of the declared return type. This distinction is
115113 * achieved by replacing expected type parameters with wildcards.
116114 */
117115 def constrainResult (meth : Symbol , mt : Type , pt : Type )(using Context ): Boolean =
118116 if (Inlines .isInlineable(meth)) {
119- // Stricter behaviour in 3.4+: do not apply `wildApprox` to non-transparent inlines
120- if (Feature .sourceVersion.isAtLeast(SourceVersion .`3.4`)) {
121- if (meth.is(Transparent )) {
122- constrainResult(mt, wildApprox(pt))
123- // do not constrain the result type of transparent inline methods
124- true
125- } else {
126- constrainResult(mt, pt)
127- }
128- } else {
129- // Best-effort to fix https://github.com/scala/scala3/issues/9685 in the 3.3.x series
130- // while preserving source compatibility as much as possible
131- val methodMatchedType = constrainResult(mt, wildApprox(pt))
132- meth.is(Transparent ) || methodMatchedType
133- }
117+ constrainResult(mt, wildApprox(pt))
118+ true
134119 }
135120 else constrainResult(mt, pt)
136121 }
0 commit comments