mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
Add extra information to nullable conversion test file
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
class C
|
||||
{
|
||||
sbyte x1;
|
||||
sbyte? x2;
|
||||
int x1;
|
||||
int? x2;
|
||||
Nullable<int> x3;
|
||||
Nullable<char> x4;
|
||||
|
||||
// Verify conversions
|
||||
void M()
|
||||
{
|
||||
x2 = x1;
|
||||
x3 = x4;
|
||||
x2 = x1; // T -> T? conversion: implicit, nullable -> implicit cast
|
||||
x3 = x4; // T1? -> T2? conversion: implicit, nullable -> implicit cast
|
||||
|
||||
x12 = x1; // T1 -> T2? conversion: implicit, nullable -> implicit cast
|
||||
x12 = null; // null -> T? conversion: implicit, null literal -> no cast
|
||||
|
||||
x3 = x2; // T? -> T? no conversion
|
||||
|
||||
x14 = x15; // T1? -> T2? conversion: implicit, user defined -> implicit cast
|
||||
}
|
||||
|
||||
// Cause the following types to exist in the database:
|
||||
sbyte? x0;
|
||||
byte? x5;
|
||||
short? x6;
|
||||
ushort? x7;
|
||||
@@ -24,4 +33,19 @@ class C
|
||||
double? x11;
|
||||
long? x12;
|
||||
float? x13;
|
||||
|
||||
A? x14;
|
||||
B? x15;
|
||||
|
||||
struct A
|
||||
{
|
||||
}
|
||||
|
||||
struct B
|
||||
{
|
||||
public static implicit operator A(B value)
|
||||
{
|
||||
return new A();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user