Skip to content

Commit

Permalink
new kotlin + new kotlin fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullinAM committed May 23, 2024
1 parent 9f5cb18 commit 93500e7
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,66 @@ import org.vorpal.research.kex.config.kexConfig
import org.vorpal.research.kex.ktype.KexType
import org.vorpal.research.kex.parameters.FinalParameters
import org.vorpal.research.kex.parameters.Parameters
import org.vorpal.research.kex.reanimator.actionsequence.*
import org.vorpal.research.kex.reanimator.actionsequence.ActionList
import org.vorpal.research.kex.reanimator.actionsequence.ActionSequence
import org.vorpal.research.kex.reanimator.actionsequence.ArrayClassConstantGetter
import org.vorpal.research.kex.reanimator.actionsequence.ArrayWrite
import org.vorpal.research.kex.reanimator.actionsequence.ClassConstantGetter
import org.vorpal.research.kex.reanimator.actionsequence.CodeAction
import org.vorpal.research.kex.reanimator.actionsequence.ConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.DefaultConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.EnumValueCreation
import org.vorpal.research.kex.reanimator.actionsequence.ExternalConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.ExternalMethodCall
import org.vorpal.research.kex.reanimator.actionsequence.FieldSetter
import org.vorpal.research.kex.reanimator.actionsequence.InnerClassConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.MethodCall
import org.vorpal.research.kex.reanimator.actionsequence.MockCall
import org.vorpal.research.kex.reanimator.actionsequence.MockList
import org.vorpal.research.kex.reanimator.actionsequence.MockNewInstance
import org.vorpal.research.kex.reanimator.actionsequence.MockSetField
import org.vorpal.research.kex.reanimator.actionsequence.MockSetupMethod
import org.vorpal.research.kex.reanimator.actionsequence.NewArray
import org.vorpal.research.kex.reanimator.actionsequence.NewArrayWithInitializer
import org.vorpal.research.kex.reanimator.actionsequence.PrimaryValue
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionArrayWrite
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionCall
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetField
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetStaticField
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionList
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewArray
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewInstance
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetField
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetStaticField
import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldGetter
import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldSetter
import org.vorpal.research.kex.reanimator.actionsequence.StaticMethodCall
import org.vorpal.research.kex.reanimator.actionsequence.StringValue
import org.vorpal.research.kex.reanimator.actionsequence.TestCall
import org.vorpal.research.kex.reanimator.actionsequence.UnknownSequence
import org.vorpal.research.kex.reanimator.codegen.ActionSequencePrinter
import org.vorpal.research.kex.util.*
import org.vorpal.research.kex.util.getConstructor
import org.vorpal.research.kex.util.getMethod
import org.vorpal.research.kex.util.isSubtypeOfCached
import org.vorpal.research.kex.util.javaString
import org.vorpal.research.kex.util.kex
import org.vorpal.research.kex.util.loadClass
import org.vorpal.research.kfg.ir.Class
import org.vorpal.research.kfg.type.*
import org.vorpal.research.kfg.type.ArrayType
import org.vorpal.research.kfg.type.BoolType
import org.vorpal.research.kfg.type.ByteType
import org.vorpal.research.kfg.type.CharType
import org.vorpal.research.kfg.type.ClassType
import org.vorpal.research.kfg.type.DoubleType
import org.vorpal.research.kfg.type.FloatType
import org.vorpal.research.kfg.type.IntType
import org.vorpal.research.kfg.type.LongType
import org.vorpal.research.kfg.type.NullType
import org.vorpal.research.kfg.type.ShortType
import org.vorpal.research.kfg.type.Type
import org.vorpal.research.kfg.type.VoidType
import org.vorpal.research.kfg.type.classType
import org.vorpal.research.kfg.type.objectType
import org.vorpal.research.kthelper.assert.ktassert
import org.vorpal.research.kthelper.assert.unreachable
import org.vorpal.research.kthelper.logging.log
Expand Down Expand Up @@ -468,9 +522,9 @@ open class ActionSequence2JavaPrinter(
actualTypes[this] = ASClass(ctx.types.byteType)
}

