Skip to content

Commit ccb980a

Browse files
authored
Silence compile-time warnings (#2725)
1 parent baa4819 commit ccb980a

4 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/embed_tests/Events.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ public ClassWithEventHandler()
4848
this.arr = new int[800];
4949
}
5050

51+
// Reference LeakEvent to silence warning
52+
protected virtual void OnLeakEvent(EventArgs e)
53+
{
54+
LeakEvent?.Invoke(this, e);
55+
}
56+
5157
~ClassWithEventHandler()
5258
{
5359
Interlocked.Decrement(ref alive);

src/runtime/PythonTypes/PyFloat.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,7 @@ public static PyFloat AsFloat(PyObject value)
103103
public double ToDouble() => Runtime.PyFloat_AsDouble(obj);
104104

105105
public override TypeCode GetTypeCode() => TypeCode.Double;
106+
107+
public override int GetHashCode() => base.GetHashCode();
106108
}
107109
}

src/runtime/PythonTypes/PyInt.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,7 @@ public string ToString(string format, IFormatProvider formatProvider)
232232
}
233233

234234
public override TypeCode GetTypeCode() => TypeCode.Int64;
235+
236+
public override int GetHashCode() => base.GetHashCode();
235237
}
236238
}

src/runtime/Util/ReflectionPolyfills.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static AssemblyBuilder DefineDynamicAssembly(this AppDomain _, AssemblyNa
1414

1515
public static Type CreateType(this TypeBuilder typeBuilder)
1616
{
17-
return typeBuilder.CreateTypeInfo();
17+
return typeBuilder.CreateTypeInfo()!;
1818
}
1919

2020
public static T GetCustomAttribute<T>(this Type type) where T: Attribute

0 commit comments

Comments
 (0)