Bug 323222 (MONO80534) - [GMCS] Inference of generic parameters fails
Summary: [GMCS] Inference of generic parameters fails
Status: RESOLVED FIXED
Alias: MONO80534
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Enhancement
Target Milestone: ---
Assignee: Raja R Harinath
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-17 01:56 UTC by David Mitchell
Modified: 2007-09-15 21:24 UTC (History)
0 users

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


Attachments
This source file will trigger the described bug (470 bytes, text/plain)
2007-01-17 01:57 UTC, Thomas Wiest
Details
This will fix the described bug (2.27 KB, patch)
2007-01-24 04:24 UTC, Thomas Wiest
Details | Diff

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


---- Reported by dmitchell@logos.com 2007-01-16 18:56:36 MST ----

Description of Problem:
The attached file has two functions. The first does nothing, but takes 
some generic parameters. The second function calls the first but does not 
explicitly provide the generic parameters. Microsoft's C# compiler 
correclty infers the parameter values, but gmcs reports error CS0411

Steps to reproduce the problem:
1. Download the attached source file
2. Attempt to compile it with the /target:library option

Actual Results:

With gmcs under Mono 1.2.2.1 - The second function results in a CS0411 
error.

With csc: Compilation completes successfully


Expected Results:
Compilation should complete successfully

How often does this happen? 
Always



---- Additional Comments From dmitchell@logos.com 2007-01-16 18:57:23 MST ----

Created an attachment (id=171286)
This source file will trigger the described bug




---- Additional Comments From dmitchell@logos.com 2007-01-23 20:40:13 MST ----

The problem seems to be in the file mcs/gmcs/generic.cs in the function static bool 
InferTypeArguments (Type[] param_types, Type[] arg_types, Type[] infered_types).

This function calls InferType for each parameter on the method, and if the call fails--for any 
reason--the call to InferTypeArguments will fail.

The problem with this is that InferType will fail if it unable to infer all of the generic 
parameters, even if subsequent method parameters might be able to correctly infer some of 
the missing parameters.

I hope to have a patch soon.



---- Additional Comments From dmitchell@logos.com 2007-01-23 21:24:40 MST ----

Created an attachment (id=171287)
This will fix the described bug




---- Additional Comments From dmitchell@logos.com 2007-01-23 21:26:56 MST ----

I've now attached a  patch that will fix the bug that is described here. However, the scope of 
my changes was very narrow, and I suspect that other generic parameter inference paths may 
be similarly affected. It might be a good idea to check this out sometime.



---- Additional Comments From dmitchell@logos.com 2007-01-25 12:45:24 MST ----

Sorry...I just edited the wrong bug...



---- Additional Comments From dmitchell@logos.com 2007-01-25 12:46:23 MST ----

Nevermind the last comment...I'm still getting used to how Bugzilla 
jumps between bugs when you edit one.



---- Additional Comments From rharinath@novell.com 2007-01-28 15:15:40 MST ----

Should be fixed in SVN r71817.

Thanks for tracking down the reason for the bug.  I've committed a
different patch that also fixes an erroneously classified testcase.

Imported an attachment (id=171286)
Imported an attachment (id=171287)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Also confirmed on Mac OS X</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".