diff --git a/src/AccessorNames.ts b/src/AccessorNames.ts index b6edd645..b56b2a3b 100644 --- a/src/AccessorNames.ts +++ b/src/AccessorNames.ts @@ -73,6 +73,7 @@ export function getAccessorName( export const unionIdentifierTypeAttributeKind = new TypeAttributeKind>( "unionIdentifier", + true, (a, b) => a.union(b), _ => undefined, undefined @@ -88,6 +89,7 @@ export function makeUnionIdentifierAttribute(): TypeAttributes { export const unionMemberNamesTypeAttributeKind = new TypeAttributeKind>( "unionMemberNames", + true, (a, b) => a.merge(b), _ => undefined, undefined diff --git a/src/ConvenienceRenderer.ts b/src/ConvenienceRenderer.ts index aef159e5..86cbc079 100644 --- a/src/ConvenienceRenderer.ts +++ b/src/ConvenienceRenderer.ts @@ -46,21 +46,24 @@ function splitDescription(descriptions: OrderedSet | undefined): string[ export type ForbiddenWordsInfo = { names: (Name | string)[]; includeGlobalForbidden: boolean }; -const assignedNameAttributeKind = new TypeAttributeKind("assignedName", undefined, undefined, undefined); +const assignedNameAttributeKind = new TypeAttributeKind("assignedName", false, undefined, undefined, undefined); const assignedPropertyNamesAttributeKind = new TypeAttributeKind>( "assignedPropertyNames", + false, undefined, undefined, undefined ); const assignedMemberNamesAttributeKind = new TypeAttributeKind>( "assignedMemberNames", + false, undefined, undefined, undefined ); const assignedCaseNamesAttributeKind = new TypeAttributeKind>( "assignedCaseNames", + false, undefined, undefined, undefined diff --git a/src/TypeAttributes.ts b/src/TypeAttributes.ts index f31aaf0a..8210d36d 100644 --- a/src/TypeAttributes.ts +++ b/src/TypeAttributes.ts @@ -10,6 +10,7 @@ export class TypeAttributeKind { constructor( readonly name: string, + readonly inIdentity: boolean, combine: ((a: T, b: T) => T) | undefined, makeInferred: ((a: T) => T | undefined) | undefined, stringify: ((a: T) => string | undefined) | undefined @@ -106,6 +107,7 @@ export function makeTypeAttributesInferred(attr: TypeAttributes): TypeAttributes export const descriptionTypeAttributeKind = new TypeAttributeKind>( "description", + false, setUnion, _ => OrderedSet(), descriptions => { @@ -122,6 +124,7 @@ export const descriptionTypeAttributeKind = new TypeAttributeKind>>( "propertyDescriptions", + false, (a, b) => a.mergeWith(setUnion, b), _ => Map(), undefined diff --git a/src/TypeBuilder.ts b/src/TypeBuilder.ts index 7fa87c47..7dcd6dbe 100644 --- a/src/TypeBuilder.ts +++ b/src/TypeBuilder.ts @@ -66,6 +66,7 @@ function provenanceToString(p: Set): string { // non-inferred form in the final graph. export const provenanceTypeAttributeKind = new TypeAttributeKind>( "provenance", + false, setUnion, a => a, provenanceToString diff --git a/src/TypeNames.ts b/src/TypeNames.ts index 7c26027b..b77fdac1 100644 --- a/src/TypeNames.ts +++ b/src/TypeNames.ts @@ -237,6 +237,7 @@ export function typeNamesUnion(c: Collection): TypeNames { export const namesTypeAttributeKind = new TypeAttributeKind( "names", + false, (a, b) => a.add(b), a => a.makeInferred(), a => a.toString()