[BZ-996056] fix package cloning when there is a pattern using a class literal referring to a type declaration