Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Drop retained elements and keep the annotation
  • Loading branch information
Linyxus committed Apr 9, 2024
commit 98cbe060bc5cdaf241ebb26fbb57ccf2e94d50c3
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/cc/CaptureOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ extension (tp: AnnotatedType)
class CleanupRetains(using Context) extends TypeMap:
def apply(tp: Type): Type =
tp match
case RetainingType(tp, _) => tp
case AnnotatedType(tp, annot) if annot.symbol == defn.RetainsAnnot || annot.symbol == defn.RetainsByNameAnnot =>
RetainingType(tp, Nil, byName = annot.symbol == defn.RetainsByNameAnnot)
case _ => mapOver(tp)

/** An extractor for `caps.reachCapability(ref)`, which is used to express a reach
Expand Down
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 @@ -454,7 +454,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
case _ => false

def signatureChanges =
(tree.tpt.hasRememberedType || tree.tpt.isInstanceOf[InferredTypeTree]) && !sym.isConstructor || paramSignatureChanges
tree.tpt.hasRememberedType && !sym.isConstructor || paramSignatureChanges

// Replace an existing symbol info with inferred types where capture sets of
// TypeParamRefs and TermParamRefs put in correspondence by BiTypeMaps with the
Expand Down
2 changes: 1 addition & 1 deletion tests/neg-custom-args/captures/byname.check
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| Found: (x$0: Int) ->{cap2} Int
| Required: (x$0: Int) -> Int
|
| Note that the expected type Int -> Int
| Note that the expected type Int ->{} Int
| is the previously inferred result type of method test
| which is also the type seen in separately compiled sources.
| The new inferred type (x$0: Int) ->{cap2} Int
Expand Down