提交 3f8cf8de 编写于 作者: J Julien Couvreur 提交者: Julien Couvreur

Fix tests to use new test APIs. Skip tests related to default

上级 6ed8aea7
......@@ -449,7 +449,7 @@ class D3
setZ
setX
";
var comp = CompileAndVerify(source, expectedOutput: expected, additionalRefs: s_valueTupleRefs);
var comp = CompileAndVerify(source, expectedOutput: expected);
comp.VerifyDiagnostics();
}
......
......@@ -1239,71 +1239,73 @@ static void Main()
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default(MyType?)").WithArguments("!=", "MyType?", "MyType?").WithLocation(15, 14)
);
// PROTOTYPE(tuple-equality) Default
// struct ValueTuple doesn't have an == operator
validate("class", "(int, int)", "(1, 2)", "false", "System.Object",
// (8,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and 'default'
// if ((x == default) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default").WithArguments("==", "(int, int)", "default").WithLocation(8, 14),
// (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'default' and '(int, int)'
// if ((default == x) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "default == x").WithArguments("==", "default", "(int, int)").WithLocation(9, 14),
// (11,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and 'default'
// if ((x != default) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default").WithArguments("!=", "(int, int)", "default").WithLocation(11, 14),
// (12,14): error CS0019: Operator '!=' cannot be applied to operands of type 'default' and '(int, int)'
// if ((default != x) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "default != x").WithArguments("!=", "default", "(int, int)").WithLocation(12, 14),
// (14,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and '(int, int)'
// if ((x == default((int, int))) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default((int, int))").WithArguments("==", "(int, int)", "(int, int)").WithLocation(14, 14),
// (15,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and '(int, int)'
// if ((x != default((int, int))) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default((int, int))").WithArguments("!=", "(int, int)", "(int, int)").WithLocation(15, 14)
);
//validate("class", "(int, int)", "(1, 2)", "false", "System.Object",
// // (8,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and 'default'
// // if ((x == default) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default").WithArguments("==", "(int, int)", "default").WithLocation(8, 14),
// // (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'default' and '(int, int)'
// // if ((default == x) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "default == x").WithArguments("==", "default", "(int, int)").WithLocation(9, 14),
// // (11,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and 'default'
// // if ((x != default) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default").WithArguments("!=", "(int, int)", "default").WithLocation(11, 14),
// // (12,14): error CS0019: Operator '!=' cannot be applied to operands of type 'default' and '(int, int)'
// // if ((default != x) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "default != x").WithArguments("!=", "default", "(int, int)").WithLocation(12, 14),
// // (14,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and '(int, int)'
// // if ((x == default((int, int))) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default((int, int))").WithArguments("==", "(int, int)", "(int, int)").WithLocation(14, 14),
// // (15,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and '(int, int)'
// // if ((x != default((int, int))) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default((int, int))").WithArguments("!=", "(int, int)", "(int, int)").WithLocation(15, 14)
// );
// struct ValueTuple doesn't have an == operator
validate("class", "(int, int)", "(0, 0)", "false", "System.Object",
// (8,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and 'default'
// if ((x == default) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default").WithArguments("==", "(int, int)", "default").WithLocation(8, 14),
// (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'default' and '(int, int)'
// if ((default == x) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "default == x").WithArguments("==", "default", "(int, int)").WithLocation(9, 14),
// (11,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and 'default'
// if ((x != default) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default").WithArguments("!=", "(int, int)", "default").WithLocation(11, 14),
// (12,14): error CS0019: Operator '!=' cannot be applied to operands of type 'default' and '(int, int)'
// if ((default != x) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "default != x").WithArguments("!=", "default", "(int, int)").WithLocation(12, 14),
// (14,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and '(int, int)'
// if ((x == default((int, int))) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default((int, int))").WithArguments("==", "(int, int)", "(int, int)").WithLocation(14, 14),
// (15,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and '(int, int)'
// if ((x != default((int, int))) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default((int, int))").WithArguments("!=", "(int, int)", "(int, int)").WithLocation(15, 14)
);
//validate("class", "(int, int)", "(0, 0)", "false", "System.Object",
// // (8,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and 'default'
// // if ((x == default) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default").WithArguments("==", "(int, int)", "default").WithLocation(8, 14),
// // (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'default' and '(int, int)'
// // if ((default == x) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "default == x").WithArguments("==", "default", "(int, int)").WithLocation(9, 14),
// // (11,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and 'default'
// // if ((x != default) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default").WithArguments("!=", "(int, int)", "default").WithLocation(11, 14),
// // (12,14): error CS0019: Operator '!=' cannot be applied to operands of type 'default' and '(int, int)'
// // if ((default != x) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "default != x").WithArguments("!=", "default", "(int, int)").WithLocation(12, 14),
// // (14,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)' and '(int, int)'
// // if ((x == default((int, int))) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default((int, int))").WithArguments("==", "(int, int)", "(int, int)").WithLocation(14, 14),
// // (15,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)' and '(int, int)'
// // if ((x != default((int, int))) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default((int, int))").WithArguments("!=", "(int, int)", "(int, int)").WithLocation(15, 14)
// );
// struct ValueTuple doesn't have an == operator, so no lifted == on ValueTuple?
validate("class", "(int, int)?", "(0, 0)", "false", "System.Object",
// (8,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)?' and 'default'
// if ((x == default) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default").WithArguments("==", "(int, int)?", "default").WithLocation(8, 14),
// (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'default' and '(int, int)?'
// if ((default == x) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "default == x").WithArguments("==", "default", "(int, int)?").WithLocation(9, 14),
// (11,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)?' and 'default'
// if ((x != default) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default").WithArguments("!=", "(int, int)?", "default").WithLocation(11, 14),
// (12,14): error CS0019: Operator '!=' cannot be applied to operands of type 'default' and '(int, int)?'
// if ((default != x) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "default != x").WithArguments("!=", "default", "(int, int)?").WithLocation(12, 14),
// (14,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)?' and '(int, int)?'
// if ((x == default((int, int)?)) != false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default((int, int)?)").WithArguments("==", "(int, int)?", "(int, int)?").WithLocation(14, 14),
// (15,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)?' and '(int, int)?'
// if ((x != default((int, int)?)) == false) throw null;
Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default((int, int)?)").WithArguments("!=", "(int, int)?", "(int, int)?").WithLocation(15, 14)
);
//validate("class", "(int, int)?", "(0, 0)", "false", "System.Object",
// // (8,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)?' and 'default'
// // if ((x == default) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default").WithArguments("==", "(int, int)?", "default").WithLocation(8, 14),
// // (9,14): error CS0019: Operator '==' cannot be applied to operands of type 'default' and '(int, int)?'
// // if ((default == x) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "default == x").WithArguments("==", "default", "(int, int)?").WithLocation(9, 14),
// // (11,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)?' and 'default'
// // if ((x != default) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default").WithArguments("!=", "(int, int)?", "default").WithLocation(11, 14),
// // (12,14): error CS0019: Operator '!=' cannot be applied to operands of type 'default' and '(int, int)?'
// // if ((default != x) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "default != x").WithArguments("!=", "default", "(int, int)?").WithLocation(12, 14),
// // (14,14): error CS0019: Operator '==' cannot be applied to operands of type '(int, int)?' and '(int, int)?'
// // if ((x == default((int, int)?)) != false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x == default((int, int)?)").WithArguments("==", "(int, int)?", "(int, int)?").WithLocation(14, 14),
// // (15,14): error CS0019: Operator '!=' cannot be applied to operands of type '(int, int)?' and '(int, int)?'
// // if ((x != default((int, int)?)) == false) throw null;
// Diagnostic(ErrorCode.ERR_BadBinaryOps, "x != default((int, int)?)").WithArguments("!=", "(int, int)?", "(int, int)?").WithLocation(15, 14)
// );
void validate(string modifier, string type, string value, string equal, string semanticType, params DiagnosticDescription[] diagnostics)
{
......@@ -1334,8 +1336,9 @@ void validateLangVer(string modifier, string type, string value, string equal, s
foreach (var @default in defaults)
{
Assert.Equal("default", @default.ToString());
Assert.Equal(semanticType, model.GetTypeInfo(@default).Type.ToTestDisplayString());
Assert.Equal(semanticType, model.GetTypeInfo(@default).ConvertedType.ToTestDisplayString());
// PROTOTYPE(tuple-equality) Default
//Assert.Equal(semanticType, model.GetTypeInfo(@default).Type.ToTestDisplayString());
//Assert.Equal(semanticType, model.GetTypeInfo(@default).ConvertedType.ToTestDisplayString());
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册