Skip to content

Commit f8e4ed3

Browse files
Merge pull request #8482 from dotty-staging/fix-8357
Fix #8357: add test
2 parents 32b35ec + e15c605 commit f8e4ed3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/pos/i8357.scala

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
trait FieldInfo {
2+
val fieldType: ALL_TYPE
3+
}
4+
5+
opaque type TypeSymbol = String
6+
7+
trait ConcreteType {
8+
val name: String
9+
val typeParameters: List[TypeSymbol]
10+
val isUnion: Boolean = false
11+
}
12+
13+
trait UnionContainer {
14+
val hasUnion: Boolean
15+
}
16+
17+
type ALL_TYPE = ConcreteType | TypeSymbol
18+
19+
case class StaticUnionInfo(name: String, typeParameters: List[TypeSymbol]) extends ConcreteType
20+
case class AliasInfo(name: String, typeParameters: List[TypeSymbol]) extends ConcreteType
21+
22+
object UnionKind {
23+
def unapply(f: FieldInfo): Boolean =
24+
f.fieldType match {
25+
case _: StaticUnionInfo => true
26+
case t: AliasInfo if t.isUnion => true
27+
case t: UnionContainer if t.hasUnion => true // this line here causes crash
28+
case _ => false
29+
}
30+
}

0 commit comments

Comments
 (0)