Bug 323931 (MONO81250) - [GMCS] Type inference wrt. params
Summary: [GMCS] Type inference wrt. params
Status: RESOLVED FIXED
Alias: MONO81250
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Martin Baulig
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-28 13:47 UTC by Marek Habersack
Modified: 2007-09-15 21:24 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
test.cs (402 bytes, text/plain)
2007-03-28 13:48 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:33:52 UTC


---- Reported by mhabersack@novell.com 2007-03-28 06:47:20 MST ----

The code in the test case attached to this bug fails to compile on Mono,
compiles fine on MS.NET. Tested with svn head.



---- Additional Comments From mhabersack@novell.com 2007-03-28 06:48:25 MST ----

Created an attachment (id=171716)
test.cs




---- Additional Comments From mhabersack@novell.com 2007-03-28 10:04:55 MST ----

MS.NET seems to infer the method's T type from the method parameters
which use T. E.g. if in the attached test case List<string> would be
replaced with List<MyClass>, MS.NET would instantiate the TestMethod
with <MyClass>:

IL_0000:  nop 
        IL_0001:  newobj instance void class App/MyClass::.ctor()
        IL_0006:  stloc.0 
        IL_0007:  newobj instance void class
[mscorlib]System.Collections.Generic.List`1<class App/MyClass>::.ctor()
        IL_000c:  stloc.1 
        IL_000d:  ldstr "Some format {0}"
        IL_0012:  ldloc.1 
        IL_0013:  ldc.i4.1 
        IL_0014:  newarr App/MyClass
        IL_0019:  stloc.2 
        IL_001a:  ldloc.2 
        IL_001b:  ldc.i4.0 
        IL_001c:  ldloc.0 
        IL_001d:  stelem.ref 
        IL_001e:  ldloc.2 
        IL_001f:  call void class App::TestMethod<class App/MyClass>
(string, class [mscorlib]System.Collections.Generic.List`1<!!0>, clas
s App/MyClass[])
        IL_0024:  nop 
        IL_0025:  ret 




---- Additional Comments From martin@ximian.com 2007-04-10 14:05:41 MST ----

-> me and assi



---- Additional Comments From martin@ximian.com 2007-04-10 14:05:58 MST ----

.



---- Additional Comments From martin@ximian.com 2007-04-11 06:59:46 MST ----

Fixed in SVN; added gtest-328.cs.

Imported an attachment (id=171716)

Unknown operating system unknown. Setting to default OS "Other".