File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ object Applications {
102
102
103
103
if (unapplyName == nme.unapplySeq) {
104
104
if (unapplyResult derivesFrom defn.SeqClass ) seqSelector :: Nil
105
- else if (isGetMatch(unapplyResult, pos)) {
105
+ else if (isGetMatch(unapplyResult, pos) && getTp.derivesFrom(defn. SeqClass ) ) {
106
106
val seqArg = getTp.elemType.hiBound
107
107
if (seqArg.exists) args.map(Function .const(seqArg))
108
108
else fail
Original file line number Diff line number Diff line change
1
+ class SQ {
2
+ val isEmpty = false
3
+ val get = Array (1 )
4
+ }
5
+ object A {
6
+ def unapplySeq (a : Int ): SQ = new SQ
7
+ }
8
+
9
+ object Main {
10
+ def main (args : Array [String ]): Unit = {
11
+ val seq : Seq [Int ] = 2 match {
12
+ case A (xs : _* ) => xs // error // error
13
+ }
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments