semantic: Correctly infer element variable types.