Skip to content

Commit 1717ed7

Browse files
committed
Test case 16338
1 parent 76130f5 commit 1717ed7

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/pos/i16338.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package de.sciss.kollflitz
2+
3+
import scala.collection.*
4+
5+
type Tagged[U] = { type Tag = U }
6+
type @@ [+T, U] = T with Tagged[U]
7+
private val anyTagger = new Tagger[Any]
8+
final class Tagger[U] private[kollflitz] {
9+
def apply[T](t : T): T @@ U = t.asInstanceOf[T @@ U]
10+
}
11+
def tag[U]: Tagger[U] = anyTagger.asInstanceOf[Tagger[U]]
12+
13+
sealed trait Sorted
14+
15+
16+
/** Enrichment methods for random access collections. */
17+
implicit final class KollFlitzSortedIndexedSeq[A, CC[_], Repr](val self: SeqOps[A, CC, Repr] @@ Sorted)
18+
extends AnyVal {
19+
20+
/** Nearest percentile (rounded index, no interpolation). */
21+
def percentile(n: Int): A = self((self.size * n - 50) / 100)
22+
23+
/** Median found by rounding the index (no interpolation). */
24+
def median: A = percentile(50)
25+
}

0 commit comments

Comments
 (0)