This project is read-only.
1

Resolved

Expression-bodied members compilation exception

description

Changes in latest 'master' branch (from e9a5f14e7e94 to 51afdccc4aed) broke compilation of this code:
using System;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;

public interface I<T> {
    T Execute();
}

public static class TestExtension {
    public static I<U> Select<T, U>(this I<T> origin, Func<T, U> selector) => null;
    
    public static TaskAwaiter<T> GetAwaiter<T>(this I<T> instance) =>
        Task.Run(() => instance.Execute()).GetAwaiter();
}

public class Test {
    public async Task Run(I<int> derived) {
        var result = await from value in derived 
                           select value; 
    }
} 
With exception:
Unexpected value 'ArrowExpressionClause' of type 'Microsoft.CodeAnalysis.CSharp.SyntaxKind'

Stack trace: 
   at Microsoft.CodeAnalysis.CSharp.LambdaFrame.AssertIsLambdaScopeSyntax(CSharpSyntaxNode syntax) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Lowering\LambdaRewriter\LambdaFrame.cs:line 109
   at Microsoft.CodeAnalysis.CSharp.LambdaFrame..ctor(TypeCompilationState compilationState, MethodSymbol topLevelMethod, CSharpSyntaxNode scopeSyntax) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Lowering\LambdaRewriter\LambdaFrame.cs:line 24
   at Microsoft.CodeAnalysis.CSharp.LambdaRewriter.MakeFrames() in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Lowering\LambdaRewriter\LambdaRewriter.cs:line 246
   at Microsoft.CodeAnalysis.CSharp.LambdaRewriter.Rewrite(BoundStatement node, NamedTypeSymbol thisType, ParameterSymbol thisParameter, MethodSymbol method, TypeCompilationState compilationState, DiagnosticBag diagnostics, Analysis analysis, Boolean assignLocals) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Lowering\LambdaRewriter\LambdaRewriter.cs:line 184
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.LowerBodyOrInitializer(MethodSymbol method, BoundStatement body, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState, DiagnosticBag diagnostics, NamedTypeSymbol& stateMachineTypeOpt, VariableSlotAllocator& variableSlotAllocatorOpt) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 1148
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethod(MethodSymbol methodSymbol, ProcessedFieldInitializers& processedInitializers, SynthesizedSubmissionFields previousSubmissionFields, TypeCompilationState compilationState) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 931
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileNamedType(NamedTypeSymbol symbol) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 431
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.<>c__DisplayClass4.<CompileNamedTypeAsTask>b__5() in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 342
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.WaitForWorkers() in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 256
   at Microsoft.CodeAnalysis.CSharp.MethodCompiler.CompileMethodBodies(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuiltOpt, Boolean generateDebugInfo, Boolean hasDeclarationErrors, DiagnosticBag diagnostics, Predicate`1 filterOpt, CancellationToken cancellationToken) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compiler\MethodCompiler.cs:line 142
   at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CompileImpl(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, CancellationToken cancellationToken, Boolean generateDebugInfo, DiagnosticBag diagnostics, Predicate`1 filterOpt) in D:\home\site\!roslyn-sources\master\Src\Compilers\CSharp\Portable\Compilation\CSharpCompilation.cs:line 2397
   at Microsoft.CodeAnalysis.Compilation.Compile(CommonPEModuleBuilder moduleBuilder, Stream win32Resources, Stream xmlDocStream, CancellationToken cancellationToken, Boolean generateDebugInfo, DiagnosticBag diagnostics, Predicate`1 filterOpt) in D:\home\site\!roslyn-sources\master\Src\Compilers\Core\Portable\Compilation\Compilation.cs:line 1245
   at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream, Stream pdbStream, Stream xmlDocumentationStream, Stream win32Resources, IEnumerable`1 manifestResources, EmitOptions options, CompilationTestData testData, CancellationToken cancellationToken) in D:\home\site\!roslyn-sources\master\Src\Compilers\Core\Portable\Compilation\Compilation.cs:line 1451
   at Microsoft.CodeAnalysis.Compilation.Emit(Stream peStream, Stream pdbStream, Stream xmlDocumentationStream, Stream win32Resources, IEnumerable`1 manifestResources, EmitOptions options, CancellationToken cancellationToken) in D:\home\site\!roslyn-sources\master\Src\Compilers\Core\Portable\Compilation\Compilation.cs:line 1324
   at lambda_method(Closure , Compilation , Stream )

comments

angocke wrote Oct 28, 2014 at 9:30 PM

Fixed in changeset a94e2e0ee8a31bfb909ff61d94847dc5383c27f3