1# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14# Check ClassCastException 15.record panda.String <external> 16.record panda.ClassCastException <external> 17 18.function panda.String panda.ClassCastException.getMessage(panda.ClassCastException a0) <external> 19 20# Also checking the edge case with record with very long (256 chars) name 21.record LoremipsumdolorsitametconsecteturadipiscingelitMorbiingravidanibhFusceaccumsandiamvitaeullamcorperfacilisisPhasellussodalesdiamquaminvulputatemagnalaoreetvelInterdumetmalesuadafamesacanteipsumprimisinfaucibusInhachabitasseplateadictumstQuisquesodalesconval {} 22 23.function i32 main() { 24try_begin: 25 newobj v0, panda.String 26 lda.obj v0 27 checkcast LoremipsumdolorsitametconsecteturadipiscingelitMorbiingravidanibhFusceaccumsandiamvitaeullamcorperfacilisisPhasellussodalesdiamquaminvulputatemagnalaoreetvelInterdumetmalesuadafamesacanteipsumprimisinfaucibusInhachabitasseplateadictumstQuisquesodalesconval 28 ldai 3 29try_end: 30 return 31catch_block1_begin: 32 sta.obj v0 33 call.virt panda.ClassCastException.getMessage, v0 34 jeqz.obj return_error 35 ldai 0 36 return 37 38catch_block2_begin: 39 ldai 1 40 return 41 42return_error: 43 ldai 2 44 return 45 46.catch panda.ClassCastException, try_begin, try_end, catch_block1_begin 47.catchall try_begin, try_end, catch_block2_begin 48} 49