From 900e78b39bee4174df4094ed057d9f92ab09132e Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Thu, 26 Mar 2020 17:35:52 +0300 Subject: [PATCH] Add hashCode, equals and toString methods from String in builtin map --- .../common/interpreter/builtins/IrBuiltInsMapGenerated.kt | 5 ++++- generators/evaluate/GenerateBuiltInsMap.kt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/builtins/IrBuiltInsMapGenerated.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/builtins/IrBuiltInsMapGenerated.kt index 465dd579f48..4a8dccdb970 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/builtins/IrBuiltInsMapGenerated.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/builtins/IrBuiltInsMapGenerated.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,6 +116,8 @@ val unaryFunctions = mapOf>( unaryOperation("unaryMinus", "Double") { a -> a.unaryMinus() }, unaryOperation("unaryPlus", "Double") { a -> a.unaryPlus() }, unaryOperation("length", "String") { a -> a.length }, + unaryOperation("hashCode", "String") { a -> a.hashCode() }, + unaryOperation("toString", "String") { a -> a.toString() }, unaryOperation("size", "BooleanArray") { a -> a.size }, unaryOperation("iterator", "BooleanArray") { a -> a.iterator() }, unaryOperation("size", "CharArray") { a -> a.size }, @@ -404,6 +406,7 @@ val binaryFunctions = mapOf>( binaryOperation("times", "Double", "Long") { a, b -> a.times(b) }, binaryOperation("times", "Double", "Short") { a, b -> a.times(b) }, binaryOperation("compareTo", "String", "String") { a, b -> a.compareTo(b) }, + binaryOperation("equals", "String", "Any?") { a, b -> a.equals(b) }, binaryOperation("get", "String", "Int") { a, b -> a.get(b) }, binaryOperation("plus", "String", "Any?") { a, b -> a.plus(b) }, binaryOperation("get", "BooleanArray", "Int") { a, b -> a.get(b) }, diff --git a/generators/evaluate/GenerateBuiltInsMap.kt b/generators/evaluate/GenerateBuiltInsMap.kt index dd08bfa6cd1..16aafa07322 100644 --- a/generators/evaluate/GenerateBuiltInsMap.kt +++ b/generators/evaluate/GenerateBuiltInsMap.kt @@ -91,7 +91,7 @@ private fun getOperationMap(argumentsCount: Int): MutableMap thisIsCompileTime || classIsCompileTime