Add a test for using @extend within @at-root.

Also fix a bug exposed by this test.