is Char -> when (value) {
in 'a'..'z' -> "'$value'"
in 'A'..'Z' -> "'$value'"
is Char -> when {
value in 'a'..'z' -> "'$value'"
value in 'A'..'Z' -> "'$value'"
else -> "(char) ${value.code}"
}.also {
actualTypes[this] = ASClass(ctx.types.charType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,39 @@ import org.vorpal.research.kex.ExecutionContext
import org.vorpal.research.kex.ktype.KexType
import org.vorpal.research.kex.parameters.FinalParameters
import org.vorpal.research.kex.parameters.Parameters
import org.vorpal.research.kex.reanimator.actionsequence.*
import org.vorpal.research.kex.reanimator.actionsequence.ActionList
import org.vorpal.research.kex.reanimator.actionsequence.ActionSequence
import org.vorpal.research.kex.reanimator.actionsequence.ArrayClassConstantGetter
import org.vorpal.research.kex.reanimator.actionsequence.ArrayWrite
import org.vorpal.research.kex.reanimator.actionsequence.ClassConstantGetter
import org.vorpal.research.kex.reanimator.actionsequence.CodeAction
import org.vorpal.research.kex.reanimator.actionsequence.ConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.DefaultConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.EnumValueCreation
import org.vorpal.research.kex.reanimator.actionsequence.ExternalConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.ExternalMethodCall
import org.vorpal.research.kex.reanimator.actionsequence.FieldSetter
import org.vorpal.research.kex.reanimator.actionsequence.InnerClassConstructorCall
import org.vorpal.research.kex.reanimator.actionsequence.MethodCall
import org.vorpal.research.kex.reanimator.actionsequence.MockList
import org.vorpal.research.kex.reanimator.actionsequence.NewArray
import org.vorpal.research.kex.reanimator.actionsequence.NewArrayWithInitializer
import org.vorpal.research.kex.reanimator.actionsequence.PrimaryValue
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionArrayWrite
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionCall
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetField
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionGetStaticField
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionList
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewArray
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionNewInstance
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetField
import org.vorpal.research.kex.reanimator.actionsequence.ReflectionSetStaticField
import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldGetter
import org.vorpal.research.kex.reanimator.actionsequence.StaticFieldSetter
import org.vorpal.research.kex.reanimator.actionsequence.StaticMethodCall
import org.vorpal.research.kex.reanimator.actionsequence.StringValue
import org.vorpal.research.kex.reanimator.actionsequence.TestCall
import org.vorpal.research.kex.reanimator.actionsequence.UnknownSequence
import org.vorpal.research.kex.reanimator.codegen.ActionSequencePrinter
import org.vorpal.research.kex.util.getConstructor
import org.vorpal.research.kex.util.getMethod
Expand Down Expand Up @@ -433,9 +465,9 @@ open class ActionSequence2KotlinPrinter(
actualTypes[this] = ASClass(ctx.types.byteType, nullable = false)
}

is Char -> when (value) {
in 'a'..'z' -> "'$value'"
in 'A'..'Z' -> "'$value'"
is Char -> when {
value in 'a'..'z' -> "'$value'"
value in 'A'..'Z' -> "'$value'"
else -> "${value.code}.toChar()"
}.also {
actualTypes[this] = ASClass(ctx.types.charType, nullable = false)
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<maven.compiler.source>${jvm.version}</maven.compiler.source>
<maven.compiler.target>${jvm.version}</maven.compiler.target>

<kotlin.version>1.9.23</kotlin.version>
<kotlin.version>2.0.0</kotlin.version>
<kotlin.code.style>official</kotlin.code.style>
<serialization.version>1.5.1</serialization.version>
<coroutines.version>1.8.0</coroutines.version>
<serialization.version>1.7.0-RC</serialization.version>
<coroutines.version>1.8.1</coroutines.version>
<collections.version>0.3.5</collections.version>
<compiler-plugin.version>3.5.1</compiler-plugin.version>

Expand Down

0 comments on commit 93500e7

Please sign in to comment.