For peeps reading the above post ....the numbers in paragraph 5 have been mixed up (transposed). The final tax position result in para 5 is CORRECT - just the written calculation is confusing for peeps to follow.
I have taken the liberty of correcting para 5 below before it gets lost amongst other posts as it is a very good example for peeps (and there is no other way to correct the text that I am aware of).
Corrections in bold to bellenuits post above.....
"If you had done it the other way round, $30K of losses is applied against the $16K discountable gains, leaving $0 discountable gains for the year and $14K of losses remaining. This remaining $14K of losses is applied against the $20K of non-discountable gains leaving $6K of net capital gains. As these are non-discountable gains, the full $6K is taxed, instead of $3K by the first method".