Imported Upstream version 4.2.1.60

Former-commit-id: 9b26026d54721a136cb1f0874b60f96f4169873f
This commit is contained in:
Xamarin Public Jenkins 2015-10-06 08:40:39 -04:00 committed by Jo Shields
parent 4215c1b088
commit 2faab2dafa
55 changed files with 488 additions and 317 deletions

View File

@ -84,8 +84,8 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in mkinstalldirs \
$(srcdir)/mono-uninstalled.pc.in COPYING.LIB ChangeLog NEWS \
compile config.guess config.rpath config.sub install-sh \
missing ltmain.sh
compile config.guess config.rpath config.sub depcomp \
install-sh missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \

View File

@ -183,11 +183,11 @@ Restrict the compiler to use only the features available in C# 3.0
Restrict the compiler to use only the features available in C# 4.0
specification.
.TP
.I "future"
.I "experimental"
Enables unstable features from upcoming versions of the language.
.PP
Notice that this flag only restricts the language features available to
the programmer. A version of produced assemblies can be controled using
the programmer. A version of produced assemblies can be controlled using
.I SDK
option.
.ne

View File

@ -276,6 +276,14 @@ namespace System.Net.Http
var headers = wr.Headers;
foreach (var header in request.Headers) {
var values = header.Value;
if (header.Key == "Host") {
//
// Host must be explicitly set for HttpWebRequest
//
wr.Host = request.Headers.Host;
continue;
}
if (header.Key == "Transfer-Encoding") {
// Chunked Transfer-Encoding is never set for HttpWebRequest. It's detected
// from ContentLength by HttpWebRequest

View File

@ -606,6 +606,39 @@ namespace MonoTests.System.Net.Http
}
}
[Test]
public void Send_Complete_CustomHeaders_Host ()
{
bool? failed = null;
var listener = CreateListener (l => {
var request = l.Request;
try {
Assert.AreEqual ("customhost", request.Headers["Host"], "#1");
failed = false;
} catch {
failed = true;
}
});
try {
var client = new HttpClient ();
client.DefaultRequestHeaders.Add("Host", "customhost");
var request = new HttpRequestMessage (HttpMethod.Get, LocalServer);
var response = client.SendAsync (request, HttpCompletionOption.ResponseHeadersRead).Result;
Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100");
Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101");
Assert.AreEqual (false, failed, "#102");
} finally {
listener.Abort ();
listener.Close ();
}
}
[Test]
public void Send_Transfer_Encoding_Chunked ()
{

View File

@ -1 +1 @@
f8c2f4cb750d69cbda8d81e1312338786dae656f
fbc2bff995e010b1e2e97373f5bd7a86db9b7aba

View File

@ -60,6 +60,7 @@ namespace System
private object m_target;
private IntPtr method;
private IntPtr delegate_trampoline;
private IntPtr rgctx;
private IntPtr method_code;
private MethodInfo method_info;
@ -68,6 +69,8 @@ namespace System
private MethodInfo original_method_info;
private DelegateData data;
private bool method_is_virtual;
#pragma warning restore 169, 414, 649
#endregion
@ -103,13 +106,19 @@ namespace System
return method_info;
} else {
if (method != IntPtr.Zero) {
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
if (!method_is_virtual)
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
else
method_info = GetVirtualMethod_internal ();
}
return method_info;
}
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern MethodInfo GetVirtualMethod_internal ();
public object Target {
get {
return m_target;
@ -467,13 +476,15 @@ namespace System
return MemberwiseClone ();
}
internal bool Compare (Delegate d)
public override bool Equals (object obj)
{
Delegate d = obj as Delegate;
if (d == null)
return false;
// Do not compare method_ptr, since it can point to a trampoline
if (d.m_target == m_target && d.method == method) {
if (d.m_target == m_target && d.Method == Method) {
if (d.data != null || data != null) {
/* Uncommon case */
if (d.data != null && data != null)
@ -492,14 +503,10 @@ namespace System
return false;
}
public override bool Equals (object obj)
{
return Compare (obj as Delegate);
}
public override int GetHashCode ()
{
return method.GetHashCode () ^ (m_target != null ? m_target.GetHashCode () : 0);
/* same implementation as CoreCLR */
return GetType ().GetHashCode ();
}
protected virtual MethodInfo GetMethodImpl ()

View File

@ -57,7 +57,7 @@ namespace System {
* of icalls, do not require an increment.
*/
#pragma warning disable 169
private const int mono_corlib_version = 135;
private const int mono_corlib_version = 138;
#pragma warning restore 169
[ComVisible (true)]

View File

@ -361,14 +361,20 @@ namespace MonoTests.System.Reflection
IList<LocalVariableInfo> locals = mb.LocalVariables;
// This might break with different compilers etc.
Assert.AreEqual (2, locals.Count, "#3");
bool foundPinnedBytePointer = false;
unsafe {
foreach (LocalVariableInfo lvi in locals) {
if (lvi.LocalType == typeof (byte[]))
// This is optimized out by CSC in .NET 4.6
Assert.IsFalse (lvi.IsPinned, "#3-1");
Assert.IsTrue ((locals [0].LocalType == typeof (byte[])) || (locals [1].LocalType == typeof (byte[])), "#4");
if (locals [0].LocalType == typeof (byte[]))
Assert.AreEqual (false, locals [0].IsPinned, "#5");
else
Assert.AreEqual (false, locals [1].IsPinned, "#6");
if (/* mcs */ lvi.LocalType == typeof (byte*) || /* csc */ lvi.LocalType == typeof (byte).MakeByRefType ()) {
foundPinnedBytePointer = true;
Assert.IsTrue (lvi.IsPinned, "#3-2");
}
}
}
Assert.IsTrue (foundPinnedBytePointer, "#4");
}
public int return_parameter_test ()
@ -804,21 +810,44 @@ namespace MonoTests.System.Reflection
var type = typeof (GenericClass<>).GetMethod("Method").GetMethodBody().LocalVariables[0].LocalType;
Assert.AreEqual (typeofT, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
bool foundTypeOfK = false;
bool foundExpectedType = false;
MethodBody mb = typeof (GenericClass<>).GetMethod("Method2").GetMethodBody();
foreach (LocalVariableInfo lvi in mb.LocalVariables) {
if (lvi.LocalType == typeofK) {
foundTypeOfK = true;
Assert.AreEqual (typeof (GenericClass<>), lvi.LocalType.DeclaringType, "#1-1");
} else if (lvi.LocalType == typeofT) {
foundExpectedType = true;
Assert.AreEqual (typeof (GenericClass<>), lvi.LocalType.DeclaringType, "#1-2");
}
}
type = typeof (GenericClass<>).GetMethod("Method2").GetMethodBody().LocalVariables[0].LocalType;
Assert.AreEqual (typeofT, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
type = typeof (GenericClass<>).GetMethod("Method2").GetMethodBody().LocalVariables[1].LocalType;
Assert.AreEqual (typeofK, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
type = typeof (GenericClass<int>).GetMethod("Method2").GetMethodBody().LocalVariables[0].LocalType;
Assert.AreEqual (typeof (int), type);
type = typeof (GenericClass<int>).GetMethod("Method2").GetMethodBody().LocalVariables[1].LocalType;
Assert.AreEqual (typeofK, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
Assert.IsTrue (foundTypeOfK, "#1-3");
if (mb.LocalVariables.Count < 2)
Assert.Ignore ("Code built in release mode - 'T var0' optmized out");
else
Assert.IsTrue (foundExpectedType, "#1-4");
foundTypeOfK = false;
foundExpectedType = false;
mb = typeof (GenericClass<int>).GetMethod("Method2").GetMethodBody();
foreach (LocalVariableInfo lvi in mb.LocalVariables) {
if (lvi.LocalType == typeofK) {
foundTypeOfK = true;
Assert.AreEqual (typeof (GenericClass<>), lvi.LocalType.DeclaringType, "#2-1");
} else if (lvi.LocalType == typeof (int)) {
foundExpectedType = true;
}
}
Assert.IsTrue (foundTypeOfK, "#2-3");
if (mb.LocalVariables.Count < 2)
Assert.Ignore ("Code built in release mode - 'int var0' optmized out");
else
Assert.IsTrue (foundExpectedType, "#2-4");
}
#endif
}

View File

@ -1 +1 @@
0240ebb4d2659b40f56c66a63819f414a5d9df62
1fdb613e86f18f2b9886f4967a0bdc43f79fef7e

View File

@ -1 +1 @@
cb7dc0666856e54db03e68c589fc978dd269c5f3
70d97fe10dc6037275080996eac59af0d68e1561

View File

@ -1 +1 @@
b341b2406947158e34dcfde3e0e842d2f8f45366
06bd1619ad328b5c34a59a366c095894e50efd56

View File

@ -1 +1 @@
e69df203c4e52e18dafc6255ea6247008eecfadb
5b9fdc62b8f41a0b32a323e04f253e4de34cd483

View File

@ -1 +1 @@
cfddc735dcaad9c8ee6f62802c7b870328e6d9e7
a6fc9a5ca70542579710af7ccfbd377501d45c30

15
mcs/errors/cs0023-26.cs Normal file
View File

@ -0,0 +1,15 @@
// CS0023: The `?' operator cannot be applied to operand of type `method group'
// Line: 14
class X
{
void Test ()
{
}
public static void Main ()
{
X x = null;
System.Action n = x?.Test;
}
}

View File

@ -189,7 +189,7 @@ namespace Mono.CSharp
TryWithCatchScope = 1 << 15,
ConditionalAccessReceiver = 1 << 16,
DontSetConditionalAccessReceiver = 1 << 16,
///
/// Indicates the current context is in probing mode, no errors are reported.

View File

@ -457,7 +457,6 @@ namespace Mono.CSharp {
//
public abstract class DelegateCreation : Expression, OverloadResolver.IErrorHandler
{
bool conditional_access_receiver;
protected MethodSpec constructor_method;
protected MethodGroupExpr method_group;
@ -520,25 +519,25 @@ namespace Mono.CSharp {
return e.CreateExpressionTree (ec);
}
void ResolveConditionalAccessReceiver (ResolveContext rc)
{
// LAMESPEC: Not sure why this is explicitly disalloed with very odd error message
if (!rc.HasSet (ResolveContext.Options.DontSetConditionalAccessReceiver) && method_group.HasConditionalAccess ()) {
Error_OperatorCannotBeApplied (rc, loc, "?", method_group.Type);
}
}
protected override Expression DoResolve (ResolveContext ec)
{
constructor_method = Delegate.GetConstructor (type);
var invoke_method = Delegate.GetInvokeMethod (type);
if (!ec.HasSet (ResolveContext.Options.ConditionalAccessReceiver)) {
if (method_group.HasConditionalAccess ()) {
conditional_access_receiver = true;
ec.Set (ResolveContext.Options.ConditionalAccessReceiver);
}
}
ResolveConditionalAccessReceiver (ec);
Arguments arguments = CreateDelegateMethodArguments (ec, invoke_method.Parameters, invoke_method.Parameters.Types, loc);
method_group = method_group.OverloadResolve (ec, ref arguments, this, OverloadResolver.Restrictions.CovariantDelegate);
if (conditional_access_receiver)
ec.With (ResolveContext.Options.ConditionalAccessReceiver, false);
if (method_group == null)
return null;
@ -594,9 +593,6 @@ namespace Mono.CSharp {
public override void Emit (EmitContext ec)
{
if (conditional_access_receiver)
ec.ConditionalAccess = new ConditionalAccessContext (type, ec.DefineLabel ());
if (method_group.InstanceExpression == null) {
ec.EmitNull ();
} else {
@ -615,20 +611,12 @@ namespace Mono.CSharp {
}
ec.Emit (OpCodes.Newobj, constructor_method);
if (conditional_access_receiver)
ec.CloseConditionalAccess (null);
}
public override void FlowAnalysis (FlowAnalysisContext fc)
{
var da = conditional_access_receiver ? fc.BranchDefiniteAssignment () : null;
base.FlowAnalysis (fc);
method_group.FlowAnalysis (fc);
if (conditional_access_receiver)
fc.DefiniteAssignment = da;
}
void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression return_type)

View File

@ -1 +1 @@
38d317979f9db73620faf65c9a701a808c9b17ef
4225b585eea7227c7a3a236f80f3f28a3dd9919b

View File

@ -1 +1 @@
c4b5db38d37bc3d4db203452efe5a88099ddf0da
acdcf32485d622ab24dcb505dba5e58729d82483

View File

@ -1561,7 +1561,7 @@ namespace Mono.CSharp {
" -help Lists all compiler options (short: -?)\n" +
" -keycontainer:NAME The key pair container used to sign the output assembly\n" +
" -keyfile:FILE The key file used to strongname the ouput assembly\n" +
" -langversion:TEXT Specifies language version: ISO-1, ISO-2, 3, 4, 5, Default or Future\n" +
" -langversion:TEXT Specifies language version: ISO-1, ISO-2, 3, 4, 5, Default or Experimental\n" +
" -lib:PATH1[,PATHn] Specifies the location of referenced assemblies\n" +
" -main:CLASS Specifies the class with the Main method (short: -m)\n" +
" -noconfig Disables implicitly referenced assemblies\n" +

View File

@ -1,14 +0,0 @@
using System;
public class D
{
void Foo ()
{
}
public static void Main()
{
D d = null;
Action a = d?.Foo;
}
}

Some files were not shown because too many files have changed in this diff Show More