Bug 27525

Summary: C#6 interpolated string raises NotImplementedException: CloneTo during compilation
Product: [Mono] Compilers Reporter: Alexander Köplinger <alex.koeplinger>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: bawng, miguel, mono-bugs+mono
Priority: High    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Tags: Is this bug a regression?: ---
Last known good build:

Description Alexander Köplinger 2015-02-27 20:59:26 UTC
Repro code:

>using System;
>
>public static class Test {
>	public static void Main() {
>		RunTest(() => Console.WriteLine($"Initializing the map took {1}ms"));
>	}
>
>	static void RunTest(Action callback) {
>		callback();
>	}
>}

This fails during compilation:

>Unhandled Exception:
>Mono.CSharp.InternalErrorException: test.cs(4,21): Test.Main() ---> System.NotImplementedException: CloneTo not implemented for expression Mono.CSharp.InterpolatedString
>  at Mono.CSharp.Expression.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Expression target) [0x00000] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:1244 
>  at Mono.CSharp.Expression.Clone (Mono.CSharp.CloneContext clonectx) [0x0000c] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:1263 
>  at Mono.CSharp.Argument.Clone (Mono.CSharp.CloneContext clonectx) [0x00000] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/argument.cs:104 
>  at Mono.CSharp.Arguments.Clone (Mono.CSharp.CloneContext ctx) [0x00022] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/argument.cs:458 
>  at Mono.CSharp.Invocation.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Expression t) [0x00012] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/expression.cs:6969 
>  at Mono.CSharp.Expression.Clone (Mono.CSharp.CloneContext clonectx) [0x0000c] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:1263 
>  at Mono.CSharp.Return.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00012] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/statement.cs:1357 
>  at Mono.CSharp.Statement.Clone (Mono.CSharp.CloneContext clonectx) [0x0000c] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/statement.cs:68 
>  at Mono.CSharp.Block.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x000c6] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/statement.cs:3101 
>  at Mono.CSharp.ParametersBlock.CloneTo (Mono.CSharp.CloneContext clonectx, Mono.CSharp.Statement t) [0x00000] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/statement.cs:3719 
>  at Mono.CSharp.Statement.Clone (Mono.CSharp.CloneContext clonectx) [0x0000c] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/statement.cs:68 
>  at Mono.CSharp.ParametersBlock.PerformClone () [0x00006] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/statement.cs:3864 
>  at Mono.CSharp.AnonymousMethodExpression.CompatibleMethodBody (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeInferenceContext tic, Mono.CSharp.TypeSpec return_type, Mono.CSharp.TypeSpec delegate_type) [0x00013] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/anonymous.cs:1393 
>  at Mono.CSharp.AnonymousMethodExpression.Compatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec type) [0x00034] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/anonymous.cs:1210 
>  at Mono.CSharp.AnonymousMethodExpression.ImplicitStandardConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeSpec delegate_type) [0x00037] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/anonymous.cs:1006 
>  at Mono.CSharp.Convert.ImplicitConversionExists (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression expr, Mono.CSharp.TypeSpec target_type) [0x0003e] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/convert.cs:695 
>  at Mono.CSharp.OverloadResolver.IsArgumentCompatible (Mono.CSharp.ResolveContext ec, Mono.CSharp.Argument argument, Modifier param_mod, Mono.CSharp.TypeSpec parameter) [0x000ca] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:5267 
>  at Mono.CSharp.OverloadResolver.IsApplicable (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Int32 arg_count, Mono.CSharp.MemberSpec& candidate, IParametersMember pm, System.Boolean& params_expanded_form, System.Boolean& dynamicArgument, Mono.CSharp.TypeSpec& returnType, Boolean errorMode) [0x0072a] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:5147 
>  at Mono.CSharp.OverloadResolver.ResolveMember[MethodSpec] (Mono.CSharp.ResolveContext rc, Mono.CSharp.Arguments& args) [0x00000] in <filename unknown>:0 
>  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& args, IErrorHandler cerrors, Restrictions restr) [0x00064] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:4113 
>  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/expression.cs:7155 
>  at Mono.CSharp.Invocation.DoResolveInvocation (Mono.CSharp.ResolveContext ec) [0x0017b] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/expression.cs:7070 
>  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext rc) [0x0004e] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/expression.cs:7006 
>  at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x0002a] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ecore.cs:500 
>  --- End of inner exception stack trace ---
>  at Mono.CSharp.Method.Emit () [0x00139] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/method.cs:1376 
>  at Mono.CSharp.TypeDefinition.Emit () [0x0026e] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/class.cs:2233 
>  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/class.cs:2733 
>  at Mono.CSharp.Class.Emit () [0x00000] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/class.cs:2871 
>  at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/class.cs:2266 
>  at Mono.CSharp.TypeContainer.EmitContainer () [0x00012] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/class.cs:335 
>  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/namespace.cs:876 
>  at Mono.CSharp.TypeContainer.EmitContainer () [0x00012] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/class.cs:335 
>  at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/module.cs:594 
>  at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/assembly.cs:484 
>  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/ikvm.cs:215 
>  at Mono.CSharp.Driver.Compile () [0x002f3] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/driver.cs:387 
>  at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/mcs/driver.cs:187
Comment 1 Marek Safar 2015-03-02 04:17:54 UTC
Fixed in master and 4.0 branch
Comment 2 Marek Safar 2015-03-10 09:21:35 UTC
*** Bug 27816 has been marked as a duplicate of this bug. ***