Try handling inside patternmatcher

Fixes problems that are seen in #285 
@odersky please review.