13af6ab5fSopenharmony_ci/*
23af6ab5fSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
33af6ab5fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
43af6ab5fSopenharmony_ci * you may not use this file except in compliance with the License.
53af6ab5fSopenharmony_ci * You may obtain a copy of the License at
63af6ab5fSopenharmony_ci *
73af6ab5fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
83af6ab5fSopenharmony_ci *
93af6ab5fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
103af6ab5fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
113af6ab5fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
123af6ab5fSopenharmony_ci * See the License for the specific language governing permissions and
133af6ab5fSopenharmony_ci * limitations under the License.
143af6ab5fSopenharmony_ci */
153af6ab5fSopenharmony_ci
163af6ab5fSopenharmony_ciimport {lang} from './@arkts.lang';
173af6ab5fSopenharmony_ci
183af6ab5fSopenharmony_ciclass NonSendableClass2 {}
193af6ab5fSopenharmony_ci
203af6ab5fSopenharmony_ci@Sendable
213af6ab5fSopenharmony_ciclass SendableClass10 {}
223af6ab5fSopenharmony_ci
233af6ab5fSopenharmony_ci@Sendable
243af6ab5fSopenharmony_ciclass SendableClass4<T, U> {
253af6ab5fSopenharmony_ci  prop1: number; // OK
263af6ab5fSopenharmony_ci  prop2: string; // OK
273af6ab5fSopenharmony_ci  prop3: boolean; // OK
283af6ab5fSopenharmony_ci  prop4: bigint; // OK
293af6ab5fSopenharmony_ci  prop5: SendableClass3; // OK
303af6ab5fSopenharmony_ci  prop6: null; // OK
313af6ab5fSopenharmony_ci  prop7: undefined; // OK
323af6ab5fSopenharmony_ci  prop8: U; // OK
333af6ab5fSopenharmony_ci  prop9: T | number | undefined; // OK
343af6ab5fSopenharmony_ci  prop10: alias0; // OK
353af6ab5fSopenharmony_ci  prop11: alias1; // OK
363af6ab5fSopenharmony_ci  prop12: ISendableExt1; // OK
373af6ab5fSopenharmony_ci  prop13: ConstEnum; // OK
383af6ab5fSopenharmony_ci  prop14: ConstEnum1; // OK
393af6ab5fSopenharmony_ci  prop15: ConstEnum2; // OK
403af6ab5fSopenharmony_ci  prop16: ConstEnum2 = ConstEnum2.Memc2; // OK
413af6ab5fSopenharmony_ci  prop17: ConstEnum | ConstEnum1 | ConstEnum2; // OK
423af6ab5fSopenharmony_ci  prop18: ConstEnum | SendableClass3; // OK
433af6ab5fSopenharmony_ci  prop19: ConstEnum1 | SendableClass10; // OK
443af6ab5fSopenharmony_ci  prop20: N.ConstEnum | ConstEnum; // OK
453af6ab5fSopenharmony_ci  prop21: alias4; // OK
463af6ab5fSopenharmony_ci  prop22: alias5; // OK
473af6ab5fSopenharmony_ci  prop23: alias6; // OK
483af6ab5fSopenharmony_ci  prop24: SendableClass3 | alias4 | alias5; // OK
493af6ab5fSopenharmony_ci  prop25: number | boolean; // OK
503af6ab5fSopenharmony_ci  prop26: boolean | bigint; // OK
513af6ab5fSopenharmony_ci  prop27: boolean | null; // OK
523af6ab5fSopenharmony_ci  prop28: bigint | null; // OK
533af6ab5fSopenharmony_ci  prop29: alias14; // OK
543af6ab5fSopenharmony_ci  prop30: alias15; // OK
553af6ab5fSopenharmony_ci  prop31: (number);
563af6ab5fSopenharmony_ci  prop32: (boolean | bigint);
573af6ab5fSopenharmony_ci  prop33: number | (SendableClass3 | ((null | string)));
583af6ab5fSopenharmony_ci  prop34: alias16;
593af6ab5fSopenharmony_ci  prop35: alias17;
603af6ab5fSopenharmony_ci  prop36: alias18;
613af6ab5fSopenharmony_ci}
623af6ab5fSopenharmony_ci
633af6ab5fSopenharmony_ci@Sendable
643af6ab5fSopenharmony_ciclass SendableClass3 {
653af6ab5fSopenharmony_ci  prop1: string[]; // ERROR, sendable class property cannot be array
663af6ab5fSopenharmony_ci  prop2: NonSendableClass2; // ERROR, sendable class property cannot be non-sendable-class
673af6ab5fSopenharmony_ci  prop3: NonSendableClass2 | null; // ERROR, sendable class property cannot be non-sendable-class union type
683af6ab5fSopenharmony_ci  prop4: NonSendableInterface | number; // ERROR, sendable class property cannot be non-sendable-class union type
693af6ab5fSopenharmony_ci  prop5: NonSendableClass2 | null | undefined; // ERROR, sendable class property cannot be non-sendable-class union type
703af6ab5fSopenharmony_ci  prop6: alias2; // ERROR, sendable class property cannot be non-sendable-type
713af6ab5fSopenharmony_ci  prop7: alias3; // ERROR, sendable class property cannot be non-sendable-type
723af6ab5fSopenharmony_ci  prop8: RegularEnum; // ERROR, sendable class property cannot be non-sendable-type
733af6ab5fSopenharmony_ci  prop9: RegularEnum1; // ERROR, sendable class property cannot be non-sendable-type
743af6ab5fSopenharmony_ci  prop10: RegularEnum2; // ERROR, sendable class property cannot be non-sendable-type
753af6ab5fSopenharmony_ci  prop11: RegularEnum2 = RegularEnum2.Memr3; // ERROR, sendable class property cannot be non-sendable-type
763af6ab5fSopenharmony_ci  prop12: ConstEnum1.Memc1; // ERROR, sendable class property cannot be enum member type
773af6ab5fSopenharmony_ci  prop13: ConstEnum2.Memc2; // ERROR, sendable class property cannot be enum member type
783af6ab5fSopenharmony_ci  prop14: ConstEnum | ConstEnum1.Memc1; // ERROR, sendable class property cannot be non-sendable union type
793af6ab5fSopenharmony_ci  prop15: ConstEnum2 | RegularEnum1; // ERROR, sendable class property cannot be non-sendable union type
803af6ab5fSopenharmony_ci  prop16: RegularEnum2.Memr2 | SendableClass10; // ERROR, sendable class property cannot be non-sendable union type
813af6ab5fSopenharmony_ci  prop17: alias7; // ERROR, sendable class property cannot be non-sendable alias type
823af6ab5fSopenharmony_ci  prop18: alias8; // ERROR, sendable class property cannot be non-sendable alias type
833af6ab5fSopenharmony_ci  prop19: alias9; // ERROR, sendable class property cannot be non-sendable alias type
843af6ab5fSopenharmony_ci  prop20: alias6 | NonSendableInterface; // ERROR, sendable class property cannot be non-sendable union type
853af6ab5fSopenharmony_ci  prop21: alias7 | SendableClass3; // ERROR, sendable class property cannot be non-sendable union type
863af6ab5fSopenharmony_ci  prop22: SendableClass10 | alias8; // ERROR, sendable class property cannot be non-sendable union type
873af6ab5fSopenharmony_ci  prop23: 1; // ERROR, sendable class property cannot be numeric literal type
883af6ab5fSopenharmony_ci  prop24: 'x'; // ERROR, sendable class property cannot be string literal type
893af6ab5fSopenharmony_ci  prop25: true; // ERROR, sendable class property cannot be boolean literal type
903af6ab5fSopenharmony_ci  prop26: 2n; // ERROR, sendable class property cannot be bigint literal type
913af6ab5fSopenharmony_ci  prop27: true | false; // ERROR, sendable class property cannot be non-sendable union type
923af6ab5fSopenharmony_ci  prop271: 3 | 'y' | false | 4; // ERROR, sendable class property cannot be non-sendable union type
933af6ab5fSopenharmony_ci  prop28: SendableClass3 | 5; // ERROR, sendable class property cannot be non-sendable union type
943af6ab5fSopenharmony_ci  prop29: alias10; // ERROR, sendable class property cannot be non-sendable alias type
953af6ab5fSopenharmony_ci  prop30: alias11; // ERROR, sendable class property cannot be non-sendable alias type
963af6ab5fSopenharmony_ci  prop31: alias12; // ERROR, sendable class property cannot be non-sendable alias type
973af6ab5fSopenharmony_ci  prop32: alias13; // ERROR, sendable class property cannot be non-sendable alias type
983af6ab5fSopenharmony_ci  prop33: (10);
993af6ab5fSopenharmony_ci  prop34: (true | 'false');
1003af6ab5fSopenharmony_ci  prop35: number | (SendableClass3 | ((string | NonSendableClass2)));
1013af6ab5fSopenharmony_ci  prop36: alias19;
1023af6ab5fSopenharmony_ci  prop37: alias20;
1033af6ab5fSopenharmony_ci  ["aaa"]: number; // ERROR, sendable class property name cannot be computed property 
1043af6ab5fSopenharmony_ci}
1053af6ab5fSopenharmony_ci
1063af6ab5fSopenharmony_citype alias0 = number | null;
1073af6ab5fSopenharmony_citype alias1 = SendableClass10;
1083af6ab5fSopenharmony_citype alias2 = NonSendableClass2;
1093af6ab5fSopenharmony_citype alias3 = NonSendableClass2 | undefined;
1103af6ab5fSopenharmony_citype alias4 = ConstEnum;
1113af6ab5fSopenharmony_citype alias5 = ConstEnum1 | ConstEnum2;
1123af6ab5fSopenharmony_citype alias6 = ConstEnum | SendableClass3;
1133af6ab5fSopenharmony_citype alias7 = RegularEnum | RegularEnum1 | ConstEnum;
1143af6ab5fSopenharmony_citype alias8 = ConstEnum1.Memc1;
1153af6ab5fSopenharmony_citype alias9 = ConstEnum | ConstEnum2.Memc3;
1163af6ab5fSopenharmony_citype alias10 = 10;
1173af6ab5fSopenharmony_citype alias11 = 'foo';
1183af6ab5fSopenharmony_citype alias12 = 20 | 'bar';
1193af6ab5fSopenharmony_citype alias13 = true | false;
1203af6ab5fSopenharmony_citype alias14 = number | boolean;
1213af6ab5fSopenharmony_citype alias15 = boolean | null | undefined;
1223af6ab5fSopenharmony_citype alias16 = (number);
1233af6ab5fSopenharmony_citype alias17 = (boolean | null);
1243af6ab5fSopenharmony_citype alias18 = (SendableClass3 | string);
1253af6ab5fSopenharmony_citype alias19 = number | (string | ((SendableClass3 | NonSendableClass2)));
1263af6ab5fSopenharmony_citype alias20 = (1 | '2' | true);
1273af6ab5fSopenharmony_ci
1283af6ab5fSopenharmony_ciconst enum ConstEnum {};
1293af6ab5fSopenharmony_ciconst enum ConstEnum1 {
1303af6ab5fSopenharmony_ci  Memc1 = 1
1313af6ab5fSopenharmony_ci};
1323af6ab5fSopenharmony_ciconst enum ConstEnum2 {
1333af6ab5fSopenharmony_ci  Memc2 = 'aa',
1343af6ab5fSopenharmony_ci  Memc3 = 2
1353af6ab5fSopenharmony_ci};
1363af6ab5fSopenharmony_ci
1373af6ab5fSopenharmony_cienum RegularEnum {};
1383af6ab5fSopenharmony_cienum RegularEnum1 {
1393af6ab5fSopenharmony_ci  Memr1 = 'aa'
1403af6ab5fSopenharmony_ci};
1413af6ab5fSopenharmony_cienum RegularEnum2 {
1423af6ab5fSopenharmony_ci  Memr2 = 'aa',
1433af6ab5fSopenharmony_ci  Memr3 = 2
1443af6ab5fSopenharmony_ci};
1453af6ab5fSopenharmony_ci
1463af6ab5fSopenharmony_ciexport declare namespace N {
1473af6ab5fSopenharmony_ci  export const enum ConstEnum {
1483af6ab5fSopenharmony_ci    E1 = 1
1493af6ab5fSopenharmony_ci  }
1503af6ab5fSopenharmony_ci}
1513af6ab5fSopenharmony_ci
1523af6ab5fSopenharmony_ci// Implement interface extending ISendable
1533af6ab5fSopenharmony_ciinterface ISendableExt1 extends lang.ISendable {
1543af6ab5fSopenharmony_ci  prop1: number; // OK
1553af6ab5fSopenharmony_ci  prop2: string; // OK
1563af6ab5fSopenharmony_ci  prop3: boolean; // OK
1573af6ab5fSopenharmony_ci  prop4: bigint; // OK
1583af6ab5fSopenharmony_ci  prop5: SendableClass3; // OK
1593af6ab5fSopenharmony_ci  prop6: null; // OK
1603af6ab5fSopenharmony_ci  prop7: undefined; // OK
1613af6ab5fSopenharmony_ci  prop8: SendableClass3 | string; // OK
1623af6ab5fSopenharmony_ci  prop9: number | null | undefined; // OK
1633af6ab5fSopenharmony_ci  prop10: alias0; // OK
1643af6ab5fSopenharmony_ci  prop11: alias1; // OK
1653af6ab5fSopenharmony_ci  prop12: ISendableExt2; // OK
1663af6ab5fSopenharmony_ci  prop13: ConstEnum; // OK
1673af6ab5fSopenharmony_ci  prop14: ConstEnum1; // OK
1683af6ab5fSopenharmony_ci  prop15: ConstEnum2; // OK
1693af6ab5fSopenharmony_ci}
1703af6ab5fSopenharmony_ci// Implement interface extending ISendable
1713af6ab5fSopenharmony_ciinterface ISendableExt2 extends lang.ISendable {
1723af6ab5fSopenharmony_ci  prop1: string[]; // ERROR, sendable interface property cannot be array
1733af6ab5fSopenharmony_ci  prop2: NonSendableClass2; // ERROR, sendable interface property cannot be non-sendable-class
1743af6ab5fSopenharmony_ci  prop3: NonSendableClass2 | null; // ERROR, sendable interface property cannot be non-sendable-class union type
1753af6ab5fSopenharmony_ci  prop4: NonSendableInterface | string; // ERROR, sendable interface property cannot be non-sendable-class union type
1763af6ab5fSopenharmony_ci  prop5: NonSendableClass2 | null | undefined; // ERROR, sendable interface property cannot be non-sendable-class union type
1773af6ab5fSopenharmony_ci  prop6: alias2; // ERROR, sendable interface property cannot be non-sendable-type
1783af6ab5fSopenharmony_ci  prop7: alias3; // ERROR, sendable interface property cannot be non-sendable-type
1793af6ab5fSopenharmony_ci  prop8: RegularEnum; // ERROR, sendable interface property cannot be non-sendable-type
1803af6ab5fSopenharmony_ci  prop9: RegularEnum1; // ERROR, sendable interface property cannot be non-sendable-type
1813af6ab5fSopenharmony_ci  prop10: RegularEnum2; // ERROR, sendable interface property cannot be non-sendable-type
1823af6ab5fSopenharmony_ci  ["aaa"]: number; // ERROR, sendable interface property name cannot be computed property
1833af6ab5fSopenharmony_ci  [Symbol.iterator](): IterableIterator<number>;
1843af6ab5fSopenharmony_ci}
1853af6ab5fSopenharmony_ci
1863af6ab5fSopenharmony_ciinterface NonSendableInterface {};
187