diff options
author | liu fengyun <liu@fengy.me> | 2017-03-14 09:45:27 +0100 |
---|---|---|
committer | liu fengyun <liu@fengy.me> | 2017-03-14 09:46:25 +0100 |
commit | f4ad5357ffeb4b90777f73e4f1e32cbacbebd33c (patch) | |
tree | 0fcb8372af52b2ebf6144889fd7bfe4be3d2cb77 /compiler | |
parent | 921f8bffc18b19449b2c1ad68c32725a7b7532e2 (diff) | |
download | dotty-f4ad5357ffeb4b90777f73e4f1e32cbacbebd33c.tar.gz dotty-f4ad5357ffeb4b90777f73e4f1e32cbacbebd33c.tar.bz2 dotty-f4ad5357ffeb4b90777f73e4f1e32cbacbebd33c.zip |
fix #2051: allow override T with => T or ()T
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/src/dotty/tools/dotc/core/Types.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index 639f5d142..271dcda7c 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -727,8 +727,8 @@ object Types { /** Is this type a legal type for a member that overrides another * member of type `that`? This is the same as `<:<`, except that - * the types ()T and => T are identified, and T is seen as overriding - * either type. + * the types `()T`, `=> T` and `T` are seen as overriding + * each other. */ final def overrides(that: Type)(implicit ctx: Context) = { def result(tp: Type): Type = tp match { @@ -737,7 +737,8 @@ object Types { } (this frozen_<:< that) || { val rthat = result(that) - (rthat ne that) && (result(this) frozen_<:< rthat) + val rthis = result(this) + (rthat.ne(that) || rthis.ne(this)) && (rthis frozen_<:< rthat) } } |