File tree 4 files changed +25
-7
lines changed
compiler/src/dotty/tools/dotc/typer
4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,7 @@ object RefChecks {
398
398
overrideError(" is an extension method, cannot override a normal method" )
399
399
else if (other.isAllOf(ExtensionMethod ) && ! member.isAllOf(ExtensionMethod )) // (1.9.2)
400
400
overrideError(" is a normal method, cannot override an extension method" )
401
- else if other.isInlineMethod && ! member.isInlineMethod then // (1.10)
401
+ else if other.is( Inline ) && ! member.is( Inline ) then // (1.10)
402
402
overrideError(" is not inline, cannot implement an inline method" )
403
403
else if (other.isScala2Macro && ! member.isScala2Macro) // (1.11)
404
404
overrideError(" cannot be used here - only Scala-2 macros can override Scala-2 macros" )
Original file line number Diff line number Diff line change @@ -3082,18 +3082,17 @@ class Typer extends Namer
3082
3082
checkEqualityEvidence(tree, pt)
3083
3083
tree
3084
3084
}
3085
+ else if (methPart(tree).symbol.isAllOf(Inline | Deferred ) && ! ctx.inInlineMethod) then
3086
+ errorTree(tree, i " Deferred inline ${methPart(tree).symbol.showLocated} cannot be invoked " )
3085
3087
else if (Inliner .isInlineable(tree) &&
3086
3088
! ctx.settings.YnoInline .value &&
3087
3089
! suppressInline) {
3088
3090
tree.tpe <:< wildApprox(pt)
3089
3091
val errorCount = ctx.reporter.errorCount
3090
3092
val meth = methPart(tree).symbol
3091
- if meth.is(Deferred ) then
3092
- errorTree(tree, i " Deferred inline ${meth.showLocated} cannot be invoked " )
3093
- else
3094
- val inlined = Inliner .inlineCall(tree)
3095
- if ((inlined ne tree) && errorCount == ctx.reporter.errorCount) readaptSimplified(inlined)
3096
- else inlined
3093
+ val inlined = Inliner .inlineCall(tree)
3094
+ if ((inlined ne tree) && errorCount == ctx.reporter.errorCount) readaptSimplified(inlined)
3095
+ else inlined
3097
3096
}
3098
3097
else if (tree.symbol.isScala2Macro &&
3099
3098
// raw and s are eliminated by the StringInterpolatorOpt phase
Original file line number Diff line number Diff line change
1
+ trait C :
2
+ inline def x : Int
3
+ inline val y : Int
4
+
5
+ def test : Unit =
6
+ val c : C = ???
7
+ c.x // error
8
+ c.y // error
Original file line number Diff line number Diff line change
1
+ trait C :
2
+ inline def x : Int
3
+ inline val y : Int
4
+
5
+ class C1 extends C :
6
+ inline val x = 1
7
+ inline val y = 2
8
+
9
+ class C2 extends C :
10
+ inline def x = 3
11
+ inline val y = 4
You can’t perform that action at this time.
0 commit comments