Forums

generic class / generic method overloads

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

generic class / generic method overloads

Postby gauthier » Fri Jan 01, 2010 3:53 am

Happy new year!

I have problem linking such class from another assembly:

a.cobra
use System

class A<of T>
def foo(action as Action<of int>)
action(1)

def foo<of TResult>(functor as Func<of int, TResult?>) as TResult?
return functor(1)


b.cobra
class Program
def main is shared
a = A<of Program>()
a.foo(do(i as int))
print i
functor as Func<of int, DateTime>?
functor = do(i as int)
return DateTime.now.addDays(i)
print a.foo(functor)


compiling with
Code: Select all
cobra -t:lib -ref:System.Core.dll a.cobra -v
cobra -t:lib -ref:System.Core.dll -ref:a.dll b.cobra


failing with:

Code: Select all
C:\tmp\cobratickets>cobra -t:lib -ref:System.Core.dll a.cobra -v
Cobra Command Line 0.8.0 post-release
Copyright (C) 2003-2009 by Cobra Language LLC.

OS Version:   Microsoft Windows NT 5.1.2600 Service Pack 2
CLR Platform: .NET
CLR Version:  2.0.50727.3053
Current Directory: C:\tmp\cobratickets
Current Exe: C:\home\dev\bin\cobra-0.8.0-post\bin\cobra.exe
Option Dictionary:
    target: 'lib'
    reference: List<of String>['System.Core.dll']
    verbosity: 1
    back-end: 'none'
    contracts: 'inline'
    correct-source: Set<of String>['none']
    debugging-tips: true
    embed-run-time: false
    include-asserts: true
    include-nil-checks: true
    include-tests: true
    include-traces: true
    native-compiler: 'auto'
    number: 'decimal'
    testify-results: 'r-testify'
    compile: true
Paths:
    a.cobra
Phase: Binding Cobra run-time library
Adding reference to Cobra.Lang.dll
Phase: Reading libraries
Reading assembly:  mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
              at:  c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
Reading assembly:  System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
              at:  C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
Loading reference: System.Core.dll
Reading assembly:  System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
              at:  C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll
Loading reference: Cobra.Lang.dll
Reading assembly:  Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e
              at:  C:\WINDOWS\assembly\GAC_MSIL\Cobra.Lang\0.8.0.1__0a4783a5c7c9616e\Cobra.Lang.dll
Phase: Parsing source code
Phase: Binding use directives
Phase: Binding inheritance
Phase: Binding interface
Phase: Computing matching base members
Phase: Binding implementation
Phase: Identifying .main
Phase: Generating C# code
Phase: Compiling C# code
Compiling to produce a.dll
Deleting intermediate files.
Compilation succeeded

C:\tmp\cobratickets>cobra -t:lib -ref:System.Core.dll -ref:a.dll b.cobra
error: COBRA INTERNAL ERROR / FallThroughException / info=GenericParam-sh(12079, didBindInh=false, didBindInt=false, didBindImp=false, name=TResult)
Compilation failed - 1 error, 0 warnings
gauthier
 
Posts: 116

Re: generic class / generic method overloads

Postby Charles » Fri Jan 01, 2010 12:31 pm

I'll take a look.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: generic class / generic method overloads

Postby Charles » Fri Jan 01, 2010 9:18 pm

Fixed.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 51 guests