add negative test for invalid references and declaration emit