@@ -49,7 +49,35 @@ void run()
49
49
throw new Exception ( "non-null pointer marshalling problem" ) ;
50
50
myNewBar . x = 10 ;
51
51
52
- my . testSwigDerivedClassHasMethod ( ) ;
52
+ // Low level implementation check
53
+ // my.testSwigDerivedClassHasMethod();
54
+
55
+ // These should not call the C# implementations as they are not overridden
56
+ int v ;
57
+ v = MyClass . call_nonVirtual ( my ) ;
58
+ if ( v != 100 ) throw new Exception ( "call_nonVirtual broken() " + v ) ;
59
+
60
+ v = MyClass . call_nonOverride ( my ) ;
61
+ if ( v != 101 ) throw new Exception ( "call_nonOverride broken() " + v ) ;
62
+
63
+ // A mix of overridden and non-overridden
64
+ MyClassEnd myend = new MyClassEnd ( ) ;
65
+ MyClass mc = myend ;
66
+
67
+ v = mc . nonVirtual ( ) ;
68
+ if ( v != 202 ) throw new Exception ( "mc.nonVirtual() broken " + v ) ;
69
+
70
+ v = MyClass . call_nonVirtual ( mc ) ;
71
+ if ( v != 202 ) throw new Exception ( "call_nonVirtual(mc) broken " + v ) ;
72
+
73
+ v = MyClass . call_nonVirtual ( myend ) ;
74
+ if ( v != 202 ) throw new Exception ( "call_nonVirtual(myend) broken" + v ) ;
75
+
76
+ v = MyClass . call_nonOverride ( mc ) ;
77
+ if ( v != 101 ) throw new Exception ( "call_nonOverride(mc) broken" + v ) ;
78
+
79
+ v = MyClass . call_nonOverride ( myend ) ;
80
+ if ( v != 101 ) throw new Exception ( "call_nonOverride(myend) broken" + v ) ;
53
81
}
54
82
}
55
83
}
@@ -81,4 +109,20 @@ public override Bar pmethod(Bar b) {
81
109
}
82
110
}
83
111
112
+ class MyClassMiddle : MyClass {
113
+ public override int nonVirtual ( ) {
114
+ return 202 ;
115
+ }
116
+ }
117
+
118
+ class MyClassEnd : MyClassMiddle {
119
+ public new bool nonVirtual ( ) {
120
+ throw new Exception ( "non-virtual overrides virtual method" ) ;
121
+ }
122
+
123
+ public new virtual bool nonOverride ( ) {
124
+ throw new Exception ( "non-override overrides virtual method" ) ;
125
+ }
126
+ }
127
+
84
128
}
0 commit comments