Automatic type inference