What steps will reproduce the problem?
1. hg clone ...
2. cd sprache
3. xbuild
What is the expected output? What do you see instead?
Build FAILED.
Errors:
/Users/jeffreymiller/Projects/sprache/Sprache.sln (default targets) ->
(Build target) ->
/Users/jeffreymiller/Projects/sprache/Sprache/Sprache.csproj (default targets)
->
/Library/Frameworks/Mono.framework/Versions/2.8.1/lib/mono/4.0/Microsoft.CSharp.
targets (CoreCompile target) ->
Parse.cs(430,64): error CS0266: Cannot implicitly convert type `Sprache.Parser<System.Collections.Generic.IEnumerable<T>>' to `Sprache.Parser<T>'. An explicit conversion exists (are you missing a cast?)
Parse.cs(430,64): error CS1662: Cannot convert `lambda expression' to delegate type `System.Func<System.Collections.Generic.IEnumerable<T>,Sprache.Parser<T>>' because some of the return types in the block are not implicitly convertible to the delegate return type
What version of the product are you using? On what operating system?
J-Scott-Millers-iMac:sprache jeffreymiller$ uname -a
Darwin J-Scott-Millers-iMac.local 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov
5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386 i386
J-Scott-Millers-iMac:sprache jeffreymiller$ mono --version
Mono JIT compiler version 2.8.1 (tarball Mon Nov 22 09:52:37 MST 2010)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: Thread + polling
Architecture: x86
Disabled: none
Misc: debugger softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC)
Please provide any additional information below.
It looks like this is a problem with Mono's generic type inference. I haven't
had a chance to come up with a simple repro case to confirm this, but I have
found that if the lambda declared within the Until parser extension method is
explicitly declared, all is well. The modified method looks like:
/// <summary>
/// Parse a sequence of items until a terminator is reached.
/// Returns the sequence, discarding the terminator.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="U"></typeparam>
/// <param name="parser"></param>
/// <param name="until"></param>
/// <returns></returns>
public static Parser<IEnumerable<T>> Until<T, U>(this Parser<T> parser, Parser<U> until)
{
//return parser.Except(until).Many().Then(r => until.Return(r));
Func<IEnumerable<T>, Parser<IEnumerable<T>>> returnFunc = r => until.Return(r);
return parser.Except(until).Many().Then(returnFunc);
}
Original issue reported on code.google.com by
j.scott....@gmail.comon 30 Dec 2010 at 6:27