blitz-foundation / monkey2

zlib License
3 stars 0 forks source link

Error : FuncList.FindFunc() Internal Error #42

Open Pharmhaus-2 opened 5 years ago

Pharmhaus-2 commented 5 years ago

Original Author: engor

See demo app below.

Namespace myapp

#Import "<std>"

Using std..

Function Main()

    Local stack:=New Stack<String>

    Local compare:=Lambda:Bool( i1:Int,i2:String )
        Return Int(i2)=i1
    End

    ' 1. compile error
    stack.Sort( compare )
    ' 2. compile error
    stack.Sort<String>( compare,"" )
    ' 3. works (the name is different)
    stack.Sort2( compare )

End

Class Stack<T> Extension

    ' I want to compare different types, why not
    ' like a compare wrapper with its internal walue

    Method Sort<V>( compareFunc:Bool( v:V,t:T ) )

        ' custom sorting is here
        For Local v:=Eachin Self

        Next
    End

    ' try to change method signature by additional parameter
    ' error is still here

    Method Sort<V>( compareFunc:Bool( v:V,t:T ),someVar:V )

        ' custom sorting is here
        For Local v:=Eachin Self

        Next
    End

    Method Sort2<V>( compareFunc:Bool( v:V,t:T ) )

        ' custom sorting is here
        For Local v:=Eachin Self

        Next
    End

End