Skip to content

Commit 7e64195

Browse files
committed
merged type re declared warning: ccb3aba
1 parent 634337b commit 7e64195

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/org/mirah/typer/assignable_type_future.mirah

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ class AssignableTypeFuture < BaseTypeFuture
5353
self:TypeFuture
5454
else
5555
earlier_declarations = declarations.keySet.map{ |future: TypeFuture| future.resolve }
56+
# TODO string comparison here is not the right call. ResolvedTypes should have good equals impls.
57+
if earlier_declarations.all? { |r: ResolvedType| r.toString == type.resolve.toString }
58+
first_type = @declarations.values.iterator.next
59+
@@log.warning("Type redeclared with same type: #{earlier_declarations}. Use first type: #{first_type}")
60+
return first_type:TypeFuture
61+
end
5662
msg = "Type redeclared as #{type.resolve} from #{earlier_declarations}"
5763
@@log.finest(msg)
5864
declared_type_error = ErrorType.new([[msg, position], ['First declared', self.position]])

0 commit comments

Comments
 (0)