Practice thinking like a compiler tester, part three


Yesterday I posed a slightly harder version of the puzzle I posted the day before

Reader Steve found a solution: 

public class C : A {}
public class A {
    public class D : C {}
}

See his comment for the trace of the logic that shows why this asserts.  

The scenario that our testers found which triggered the assertion is just slightly more complex, but basically the same idea:

public class C : A.B {}
public class A {
    public class B {}
    public class D : C {}
}

Tricky! 

Fortunately, the problem was that the assertion and comment was wrong, not the program logic.

Comments (1)

  1. Visual Studio Orcas Beta 1 is available for download . Though quite similar to the March CTP in terms