@@ -17,8 +17,6 @@ import Inferencing.*
17
17
import ErrorReporting .*
18
18
import util .SourceFile
19
19
import TypeComparer .necessarySubType
20
- import dotty .tools .dotc .core .Flags .Transparent
21
- import dotty .tools .dotc .config .{ Feature , SourceVersion }
22
20
23
21
import scala .annotation .internal .sharable
24
22
import dotty .tools .dotc .util .Spans .{NoSpan , Span }
@@ -108,29 +106,16 @@ object ProtoTypes {
108
106
if ! res then ctx.typerState.constraint = savedConstraint
109
107
res
110
108
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.
112
110
* In that case, we should always succeed and not constrain type parameters in the expected type,
113
111
* because the actual return type can be a subtype of the currently known return type.
114
112
* However, we should constrain parameters of the declared return type. This distinction is
115
113
* achieved by replacing expected type parameters with wildcards.
116
114
*/
117
115
def constrainResult (meth : Symbol , mt : Type , pt : Type )(using Context ): Boolean =
118
116
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
134
119
}
135
120
else constrainResult(mt, pt)
136
121
}
0 commit comments