Skip to content

Commit 70192c0

Browse files
committed
Hash-cons CompactAnnotations
1 parent b4a64df commit 70192c0

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/core/Annotations.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ object Annotations {
198198

199199
override def refersToParamOf(tl: TermLambda)(using Context): Boolean =
200200
refersToLambdaParam(tp, tl)
201+
202+
override def hash: Int = tp.hash
203+
override def eql(that: Annotation) = that match
204+
case that: CompactAnnotation => this.tp `eql` that.tp
205+
case _ => false
201206
end CompactAnnotation
202207

203208
/** Sanitize @retains arguments to approximate illegal types that could cause a compilation

tests/neg-custom-args/captures/spread-problem.check

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
11 | race(src1, src2) // error
88
| ^^^^^^^^^^
99
| Found: (Source[T]^, Source[T]^)
10-
| Required: Seq[Source[T]^{C}]
11-
|
12-
| where: C is a type variable with constraint >: scala.caps.CapSet and <: scala.caps.CapSet^
10+
| Required: Seq[Source[T]^]
1311
|
1412
| longer explanation available when compiling with `-explain`

0 commit comments

Comments
 (0)