core: fix inferencer bugs with case and type applications