diff --git a/ets2panda/compiler/core/ETSCompiler.cpp b/ets2panda/compiler/core/ETSCompiler.cpp index f7d9c68b16b3b9eaa58a4a84bc5e20c59204f83f..27964c26471698880a3cf18d5a3d9fbd500c9a49 100644 --- a/ets2panda/compiler/core/ETSCompiler.cpp +++ b/ets2panda/compiler/core/ETSCompiler.cpp @@ -1989,11 +1989,11 @@ void ETSCompiler::CompileCastUnboxable(const ir::TSAsExpression *expr) const break; } case checker::ETSObjectFlags::BUILTIN_BYTE: { - etsg->CastToChar(expr); + etsg->CastToByte(expr); break; } case checker::ETSObjectFlags::BUILTIN_CHAR: { - etsg->CastToByte(expr); + etsg->CastToChar(expr); break; } case checker::ETSObjectFlags::BUILTIN_SHORT: { diff --git a/ets2panda/test/runtime/ets/castSequence.ets b/ets2panda/test/runtime/ets/castSequence.ets index c3e86ca68a318dfcbdaad8a4c8c240fb295eb301..f490ee4f52e23c5737e6d49e44e7adaf2e35fe72 100644 --- a/ets2panda/test/runtime/ets/castSequence.ets +++ b/ets2panda/test/runtime/ets/castSequence.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,10 +25,10 @@ function main(): void { assert a_Short instanceof Short assert b_double == 215.0 - let a_Int : Int = 2142; - let b_Double : Double = a_Int as Double; + let a_char : char = 128 as char; + let b_Char = a_char as Char; - assert b_Double instanceof Double && b_Double.unboxed() == 2142.0 + assert b_Char.unboxed() == 128 as char; return; } \ No newline at end of file diff --git a/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt b/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt index 7b6b2e0d97a8ed83bdb97e21f71a9007f3265ae9..21ef806ea2f56eccb4630e8e13a31a762244a74b 100644 --- a/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt +++ b/ets2panda/test/test-lists/ets-runtime/ets-runtime-ignored.txt @@ -54,9 +54,6 @@ OptionalCall.ets # Functional type with rest parameter lambdaExpressionWithRestParameter.ets -# Non-trivial cast sequence -castSequence.ets - # ignored due to interface implementation modification local-class-standard-example1.ets local-class-standard-example2.ets