Skip to content

Commit c2a4235

Browse files
committed
C#: Add type-mention tests with nullability
1 parent 1c8547c commit c2a4235

File tree

6 files changed

+92
-0
lines changed

6 files changed

+92
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
3+
#nullable disable
4+
5+
public class Base { }
6+
public class Derived : Base { }
7+
public interface I0 { }
8+
public interface I1 : I0 { }
9+
public struct Str : I1 { }
10+
11+
public class C1
12+
{
13+
public void M1()
14+
{
15+
Derived? d0 = new Derived();
16+
Derived d1 = new Derived();
17+
Str? s0 = new Str();
18+
Str s1 = new Str();
19+
I1? i0 = new Str();
20+
I1 i1 = new Str();
21+
}
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
| Program.cs:6:24:6:27 | Base |
2+
| Program.cs:6:24:6:27 | Base |
3+
| Program.cs:8:23:8:24 | I0 |
4+
| Program.cs:8:23:8:24 | I0 |
5+
| Program.cs:9:21:9:22 | I1 |
6+
| Program.cs:13:12:13:15 | Void |
7+
| Program.cs:15:9:15:15 | Derived |
8+
| Program.cs:15:27:15:33 | Derived |
9+
| Program.cs:16:9:16:15 | Derived |
10+
| Program.cs:16:26:16:32 | Derived |
11+
| Program.cs:17:9:17:11 | Str |
12+
| Program.cs:17:9:17:12 | Nullable<Str> |
13+
| Program.cs:17:23:17:25 | Str |
14+
| Program.cs:18:9:18:11 | Str |
15+
| Program.cs:18:22:18:24 | Str |
16+
| Program.cs:19:9:19:10 | I1 |
17+
| Program.cs:19:22:19:24 | Str |
18+
| Program.cs:20:9:20:10 | I1 |
19+
| Program.cs:20:21:20:23 | Str |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import csharp
2+
3+
from TypeMention tm
4+
select tm
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
3+
#nullable enable
4+
5+
public class Base { }
6+
public class Derived : Base { }
7+
public interface I0 { }
8+
public interface I1 : I0 { }
9+
public struct Str : I1 { }
10+
11+
public class C1
12+
{
13+
public void M1()
14+
{
15+
Derived? d0 = new Derived();
16+
Derived d1 = new Derived();
17+
Str? s0 = new Str();
18+
Str s1 = new Str();
19+
I1? i0 = new Str();
20+
I1 i1 = new Str();
21+
}
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
| Program.cs:6:24:6:27 | Base |
2+
| Program.cs:6:24:6:27 | Base |
3+
| Program.cs:6:24:6:27 | Base |
4+
| Program.cs:8:23:8:24 | I0 |
5+
| Program.cs:8:23:8:24 | I0 |
6+
| Program.cs:8:23:8:24 | I0 |
7+
| Program.cs:9:21:9:22 | I1 |
8+
| Program.cs:13:12:13:15 | Void |
9+
| Program.cs:15:9:15:15 | Derived |
10+
| Program.cs:15:27:15:33 | Derived |
11+
| Program.cs:16:9:16:15 | Derived |
12+
| Program.cs:16:26:16:32 | Derived |
13+
| Program.cs:17:9:17:11 | Str |
14+
| Program.cs:17:9:17:12 | Nullable<Str> |
15+
| Program.cs:17:23:17:25 | Str |
16+
| Program.cs:18:9:18:11 | Str |
17+
| Program.cs:18:22:18:24 | Str |
18+
| Program.cs:19:9:19:10 | I1 |
19+
| Program.cs:19:22:19:24 | Str |
20+
| Program.cs:20:9:20:10 | I1 |
21+
| Program.cs:20:21:20:23 | Str |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import csharp
2+
3+
from TypeMention tm
4+
select tm

0 commit comments

Comments
 (0)