Пример #1
0
  public void testConstants() throws Exception {
    assertType("1", builtIns.getIntType());
    assertType("0x1", builtIns.getIntType());
    assertType("0X1", builtIns.getIntType());
    assertType("0b1", builtIns.getIntType());
    assertType("0B1", builtIns.getIntType());

    assertType("1.toLong()", builtIns.getLongType());

    assertType("1.0", builtIns.getDoubleType());
    assertType("1.0.toDouble()", builtIns.getDoubleType());
    assertType("0x1.fffffffffffffp1023", builtIns.getDoubleType());

    assertType("1.0.toFloat()", builtIns.getFloatType());
    assertType("0x1.fffffffffffffp1023.toFloat()", builtIns.getFloatType());

    assertType("true", builtIns.getBooleanType());
    assertType("false", builtIns.getBooleanType());

    assertType("'d'", builtIns.getCharType());

    assertType("\"d\"", builtIns.getStringType());
    assertType("\"\"\"d\"\"\"", builtIns.getStringType());

    assertType("Unit.VALUE", KotlinBuiltIns.getInstance().getUnitType());

    assertType("null", KotlinBuiltIns.getInstance().getNullableNothingType());
  }
Пример #2
0
 @NotNull
 @Override
 public JetType getType(@NotNull KotlinBuiltIns kotlinBuiltIns) {
   return kotlinBuiltIns.getDoubleType();
 }