typia 15.1.0 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/TypeGuardError.js.map +1 -1
- package/lib/basic.js.map +1 -1
- package/lib/compare.js.map +1 -1
- package/lib/functional.js.map +1 -1
- package/lib/http.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internal/_IProtobufWriter.js.map +1 -1
- package/lib/internal/_ProtobufReader.js.map +1 -1
- package/lib/internal/_ProtobufSizer.js.map +1 -1
- package/lib/internal/_ProtobufWriter.js.map +1 -1
- package/lib/internal/_accessExpressionAsString.js.map +1 -1
- package/lib/internal/_assertGuard.js.map +1 -1
- package/lib/internal/_coerceLlmArguments.js.map +1 -1
- package/lib/internal/_createLlmEvaluation.js.map +1 -1
- package/lib/internal/_createStandardSchema.js.map +1 -1
- package/lib/internal/_decimal.js.map +1 -1
- package/lib/internal/_functionalTypeGuardErrorFactory.js.map +1 -1
- package/lib/internal/_httpFormDataReadArray.js.map +1 -1
- package/lib/internal/_httpFormDataReadBigint.js.map +1 -1
- package/lib/internal/_httpFormDataReadBlob.js.map +1 -1
- package/lib/internal/_httpFormDataReadBoolean.js.map +1 -1
- package/lib/internal/_httpFormDataReadFile.js.map +1 -1
- package/lib/internal/_httpFormDataReadNumber.js.map +1 -1
- package/lib/internal/_httpFormDataReadString.js.map +1 -1
- package/lib/internal/_httpHeaderReadBigint.js.map +1 -1
- package/lib/internal/_httpHeaderReadBoolean.js.map +1 -1
- package/lib/internal/_httpHeaderReadNumber.js.map +1 -1
- package/lib/internal/_httpParameterReadBigint.js.map +1 -1
- package/lib/internal/_httpParameterReadBoolean.js.map +1 -1
- package/lib/internal/_httpParameterReadNumber.js.map +1 -1
- package/lib/internal/_httpParameterReadString.js.map +1 -1
- package/lib/internal/_httpQueryParseURLSearchParams.js.map +1 -1
- package/lib/internal/_httpQueryReadArray.js.map +1 -1
- package/lib/internal/_httpQueryReadBigint.js.map +1 -1
- package/lib/internal/_httpQueryReadBoolean.js.map +1 -1
- package/lib/internal/_httpQueryReadNumber.js.map +1 -1
- package/lib/internal/_httpQueryReadString.js.map +1 -1
- package/lib/internal/_isBetween.js.map +1 -1
- package/lib/internal/_isBigintString.js.map +1 -1
- package/lib/internal/_isFormatByte.js.map +1 -1
- package/lib/internal/_isFormatDate.js.map +1 -1
- package/lib/internal/_isFormatDateTime.js.map +1 -1
- package/lib/internal/_isFormatDuration.js.map +1 -1
- package/lib/internal/_isFormatEmail.js.map +1 -1
- package/lib/internal/_isFormatHostname.js.map +1 -1
- package/lib/internal/_isFormatIdnEmail.js.map +1 -1
- package/lib/internal/_isFormatIdnHostname.js.map +1 -1
- package/lib/internal/_isFormatIpv4.js.map +1 -1
- package/lib/internal/_isFormatIpv6.js.map +1 -1
- package/lib/internal/_isFormatIri.js.map +1 -1
- package/lib/internal/_isFormatIriReference.js.map +1 -1
- package/lib/internal/_isFormatJsonPointer.js.map +1 -1
- package/lib/internal/_isFormatPassword.js.map +1 -1
- package/lib/internal/_isFormatRegex.js.map +1 -1
- package/lib/internal/_isFormatRelativeJsonPointer.js.map +1 -1
- package/lib/internal/_isFormatTime.js.map +1 -1
- package/lib/internal/_isFormatUri.js.map +1 -1
- package/lib/internal/_isFormatUriReference.js.map +1 -1
- package/lib/internal/_isFormatUriTemplate.js.map +1 -1
- package/lib/internal/_isFormatUrl.js.map +1 -1
- package/lib/internal/_isFormatUuid.js.map +1 -1
- package/lib/internal/_isMultipleOf.js.map +1 -1
- package/lib/internal/_isTypeFloat.js.map +1 -1
- package/lib/internal/_isTypeInt16.js.map +1 -1
- package/lib/internal/_isTypeInt32.js.map +1 -1
- package/lib/internal/_isTypeInt64.js.map +1 -1
- package/lib/internal/_isTypeInt64Bigint.js.map +1 -1
- package/lib/internal/_isTypeInt8.js.map +1 -1
- package/lib/internal/_isTypeUint16.js.map +1 -1
- package/lib/internal/_isTypeUint32.js.map +1 -1
- package/lib/internal/_isTypeUint64.js.map +1 -1
- package/lib/internal/_isTypeUint64Bigint.js.map +1 -1
- package/lib/internal/_isTypeUint8.js.map +1 -1
- package/lib/internal/_isUniqueItems.js.map +1 -1
- package/lib/internal/_jsonStringifyArray.js.map +1 -1
- package/lib/internal/_jsonStringifyElement.js.map +1 -1
- package/lib/internal/_jsonStringifyNumber.js.map +1 -1
- package/lib/internal/_jsonStringifyProperty.js.map +1 -1
- package/lib/internal/_jsonStringifyRest.js.map +1 -1
- package/lib/internal/_jsonStringifyString.js.map +1 -1
- package/lib/internal/_jsonStringifyTail.js.map +1 -1
- package/lib/internal/_llmApplicationFinalize.js +8 -1
- package/lib/internal/_llmApplicationFinalize.js.map +1 -1
- package/lib/internal/_notationAny.js.map +1 -1
- package/lib/internal/_notationAssign.js.map +1 -1
- package/lib/internal/_notationCamel.js.map +1 -1
- package/lib/internal/_notationKebab.js.map +1 -1
- package/lib/internal/_notationKeyCollision.js.map +1 -1
- package/lib/internal/_notationPascal.js.map +1 -1
- package/lib/internal/_notationSnake.js.map +1 -1
- package/lib/internal/_parseLlmArguments.js.map +1 -1
- package/lib/internal/_plainCloneAny.js.map +1 -1
- package/lib/internal/_randomArray.js.map +1 -1
- package/lib/internal/_randomBigint.js.map +1 -1
- package/lib/internal/_randomBoolean.js.map +1 -1
- package/lib/internal/_randomFormatByte.js.map +1 -1
- package/lib/internal/_randomFormatDate.js.map +1 -1
- package/lib/internal/_randomFormatDatetime.js.map +1 -1
- package/lib/internal/_randomFormatDuration.js.map +1 -1
- package/lib/internal/_randomFormatEmail.js.map +1 -1
- package/lib/internal/_randomFormatHostname.js.map +1 -1
- package/lib/internal/_randomFormatIdnEmail.js.map +1 -1
- package/lib/internal/_randomFormatIdnHostname.js.map +1 -1
- package/lib/internal/_randomFormatIpv4.js.map +1 -1
- package/lib/internal/_randomFormatIpv6.js.map +1 -1
- package/lib/internal/_randomFormatIri.js.map +1 -1
- package/lib/internal/_randomFormatIriReference.js.map +1 -1
- package/lib/internal/_randomFormatJsonPointer.js.map +1 -1
- package/lib/internal/_randomFormatPassword.js.map +1 -1
- package/lib/internal/_randomFormatRegex.js.map +1 -1
- package/lib/internal/_randomFormatRelativeJsonPointer.js.map +1 -1
- package/lib/internal/_randomFormatTime.js.map +1 -1
- package/lib/internal/_randomFormatUri.js.map +1 -1
- package/lib/internal/_randomFormatUriReference.js.map +1 -1
- package/lib/internal/_randomFormatUriTemplate.js.map +1 -1
- package/lib/internal/_randomFormatUrl.js.map +1 -1
- package/lib/internal/_randomFormatUuid.js.map +1 -1
- package/lib/internal/_randomInteger.js.map +1 -1
- package/lib/internal/_randomMultiple.js.map +1 -1
- package/lib/internal/_randomNumber.js.map +1 -1
- package/lib/internal/_randomPattern.js.map +1 -1
- package/lib/internal/_randomPick.js.map +1 -1
- package/lib/internal/_randomString.js.map +1 -1
- package/lib/internal/_randomStringLength.js.map +1 -1
- package/lib/internal/_stringLength.js.map +1 -1
- package/lib/internal/_stringLengthGte.js.map +1 -1
- package/lib/internal/_stringLengthLte.js.map +1 -1
- package/lib/internal/_throwTypeGuardError.js.map +1 -1
- package/lib/internal/_validateReport.js.map +1 -1
- package/lib/internal/private/__notationRename.js.map +1 -1
- package/lib/internal/private/__randomComposition.js.map +1 -1
- package/lib/internal/private/__randomEpoch.js.map +1 -1
- package/lib/json.js.map +1 -1
- package/lib/llm.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/notations.js.map +1 -1
- package/lib/plain.js.map +1 -1
- package/lib/protobuf.js.map +1 -1
- package/lib/re-exports.js.map +1 -1
- package/lib/reflect.js.map +1 -1
- package/lib/transform.d.ts +5 -2
- package/lib/transform.js +6 -2
- package/lib/transform.js.map +1 -1
- package/lib/transform.mjs +7 -3
- package/lib/transform.mjs.map +1 -1
- package/lib/transformers/NoTransformConfigurationError.js.map +1 -1
- package/native/cmd/ttsc-typia/build.go +3 -1
- package/native/cmd/ttsc-typia/content_mapper_transform_ts71_test.go +102 -0
- package/native/cmd/ttsc-typia/diagnostics.go +1 -1
- package/native/cmd/ttsc-typia/distinct_programs_concurrent_emit_test.go +167 -0
- package/native/cmd/ttsc-typia/exact_optional_family_emission_contract_test.go +2 -1
- package/native/cmd/ttsc-typia/project_dependencies_heritage_forms_transform_test.go +84 -0
- package/native/cmd/ttsc-typia/schema_literal_helpers_test.go +2 -1
- package/native/cmd/ttsc-typia/transform.go +7 -6
- package/native/core/context/EmitFactory.go +20 -29
- package/native/core/context/ImportProgrammer.go +5 -7
- package/native/core/context/NodeFactory.go +25 -0
- package/native/core/context/node_factory_ownership_test.go +45 -0
- package/native/core/factories/ExpressionFactory.go +13 -14
- package/native/core/factories/IdentifierFactory.go +3 -5
- package/native/core/factories/LiteralFactory.go +6 -8
- package/native/core/factories/NumericRangeFactory.go +8 -10
- package/native/core/factories/StatementFactory.go +5 -7
- package/native/core/factories/TemplateFactory.go +1 -3
- package/native/core/factories/TypeFactory.go +7 -9
- package/native/core/factories/ValueFactory.go +5 -7
- package/native/core/factories/factory_utility_coverage_test.go +21 -20
- package/native/core/factories/internal/metadata/MetadataHelper.go +13 -13
- package/native/core/factories/internal/metadata/comment_tags_coverage_test.go +7 -16
- package/native/core/factories/internal/metadata/emplace_metadata_object.go +36 -27
- package/native/core/factories/internal/metadata/iterate_metadata_alias.go +2 -2
- package/native/core/factories/internal/metadata/iterate_metadata_constant.go +4 -4
- package/native/core/factories/internal/metadata/iterate_metadata_function.go +2 -2
- package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +11 -11
- package/native/core/factories/internal/metadata/js_doc_link_text_test.go +6 -16
- package/native/core/factories/internal/metadata/js_doc_parameter_name_reads_qualified_name_test.go +2 -1
- package/native/core/factories/internal/metadata/js_doc_source_helpers_test.go +44 -0
- package/native/core/factories/internal/metadata/js_doc_type_tag_blank_separation_test.go +16 -22
- package/native/core/factories/numeric_range_factory_enforces_64bit_bounds_test.go +2 -1
- package/native/core/programmers/AssertProgrammer.go +16 -18
- package/native/core/programmers/IsProgrammer.go +10 -12
- package/native/core/programmers/RandomProgrammer.go +29 -31
- package/native/core/programmers/ValidateProgrammer.go +20 -22
- package/native/core/programmers/compare/CompareEqualProgrammer.go +1 -3
- package/native/core/programmers/compare/CompareLessProgrammer.go +1 -3
- package/native/core/programmers/functional/FunctionalAssertFunctionProgrammer.go +3 -5
- package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalAssertReturnProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalIsFunctionProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +8 -10
- package/native/core/programmers/functional/FunctionalIsReturnProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalValidateFunctionProgrammer.go +4 -6
- package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +2 -2
- package/native/core/programmers/functional/FunctionalValidateReturnProgrammer.go +2 -2
- package/native/core/programmers/helpers/ClassifyJoiner.go +1 -3
- package/native/core/programmers/helpers/CloneJoiner.go +8 -14
- package/native/core/programmers/helpers/FunctionProgrammer.go +3 -5
- package/native/core/programmers/helpers/NotationJoiner.go +6 -12
- package/native/core/programmers/helpers/PruneJoiner.go +10 -12
- package/native/core/programmers/helpers/RandomJoiner.go +5 -7
- package/native/core/programmers/helpers/StringifyJoinder.go +15 -17
- package/native/core/programmers/helpers/UnionExplorer.go +24 -26
- package/native/core/programmers/http/HttpAssertFormDataProgrammer.go +2 -4
- package/native/core/programmers/http/HttpAssertHeadersProgrammer.go +1 -1
- package/native/core/programmers/http/HttpAssertQueryProgrammer.go +1 -1
- package/native/core/programmers/http/HttpFormDataProgrammer.go +9 -11
- package/native/core/programmers/http/HttpHeadersProgrammer.go +7 -9
- package/native/core/programmers/http/HttpIsFormDataProgrammer.go +2 -4
- package/native/core/programmers/http/HttpIsHeadersProgrammer.go +1 -1
- package/native/core/programmers/http/HttpIsQueryProgrammer.go +1 -1
- package/native/core/programmers/http/HttpParameterProgrammer.go +2 -4
- package/native/core/programmers/http/HttpQueryProgrammer.go +8 -10
- package/native/core/programmers/http/HttpValidateFormDataProgrammer.go +2 -4
- package/native/core/programmers/http/HttpValidateHeadersProgrammer.go +1 -1
- package/native/core/programmers/http/HttpValidateQueryProgrammer.go +1 -1
- package/native/core/programmers/internal/CheckerProgrammer.go +26 -28
- package/native/core/programmers/internal/FeatureProgrammer.go +32 -34
- package/native/core/programmers/iterate/check_array_length.go +1 -1
- package/native/core/programmers/iterate/check_bigint.go +2 -4
- package/native/core/programmers/iterate/check_dynamic_key.go +5 -7
- package/native/core/programmers/iterate/check_dynamic_properties.go +43 -57
- package/native/core/programmers/iterate/check_everything.go +3 -5
- package/native/core/programmers/iterate/check_exclude.go +2 -4
- package/native/core/programmers/iterate/check_native.go +2 -4
- package/native/core/programmers/iterate/check_number.go +2 -4
- package/native/core/programmers/iterate/check_object.go +3 -5
- package/native/core/programmers/iterate/check_object_type_tags.go +1 -1
- package/native/core/programmers/iterate/check_string.go +2 -4
- package/native/core/programmers/iterate/check_template.go +7 -9
- package/native/core/programmers/iterate/decode_union_object.go +2 -4
- package/native/core/programmers/iterate/feature_object_entries.go +2 -4
- package/native/core/programmers/json/JsonAssertParseProgrammer.go +2 -2
- package/native/core/programmers/json/JsonAssertStringifyProgrammer.go +2 -4
- package/native/core/programmers/json/JsonIsParseProgrammer.go +4 -6
- package/native/core/programmers/json/JsonIsStringifyProgrammer.go +2 -4
- package/native/core/programmers/json/JsonStringifyProgrammer.go +37 -39
- package/native/core/programmers/json/JsonValidateParseProgrammer.go +2 -2
- package/native/core/programmers/json/JsonValidateStringifyProgrammer.go +2 -4
- package/native/core/programmers/llm/LlmApplicationProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmCoerceProgrammer.go +2 -4
- package/native/core/programmers/llm/LlmControllerProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmEvaluationProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmParametersProgrammer.go +1 -3
- package/native/core/programmers/llm/LlmParseProgrammer.go +3 -5
- package/native/core/programmers/llm/LlmSchemaProgrammer.go +5 -7
- package/native/core/programmers/llm/LlmStructuredOutputProgrammer.go +2 -4
- package/native/core/programmers/llm/llm_schema_programmer_coverage_test.go +1 -1
- package/native/core/programmers/notations/NotationAssertGeneralProgrammer.go +1 -3
- package/native/core/programmers/notations/NotationGeneralProgrammer.go +26 -28
- package/native/core/programmers/notations/NotationIsGeneralProgrammer.go +1 -3
- package/native/core/programmers/notations/NotationValidateGeneralProgrammer.go +1 -3
- package/native/core/programmers/plain/PlainAssertClassifyProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainAssertCloneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainAssertPruneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainClassifyProgrammer.go +44 -46
- package/native/core/programmers/plain/PlainCloneProgrammer.go +30 -32
- package/native/core/programmers/plain/PlainIsCloneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainIsPruneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainPruneProgrammer.go +26 -28
- package/native/core/programmers/plain/PlainValidateClassifyProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainValidateCloneProgrammer.go +2 -4
- package/native/core/programmers/plain/PlainValidatePruneProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufAssertDecodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufAssertEncodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufDecodeProgrammer.go +24 -25
- package/native/core/programmers/protobuf/ProtobufEncodeProgrammer.go +23 -25
- package/native/core/programmers/protobuf/ProtobufIsDecodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufIsEncodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +1 -3
- package/native/core/programmers/protobuf/ProtobufValidateDecodeProgrammer.go +2 -4
- package/native/core/programmers/protobuf/ProtobufValidateEncodeProgrammer.go +3 -5
- package/native/core/programmers/protobuf/protobuf_programmer_helper_coverage_test.go +1 -1
- package/native/core/programmers/reflect/ReflectLiteralsProgrammer.go +1 -3
- package/native/core/schemas/metadata/MetadataCollection.go +2 -2
- package/native/core/schemas/metadata/MetadataDefaultLibrary.go +1 -1
- package/native/core/schemas/metadata/MetadataDependency.go +13 -13
- package/native/core/utils/PromiseTypeFactory.go +3 -3
- package/native/go.mod +3 -4
- package/native/go.work +1 -1
- package/native/transform/CallExpressionTransformer.go +4 -4
- package/native/transform/FileTransformer.go +2 -4
- package/native/transform/features/RandomTransformer.go +1 -3
- package/native/transform/features/compare/CompareEqualTransformer.go +1 -1
- package/native/transform/features/compare/CompareLessTransformer.go +1 -1
- package/native/transform/features/functional/FunctionalGenericTransformer.go +2 -2
- package/native/transform/features/llm/LlmCoerceTransformer.go +1 -1
- package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations.go +1 -1
- package/native/transform/features/llm/LlmEvaluationTransformer.go +1 -1
- package/native/transform/features/llm/LlmParseTransformer.go +1 -1
- package/native/transform/features/llm/LlmSchemaTransformer.go +1 -3
- package/native/transform/features/reflect/ReflectNameTransformer.go +1 -3
- package/native/transform/file_transformer_coverage_test.go +2 -1
- package/native/transform/internal/GenericTransformer.go +1 -3
- package/package.json +6 -6
- package/src/transform.ts +6 -2
|
@@ -44,8 +44,8 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
44
44
|
// Capture the first symbol declaration's source file when locatable so
|
|
45
45
|
// plain.classify can value-import a cross-module class it reconstructs.
|
|
46
46
|
// Additive: other features ignore obj.Source.
|
|
47
|
-
if sym := props.Type.Symbol(); sym != nil && len(sym
|
|
48
|
-
decl := sym
|
|
47
|
+
if sym := props.Type.Symbol(); sym != nil && len(nativeast.SymbolDeclarationsOf(sym)) != 0 {
|
|
48
|
+
decl := nativeast.SymbolDeclarationsOf(sym)[0]
|
|
49
49
|
// A `class` (declaration or expression — including a generic instantiation,
|
|
50
50
|
// whose symbol still resolves to the class declaration) has a runtime value
|
|
51
51
|
// binding; an interface / type alias / anonymous object literal does not, so
|
|
@@ -53,7 +53,7 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
53
53
|
// name. classRefOf gates on this.
|
|
54
54
|
obj.IsClass = decl.Kind == nativeast.KindClassDeclaration || decl.Kind == nativeast.KindClassExpression
|
|
55
55
|
if src := nativeast.GetSourceFileOfNode(decl); src != nil {
|
|
56
|
-
file := src.FileName()
|
|
56
|
+
file := string(src.FileName())
|
|
57
57
|
obj.Source = &file
|
|
58
58
|
// The Default modifier covers `export default class C {}`; a SEPARATE
|
|
59
59
|
// `class C {}; export default C;` puts no modifier on the class, so also
|
|
@@ -126,7 +126,7 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
126
126
|
pred := func(symbol *nativeast.Symbol, node *nativeast.Node) bool {
|
|
127
127
|
name := "<anonymous>"
|
|
128
128
|
if symbol != nil {
|
|
129
|
-
name = symbol
|
|
129
|
+
name = nativeast.SymbolNameOf(symbol)
|
|
130
130
|
}
|
|
131
131
|
// Diagnose ES #private before the symbol-key filter so JEV reports the
|
|
132
132
|
// nominal member rather than its compiler-generated mangled name.
|
|
@@ -146,7 +146,7 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
146
146
|
// would declare an uninhabitable required property (#2226). Checked on the
|
|
147
147
|
// SYMBOL rather than a declaration node so a late-bound member with no
|
|
148
148
|
// reachable declaration is excluded too.
|
|
149
|
-
if symbol != nil && iterate_metadata_intersection_is_symbol_name(symbol
|
|
149
|
+
if symbol != nil && iterate_metadata_intersection_is_symbol_name(nativeast.SymbolNameOf(symbol)) {
|
|
150
150
|
rejectMember(name, "LLM evaluation does not support symbol-keyed properties.")
|
|
151
151
|
return false
|
|
152
152
|
}
|
|
@@ -180,24 +180,24 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
180
180
|
continue
|
|
181
181
|
}
|
|
182
182
|
var node *nativeast.Node
|
|
183
|
-
if len(symbol
|
|
184
|
-
node = symbol
|
|
183
|
+
if len(nativeast.SymbolDeclarationsOf(symbol)) != 0 {
|
|
184
|
+
node = nativeast.SymbolDeclarationsOf(symbol)[0]
|
|
185
185
|
}
|
|
186
186
|
var typ *nativechecker.Type
|
|
187
187
|
if node != nil {
|
|
188
188
|
typ = props.Checker.GetTypeOfSymbolAtLocation(symbol, node)
|
|
189
189
|
} else {
|
|
190
|
-
typ = nativechecker.Checker_getTypeOfPropertyOfType(props.Checker, props.Type, symbol
|
|
190
|
+
typ = nativechecker.Checker_getTypeOfPropertyOfType(props.Checker, props.Type, nativeast.SymbolNameOf(symbol))
|
|
191
191
|
}
|
|
192
192
|
if pred(symbol, node) == false || typ == nil {
|
|
193
193
|
continue
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
key := MetadataHelper.Literal_to_metadata(symbol
|
|
196
|
+
key := MetadataHelper.Literal_to_metadata(nativeast.SymbolNameOf(symbol))
|
|
197
197
|
explore := MetadataFactory_IExplore{
|
|
198
198
|
Top: false,
|
|
199
199
|
Object: obj,
|
|
200
|
-
Property: symbol
|
|
200
|
+
Property: nativeast.SymbolNameOf(symbol),
|
|
201
201
|
Parameter: nil,
|
|
202
202
|
Nested: nil,
|
|
203
203
|
Aliased: false,
|
|
@@ -213,7 +213,7 @@ func Emplace_metadata_object(props IMetadataIteratorProps) *schemametadata.Metad
|
|
|
213
213
|
Explore: explore,
|
|
214
214
|
Intersected: false,
|
|
215
215
|
})
|
|
216
|
-
value.Optional = symbol
|
|
216
|
+
value.Optional = nativeast.SymbolFlagsOf(symbol)&nativeast.SymbolFlagsOptional != 0
|
|
217
217
|
insert(emplace_metadata_object_insert{
|
|
218
218
|
Key: key,
|
|
219
219
|
Value: value,
|
|
@@ -299,7 +299,7 @@ func emplace_metadata_object_touch_heritage(
|
|
|
299
299
|
return
|
|
300
300
|
}
|
|
301
301
|
visited[symbol] = true
|
|
302
|
-
for _, decl := range symbol
|
|
302
|
+
for _, decl := range nativeast.SymbolDeclarationsOf(symbol) {
|
|
303
303
|
if decl == nil {
|
|
304
304
|
continue
|
|
305
305
|
}
|
|
@@ -336,15 +336,24 @@ func emplace_metadata_object_touch_heritage(
|
|
|
336
336
|
// The node walk reports the heritage expression's symbol and every
|
|
337
337
|
// reference written in its type arguments (e.g. `extends Base<Id>`).
|
|
338
338
|
schemametadata.MetadataDependency_touchTypeNode(checker, element)
|
|
339
|
-
|
|
340
|
-
|
|
339
|
+
// Type heritage (interface extends and class implements) is a type
|
|
340
|
+
// reference on 7.1; class extends remains an expression. Older targets
|
|
341
|
+
// represent both forms as expressions with type arguments.
|
|
342
|
+
var name *nativeast.Node
|
|
343
|
+
switch element.Kind {
|
|
344
|
+
case nativeast.KindTypeReference:
|
|
345
|
+
name = element.AsTypeReferenceNode().TypeName
|
|
346
|
+
case nativeast.KindExpressionWithTypeArguments:
|
|
347
|
+
name = element.AsExpressionWithTypeArguments().Expression
|
|
348
|
+
}
|
|
349
|
+
if name == nil {
|
|
341
350
|
continue
|
|
342
351
|
}
|
|
343
|
-
target := checker.GetSymbolAtLocation(
|
|
352
|
+
target := checker.GetSymbolAtLocation(name)
|
|
344
353
|
if target == nil {
|
|
345
354
|
continue
|
|
346
355
|
}
|
|
347
|
-
if target
|
|
356
|
+
if nativeast.SymbolFlagsOf(target)&nativeast.SymbolFlagsAlias != 0 {
|
|
348
357
|
if resolved := nativechecker.Checker_getAliasedSymbol(checker, target); resolved != nil {
|
|
349
358
|
target = resolved
|
|
350
359
|
}
|
|
@@ -366,10 +375,10 @@ func emplace_metadata_object_private_fields(checker *nativechecker.Checker, typ
|
|
|
366
375
|
}
|
|
367
376
|
visited[typ] = true
|
|
368
377
|
sym := typ.Symbol()
|
|
369
|
-
if sym == nil || len(sym
|
|
378
|
+
if sym == nil || len(nativeast.SymbolDeclarationsOf(sym)) == 0 {
|
|
370
379
|
return false
|
|
371
380
|
}
|
|
372
|
-
decl := sym
|
|
381
|
+
decl := nativeast.SymbolDeclarationsOf(sym)[0]
|
|
373
382
|
var members []*nativeast.Node
|
|
374
383
|
if decl.Kind == nativeast.KindClassDeclaration {
|
|
375
384
|
if cd := decl.AsClassDeclaration(); cd != nil && cd.Members != nil {
|
|
@@ -441,7 +450,7 @@ func emplace_metadata_object_is_default_export(
|
|
|
441
450
|
if target == nil {
|
|
442
451
|
continue
|
|
443
452
|
}
|
|
444
|
-
if target == sym || (len(target
|
|
453
|
+
if target == sym || (len(nativeast.SymbolDeclarationsOf(target)) != 0 && nativeast.SymbolDeclarationsOf(target)[0] == decl) {
|
|
445
454
|
return true
|
|
446
455
|
}
|
|
447
456
|
}
|
|
@@ -592,21 +601,21 @@ func emplace_metadata_object_intersection_append(
|
|
|
592
601
|
continue
|
|
593
602
|
}
|
|
594
603
|
var node *nativeast.Node
|
|
595
|
-
if len(symbol
|
|
596
|
-
node = symbol
|
|
604
|
+
if len(nativeast.SymbolDeclarationsOf(symbol)) != 0 {
|
|
605
|
+
node = nativeast.SymbolDeclarationsOf(symbol)[0]
|
|
597
606
|
}
|
|
598
607
|
var typ *nativechecker.Type
|
|
599
608
|
if node != nil {
|
|
600
609
|
typ = props.Checker.GetTypeOfSymbolAtLocation(symbol, node)
|
|
601
610
|
} else {
|
|
602
|
-
typ = nativechecker.Checker_getTypeOfPropertyOfType(props.Checker, child, symbol
|
|
611
|
+
typ = nativechecker.Checker_getTypeOfPropertyOfType(props.Checker, child, nativeast.SymbolNameOf(symbol))
|
|
603
612
|
}
|
|
604
613
|
if pred(symbol, node) == false || typ == nil {
|
|
605
614
|
continue
|
|
606
615
|
}
|
|
607
616
|
|
|
608
617
|
explore := props.Explore
|
|
609
|
-
explore.Property = symbol
|
|
618
|
+
explore.Property = nativeast.SymbolNameOf(symbol)
|
|
610
619
|
explore.Parameter = nil
|
|
611
620
|
explore.Nested = nil
|
|
612
621
|
explore.Aliased = false
|
|
@@ -622,9 +631,9 @@ func emplace_metadata_object_intersection_append(
|
|
|
622
631
|
Intersected: false,
|
|
623
632
|
Prunable: props.Prunable,
|
|
624
633
|
})
|
|
625
|
-
value.Optional = symbol
|
|
634
|
+
value.Optional = nativeast.SymbolFlagsOf(symbol)&nativeast.SymbolFlagsOptional != 0
|
|
626
635
|
insert(emplace_metadata_object_insert{
|
|
627
|
-
Key: MetadataHelper.Literal_to_metadata(symbol
|
|
636
|
+
Key: MetadataHelper.Literal_to_metadata(nativeast.SymbolNameOf(symbol)),
|
|
628
637
|
Value: value,
|
|
629
638
|
Symbol: symbol,
|
|
630
639
|
Node: node,
|
|
@@ -662,10 +671,10 @@ func emplace_metadata_object_intersection_has_duplicate_key(
|
|
|
662
671
|
return true
|
|
663
672
|
}
|
|
664
673
|
for _, symbol := range collection.ApparentProperties(checker, child) {
|
|
665
|
-
if keys[symbol
|
|
674
|
+
if keys[nativeast.SymbolNameOf(symbol)] {
|
|
666
675
|
return true
|
|
667
676
|
}
|
|
668
|
-
keys[symbol
|
|
677
|
+
keys[nativeast.SymbolNameOf(symbol)] = true
|
|
669
678
|
}
|
|
670
679
|
}
|
|
671
680
|
return false
|
|
@@ -19,10 +19,10 @@ func Iterate_metadata_alias(props IMetadataIteratorProps) bool {
|
|
|
19
19
|
return false
|
|
20
20
|
}
|
|
21
21
|
aliasSymbol := nativechecker_type_name_symbol(props.Type)
|
|
22
|
-
if aliasSymbol == nil || len(aliasSymbol
|
|
22
|
+
if aliasSymbol == nil || len(nativeast.SymbolDeclarationsOf(aliasSymbol)) == 0 {
|
|
23
23
|
return false
|
|
24
24
|
}
|
|
25
|
-
if aliasSymbol
|
|
25
|
+
if nativeast.SymbolDeclarationsOf(aliasSymbol)[0].Kind != nativeast.KindTypeAliasDeclaration {
|
|
26
26
|
return false
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -168,18 +168,18 @@ func iterate_metadata_constant_shared(checker *nativechecker.Checker, typ *nativ
|
|
|
168
168
|
return false
|
|
169
169
|
}
|
|
170
170
|
symbol := typ.Symbol()
|
|
171
|
-
if symbol == nil || len(symbol
|
|
171
|
+
if symbol == nil || len(nativeast.SymbolDeclarationsOf(symbol)) == 0 {
|
|
172
172
|
return false
|
|
173
173
|
}
|
|
174
|
-
declaration := symbol
|
|
174
|
+
declaration := nativeast.SymbolDeclarationsOf(symbol)[0]
|
|
175
175
|
if declaration == nil || declaration.Kind != nativeast.KindEnumMember || declaration.Parent == nil {
|
|
176
176
|
return false
|
|
177
177
|
}
|
|
178
178
|
// declaration merging (`enum E { a = 1 }` beside `enum E { b = 1 }`) spreads
|
|
179
179
|
// one enum over several declarations
|
|
180
180
|
declarations := []*nativeast.Node{declaration.Parent}
|
|
181
|
-
if symbol
|
|
182
|
-
declarations =
|
|
181
|
+
if nativeast.SymbolParentOf(symbol) != nil && len(nativeast.SymbolDeclarationsOf(nativeast.SymbolParentOf(symbol))) != 0 {
|
|
182
|
+
declarations = nativeast.SymbolDeclarationsOf(nativeast.SymbolParentOf(symbol))
|
|
183
183
|
}
|
|
184
184
|
// compare by value: a member's own type may be the fresh form of the
|
|
185
185
|
// regular literal type the union holds
|
|
@@ -55,7 +55,7 @@ func Iterate_metadata_function(props IMetadataIteratorProps) bool {
|
|
|
55
55
|
paramType := props.Checker.GetTypeOfSymbol(p)
|
|
56
56
|
explore := props.Explore
|
|
57
57
|
explore.Top = false
|
|
58
|
-
explore.Parameter = p
|
|
58
|
+
explore.Parameter = nativeast.SymbolNameOf(p)
|
|
59
59
|
metadata := Explore_metadata(Explore_metadata_IProps{
|
|
60
60
|
Options: props.Options,
|
|
61
61
|
Checker: props.Checker,
|
|
@@ -78,7 +78,7 @@ func Iterate_metadata_function(props IMetadataIteratorProps) bool {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
parameters = append(parameters, schemametadata.MetadataParameter_create(schemametadata.MetadataParameter{
|
|
81
|
-
Name: p
|
|
81
|
+
Name: nativeast.SymbolNameOf(p),
|
|
82
82
|
Type: metadata,
|
|
83
83
|
TsType: paramType,
|
|
84
84
|
Description: metadata_node_description(p),
|
|
@@ -585,10 +585,10 @@ func iterate_metadata_intersection_is_removable_object_constraint(
|
|
|
585
585
|
// nominal brand), so it is phantom and removable. typia's own tag is handled
|
|
586
586
|
// as a constraint, not stripped here; any required string-keyed property might
|
|
587
587
|
// be real data ??both keep the object as a constraint, not a removable brand.
|
|
588
|
-
if iterate_metadata_intersection_is_symbol_name(symbol
|
|
588
|
+
if iterate_metadata_intersection_is_symbol_name(nativeast.SymbolNameOf(symbol)) {
|
|
589
589
|
continue
|
|
590
590
|
}
|
|
591
|
-
if symbol
|
|
591
|
+
if nativeast.SymbolNameOf(symbol) == "typia.tag" || nativeast.SymbolFlagsOf(symbol)&nativeast.SymbolFlagsOptional == 0 {
|
|
592
592
|
return false
|
|
593
593
|
}
|
|
594
594
|
}
|
|
@@ -654,7 +654,7 @@ func iterate_metadata_intersection_identify(
|
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
656
|
for _, symbol := range collection.ApparentProperties(checker, typ) {
|
|
657
|
-
if symbol
|
|
657
|
+
if nativeast.SymbolNameOf(symbol) == "typia.tag" {
|
|
658
658
|
return iterate_metadata_intersection_identity{Kind: "tag"}
|
|
659
659
|
}
|
|
660
660
|
}
|
|
@@ -784,7 +784,7 @@ func iterate_metadata_intersection_is_plain_object_only(
|
|
|
784
784
|
}
|
|
785
785
|
|
|
786
786
|
for _, symbol := range collection.ApparentProperties(checker, typ) {
|
|
787
|
-
if symbol
|
|
787
|
+
if nativeast.SymbolNameOf(symbol) == "typia.tag" {
|
|
788
788
|
return false
|
|
789
789
|
}
|
|
790
790
|
}
|
|
@@ -927,7 +927,7 @@ func iterate_metadata_intersection_has_conflicting_required_literal(
|
|
|
927
927
|
return false
|
|
928
928
|
}
|
|
929
929
|
for _, symbol := range collection.ApparentProperties(checker, child) {
|
|
930
|
-
if symbol
|
|
930
|
+
if nativeast.SymbolFlagsOf(symbol)&nativeast.SymbolFlagsOptional != 0 {
|
|
931
931
|
continue
|
|
932
932
|
}
|
|
933
933
|
propertyType := iterate_metadata_intersection_property_type(checker, child, symbol)
|
|
@@ -935,14 +935,14 @@ func iterate_metadata_intersection_has_conflicting_required_literal(
|
|
|
935
935
|
if ok == false {
|
|
936
936
|
continue
|
|
937
937
|
}
|
|
938
|
-
list := constraints[symbol
|
|
938
|
+
list := constraints[nativeast.SymbolNameOf(symbol)]
|
|
939
939
|
for _, prev := range list {
|
|
940
940
|
if iterate_metadata_intersection_literal_disjoint(prev, literal) {
|
|
941
941
|
result = true
|
|
942
942
|
return true
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
constraints[symbol
|
|
945
|
+
constraints[nativeast.SymbolNameOf(symbol)] = append(list, literal)
|
|
946
946
|
}
|
|
947
947
|
return false
|
|
948
948
|
}
|
|
@@ -958,12 +958,12 @@ func iterate_metadata_intersection_property_type(
|
|
|
958
958
|
if checker == nil || owner == nil || symbol == nil {
|
|
959
959
|
return nil
|
|
960
960
|
}
|
|
961
|
-
if len(symbol
|
|
962
|
-
if typ := checker.GetTypeOfSymbolAtLocation(symbol, symbol
|
|
961
|
+
if len(nativeast.SymbolDeclarationsOf(symbol)) != 0 {
|
|
962
|
+
if typ := checker.GetTypeOfSymbolAtLocation(symbol, nativeast.SymbolDeclarationsOf(symbol)[0]); typ != nil {
|
|
963
963
|
return typ
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
|
-
return nativechecker.Checker_getTypeOfPropertyOfType(checker, owner, symbol
|
|
966
|
+
return nativechecker.Checker_getTypeOfPropertyOfType(checker, owner, nativeast.SymbolNameOf(symbol))
|
|
967
967
|
}
|
|
968
968
|
|
|
969
969
|
func iterate_metadata_intersection_literal_set(
|
|
@@ -1065,7 +1065,7 @@ func iterate_metadata_intersection_category(
|
|
|
1065
1065
|
return "array"
|
|
1066
1066
|
}
|
|
1067
1067
|
for _, symbol := range collection.ApparentProperties(checker, typ) {
|
|
1068
|
-
if symbol
|
|
1068
|
+
if nativeast.SymbolNameOf(symbol) == "typia.tag" {
|
|
1069
1069
|
return "tag"
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
@@ -4,12 +4,7 @@
|
|
|
4
4
|
package metadata
|
|
5
5
|
|
|
6
6
|
import (
|
|
7
|
-
"path/filepath"
|
|
8
7
|
"testing"
|
|
9
|
-
|
|
10
|
-
nativeast "github.com/microsoft/typescript-go/shim/ast"
|
|
11
|
-
nativecore "github.com/microsoft/typescript-go/shim/core"
|
|
12
|
-
nativeparser "github.com/microsoft/typescript-go/shim/parser"
|
|
13
8
|
)
|
|
14
9
|
|
|
15
10
|
// TestJsDocLinkText verifies the metadata helper renders visible inline links.
|
|
@@ -29,11 +24,9 @@ import (
|
|
|
29
24
|
// @evidence contracts/testing.md#behavioral-verification JSDoc is parsed from source and the link renderer returns descriptions and tags with qualified targets, labels, call suffixes, URLs and tag comments; a nil link renders empty.
|
|
30
25
|
// @evidence contracts/testing.md#independent-expectations Authored JSDoc text defines the visible output; expected strings are literals.
|
|
31
26
|
// @evidence contracts/testing.md#distinguishing-cases Qualified and labeled links, URL links and tag comments are separate rows with a nil control.
|
|
32
|
-
// @evidence contracts/testing.md#execution-ownership The typia_native_internal Go command (go -C packages/typia/test test -tags typia_native_internal ../native/...) runs this same-package Test function in process. The tagged test
|
|
27
|
+
// @evidence contracts/testing.md#execution-ownership The typia_native_internal Go command (go -C packages/typia/test test -tags typia_native_internal ../native/...) runs this same-package Test function in process. The tagged test loads one authored TypeScript source through the in-process compiler binder and calls the renderer on its real property symbol. A test-owned fixture and Program are cleaned up without launching a compiler or native host process.
|
|
33
28
|
func TestJsDocLinkText(t *testing.T) {
|
|
34
|
-
file :=
|
|
35
|
-
nativeast.SourceFileParseOptions{FileName: filepath.ToSlash(filepath.Join(t.TempDir(), "links.ts"))},
|
|
36
|
-
`interface ITarget {
|
|
29
|
+
program, file := jsDocTestSource(t, `interface ITarget {
|
|
37
30
|
value: string;
|
|
38
31
|
}
|
|
39
32
|
interface IBox {
|
|
@@ -48,14 +41,11 @@ interface IBox {
|
|
|
48
41
|
*/
|
|
49
42
|
field: string;
|
|
50
43
|
}
|
|
51
|
-
|
|
52
|
-
nativecore.ScriptKindTS,
|
|
53
|
-
)
|
|
44
|
+
`)
|
|
54
45
|
member := file.Statements.Nodes[1].AsInterfaceDeclaration().Members.Nodes[0]
|
|
55
|
-
symbol :=
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Declarations: []*nativeast.Node{member},
|
|
46
|
+
symbol := program.Checker.GetSymbolAtLocation(member.Name())
|
|
47
|
+
if symbol == nil {
|
|
48
|
+
t.Fatal("comment property symbol was not bound")
|
|
59
49
|
}
|
|
60
50
|
description := metadata_node_description(symbol)
|
|
61
51
|
if description == nil {
|
package/native/core/factories/internal/metadata/js_doc_parameter_name_reads_qualified_name_test.go
CHANGED
|
@@ -10,6 +10,7 @@ import (
|
|
|
10
10
|
nativeast "github.com/microsoft/typescript-go/shim/ast"
|
|
11
11
|
nativecore "github.com/microsoft/typescript-go/shim/core"
|
|
12
12
|
nativeparser "github.com/microsoft/typescript-go/shim/parser"
|
|
13
|
+
nativetspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
// TestJSDocParameterNameReadsQualifiedName verifies dotted JSDoc parameter names.
|
|
@@ -30,7 +31,7 @@ import (
|
|
|
30
31
|
// @evidence contracts/testing.md#execution-ownership The typia_native_internal Go command (go -C packages/typia/test test -tags typia_native_internal ../native/...) runs this same-package Test function in process. The tagged test parses in-memory source with the typescript-go parser, with no filesystem fixture or process.
|
|
31
32
|
func TestJSDocParameterNameReadsQualifiedName(t *testing.T) {
|
|
32
33
|
file := nativeparser.ParseSourceFile(
|
|
33
|
-
nativeast.SourceFileParseOptions{FileName: filepath.ToSlash(filepath.Join(t.TempDir(), "qualified.ts"))},
|
|
34
|
+
nativeast.SourceFileParseOptions{FileName: nativetspath.RootedFilePath(filepath.ToSlash(filepath.Join(t.TempDir(), "qualified.ts")))},
|
|
34
35
|
`interface Box {
|
|
35
36
|
/**
|
|
36
37
|
* @param input.value nested value
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//go:build typia_native_internal
|
|
2
|
+
|
|
3
|
+
package metadata
|
|
4
|
+
|
|
5
|
+
import (
|
|
6
|
+
"os"
|
|
7
|
+
"path/filepath"
|
|
8
|
+
"testing"
|
|
9
|
+
|
|
10
|
+
nativeast "github.com/microsoft/typescript-go/shim/ast"
|
|
11
|
+
"github.com/samchon/ttsc/packages/ttsc/driver"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
// jsDocTestSource loads authored comments with the real compiler binder so
|
|
15
|
+
// metadata tests consume compiler-owned symbols on either TypeScript target.
|
|
16
|
+
// The caller selects declarations from the returned file; one Program can hold
|
|
17
|
+
// every comment spelling in a table, and test cleanup closes that Program.
|
|
18
|
+
func jsDocTestSource(t *testing.T, text string) (*driver.Program, *nativeast.SourceFile) {
|
|
19
|
+
t.Helper()
|
|
20
|
+
root := t.TempDir()
|
|
21
|
+
fileName := filepath.Join(root, "comments.ts")
|
|
22
|
+
for name, content := range map[string]string{
|
|
23
|
+
"comments.ts": text,
|
|
24
|
+
"tsconfig.json": `{"compilerOptions":{"target":"es2022","module":"nodenext","moduleResolution":"nodenext","strict":true,"skipLibCheck":true,"types":[]},"files":["comments.ts"]}`,
|
|
25
|
+
} {
|
|
26
|
+
if err := os.WriteFile(filepath.Join(root, name), []byte(content), 0o644); err != nil {
|
|
27
|
+
t.Fatal(err)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
program, diagnostics, err := driver.LoadProgram(root, "tsconfig.json", driver.LoadProgramOptions{})
|
|
31
|
+
if err != nil || driver.CountErrors(diagnostics) != 0 {
|
|
32
|
+
t.Fatalf("load JSDoc fixture: %v; %+v", err, diagnostics)
|
|
33
|
+
}
|
|
34
|
+
t.Cleanup(func() {
|
|
35
|
+
if err := program.Close(); err != nil {
|
|
36
|
+
t.Error(err)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
source := program.SourceFile(fileName)
|
|
40
|
+
if source == nil {
|
|
41
|
+
t.Fatal("JSDoc source was not loaded")
|
|
42
|
+
}
|
|
43
|
+
return program, source
|
|
44
|
+
}
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
package metadata
|
|
5
5
|
|
|
6
6
|
import (
|
|
7
|
-
"
|
|
7
|
+
"fmt"
|
|
8
8
|
"reflect"
|
|
9
|
+
"strings"
|
|
9
10
|
"testing"
|
|
10
11
|
|
|
11
|
-
nativeast "github.com/microsoft/typescript-go/shim/ast"
|
|
12
|
-
nativecore "github.com/microsoft/typescript-go/shim/core"
|
|
13
|
-
nativeparser "github.com/microsoft/typescript-go/shim/parser"
|
|
14
12
|
schemametadata "github.com/samchon/typia/packages/typia/native/core/schemas/metadata"
|
|
15
13
|
)
|
|
16
14
|
|
|
@@ -25,16 +23,12 @@ import (
|
|
|
25
23
|
// 3. Compare exact payloads, keeping literal stars, linked-text separation and
|
|
26
24
|
// Unicode prefixes that the JSDoc scanner treats as content.
|
|
27
25
|
//
|
|
28
|
-
// @evidence contracts/testing.md#behavioral-verification
|
|
26
|
+
// @evidence contracts/testing.md#behavioral-verification One compiler Program binds all authored JSDoc-bearing declarations and metadata_node_js_doc_tags extracts their public metadata values; exact tag arrays expose added star payload or dropped legitimate description text.
|
|
29
27
|
// @evidence contracts/testing.md#independent-expectations Literal arrays follow the JSDoc scanner's ASCII-started whitespace and CR/LF delimiter rules; Unicode-only prefixes and Unicode line characters remain content, as confirmed against TypeScript's independent JSDoc parser. Expected link labels, integer values and literal stars are authored separately from the metadata helper.
|
|
30
28
|
// @evidence contracts/testing.md#distinguishing-cases Compact and braced tags, CRLF and ASCII horizontal whitespace, and ASCII-started mixed Unicode horizontal whitespace retain integer meaning; inline and continuation literal stars, Unicode-only prefix content and Unicode line characters prevent over-removal. Line and paragraph separators after an ASCII space must not be crossed to strip a genuine star. Linked descriptions retain their separating newline. All nineteen spellings report independent subtest identities.
|
|
31
|
-
// @evidence contracts/testing.md#execution-ownership This tagged same-package Go unit
|
|
29
|
+
// @evidence contracts/testing.md#execution-ownership This tagged same-package Go unit loads one test-owned source containing all nineteen distinct interfaces, selects their real compiler symbols and calls the private metadata helper. The canonical typia_native_internal command executes the Test and subtests; cleanup closes the shared in-process Program and removes its fixture, with no compiler or native host subprocess.
|
|
32
30
|
func TestJsDocTypeTagBlankSeparation(t *testing.T) {
|
|
33
|
-
|
|
34
|
-
if err != nil {
|
|
35
|
-
t.Fatal(err)
|
|
36
|
-
}
|
|
37
|
-
for _, fixture := range []struct {
|
|
31
|
+
fixtures := []struct {
|
|
38
32
|
name string
|
|
39
33
|
text string
|
|
40
34
|
description string
|
|
@@ -59,18 +53,18 @@ func TestJsDocTypeTagBlankSeparation(t *testing.T) {
|
|
|
59
53
|
{"bom-content", "* @type int\n\ufeff*\n\ufeff* @minimum 3\n\ufeff*\n\ufeff* @title literal * marks", "*", "3\n\ufeff*\n\ufeff*"},
|
|
60
54
|
{"zero-width-content", "* @type int\n\u200b*\n\u200b* @minimum 3\n\u200b*\n\u200b* @title literal * marks", "*", "3\n\u200b*\n\u200b*"},
|
|
61
55
|
{"unicode-line-content", "* @type int\u2028 *\u2028 * @minimum 3\u2029 *\u2029 * @title literal * marks", "*", "3\u2029 *\u2029 *"},
|
|
62
|
-
}
|
|
56
|
+
}
|
|
57
|
+
var source strings.Builder
|
|
58
|
+
for index, fixture := range fixtures {
|
|
59
|
+
fmt.Fprintf(&source, "interface Box%d {\n /**\n %s\n */\n field: number;\n}\n", index, fixture.text)
|
|
60
|
+
}
|
|
61
|
+
program, file := jsDocTestSource(t, source.String())
|
|
62
|
+
for index, fixture := range fixtures {
|
|
63
63
|
t.Run(fixture.name, func(t *testing.T) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
)
|
|
69
|
-
member := file.Statements.Nodes[0].AsInterfaceDeclaration().Members.Nodes[0]
|
|
70
|
-
symbol := &nativeast.Symbol{
|
|
71
|
-
Name: "field",
|
|
72
|
-
ValueDeclaration: member,
|
|
73
|
-
Declarations: []*nativeast.Node{member},
|
|
64
|
+
member := file.Statements.Nodes[index].AsInterfaceDeclaration().Members.Nodes[0]
|
|
65
|
+
symbol := program.Checker.GetSymbolAtLocation(member.Name())
|
|
66
|
+
if symbol == nil {
|
|
67
|
+
t.Fatal("comment property symbol was not bound")
|
|
74
68
|
}
|
|
75
69
|
wanted := []schemametadata.IJsDocTagInfo{
|
|
76
70
|
{Name: "type", Text: []schemametadata.IJsDocTagInfo_IText{{Kind: "text", Text: "int"}}},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package factories
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
nativecontext "github.com/samchon/typia/packages/typia/native/core/context"
|
|
4
5
|
"testing"
|
|
5
6
|
|
|
6
7
|
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
@@ -23,7 +24,7 @@ import (
|
|
|
23
24
|
// @evidence contracts/testing.md#distinguishing-cases Number int32/uint32/int64/uint64, bigint int64/uint64 and unknown controls distinguish signedness, width, exact string construction and unrestricted fallback.
|
|
24
25
|
// @evidence contracts/testing.md#execution-ownership The canonical native Go command (pnpm test:go:native) runs this same-package Test function in process. It builds AST nodes in memory with no checker, filesystem fixture or process.
|
|
25
26
|
func TestNumericRangeFactoryEnforces64BitBounds(t *testing.T) {
|
|
26
|
-
input :=
|
|
27
|
+
input := nativecontext.NodeFactoryOf().NewIdentifier("input")
|
|
27
28
|
|
|
28
29
|
for _, name := range []string{"int64", "uint64"} {
|
|
29
30
|
node := NumericRangeFactory.Bigint(name, input)
|