0xFF0000FF 整数文字不符合预期的类型 kotlin.Int [英] 0xFF0000FF An integer literal does not conform to the expected type kotlin.Int

查看:31
本文介绍了0xFF0000FF 整数文字不符合预期的类型 kotlin.Int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么这不起作用:

var color: Int = 0xFF0000FF

以及为什么我必须调用 toInt()

and why do I have to call toInt()

var color: Int = 0xFF0000FF.toInt()

推荐答案

这是编译器中的一个错误,请随意投票/观看:https://youtrack.jetbrains.com/issue/KT-2780

This is a bug in the compiler, feel free to vote / watch it: https://youtrack.jetbrains.com/issue/KT-2780

这篇关于0xFF0000FF 整数文字不符合预期的类型 kotlin.Int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