Imported Upstream version 5.10.0.78
Former-commit-id: 46737382176d7b811604042c613d5df6eef74f33
This commit is contained in:
parent
b7cd5de421
commit
6db692b74b
@ -1 +1 @@
|
||||
f3cdec28bfd3d14c4e51f3f8697b1c542f26bcfa
|
||||
dad97840452a2f832fc1323d67be2b04d45fc712
|
@ -1 +1 @@
|
||||
34b930d40a1798a2e6cf86e9dc5b5aef795412f2
|
||||
1b855480ca426b8d704fef63adf86f09b2b33da2
|
@ -34,7 +34,7 @@ static class Consts
|
||||
// Use these assembly version constants to make code more maintainable.
|
||||
//
|
||||
|
||||
public const string MonoVersion = "5.10.0.71";
|
||||
public const string MonoVersion = "5.10.0.78";
|
||||
public const string MonoCompany = "Mono development team";
|
||||
public const string MonoProduct = "Mono Common Language Infrastructure";
|
||||
public const string MonoCopyright = "(c) Various Mono authors";
|
||||
|
@ -1 +1 @@
|
||||
f46637fe7b50026e71c6ce268ea9f06072f1427c
|
||||
cf7fd8b1f52fa69a3f0c94971b492a2e3ad201bd
|
@ -1 +1 @@
|
||||
09a0bbd139544d6660f459487cd7b64444fa0110
|
||||
622d2ec0823ad7bd945fc203628e4a1290ba8528
|
@ -1 +1 @@
|
||||
9dbd62725d59ac2b05fb7b233c7392fc2701c97c
|
||||
bd7bcec7d9505215a55dda1ebc8154522a62f70d
|
@ -1 +1 @@
|
||||
155d65127d43b1f2e787e1c95de7098297585a65
|
||||
e87333586392ab866201d6ba269f3d8855e6d0a9
|
@ -1 +1 @@
|
||||
7934a0f5c354efc029c3deca559be7d379278ae7
|
||||
d718c10f264ce127870f830fde9359d0d2106b88
|
@ -1 +1 @@
|
||||
a2d6f567f1c826b06f814cdc88138a155050fb50
|
||||
11fa18ea6714274085a830b743543b03862fed53
|
@ -1 +1 @@
|
||||
e66da28062c88338d362b64caa5b9844cceac6c6
|
||||
29c3b6cb6acbee9ec9a2bcf01e8dcc796eaa4696
|
@ -1 +1 @@
|
||||
f46637fe7b50026e71c6ce268ea9f06072f1427c
|
||||
cf7fd8b1f52fa69a3f0c94971b492a2e3ad201bd
|
@ -1 +1 @@
|
||||
09a0bbd139544d6660f459487cd7b64444fa0110
|
||||
622d2ec0823ad7bd945fc203628e4a1290ba8528
|
@ -1 +1 @@
|
||||
9dbd62725d59ac2b05fb7b233c7392fc2701c97c
|
||||
bd7bcec7d9505215a55dda1ebc8154522a62f70d
|
@ -1 +1 @@
|
||||
155d65127d43b1f2e787e1c95de7098297585a65
|
||||
e87333586392ab866201d6ba269f3d8855e6d0a9
|
@ -1 +1 @@
|
||||
7934a0f5c354efc029c3deca559be7d379278ae7
|
||||
d718c10f264ce127870f830fde9359d0d2106b88
|
@ -1 +1 @@
|
||||
a2d6f567f1c826b06f814cdc88138a155050fb50
|
||||
11fa18ea6714274085a830b743543b03862fed53
|
@ -1 +1 @@
|
||||
e66da28062c88338d362b64caa5b9844cceac6c6
|
||||
29c3b6cb6acbee9ec9a2bcf01e8dcc796eaa4696
|
@ -1 +1 @@
|
||||
f46637fe7b50026e71c6ce268ea9f06072f1427c
|
||||
cf7fd8b1f52fa69a3f0c94971b492a2e3ad201bd
|
@ -1 +1 @@
|
||||
09a0bbd139544d6660f459487cd7b64444fa0110
|
||||
622d2ec0823ad7bd945fc203628e4a1290ba8528
|
@ -1 +1 @@
|
||||
9dbd62725d59ac2b05fb7b233c7392fc2701c97c
|
||||
bd7bcec7d9505215a55dda1ebc8154522a62f70d
|
@ -1 +1 @@
|
||||
155d65127d43b1f2e787e1c95de7098297585a65
|
||||
e87333586392ab866201d6ba269f3d8855e6d0a9
|
@ -1 +1 @@
|
||||
7934a0f5c354efc029c3deca559be7d379278ae7
|
||||
d718c10f264ce127870f830fde9359d0d2106b88
|
@ -1 +1 @@
|
||||
a2d6f567f1c826b06f814cdc88138a155050fb50
|
||||
11fa18ea6714274085a830b743543b03862fed53
|
@ -1 +1 @@
|
||||
e66da28062c88338d362b64caa5b9844cceac6c6
|
||||
29c3b6cb6acbee9ec9a2bcf01e8dcc796eaa4696
|
@ -1,4 +1,4 @@
|
||||
// CS1983: The return type of an async method must be void, Task, or Task<T>
|
||||
// CS1983: The return type of an async method must be void or task type
|
||||
// Line: 6
|
||||
|
||||
class C
|
||||
|
13
mcs/errors/cs8346.cs
Normal file
13
mcs/errors/cs8346.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// CS8346: Cannot convert a stackalloc expression of type `byte' to type `System.Span<int>'
|
||||
// Line: 11
|
||||
// Compiler options: -langversion:7.2
|
||||
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
Span<int> stackSpan = stackalloc byte[1];
|
||||
}
|
||||
}
|
@ -391,9 +391,21 @@ namespace Mono.CSharp {
|
||||
return System.Linq.Expressions.Expression.Assign (target_object, source_object);
|
||||
}
|
||||
|
||||
protected virtual Expression ResolveConversions (ResolveContext ec)
|
||||
protected virtual Expression ResolveConversions (ResolveContext rc)
|
||||
{
|
||||
source = Convert.ImplicitConversionRequired (ec, source, target.Type, source.Location);
|
||||
var ttype = target.Type;
|
||||
var stackAlloc = source as StackAlloc;
|
||||
if (stackAlloc != null && ttype.Arity == 1 && ttype.GetDefinition () == rc.Module.PredefinedTypes.SpanGeneric.TypeSpec &&
|
||||
rc.Module.Compiler.Settings.Version >= LanguageVersion.V_7_2) {
|
||||
|
||||
var etype = ttype.TypeArguments [0];
|
||||
var stype = ((PointerContainer)source.Type).Element;
|
||||
if (etype == stype && stackAlloc.ResolveSpanConversion (rc, ttype)) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
source = Convert.ImplicitConversionRequired (rc, source, ttype, source.Location);
|
||||
if (source == null)
|
||||
return null;
|
||||
|
||||
|
192
mcs/mcs/async.cs
192
mcs/mcs/async.cs
@ -628,59 +628,113 @@ namespace Mono.CSharp
|
||||
|
||||
protected override bool DoDefineMembers ()
|
||||
{
|
||||
PredefinedType builder_type;
|
||||
PredefinedMember<MethodSpec> bf;
|
||||
PredefinedMember<MethodSpec> bs;
|
||||
PredefinedMember<MethodSpec> sr;
|
||||
PredefinedMember<MethodSpec> se;
|
||||
PredefinedMember<MethodSpec> sm;
|
||||
TypeSpec bt;
|
||||
bool has_task_return_type = false;
|
||||
var pred_members = Module.PredefinedMembers;
|
||||
|
||||
if (return_type.Kind == MemberKind.Void) {
|
||||
builder_type = Module.PredefinedTypes.AsyncVoidMethodBuilder;
|
||||
bf = pred_members.AsyncVoidMethodBuilderCreate;
|
||||
bs = pred_members.AsyncVoidMethodBuilderStart;
|
||||
sr = pred_members.AsyncVoidMethodBuilderSetResult;
|
||||
se = pred_members.AsyncVoidMethodBuilderSetException;
|
||||
sm = pred_members.AsyncVoidMethodBuilderSetStateMachine;
|
||||
} else if (return_type == Module.PredefinedTypes.Task.TypeSpec) {
|
||||
builder_type = Module.PredefinedTypes.AsyncTaskMethodBuilder;
|
||||
bf = pred_members.AsyncTaskMethodBuilderCreate;
|
||||
bs = pred_members.AsyncTaskMethodBuilderStart;
|
||||
sr = pred_members.AsyncTaskMethodBuilderSetResult;
|
||||
se = pred_members.AsyncTaskMethodBuilderSetException;
|
||||
sm = pred_members.AsyncTaskMethodBuilderSetStateMachine;
|
||||
task = pred_members.AsyncTaskMethodBuilderTask.Get ();
|
||||
} else {
|
||||
builder_type = Module.PredefinedTypes.AsyncTaskMethodBuilderGeneric;
|
||||
bf = pred_members.AsyncTaskMethodBuilderGenericCreate;
|
||||
bs = pred_members.AsyncTaskMethodBuilderGenericStart;
|
||||
sr = pred_members.AsyncTaskMethodBuilderGenericSetResult;
|
||||
se = pred_members.AsyncTaskMethodBuilderGenericSetException;
|
||||
sm = pred_members.AsyncTaskMethodBuilderGenericSetStateMachine;
|
||||
task = pred_members.AsyncTaskMethodBuilderGenericTask.Get ();
|
||||
has_task_return_type = true;
|
||||
}
|
||||
|
||||
set_result = sr.Get ();
|
||||
set_exception = se.Get ();
|
||||
builder_factory = bf.Get ();
|
||||
builder_start = bs.Get ();
|
||||
|
||||
var istate_machine = Module.PredefinedTypes.IAsyncStateMachine;
|
||||
var set_statemachine = sm.Get ();
|
||||
MethodSpec set_statemachine;
|
||||
|
||||
if (!builder_type.Define () || !istate_machine.Define () || set_result == null || builder_factory == null ||
|
||||
set_exception == null || set_statemachine == null || builder_start == null ||
|
||||
!Module.PredefinedTypes.INotifyCompletion.Define ()) {
|
||||
Report.Error (1993, Location,
|
||||
"Cannot find compiler required types for asynchronous functions support. Are you targeting the wrong framework version?");
|
||||
return base.DoDefineMembers ();
|
||||
if (return_type.IsCustomTaskType ()) {
|
||||
//
|
||||
// TODO: Would be nice to cache all this on per-type basis
|
||||
//
|
||||
var btypes = Compiler.BuiltinTypes;
|
||||
bt = return_type.MemberDefinition.GetAsyncMethodBuilder ();
|
||||
TypeSpec bt_inflated;
|
||||
if (return_type.IsGeneric) {
|
||||
bt_inflated = bt.MakeGenericType (Module, bt.MemberDefinition.TypeParameters);
|
||||
} else {
|
||||
bt_inflated = bt;
|
||||
}
|
||||
|
||||
var set_result_sign = MemberFilter.Method ("SetResult", 0, ParametersCompiled.CreateFullyResolved (bt.MemberDefinition.TypeParameters), btypes.Void);
|
||||
set_result = new PredefinedMember<MethodSpec> (Module, bt, set_result_sign).Resolve (Location);
|
||||
|
||||
var set_exception_sign = MemberFilter.Method ("SetException", 0, ParametersCompiled.CreateFullyResolved (btypes.Exception), btypes.Void);
|
||||
set_exception = new PredefinedMember<MethodSpec> (Module, bt, set_exception_sign).Resolve (Location);
|
||||
|
||||
var builder_factory_sign = MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, bt_inflated);
|
||||
builder_factory = new PredefinedMember<MethodSpec> (Module, bt, builder_factory_sign).Resolve (Location);
|
||||
if (builder_factory?.IsStatic == false)
|
||||
throw new NotImplementedException ("report better error message");
|
||||
|
||||
var builder_start_sign = MemberFilter.Method ("Start", 1, new ParametersImported (
|
||||
new [] {
|
||||
new ParameterData (null, Parameter.Modifier.REF),
|
||||
},
|
||||
new [] {
|
||||
new TypeParameterSpec (0, null, SpecialConstraint.None, Variance.None, null),
|
||||
}, false),
|
||||
btypes.Void);
|
||||
builder_start = new PredefinedMember<MethodSpec> (Module, bt, builder_start_sign).Resolve (Location);
|
||||
|
||||
if (!istate_machine.Define ())
|
||||
return false;
|
||||
|
||||
var set_statemachine_sign = MemberFilter.Method ("SetStateMachine", 0, ParametersCompiled.CreateFullyResolved (istate_machine.TypeSpec), btypes.Void);
|
||||
set_statemachine = new PredefinedMember<MethodSpec> (Module, bt, set_statemachine_sign).Resolve (Location); ;
|
||||
|
||||
var task_sign = MemberFilter.Property ("Task", return_type.MemberDefinition as TypeSpec);
|
||||
task = new PredefinedMember<PropertySpec> (Module, bt, task_sign).Resolve (Location);
|
||||
|
||||
if (set_result == null || set_exception == null || builder_factory == null || builder_start == null || set_statemachine == null || task == null ||
|
||||
!Module.PredefinedTypes.INotifyCompletion.Define ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
has_task_return_type = return_type.IsGeneric;
|
||||
} else {
|
||||
PredefinedType builder_type;
|
||||
PredefinedMember<MethodSpec> bf;
|
||||
PredefinedMember<MethodSpec> bs;
|
||||
PredefinedMember<MethodSpec> sr;
|
||||
PredefinedMember<MethodSpec> se;
|
||||
PredefinedMember<MethodSpec> sm;
|
||||
var pred_members = Module.PredefinedMembers;
|
||||
|
||||
if (return_type.Kind == MemberKind.Void) {
|
||||
builder_type = Module.PredefinedTypes.AsyncVoidMethodBuilder;
|
||||
bf = pred_members.AsyncVoidMethodBuilderCreate;
|
||||
bs = pred_members.AsyncVoidMethodBuilderStart;
|
||||
sr = pred_members.AsyncVoidMethodBuilderSetResult;
|
||||
se = pred_members.AsyncVoidMethodBuilderSetException;
|
||||
sm = pred_members.AsyncVoidMethodBuilderSetStateMachine;
|
||||
} else if (return_type == Module.PredefinedTypes.Task.TypeSpec) {
|
||||
builder_type = Module.PredefinedTypes.AsyncTaskMethodBuilder;
|
||||
bf = pred_members.AsyncTaskMethodBuilderCreate;
|
||||
bs = pred_members.AsyncTaskMethodBuilderStart;
|
||||
sr = pred_members.AsyncTaskMethodBuilderSetResult;
|
||||
se = pred_members.AsyncTaskMethodBuilderSetException;
|
||||
sm = pred_members.AsyncTaskMethodBuilderSetStateMachine;
|
||||
task = pred_members.AsyncTaskMethodBuilderTask.Get ();
|
||||
} else {
|
||||
builder_type = Module.PredefinedTypes.AsyncTaskMethodBuilderGeneric;
|
||||
bf = pred_members.AsyncTaskMethodBuilderGenericCreate;
|
||||
bs = pred_members.AsyncTaskMethodBuilderGenericStart;
|
||||
sr = pred_members.AsyncTaskMethodBuilderGenericSetResult;
|
||||
se = pred_members.AsyncTaskMethodBuilderGenericSetException;
|
||||
sm = pred_members.AsyncTaskMethodBuilderGenericSetStateMachine;
|
||||
task = pred_members.AsyncTaskMethodBuilderGenericTask.Get ();
|
||||
has_task_return_type = true;
|
||||
}
|
||||
|
||||
set_result = sr.Get ();
|
||||
set_exception = se.Get ();
|
||||
builder_factory = bf.Get ();
|
||||
builder_start = bs.Get ();
|
||||
|
||||
set_statemachine = sm.Get ();
|
||||
|
||||
if (!builder_type.Define () || !istate_machine.Define () || set_result == null || builder_factory == null ||
|
||||
set_exception == null || set_statemachine == null || builder_start == null ||
|
||||
!Module.PredefinedTypes.INotifyCompletion.Define ()) {
|
||||
Report.Error (1993, Location,
|
||||
"Cannot find compiler required types for asynchronous functions support. Are you targeting the wrong framework version?");
|
||||
return base.DoDefineMembers ();
|
||||
}
|
||||
|
||||
bt = builder_type.TypeSpec;
|
||||
}
|
||||
|
||||
var bt = builder_type.TypeSpec;
|
||||
|
||||
//
|
||||
// Inflate generic Task types
|
||||
//
|
||||
@ -825,9 +879,26 @@ namespace Mono.CSharp
|
||||
predefined = unsafeVersion ? pm.AsyncVoidMethodBuilderOnCompletedUnsafe : pm.AsyncVoidMethodBuilderOnCompleted;
|
||||
} else if (return_type == Module.PredefinedTypes.Task.TypeSpec) {
|
||||
predefined = unsafeVersion ? pm.AsyncTaskMethodBuilderOnCompletedUnsafe : pm.AsyncTaskMethodBuilderOnCompleted;
|
||||
} else {
|
||||
} else if (return_type.IsGenericTask) {
|
||||
predefined = unsafeVersion ? pm.AsyncTaskMethodBuilderGenericOnCompletedUnsafe : pm.AsyncTaskMethodBuilderGenericOnCompleted;
|
||||
has_task_return_type = true;
|
||||
} else {
|
||||
var parameters = new ParametersImported (
|
||||
new [] {
|
||||
new ParameterData (null, Parameter.Modifier.REF),
|
||||
new ParameterData (null, Parameter.Modifier.REF)
|
||||
},
|
||||
new [] {
|
||||
new TypeParameterSpec (0, null, SpecialConstraint.None, Variance.None, null),
|
||||
new TypeParameterSpec (1, null, SpecialConstraint.None, Variance.None, null)
|
||||
}, false);
|
||||
|
||||
var on_completed_sign = unsafeVersion ?
|
||||
MemberFilter.Method ("AwaitUnsafeOnCompleted", 2, parameters, Compiler.BuiltinTypes.Void) :
|
||||
MemberFilter.Method ("AwaitOnCompleted", 2, parameters, Compiler.BuiltinTypes.Void);
|
||||
|
||||
predefined = new PredefinedMember<MethodSpec> (Module, return_type.MemberDefinition.GetAsyncMethodBuilder (), on_completed_sign);
|
||||
has_task_return_type = return_type.IsGeneric;
|
||||
}
|
||||
|
||||
var on_completed = predefined.Resolve (Location);
|
||||
@ -887,11 +958,14 @@ namespace Mono.CSharp
|
||||
// stateMachine.$builder.Start<{storey-type}>(ref stateMachine);
|
||||
//
|
||||
instance.AddressOf (ec, AddressOp.Store);
|
||||
ec.Emit (OpCodes.Ldflda, builder_field);
|
||||
|
||||
bool struct_builder = builder.MemberType.IsStruct;
|
||||
|
||||
ec.Emit (struct_builder ? OpCodes.Ldflda : OpCodes.Ldfld, builder_field);
|
||||
if (Task != null)
|
||||
ec.Emit (OpCodes.Dup);
|
||||
instance.AddressOf (ec, AddressOp.Store);
|
||||
ec.Emit (OpCodes.Call, builder_start.MakeGenericMethod (Module, instance.Type));
|
||||
ec.Emit (struct_builder ? OpCodes.Call : OpCodes.Callvirt, builder_start.MakeGenericMethod (Module, instance.Type));
|
||||
|
||||
//
|
||||
// Emits return stateMachine.$builder.Task;
|
||||
@ -1029,4 +1103,20 @@ namespace Mono.CSharp
|
||||
EmitAssign (ec, new NullConstant (type, loc), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
static class TypeSpecAsyncExtensions
|
||||
{
|
||||
public static bool IsCustomTaskType (this TypeSpec type)
|
||||
{
|
||||
// LAMESPEC: Arity is not mentioned
|
||||
if (type.Arity > 1)
|
||||
return false;
|
||||
|
||||
var amb = type.MemberDefinition.GetAsyncMethodBuilder ();
|
||||
if (amb == null)
|
||||
return false;
|
||||
|
||||
return amb.Arity == type.Arity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -789,6 +789,17 @@ namespace Mono.CSharp {
|
||||
return ((BoolConstant) pos_args[0].Expr).Value;
|
||||
}
|
||||
|
||||
public TypeSpec GetAsyncMethodBuilderValue ()
|
||||
{
|
||||
if (!arg_resolved)
|
||||
Resolve ();
|
||||
|
||||
if (resolve_error)
|
||||
return null;
|
||||
|
||||
return GetArgumentType ();
|
||||
}
|
||||
|
||||
public TypeSpec GetCoClassAttributeValue ()
|
||||
{
|
||||
if (!arg_resolved)
|
||||
@ -1754,6 +1765,7 @@ namespace Mono.CSharp {
|
||||
|
||||
// New in .NET 4.7
|
||||
public readonly PredefinedTupleElementNamesAttribute TupleElementNames;
|
||||
public readonly PredefinedAttribute AsyncMethodBuilder;
|
||||
|
||||
// New in .NET 4.7.1
|
||||
public readonly PredefinedAttribute IsReadOnly;
|
||||
@ -1838,6 +1850,7 @@ namespace Mono.CSharp {
|
||||
CallerLineNumberAttribute = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "CallerLineNumberAttribute");
|
||||
CallerFilePathAttribute = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "CallerFilePathAttribute");
|
||||
|
||||
AsyncMethodBuilder = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "AsyncMethodBuilderAttribute");
|
||||
TupleElementNames = new PredefinedTupleElementNamesAttribute (module, "System.Runtime.CompilerServices", "TupleElementNamesAttribute");
|
||||
IsReadOnly = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "IsReadOnlyAttribute");
|
||||
IsByRefLike = new PredefinedAttribute (module, "System.Runtime.CompilerServices", "IsByRefLikeAttribute");
|
||||
|
@ -1 +1 @@
|
||||
da3ec32d6fb042738c08224ca2367f0262506c27
|
||||
6b1adc297a3831c9f1efbe0d0eb0b1af7230f911
|
@ -1 +1 @@
|
||||
b6a508cffc61cadc2e4ab73e7cc62af1fc2793d6
|
||||
20ee9e73b19c3cf415315fbd67fcaeb787ac8ef6
|
@ -1 +1 @@
|
||||
51f268737c01310008f6ef3be4705ffc0373b7ed
|
||||
518ccc8ef43fb3e1a0902069579690ac6875696a
|
@ -693,6 +693,11 @@ namespace Mono.CSharp {
|
||||
GetSignatureForError (), mc.GetSignatureForError (), input_variance, gtype_variance, parameters);
|
||||
}
|
||||
|
||||
public TypeSpec GetAsyncMethodBuilder ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public TypeSpec GetAttributeCoClass ()
|
||||
{
|
||||
return null;
|
||||
|
@ -1405,6 +1405,7 @@ namespace Mono.CSharp
|
||||
public string DefaultIndexerName;
|
||||
public bool? CLSAttributeValue;
|
||||
public TypeSpec CoClass;
|
||||
public TypeSpec AsyncMethodBuilder;
|
||||
|
||||
static bool HasMissingType (ConstructorInfo ctor)
|
||||
{
|
||||
@ -1446,7 +1447,14 @@ namespace Mono.CSharp
|
||||
if (args.Count == 1) {
|
||||
bag.Obsolete = new ObsoleteAttribute ((string) args[0].Value);
|
||||
} else if (args.Count == 2) {
|
||||
bag.Obsolete = new ObsoleteAttribute ((string) args[0].Value, (bool) args[1].Value);
|
||||
const string ByRefLikeMarker = "Types with embedded references are not supported in this version of your compiler.";
|
||||
|
||||
var msg = (string)args[0].Value;
|
||||
|
||||
if (msg == ByRefLikeMarker)
|
||||
continue;
|
||||
|
||||
bag.Obsolete = new ObsoleteAttribute (msg, (bool) args[1].Value);
|
||||
} else {
|
||||
bag.Obsolete = new ObsoleteAttribute ();
|
||||
}
|
||||
@ -1526,6 +1534,20 @@ namespace Mono.CSharp
|
||||
bag.CoClass = importer.ImportType ((MetaType) a.ConstructorArguments[0].Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name == "AsyncMethodBuilderAttribute") {
|
||||
if (dt.Namespace != "System.Runtime.CompilerServices")
|
||||
continue;
|
||||
|
||||
if (HasMissingType (a.Constructor))
|
||||
continue;
|
||||
|
||||
if (bag == null)
|
||||
bag = new AttributesBag ();
|
||||
|
||||
bag.AsyncMethodBuilder = importer.ImportType ((MetaType)a.ConstructorArguments [0].Value);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2133,6 +2155,14 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
public TypeSpec GetAsyncMethodBuilder ()
|
||||
{
|
||||
if (cattrs == null)
|
||||
ReadAttributes ();
|
||||
|
||||
return cattrs.AsyncMethodBuilder;
|
||||
}
|
||||
|
||||
public TypeSpec GetAttributeCoClass ()
|
||||
{
|
||||
if (cattrs == null)
|
||||
@ -2449,6 +2479,11 @@ namespace Mono.CSharp
|
||||
|
||||
#endregion
|
||||
|
||||
public TypeSpec GetAsyncMethodBuilder ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public TypeSpec GetAttributeCoClass ()
|
||||
{
|
||||
return null;
|
||||
|
@ -1267,8 +1267,9 @@ namespace Mono.CSharp {
|
||||
if ((ModFlags & Modifiers.ASYNC) != 0) {
|
||||
if (ReturnType.Kind != MemberKind.Void &&
|
||||
ReturnType != Module.PredefinedTypes.Task.TypeSpec &&
|
||||
!ReturnType.IsGenericTask) {
|
||||
Report.Error (1983, Location, "The return type of an async method must be void, Task, or Task<T>");
|
||||
!ReturnType.IsGenericTask &&
|
||||
!ReturnType.IsCustomTaskType ()) {
|
||||
Report.Error (1983, Location, "The return type of an async method must be void or task type");
|
||||
}
|
||||
|
||||
block = (ToplevelBlock) block.ConvertToAsyncTask (this, Parent.PartialContainer, parameters, ReturnType, null, Location);
|
||||
|
@ -1 +1 @@
|
||||
6f86db260bf6516fe48fce41e5197b299a5cfc88
|
||||
9c51128548f7bf24c42648a23fef1bf5dbc67fa8
|
@ -242,6 +242,7 @@ namespace Mono.CSharp
|
||||
|
||||
// C# 7.0
|
||||
public readonly PredefinedType[] Tuples;
|
||||
public readonly PredefinedType SpanGeneric;
|
||||
|
||||
public PredefinedTypes (ModuleContainer module)
|
||||
{
|
||||
@ -301,6 +302,8 @@ namespace Mono.CSharp
|
||||
FormattableString = new PredefinedType (module, MemberKind.Class, "System", "FormattableString");
|
||||
FormattableStringFactory = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "FormattableStringFactory");
|
||||
|
||||
SpanGeneric = new PredefinedType (module, MemberKind.Struct, "System", "Span", 1);
|
||||
|
||||
//
|
||||
// Define types which are used for comparison. It does not matter
|
||||
// if they don't exist as no error report is needed
|
||||
@ -348,6 +351,8 @@ namespace Mono.CSharp
|
||||
if (pt.Define ())
|
||||
pt.TypeSpec.IsTupleType = true;
|
||||
}
|
||||
|
||||
SpanGeneric.Define ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,6 +435,7 @@ namespace Mono.CSharp
|
||||
ArrayEmpty = new PredefinedMember<MethodSpec> (module, types.Array,
|
||||
MemberFilter.Method ("Empty", 1, ParametersCompiled.EmptyReadOnlyParameters, null));
|
||||
|
||||
// TODO: Must me static
|
||||
AsyncTaskMethodBuilderCreate = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder,
|
||||
MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncTaskMethodBuilder.TypeSpec));
|
||||
|
||||
@ -485,6 +491,7 @@ namespace Mono.CSharp
|
||||
AsyncTaskMethodBuilderTask = new PredefinedMember<PropertySpec> (module, types.AsyncTaskMethodBuilder,
|
||||
MemberFilter.Property ("Task", null));
|
||||
|
||||
// TODO: Must me static
|
||||
AsyncTaskMethodBuilderGenericCreate = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilderGeneric,
|
||||
MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncVoidMethodBuilder.TypeSpec));
|
||||
|
||||
@ -542,6 +549,7 @@ namespace Mono.CSharp
|
||||
AsyncTaskMethodBuilderGenericTask = new PredefinedMember<PropertySpec> (module, types.AsyncTaskMethodBuilderGeneric,
|
||||
MemberFilter.Property ("Task", null));
|
||||
|
||||
// TODO: Must me static
|
||||
AsyncVoidMethodBuilderCreate = new PredefinedMember<MethodSpec> (module, types.AsyncVoidMethodBuilder,
|
||||
MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncVoidMethodBuilder.TypeSpec));
|
||||
|
||||
@ -1006,9 +1014,6 @@ namespace Mono.CSharp
|
||||
|
||||
public T Resolve (Location loc)
|
||||
{
|
||||
if (member != null)
|
||||
return member;
|
||||
|
||||
if (Get () != null)
|
||||
return member;
|
||||
|
||||
|
@ -1454,6 +1454,7 @@ namespace Mono.CSharp
|
||||
int TypeParametersCount { get; }
|
||||
TypeParameterSpec[] TypeParameters { get; }
|
||||
|
||||
TypeSpec GetAsyncMethodBuilder ();
|
||||
TypeSpec GetAttributeCoClass ();
|
||||
string GetAttributeDefaultMember ();
|
||||
AttributeUsageAttribute GetAttributeUsage (PredefinedAttribute pa);
|
||||
@ -1588,6 +1589,11 @@ namespace Mono.CSharp
|
||||
|
||||
#region ITypeDefinition Members
|
||||
|
||||
TypeSpec ITypeDefinition.GetAsyncMethodBuilder ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
TypeSpec ITypeDefinition.GetAttributeCoClass ()
|
||||
{
|
||||
return null;
|
||||
@ -1776,6 +1782,11 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
public TypeSpec GetAsyncMethodBuilder ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public TypeSpec GetAttributeCoClass ()
|
||||
{
|
||||
return Element.MemberDefinition.GetAttributeCoClass ();
|
||||
|
16
mcs/tests/test-948.cs
Normal file
16
mcs/tests/test-948.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Compiler options: -langversion:7.2 -unsafe
|
||||
|
||||
using System;
|
||||
|
||||
class X
|
||||
{
|
||||
public static void Main ()
|
||||
{
|
||||
Span<int> stackSpan = stackalloc int[100];
|
||||
}
|
||||
|
||||
unsafe void Foo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
127
mcs/tests/test-async-94.cs
Normal file
127
mcs/tests/test-async-94.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[AsyncMethodBuilder (typeof(MyTaskMethodBuilder<>))]
|
||||
class MyTask<T>
|
||||
{
|
||||
}
|
||||
|
||||
[AsyncMethodBuilder (typeof(MyTaskMethodBuilder))]
|
||||
class MyTask
|
||||
{
|
||||
}
|
||||
|
||||
class MyTaskMethodBuilder
|
||||
{
|
||||
public static MyTaskMethodBuilder Create()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public MyTask Task {
|
||||
get {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetException (Exception exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetResult ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AwaitOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Start<TStateMachine> (ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetStateMachine (IAsyncStateMachine stateMachine)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MyTaskMethodBuilder<T>
|
||||
{
|
||||
public static MyTaskMethodBuilder<T> Create()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public MyTask<T> Task {
|
||||
get {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetException (Exception exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetResult (T result)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AwaitOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine> (ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Start<TStateMachine> (ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetStateMachine (IAsyncStateMachine stateMachine)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class X
|
||||
{
|
||||
public async MyTask Test ()
|
||||
{
|
||||
await Task.Delay (1);
|
||||
}
|
||||
|
||||
public async MyTask<int> Test2 ()
|
||||
{
|
||||
await Task.Delay (1);
|
||||
return 2;
|
||||
}
|
||||
|
||||
public async ValueTask<string> Test3 ()
|
||||
{
|
||||
await Task.Delay (1);
|
||||
return "as";
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
var x = new X ();
|
||||
var r1 = x.Test3 ().Result;
|
||||
}
|
||||
}
|
16
mcs/tests/test-readonly-03.cs
Normal file
16
mcs/tests/test-readonly-03.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Compiler options: -langversion:latest
|
||||
using System;
|
||||
|
||||
readonly struct S
|
||||
{
|
||||
static S shared = new S ();
|
||||
|
||||
public S (int arg)
|
||||
{
|
||||
this = shared;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
}
|
||||
}
|
24
mcs/tests/test-ref-10.cs
Normal file
24
mcs/tests/test-ref-10.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// Compiler options: -langversion:latest
|
||||
|
||||
using System;
|
||||
|
||||
ref struct ValueStringBuilder
|
||||
{
|
||||
public override string ToString ()
|
||||
{
|
||||
return "aaa";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class X
|
||||
{
|
||||
public static int Main ()
|
||||
{
|
||||
var s = new ValueStringBuilder ();
|
||||
if (s.ToString () != "aaa")
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
4e488c37bc46fed416be09476a01fed86a94ba5e
|
||||
4dbc7042a8a8252f26b40788a5460fbf138e5b46
|
@ -821,6 +821,11 @@ typedef struct {
|
||||
void mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies);
|
||||
void mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
|
||||
");
|
||||
|
||||
// These values are part of the public API, so they are expected not to change
|
||||
tc.WriteLine("#define MONO_AOT_MODE_NORMAL 1");
|
||||
tc.WriteLine("#define MONO_AOT_MODE_FULL 3");
|
||||
tc.WriteLine("#define MONO_AOT_MODE_LLVMONLY 4");
|
||||
} else {
|
||||
tc.WriteLine ("#include <mono/metadata/mono-config.h>");
|
||||
tc.WriteLine ("#include <mono/metadata/assembly.h>\n");
|
||||
|
@ -1 +1 @@
|
||||
fa050c7d79f62e040d8997246d7e2dc715f9d05b
|
||||
d6a633d3b240e5bd794a91bd7e48897acaa7fc64
|
@ -1 +1 @@
|
||||
#define FULL_VERSION "explicit/94fa6e5"
|
||||
#define FULL_VERSION "explicit/e87f9d7"
|
||||
|
BIN
po/mcs/de.gmo
BIN
po/mcs/de.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
bedee19c69662447845648dc66e8e47a43644128
|
||||
da8f1364e436f162752907da2e26c20ea9ac161c
|
BIN
po/mcs/es.gmo
BIN
po/mcs/es.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
7155f3bc3eed5336428e7599a3950cdeece8507f
|
||||
c6396bb9a350263cb5f35de2bbf5bcdf7f6a7407
|
BIN
po/mcs/ja.gmo
BIN
po/mcs/ja.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
a7da8cdcf0efaa86d5b0e16899cfc2c52dd06560
|
||||
89e4e228d152cb3572b8074df47cbf593ae4b73f
|
539
po/mcs/mcs.pot
539
po/mcs/mcs.pot
File diff suppressed because it is too large
Load Diff
BIN
po/mcs/pt_BR.gmo
BIN
po/mcs/pt_BR.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
a40a4e7f3a6f233e6afa13e4a33b434134da328f
|
||||
7fdfb7dd15beb1e0153cff685188a25415de0f86
|
Loading…
x
Reference in New Issue
Block a user