Practice thinking like a compiler tester, part three

Practice thinking like a compiler tester, part three

  • Comments 1

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.

Page 1 of 1 (1 items)