Skip to content

Commit e64564b

Browse files
authored
Merge pull request scala#6338 from joroKr21/glb-lub-typevar
Don't abort on glb/lub of TypeVar
2 parents 27335e1 + ac9c807 commit e64564b

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

src/reflect/scala/reflect/internal/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4669,7 +4669,7 @@ trait Types
46694669
case tv@TypeVar(_, constr) =>
46704670
if (tv.instValid) stripType(constr.inst)
46714671
else if (tv.untouchable) stripped += tv
4672-
else abort("trying to do lub/glb of typevar " + tv)
4672+
else {} // ignore when this happens (neg/t10514.scala) -- don't abort("trying to do lub/glb of typevar " + tv)
46734673
case tp => stripped += tp
46744674
}
46754675
ts foreach stripType

test/files/neg/t10514.check

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
t10514.scala:8: error: no type parameters for constructor Foo: (value: F[C[G[Foo[F,G]]]])Foo[F,G] exist so that it can be applied to arguments (Some[C[Foo[Option,Test.this.Id]]])
2+
--- because ---
3+
argument expression's type is not compatible with formal parameter type;
4+
found : Some[C[Foo[Option,Test.this.Id]]]
5+
required: ?F[C[?G[Foo[?F,?G]]]]
6+
new Foo(Some(new C(new Foo[Option, Id](None))))
7+
^
8+
t10514.scala:8: error: type mismatch;
9+
found : Some[C[Foo[Option,Test.this.Id]]]
10+
required: F[C[G[Foo[F,G]]]]
11+
new Foo(Some(new C(new Foo[Option, Id](None))))
12+
^
13+
two errors found

test/files/neg/t10514.flags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-language:higherKinds

test/files/neg/t10514.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// document status quo (used to crash, now just fails to infer)
2+
// to make this compile, explicitly provide type args
3+
class C[T](x: T)
4+
class Foo[F[_], G[_]](value: F[C[G[Foo[F, G]]]])
5+
6+
class Test {
7+
type Id[A] = A
8+
new Foo(Some(new C(new Foo[Option, Id](None))))
9+
}

0 commit comments

Comments
 (0)