Ticket #291 (new defect)

Opened 7 years ago

Last modified 7 years ago

lambda and object initialization compiler error

Reported by: jaegs Owned by:
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:


This example comes from DefaultDictionary?.cobra

This compiles

factory as Func<of int> = do = 5
dd = DefaultDictionary<of int, int>(factory, willRecordDefaults = false)

This doesn't

dd = DefaultDictionary<of int, int>(do = 5, willRecordDefaults = false)
DefaultDictionary.cobra(112): error: Cannot convert "anonymous method" to non-delegate type "object"
DefaultDictionary.cobra(112): error: The best overloaded method match for "Cobra.CoreX.TestDefaultDictionary._ch_ext_init_6222(object, bool)" has some invalid arguments
DefaultDictionary.cobra(112): error: Argument "#1" cannot convert "anonymous method" expression to type "object"
DefaultDictionary.cobra(58): error: The best overloaded method match for "Cobra.CoreX.DefaultDictionary<int,int>.DefaultDictionary(System.Func<int>)" has some invalid arguments

Cobra svn:2771 (post 0.8) / 2012-08-05 on Mono 2.10.9 CLR v4.0.30319 on Mac OS X 10.6.8

Change History

Changed 7 years ago by Charles

I've seen this before. It has to do with the fact that Cobra introduced lambdas for earlier versions on .NET that didn't have them (.NET 2.0). This will be post 0.9.

Note: See TracTickets for help on using tickets.