[jira] Created: (BOO-1340) Invoking a closure on a method inside a generic type causes Bad IL and BadImageFormatException

Invoking a closure on a method inside a generic type causes Bad IL and BadImageFormatException
----------------------------------------------------------------------------------------------

                 Key: BOO-1340
                 URL: https://jira.codehaus.org/browse/BOO-1340
             Project: Boo
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 0.9.4
         Environment: .net 3.5 and 4.0
            Reporter: Giovanni Bassi
            Priority: Minor

Attempting to call a regular method which references a generic parameter from it's type fails if you try to
pass a closure referencing the generic type.

{code:title=fails.boo|borderStyle=solid}
class Entity: 
	public Prop as string

class Repository[of T(Entity)]:
	def Get(p):
		Where({ p | p.Prop == p})
	def Where(predicate as System.Func[of T, bool]):
		pass
{code}

If you use a closure on an object where the generic parameter is already defined, it doesn't fail. This will pass:

{code:title=works.boo|borderStyle=solid}
(Continue reading)

[jira] (BOO-1340) Invoking a closure on a method inside a generic type causes Bad IL and BadImageFormatException


    [
https://jira.codehaus.org/browse/BOO-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=293437#comment-293437
] 

Maksym Trushyn commented on BOO-1340:
-------------------------------------

I tested the similar scenario after applying my patch (https://github.com/bamboo/boo/pull/18)
The following scenario worked for me:

"""
True
False
"""
import System
import System.Collections.Generic
import System.Linq.Enumerable

class Entity: 
	public Prop as string

class Repository[of T(Entity)]:
	def Get(p):
		Where({ p | p.Prop == "333"})
	def Where(predicate as System.Func[of T, bool]):
		print predicate(Entity(Prop:"333"))
		print predicate(Entity(Prop:"444"))

Repository of Entity().Get(Entity())
(Continue reading)


Gmane