History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-691
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Andy Bulka
Votes: 0
Watchers: 0
Operations

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

A class that implements an interface cannot rely on inherited methods?

Created: 08/Mar/06 05:53 PM   Updated: 07/May/07 06:29 AM
Component/s: Compiler
Affects Version/s: 0.7.5, 0.7.6
Fix Version/s: 0.7.7

Time Tracking:
Not Specified

File Attachments: 1. Text File boo-691.patch (30 kb)

Environment: Windows XP
Issue Links:
Related
 


 Description  « Hide
It seems that a class that implements an interface cannot rely on
inherited methods to have implemented some of the methods already.

Boo insists that all the methods are declared and implemented in the
actual class which implements the interface. Whereas C# (and common
sense?) says that if a class inherits from a class that already
implements all the methods, then the contract is satisfied.

The example below fails to instantiate B, the error message is about B not implementing an interface etc.

In either case, though, its just wrong to say that class B doesn't
implement IDo.
----------------------------------
import System

interface IDo:
def Do1()
def Do2()

class A:
def Do1():
pass

class B(A, IDo):
#def Do1(): # Shouldn't need to implement again since

  1. pass # Class B inherits Do1() from class A
    def Do2():
    pass

b = B() # FAILS since B doesn't implement Do1()
----------------------------------

See Google thread
http://groups.google.com/group/boolang/browse_thread/thread/a9446572632cea8d?hl=en

Doug H confirms this bug.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Andy Bulka - 08/Mar/06 05:55 PM
P.S. The error message referred to above, happens to be

BCW0001: WARNING: Type 'B' does not provide an implementation for 'IDo.Do1()' and will be marked abstract
BCE0085: Boo.Lang.Compiler.CompilerError: Cannot create instance of abstract class 'B'.


Arron Washington - 17/May/06 10:49 PM
Oh boy, I'm sure glad my JIRA session timed out /before/ I uploaded the patch!

This patch fixes the issue described in this post and the one at http://groups.google.com/group/boolang/browse_frm/thread/4592cc6aa086f4bd/9a111a4d5d4b9a93#9a111a4d5d4b9a93 and however many other reported issues.

Due to the... unique way this particular pipeline step was coded, the patch has two 'parts' – one part that scans for inherited implementations from external classes (other assemblies etc). These are the methods that start with 'CheckInh...'

The other, to deal with inherited implementations written in Boo, just recursively walks up the basetype hierarchy until it finds what it wants or can't climb any farther up.

It would be nice if someone with a big Boo project patched their copy with this patch and made sure nothing exploded before it gets into SVN, if ever.


Arron Washington - 28/May/06 12:19 PM
Fixed in 2255