Skip to content

Commit

Permalink
Don't do post checks in inlined code
Browse files Browse the repository at this point in the history
Capability references in inlined code might end up not being tracked or being redundant.
Don't flag this as an error.
  • Loading branch information
odersky committed Jul 14, 2024
1 parent 18778a4 commit 0d96406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/cc/Setup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:

/** Check well formed at post check time */
private def checkWellformedLater(parent: Type, ann: Tree, tpt: Tree)(using Context): Unit =
if !tpt.span.isZeroExtent then
if !tpt.span.isZeroExtent && enclosingInlineds.isEmpty then
todoAtPostCheck += (ctx1 =>
checkWellformedPost(parent, ann, tpt)(using ctx1.withOwner(ctx.owner)))

Expand Down
5 changes: 5 additions & 0 deletions tests/pos-custom-args/captures/inline-problem.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trait Listener[+T]

inline def consume[T](f: T => Unit): Listener[T]^{f} = ???

val consumePure = consume(_ => ())

0 comments on commit 0d96406

Please sign in to comment.