Issue Details (XML | Word | Printable)

Key: BOO-1076
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Avishay Lavie
Reporter: Greg Nagel
Votes: 0
Watchers: 1
Operations

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

Generic methods of generic types not being recognized correctly.

Created: 28/Jul/08 01:38 PM   Updated: 22/Jan/09 09:22 AM   Resolved: 03/Oct/08 02:30 PM
Return to search
Component/s: None
Affects Version/s: 0.9
Fix Version/s: 0.9

Time Tracking:
Not Specified

Environment: Windows XP, under SVN 3028

Testcase included: yes


 Description  « Hide

C# Test dll

public class Test<T>
{
	public static void Bar<U>(U u)
	{
	}
}

public interface IFace
{
}

Boo program:

class A:
	pass

x as IFace = null
Test[of A].Bar(x)

If A is replaced with object, it runs without error.

Here's the error:

Unhandled Exception: System.BadImageFormatException: An attempt was made to load
a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at TestModule.Main(String[] argv)

I tried looking at it with reflector, but reflector gets a null reference error. Here's the main function in ildasm:

.method private hidebysig static void  Main(string[] argv) cil managed
{
  .entrypoint
  // Code size       14 (0xe)
  .maxstack  1
  .locals init ([0] class [testlib]IFace x)
  IL_0000:  ldnull
  IL_0001:  stloc.0
  IL_0002:  ldloc.0
  IL_0003:  unbox.any  !!0
  IL_0008:  call       void class [testlib]Test`1<class A>::Bar<!!0>(!!0)
  IL_000d:  ret
} // end of method TestModule::Main

Reflector raises an exception after the second ! in IL_0003: unbox.any !!0
Assigning x to an instance of IFace doesn't change anything.

When you change IFace to a class instead of an interface, it raises a compile error:
test.boo(5,15): BCE0017: Boo.Lang.Compiler.CompilerError: The best overload for
the method 'Test[of T][A].Bar' is not compatible with the argument list '(IFace)
'.

When you try to specify the parameters explicitly as either class or interface, it gives another error:
test.boo(5,15): BCE0138: Boo.Lang.Compiler.CompilerError: 'Test[of T][A].Bar' is
not a generic definition.



Avishay Lavie added a comment - 03/Oct/08 02:30 PM

Resolved in r3043.


Avishay Lavie made changes - 03/Oct/08 02:30 PM
Field Original Value New Value
Assignee Avishay Lavie [ avish ]
Resolution Fixed [ 1 ]
Fix Version/s 0.8.3 [ 13815 ]
Status Open [ 1 ] Resolved [ 5 ]
Rodrigo B. de Oliveira made changes - 22/Jan/09 09:22 AM
Affects Version/s 0.9 [ 13816 ]
Fix Version/s 0.8.3 [ 13815 ]
Fix Version/s 0.9 [ 13816 ]