Bug 13969 - mcs fails to infer some sort of delegate types
Summary: mcs fails to infer some sort of delegate types
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-08-14 08:57 UTC by Atsushi Eno
Modified: 2013-08-15 05:04 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Atsushi Eno 2013-08-14 08:57:09 UTC
I will try if I can create a simpler repro here, but so far mcs fails to compile this project (only desktop version matters), due to insufficient type inference (or something that looks like it):
https://github.com/linerlock/parseq/

	Combinator.cs(67,66): error CS0411: The type arguments for method `Parseq.Combinator.Lazy<TToken,TResult>(this System.Func<Parseq.Parser<TToken,TResult>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
	Combinator.cs(67,52): error CS0411: The type arguments for method `Parseq.Combinator.Or<TToken,TResult>(this Parseq.Parser<TToken,TResult>, Parseq.Parser<TToken,TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
	CpsExtensions.cs(48,84): error CS0411: The type arguments for method `Parseq.CpsExtensions.SelectMany<TResult,T,U>(this Parseq.Cps<TResult,T>, System.Func<T,Parseq.Cps<TResult,U>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
	CpsExtensions.cs(48,56): error CS1594: Delegate `System.Func<T,Parseq.Cps<TResult,U>>' has some invalid arguments
	CpsExtensions.cs(48,65): error CS1503: Argument `#1' cannot convert `System.Collections.Generic.IEnumerable<T>' expression to type `T'
	CpsExtensions.cs(48,50): error CS0411: The type arguments for method `Parseq.Foldable.Foldl<T,U>(this System.Collections.Generic.IEnumerable<T>, U, System.Func<U,T,U>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
	CpsExtensions.cs(61,21): error CS0411: The type arguments for method `Parseq.Cps.For<TResult,T,U>(this System.Collections.Generic.IEnumerable<T>, System.Func<T,Parseq.Cps<TResult,U>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
	CpsExtensions.cs(116,25): error CS0411: The type arguments for method `Parseq.CpsExtensions.SelectMany<TResult,T,U>(this Parseq.Cps<TResult,T>, System.Func<T,Parseq.Cps<TResult,U>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
	StreamExtensions.cs(64,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<T,U>)' and `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,U>)'
	StreamExtensions.cs(69,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<T,U>)' and `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,U>)'
	StreamExtensions.cs(88,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<T,Parseq.IStream<U>>)' and `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,Parseq.IStream<U>>)'
	StreamExtensions.cs(93,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<T,Parseq.IStream<U>>)' and `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,Parseq.IStream<U>>)'

(I'm also not sure if the code is compliant to C# language specification either.)
Comment 1 Marek Safar 2013-08-14 10:54:37 UTC
I can reproduce it with small test case
Comment 2 Marek Safar 2013-08-14 15:53:52 UTC
Fixed in master
Comment 3 Atsushi Eno 2013-08-15 00:46:09 UTC
Cool, thanks Marek, but there still seems to be some similar delegate variance check mismatch. I get 4 compile errors in the original project:

	StreamExtensions.cs(64,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<T,U>)' and `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,U>)'
	StreamExtensions.cs(69,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<T,U>)' and `Parseq.StreamExtensions.Select<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,U>)'
	StreamExtensions.cs(88,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<T,Parseq.IStream<U>>)' and `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,Parseq.IStream<U>>)'
	StreamExtensions.cs(93,27): error CS0121: The call is ambiguous between the following methods or properties: `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<T,Parseq.IStream<U>>)' and `Parseq.StreamExtensions.SelectMany<T,U>(this Parseq.IStream<T>, System.Func<Parseq.IStream<T>,Parseq.IStream<U>>)'
Comment 4 Marek Safar 2013-08-15 03:14:13 UTC
Yeah, I am on it. It's different issue thought.
Comment 5 Marek Safar 2013-08-15 05:04:13 UTC
Fixed in master too.