diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-02-18 18:44:00 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-02-18 18:54:54 +0100 |
commit | 48cd10159573150ed41c86d45c259cf6ad1a0c8e (patch) | |
tree | 04728f51325eef76743db0477617731acfdc73cc /src/dotty | |
parent | 4be70a5a8469c1355c84bef70936a81f899a9678 (diff) | |
download | dotty-48cd10159573150ed41c86d45c259cf6ad1a0c8e.tar.gz dotty-48cd10159573150ed41c86d45c259cf6ad1a0c8e.tar.bz2 dotty-48cd10159573150ed41c86d45c259cf6ad1a0c8e.zip |
ProtoTypes#wildApprox: fix LazyRef approximation
Before this commit, the output of `wildApprox(A)` where `A <: Sys[LazyRef(A)]` was
`? <: Sys[LazyRef(() => wildApprox(A))]`. This lead to infinite
subtyping checks.
This is fixed by always approximating a LazyRef by an unbounded
wildcard. Since we only create LazyRefs when we encounter a cycle, this
should be safe.
Fix #1103.
Diffstat (limited to 'src/dotty')
-rw-r--r-- | src/dotty/tools/dotc/typer/ProtoTypes.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala index 8a758bcc8..7997d1cf4 100644 --- a/src/dotty/tools/dotc/typer/ProtoTypes.scala +++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala @@ -420,6 +420,8 @@ object ProtoTypes { WildcardType(tp1a.bounds | tp2a.bounds) else tp.derivedOrType(tp1a, tp2a) + case tp: LazyRef => + WildcardType case tp: SelectionProto => tp.derivedSelectionProto(tp.name, wildApprox(tp.memberProto), NoViewsAllowed) case tp: ViewProto => |