File tree Expand file tree Collapse file tree 3 files changed +38
-6
lines changed
csharp/ql/test/library-tests/dispatch Expand file tree Collapse file tree 3 files changed +38
-6
lines changed Original file line number Diff line number Diff line change 174174| ViableCallable.cs:409:10:409:12 | Run | ViableCallable.cs:397:36:397:40 | M |
175175| ViableCallable.cs:409:10:409:12 | Run | ViableCallable.cs:403:53:403:57 | M |
176176| ViableCallable.cs:409:10:409:12 | Run | ViableCallable.cs:405:42:405:46 | M |
177- | ViableCallable.cs:431:25:431:29 | M2 | ViableCallable.cs:442:17:442:23 | (...) => ... |
178- | ViableCallable.cs:436:10:436:10 | M | ViableCallable.cs:430:23:430:24 | M1 |
179- | ViableCallable.cs:436:10:436:10 | M | ViableCallable.cs:431:25:431:29 | M2 |
177+ | ViableCallable.cs:431:22:431:26 | M2 | ViableCallable.cs:456:14:456:29 | (...) => ... |
178+ | ViableCallable.cs:431:22:431:26 | M2 | ViableCallable.cs:462:14:462:29 | (...) => ... |
179+ | ViableCallable.cs:436:10:436:11 | M1 | ViableCallable.cs:430:23:430:24 | M1 |
180+ | ViableCallable.cs:436:10:436:11 | M1 | ViableCallable.cs:445:23:445:27 | M2 |
181+ | ViableCallable.cs:445:23:445:27 | M2 | ViableCallable.cs:442:17:442:23 | (...) => ... |
182+ | ViableCallable.cs:445:23:445:27 | M2 | ViableCallable.cs:456:14:456:29 | (...) => ... |
183+ | ViableCallable.cs:445:23:445:27 | M2 | ViableCallable.cs:462:14:462:29 | (...) => ... |
184+ | ViableCallable.cs:453:10:453:14 | M4 | ViableCallable.cs:431:22:431:26 | M2 |
185+ | ViableCallable.cs:453:10:453:14 | M4 | ViableCallable.cs:445:23:445:27 | M2 |
186+ | ViableCallable.cs:459:10:459:14 | M5 | ViableCallable.cs:431:22:431:26 | M2 |
187+ | ViableCallable.cs:459:10:459:14 | M5 | ViableCallable.cs:445:23:445:27 | M2 |
Original file line number Diff line number Diff line change 401401| ViableCallable.cs:424:9:424:21 | call to method M | C15.A4.M<T1>() |
402402| ViableCallable.cs:424:9:424:21 | call to method M | C15.A5.M<T1>() |
403403| ViableCallable.cs:439:9:439:19 | call to method M1 | C16<String,Int32>.M1(string) |
404- | ViableCallable.cs:442:9:442:24 | call to method M2 | C16<String,Int32>.M2<T>(Func<T>) |
404+ | ViableCallable.cs:442:9:442:24 | call to method M2 | C17.M2<T>(Func<T>) |
405+ | ViableCallable.cs:456:9:456:30 | call to method M2 | C16<T,Int32>.M2<T>(Func<T>) |
406+ | ViableCallable.cs:456:9:456:30 | call to method M2 | C17.M2<T>(Func<T>) |
407+ | ViableCallable.cs:462:9:462:30 | call to method M2 | C16<T,Int32>.M2<T>(Func<T>) |
408+ | ViableCallable.cs:462:9:462:30 | call to method M2 | C17.M2<T>(Func<T>) |
Original file line number Diff line number Diff line change @@ -428,17 +428,37 @@ void Run(I<int> i)
428428abstract class C16 < T1 , T2 >
429429{
430430 public virtual T2 M1 ( T1 x ) => throw null ;
431- protected virtual T M2 < T > ( Func < T > x ) => x ( ) ;
431+ public virtual T M2 < T > ( Func < T > x ) => x ( ) ;
432432}
433433
434434class C17 : C16 < string , int >
435435{
436- void M ( int i )
436+ void M1 ( int i )
437437 {
438438 // Viable callables: C16<string, int>.M1()
439439 this . M1 ( "" ) ;
440440
441441 // Viable callables: C16<string, int>.M2<int>()
442442 this . M2 ( ( ) => i ) ;
443443 }
444+
445+ public override T M2 < T > ( Func < T > x ) => x ( ) ;
446+
447+ void M3 < T > ( T t , string s ) where T : C17
448+ {
449+ // Viable callable: C17.M2()
450+ t . M2 ( ( ) => s ) ;
451+ }
452+
453+ void M4 < T > ( C16 < T , int > c ) where T : struct
454+ {
455+ // Viable callable: C16.M2() [also reports C17.M2(); false positive]
456+ c . M2 ( ( ) => default ( T ) ) ;
457+ }
458+
459+ void M5 < T > ( C16 < T , int > c ) where T : class
460+ {
461+ // Viable callables: {C16,C17}.M1()
462+ c . M2 ( ( ) => default ( T ) ) ;
463+ }
444464}
You can’t perform that action at this time.
0 commit comments