C#: Stub generator support for explicit interface implementations of explicit conversion operators including test cases.

This commit is contained in:
Michael Nebel
2023-02-28 10:57:59 +01:00
parent 59349ed7c7
commit d8acc7cd17
3 changed files with 9 additions and 4 deletions

View File

@@ -744,9 +744,9 @@ private string stubOperator(Operator o, Assembly assembly) {
if o instanceof ConversionOperator
then
result =
" " + stubModifiers(o) + stubExplicit(o) + "operator " + stubChecked(o) +
stubClassName(o.getReturnType()) + "(" + stubParameters(o) + ")" + stubImplementation(o) +
";\n"
" " + stubModifiers(o) + stubExplicit(o) + stubExplicitImplementation(o) + "operator " +
stubChecked(o) + stubClassName(o.getReturnType()) + "(" + stubParameters(o) + ")" +
stubImplementation(o) + ";\n"
else
if not o.getDeclaringType() instanceof Enum
then

File diff suppressed because one or more lines are too long

View File

@@ -146,6 +146,8 @@ namespace Test
static virtual T operator -(T left, T right) => throw null;
static abstract T operator *(T left, T right);
static virtual T operator /(T left, T right) => throw null;
static abstract explicit operator short(T n);
static abstract explicit operator int(T n);
void M1();
void M2();
}
@@ -154,6 +156,7 @@ namespace Test
{
static abstract T operator +(T left, T right);
static virtual T operator -(T left, T right) => throw null;
static abstract explicit operator short(T n);
void M1();
}
@@ -165,6 +168,8 @@ namespace Test
static Class11 IInterface2<Class11>.operator /(Class11 left, Class11 right) => throw null;
public void M1() => throw null;
void IInterface2<Class11>.M2() => throw null;
public static explicit operator short(Class11 n) => 0;
static explicit IInterface2<Class11>.operator int(Class11 n) => 0;
}
public enum Enum1