• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brighterscript / #12837

24 Jul 2024 05:52PM UTC coverage: 87.936% (+2.3%) from 85.65%
#12837

push

TwitchBronBron
0.67.4

6069 of 7376 branches covered (82.28%)

Branch coverage included in aggregate %.

8793 of 9525 relevant lines covered (92.31%)

1741.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.65
/src/types/ArrayType.ts
1
import type { BscType } from './BscType';
2
import { DynamicType } from './DynamicType';
1✔
3

4
export class ArrayType implements BscType {
1✔
5
    constructor(...innerTypes: BscType[]) {
6
        this.innerTypes = innerTypes;
14✔
7
    }
8
    public innerTypes: BscType[] = [];
14✔
9

10
    public isAssignableTo(targetType: BscType) {
11
        if (targetType instanceof DynamicType) {
7✔
12
            return true;
1✔
13
        } else if (!(targetType instanceof ArrayType)) {
6✔
14
            return false;
2✔
15
        }
16
        //this array type is assignable to the target IF
17
        //1. all of the types in this array are present in the target
18
        outer: for (let innerType of this.innerTypes) {
4✔
19
            //find this inner type in the target
20

21
            // eslint-disable-next-line no-unreachable-loop
22
            for (let targetInnerType of targetType.innerTypes) {
2✔
23
                //TODO is this loop correct? It ends after 1 iteration but we might need to do more iterations
24

25
                if (innerType.isAssignableTo(targetInnerType)) {
2✔
26
                    continue outer;
1✔
27
                }
28

29
                //our array contains a type that the target array does not...so these arrays are different
30
                return false;
1✔
31
            }
32
        }
33
        return true;
3✔
34
    }
35

36
    public isConvertibleTo(targetType: BscType) {
37
        return this.isAssignableTo(targetType);
2✔
38
    }
39

40
    public toString() {
41
        return `Array<${this.innerTypes.map((x) => x.toString()).join(' | ')}>`;
2✔
42
    }
43

44
    public toTypeString(): string {
45
        return 'object';
×
46
    }
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc