File tree 1 file changed +3
-2
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import Inferencing.*
17
17
import ErrorReporting .*
18
18
import util .SourceFile
19
19
import TypeComparer .necessarySubType
20
+ import dotty .tools .dotc .core .Flags .Transparent
20
21
21
22
import scala .annotation .internal .sharable
22
23
@@ -105,14 +106,14 @@ object ProtoTypes {
105
106
if ! res then ctx.typerState.constraint = savedConstraint
106
107
res
107
108
108
- /** Constrain result with special case if `meth` is an inlineable method in an inlineable context.
109
+ /** Constrain result with special case if `meth` is a transparent inlineable method in an inlineable context.
109
110
* In that case, we should always succeed and not constrain type parameters in the expected type,
110
111
* because the actual return type can be a subtype of the currently known return type.
111
112
* However, we should constrain parameters of the declared return type. This distinction is
112
113
* achieved by replacing expected type parameters with wildcards.
113
114
*/
114
115
def constrainResult (meth : Symbol , mt : Type , pt : Type )(using Context ): Boolean =
115
- if (Inlines .isInlineable(meth)) {
116
+ if (Inlines .isInlineable(meth) && meth.is( Transparent ) ) {
116
117
constrainResult(mt, wildApprox(pt))
117
118
true
118
119
}
You can’t perform that action at this time.
0 commit comments