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

Key: BOO-864
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Spruce Weber
Votes: 0
Watchers: 0
Operations

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

Error implementing interface inheriting interface implemented by base class

Created: 22/Aug/07 10:27 AM   Updated: 21/Mar/08 07:08 AM
Component/s: Compiler
Affects Version/s: 0.7.8
Fix Version/s: 0.8.2

Time Tracking:
Not Specified

File Attachments: 1. Text File BindBaseTypes.cs.patch (2 kb)
2. Zip Archive InterfaceTest.zip (9 kb)
3. Text File ProcessInheritedAbstractMembers.cs.patch (0.6 kb)

Environment: CLR v2.0.50727.42


 Description  « Hide
Error BCE0071: Inheritance cycle detected: 'IFoo' is caused by the following code...

public interface IFoo:
pass

public interface IBar(IFoo):
pass

public class BaseFoo(IFoo):
pass

public class MyFoo(BaseFoo, IBar):
pass



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Spruce Weber - 22/Aug/07 02:40 PM
This attachment provides a VS2005 solution that is a more complete example than in the issue description.

It fails to compile with the following error:

Error BCE0055: Internal compiler error: Object reference not set to an
instance of an object..

This error occurs within the ProcessInheritedAbstractMembers step.


Spruce Weber - 05/Mar/08 01:05 PM
BindBaseTypes.cs.patch fixes this issue.
ProcessInheritedAbstractMembers.cs.patch fixes a closely-related issue.

All previous passing

BindBaseTypes.ResolveBaseTypes previously grouped all base types (classes and interfaces) into one visited list. This can result in an interface being visited twice in certain situations such as in this issue's test case. The patch modifies this method to distinguish between classes and interfaces and places them into two separate visited lists. Inheritance cycles will still be detected for both classes and interfaces.

Another issue is so closely related that I'm placing the fix for it here also. In the test case if IFoo and BaseFoo have an Event defined and are referenced from an assembly compiled from C#, the following exception occurs...

Entering Boo.Lang.Compiler.Steps.ProcessInheritedAbstractMembers
test.boo(11,11): node 'IBar' mark visited.
test.boo(14,7): node 'MyFoo' mark visited.
test.boo(14,7): Internal compiler error on node 'MyFoo': System.NullReferenceException: Object reference not set to an instance of an object.
at Boo.Lang.Compiler.Steps.ProcessInheritedAbstractMembers.CheckInheritedEventImpl(IEvent impl, IEvent target)
at Boo.Lang.Compiler.Steps.ProcessInheritedAbstractMembers.CheckInheritsInterfaceImplementation(ClassDefinition node, IEntity entity)
at Boo.Lang.Compiler.Steps.ProcessInheritedAbstractMembers.ResolveAbstractEvent(ClassDefinition node, TypeReference baseTypeRef, IEvent entity)
...

The problem is that C# gives an Event and its corresponding MulticastDelegate field identical names. Having members with identical names is not taken into account in ProcessInheritedAbstractMembers.CheckInheritsInterfaceImplementation which loops through an external type's members and replaces any ExternalEvents with their identically-named ExternalField. The patch modifies this method to not replace an ExternalEvent with an ExternalField of a type descending from MulticastDelegate.


Spruce Weber - 12/Mar/08 02:38 PM
This version contains only those parts of the file actually changed.

Rodrigo B. de Oliveira - 21/Mar/08 07:08 AM
Patch applied. Thanks!