Issue Details (XML | Word | Printable)

Key: BOO-989
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Cedric Vivier
Reporter: Marcus Griep
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Possibly suggest alternative when a function marked with 'override' doesn't override anything

Created: 09/Apr/08 10:59 AM   Updated: 25/Jan/09 03:16 PM   Resolved: 25/Jan/09 03:16 PM
Return to search
Component/s: Compiler
Affects Version/s: 0.8.1
Fix Version/s: 0.9

Time Tracking:
Not Specified


 Description  « Hide

Take, for example, this general class:

class Demonstrative:
  override def GetHasCode():
    return 1

Here, the likely intended override GetHashCode() is not overriden, but an error is produced about the GetHasCode() method. In another example, interfaces do not require overrides, so this will also generate a warning/error:

class Illistrative(IDisposable):
  override def Dispose():
    pass

In both cases, an error is generated, but no suggestion as to fixes are given. Possibly use Cedric's soundex method to suggest the intended override if one exists (perhaps) in first case, and in second case, note that an interface requires the Dispose() method and give explanation 'If you intended to implement 'IDisposable.Dispose()', remove the override keyword.', or be tolerant to the override keyword in this case.



Marcus Griep made changes - 09/Apr/08 11:18 AM
Field Original Value New Value
Description Take, for example, this general class:

{code}
class Demonstrative:
  override def GetHasCode():
    return 1
{code}

Here, the likely intended override {{GetHashCode}} is not overriden, but no warning/error is produced about the {{GetHasCode}} method. In another example, interfaces do not require overrides, so this should also generate a warning/error:

{code}
class Illistrative(IDisposable):
  override def Dispose():
    pass
{code}

In both cases, a warning (minimum) should be generated, and possibly use Cedric's soundex method to suggest the intended override if one exists (perhaps).
Take, for example, this general class:

{code}
class Demonstrative:
  override def GetHasCode():
    return 1
{code}

Here, the likely intended override {{GetHashCode()}} is not overriden, but an error is produced about the {{GetHasCode()}} method. In another example, interfaces do not require overrides, so this will also generate a warning/error:

{code}
class Illistrative(IDisposable):
  override def Dispose():
    pass
{code}

In both cases, an error is generated, but no suggestion as to fixes are given. Possibly use Cedric's soundex method to suggest the intended override if one exists (perhaps) in first case, and in second case, note that an interface requires the {{Dispose()}} method and give explanation 'If you intended to implement 'IDisposable.Dispose()', remove the override keyword.', or be tolerant to the override keyword in this case.
Summary Issue a warning when a function marked with 'override' doesn't override anything Possibly suggest alternative when a function marked with 'override' doesn't override anything
Cedric Vivier made changes - 16/Jan/09 09:18 PM
Assignee Cedric Vivier [ cedricv ]
Rodrigo B. de Oliveira made changes - 22/Jan/09 09:24 AM
Fix Version/s 0.9 [ 13816 ]
Fix Version/s 0.9.1 [ 14922 ]
Cedric Vivier made changes - 23/Jan/09 10:52 PM
Status Open [ 1 ] In Progress [ 3 ]
Cedric Vivier made changes - 23/Jan/09 10:53 PM
Fix Version/s 0.9.1 [ 14922 ]
Fix Version/s 0.9 [ 13816 ]
Component/s Compiler [ 10940 ]
Rodrigo B. de Oliveira made changes - 24/Jan/09 07:31 AM
Fix Version/s 0.9 [ 13816 ]
Fix Version/s 0.9.1 [ 14922 ]
Cedric Vivier added a comment - 25/Jan/09 03:16 PM

Landed in rev. 3192


Cedric Vivier made changes - 25/Jan/09 03:16 PM
Resolution Fixed [ 1 ]
Fix Version/s 0.9.1 [ 14922 ]
Fix Version/s 0.9 [ 13816 ]
Status In Progress [ 3 ] Resolved [ 5 ]