From bb43b1644be419ee9fc783e8eafd68c20bf28d8e Mon Sep 17 00:00:00 2001 From: Ary Borenszweig <aborenszweig@manas.com.ar> Date: Thu, 14 Feb 2013 18:32:51 -0300 Subject: [PATCH] Dispatch if scope has restricted defs (or any of it's parents) --- lib/crystal/type_inference/call.rb | 2 +- lib/crystal/types.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/crystal/type_inference/call.rb b/lib/crystal/type_inference/call.rb index b088182a95..a70ccf6f5f 100644 --- a/lib/crystal/type_inference/call.rb +++ b/lib/crystal/type_inference/call.rb @@ -21,7 +21,7 @@ module Crystal return if @types_signature == types_signature @types_signature = types_signature - if has_unions_in_obj? || (obj && obj.type.has_restricted_defs?(name) && has_unions_in_args?) + if has_unions_in_obj? || (obj && obj.type.has_restricted_defs?(name) && has_unions_in_args?) || (scope && scope.has_restricted_defs?(name) && has_unions_in_args?) compute_dispatch return end diff --git a/lib/crystal/types.rb b/lib/crystal/types.rb index 55ded77e54..7d06632f8f 100644 --- a/lib/crystal/types.rb +++ b/lib/crystal/types.rb @@ -171,7 +171,7 @@ module Crystal def has_restricted_defs?(name) defs = @defs[name] - defs && defs.keys.any? { |ary| ary[0].any? } + (defs && defs.keys.any? { |ary| ary[0].any? }) || (parents && parents.any? { |p| p.has_restricted_defs?(name) }) end end -- GitLab