Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
33e17d11
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
33e17d11
编写于
9月 10, 2020
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix tests
上级
61f2563a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
10 deletion
+29
-10
src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests_NativeInteger.cs
...harp/Test/Emit/Attributes/AttributeTests_NativeInteger.cs
+8
-7
src/Compilers/CSharp/Test/Symbol/Symbols/ExtendedPartialMethodsTests.cs
...CSharp/Test/Symbol/Symbols/ExtendedPartialMethodsTests.cs
+21
-3
未找到文件。
src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests_NativeInteger.cs
浏览文件 @
33e17d11
...
...
@@ -1249,6 +1249,7 @@ static void Main()
}
[
Fact
]
[
WorkItem
(
45519
,
"https://github.com/dotnet/roslyn/issues/45519"
)]
public
void
EmitAttribute_PartialMethods
()
{
var
source
=
...
...
@@ -1260,13 +1261,13 @@ public void EmitAttribute_PartialMethods()
static partial void F2(nuint x);
}"
;
var
comp
=
CreateCompilation
(
source
,
options
:
TestOptions
.
ReleaseDll
.
WithMetadataImportOptions
(
MetadataImportOptions
.
All
),
parseOptions
:
TestOptions
.
Regular9
);
// Ideally should not emit any attributes. Compare with dynamic/object.
var
expected
=
@"Program
void F2(System.UIntPtr x)
[NativeInteger] System.UIntPtr x
"
;
AssertNativeIntegerAttributes
(
comp
,
expected
);
comp
.
VerifyEmitDiagnostics
(
// (4,25): error CS8824: Partial method declarations 'void Program.F2(nuint x)' and 'void Program.F2(UIntPtr x)' must have identical parameter types and identical return types.
// static partial void F2(System.UIntPtr x) { }
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"F2"
).
WithArguments
(
"void Program.F2(nuint x)"
,
"void Program.F2(UIntPtr x)"
).
WithLocation
(
4
,
25
),
// (5,25): error CS8824: Partial method declarations 'void Program.F1(IntPtr x)' and 'void Program.F1(nint x)' must have identical parameter types and identical return types.
// static partial void F1(nint x) { }
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"F1"
).
WithArguments
(
"void Program.F1(IntPtr x)"
,
"void Program.F1(nint x)"
).
WithLocation
(
5
,
25
)
);
}
// Shouldn't depend on [NullablePublicOnly].
...
...
src/Compilers/CSharp/Test/Symbol/Symbols/ExtendedPartialMethodsTests.cs
浏览文件 @
33e17d11
...
...
@@ -2687,7 +2687,13 @@ partial class C
public partial IEnumerable<string> M2() => null!;
}"
;
var
comp
=
CreateCompilation
(
source
,
parseOptions
:
TestOptions
.
RegularWithExtendedPartialMethods
);
comp
.
VerifyDiagnostics
();
comp
.
VerifyDiagnostics
(
// (8,27): error CS8824: Partial method declarations 'string? C.M1()' and 'string C.M1()' must have identical parameter types and identical return types.
// public partial string M1() => "hello";
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"M1"
).
WithArguments
(
"string? C.M1()"
,
"string C.M1()"
).
WithLocation
(
8
,
27
),
// (11,40): error CS8824: Partial method declarations 'IEnumerable<string?> C.M2()' and 'IEnumerable<string> C.M2()' must have identical parameter types and identical return types.
// public partial IEnumerable<string> M2() => null!;
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"M2"
).
WithArguments
(
"IEnumerable<string?> C.M2()"
,
"IEnumerable<string> C.M2()"
).
WithLocation
(
11
,
40
));
}
[
Fact
,
WorkItem
(
44930
,
"https://github.com/dotnet/roslyn/issues/44930"
)]
...
...
@@ -2967,7 +2973,13 @@ partial class C
public partial object M2() => null;
}"
;
var
comp
=
CreateCompilation
(
source
,
parseOptions
:
TestOptions
.
RegularWithExtendedPartialMethods
);
comp
.
VerifyDiagnostics
();
comp
.
VerifyDiagnostics
(
// (5,28): error CS8824: Partial method declarations 'object C.M1()' and 'dynamic C.M1()' must have identical parameter types and identical return types.
// public partial dynamic M1() => null;
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"M1"
).
WithArguments
(
"object C.M1()"
,
"dynamic C.M1()"
).
WithLocation
(
5
,
28
),
// (8,27): error CS8824: Partial method declarations 'dynamic C.M2()' and 'object C.M2()' must have identical parameter types and identical return types.
// public partial object M2() => null;
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"M2"
).
WithArguments
(
"dynamic C.M2()"
,
"object C.M2()"
).
WithLocation
(
8
,
27
));
}
[
Fact
,
WorkItem
(
44930
,
"https://github.com/dotnet/roslyn/issues/44930"
)]
...
...
@@ -2985,7 +2997,13 @@ partial class C
public partial IntPtr M2() => default;
}"
;
var
comp
=
CreateCompilation
(
source
,
parseOptions
:
TestOptions
.
RegularWithExtendedPartialMethods
);
comp
.
VerifyDiagnostics
();
comp
.
VerifyDiagnostics
(
// (7,25): error CS8824: Partial method declarations 'IntPtr C.M1()' and 'nint C.M1()' must have identical parameter types and identical return types.
// public partial nint M1() => 0;
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"M1"
).
WithArguments
(
"IntPtr C.M1()"
,
"nint C.M1()"
).
WithLocation
(
7
,
25
),
// (10,27): error CS8824: Partial method declarations 'nint C.M2()' and 'IntPtr C.M2()' must have identical parameter types and identical return types.
// public partial IntPtr M2() => default;
Diagnostic
(
ErrorCode
.
ERR_PartialMethodSignatureDifference
,
"M2"
).
WithArguments
(
"nint C.M2()"
,
"IntPtr C.M2()"
).
WithLocation
(
10
,
27
));
}
[
Fact
,
WorkItem
(
44930
,
"https://github.com/dotnet/roslyn/issues/44930"
)]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录