Changeset 1745

Show
Ignore:
Timestamp:
11/07/08 21:49:39 (2 months ago)
Author:
Chuck.Esterbrook
Message:

Fixed: No warning for derived methods that are not marked "override" or "new" when the parameters differ by being nilable (String?) or not (String).
ticket:59

Location:
cobra/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • cobra/trunk/Developer/IntermediateReleaseNotes.text

    r1744 r1745  
    214214 
    215215* Fixed: The error message for fixed size array syntax (`int[10]`) is misleading and uninformative. ticket:27 
     216 
     217* Fixed: No warning for derived methods that are not marked "override" or "new" when the parameters differ by being nilable (String?) or not (String). ticket:59 
  • cobra/trunk/Source/Members.cobra

    r1731 r1745  
    278278                if params.count <> otherParams.count 
    279279                        return false 
    280                 for i = 0 .. params.count 
    281                         if params[i].type <> otherParams[i].type 
     280                for i in params.count 
     281                        if not _matchesForOverride(params[i].type, otherParams[i].type) 
    282282                                return false 
    283283                return true 
     284 
     285        def _matchesForOverride(a as IType, b as IType) as bool 
     286                if a == b 
     287                        return true 
     288                if (a inherits NilableType) <> (b inherits NilableType) 
     289                        if a inherits NilableType, a = a.theWrappedType 
     290                        if b inherits NilableType, b = b.theWrappedType 
     291                        return a == b 
     292                return false 
    284293 
    285294 
  • cobra/trunk/Tests/120-classes/720-override/110-error-for-no-override-of-overload.cobra

    r1177 r1745  
    1 # .error. must specify 
     1class Top 
    22 
    3 class Top 
    43        def foo(i as int) 
    54                pass 
     5 
    66        def foo(i as int, j as int) 
    77                pass 
    88 
     9        def equals(other as Object) as bool  # .error. Member "equals" also exists in the base class. You must specify 
     10                # ^ Missing ? on Object 
     11                return this is other 
     12 
     13 
    914class Bottom 
    1015        inherits Top 
    11         def foo(i as int)  # <--  should be error for no "is override", new or base 
     16 
     17        def foo(i as int)  # .error. must specify 
    1218                pass 
     19 
    1320        def main is shared 
    1421                pass