From b3655b91042b820590114031bde95ea2da12d334 Mon Sep 17 00:00:00 2001 From: Mark Pearce Date: Wed, 29 Nov 2023 15:31:58 -0400 Subject: [PATCH 1/2] Classes do not include AA members --- src/types/BuiltInInterfaceAdder.spec.ts | 10 +++++----- src/types/BuiltInInterfaceAdder.ts | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/types/BuiltInInterfaceAdder.spec.ts b/src/types/BuiltInInterfaceAdder.spec.ts index 3f5749d30..c79134611 100644 --- a/src/types/BuiltInInterfaceAdder.spec.ts +++ b/src/types/BuiltInInterfaceAdder.spec.ts @@ -85,22 +85,22 @@ describe('BuiltInInterfaceAdder', () => { expectTypeToBe(myType.getMemberType('join', { flags: SymbolTypeFlag.runtime }), TypedFunctionType); }); - it('should add members to ClassType', () => { + it('should not add members to ClassType', () => { const myType = new ClassType('Klass'); BuiltInInterfaceAdder.addBuiltInInterfacesToType(myType); - expectTypeToBe(myType.getMemberType('clear', { flags: SymbolTypeFlag.runtime }), TypedFunctionType); - expectTypeToBe(myType.getMemberType('lookUp', { flags: SymbolTypeFlag.runtime }), TypedFunctionType); + expect(myType.getMemberType('clear', { flags: SymbolTypeFlag.runtime }).isResolvable()).to.be.false; + expect(myType.getMemberType('lookUp', { flags: SymbolTypeFlag.runtime }).isResolvable()).to.be.false; }); - it('should allow classes to override built in members', () => { + it('should allow classes to override AA members', () => { const myType = new ClassType('Klass'); myType.addMember('clear', null, new BooleanType(), SymbolTypeFlag.runtime); BuiltInInterfaceAdder.addBuiltInInterfacesToType(myType); expectTypeToBe(myType.getMemberType('clear', { flags: SymbolTypeFlag.runtime }), BooleanType); }); - it('should not include members that have already been overridded', () => { + it('should not include members that have already been overrided', () => { const myType = new ClassType('Klass'); myType.addMember('clear', null, new BooleanType(), SymbolTypeFlag.runtime); BuiltInInterfaceAdder.addBuiltInInterfacesToType(myType); diff --git a/src/types/BuiltInInterfaceAdder.ts b/src/types/BuiltInInterfaceAdder.ts index 38a29f1a7..038c26f01 100644 --- a/src/types/BuiltInInterfaceAdder.ts +++ b/src/types/BuiltInInterfaceAdder.ts @@ -114,8 +114,6 @@ export class BuiltInInterfaceAdder { return 'roInvalid'; } else if (isCallableType(theType)) { return 'roFunction'; - } else if (isClassType(theType)) { - return 'roAssociativeArray'; } else if (isAssociativeArrayType(theType)) { return 'roAssociativeArray'; } else if (isArrayType(theType)) { From 465af1164670d7b1d586a484f0615fac2500a55f Mon Sep 17 00:00:00 2001 From: Mark Pearce Date: Wed, 29 Nov 2023 15:35:16 -0400 Subject: [PATCH 2/2] lint fix --- src/types/BuiltInInterfaceAdder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/BuiltInInterfaceAdder.ts b/src/types/BuiltInInterfaceAdder.ts index 038c26f01..6720865f8 100644 --- a/src/types/BuiltInInterfaceAdder.ts +++ b/src/types/BuiltInInterfaceAdder.ts @@ -5,7 +5,7 @@ import type { TypedFunctionType } from './TypedFunctionType'; import type { SymbolTable } from '../SymbolTable'; import { SymbolTypeFlag } from '../SymbolTable'; import type { BscType } from './BscType'; -import { isArrayType, isAssociativeArrayType, isBooleanType, isCallableType, isClassType, isComponentType, isDoubleType, isEnumMemberType, isFloatType, isIntegerType, isInterfaceType, isInvalidType, isLongIntegerType, isStringType } from '../astUtils/reflection'; +import { isArrayType, isAssociativeArrayType, isBooleanType, isCallableType, isComponentType, isDoubleType, isEnumMemberType, isFloatType, isIntegerType, isInterfaceType, isInvalidType, isLongIntegerType, isStringType } from '../astUtils/reflection'; import type { ComponentType } from './ComponentType'; import util from '../util'; import type { UnionType } from './UnionType';