Fabulous Adventures In Coding

Eric Lippert's Blog

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.

Published Thursday, April 12, 2007 7:00 AM by Eric Lippert
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Charlie Calvert's Community Blog said:

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

April 21, 2007 1:11 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication


© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker