diff --git a/developer/src/kmc-ldml/src/compiler/compiler.ts b/developer/src/kmc-ldml/src/compiler/compiler.ts index 9da7c9cd87a..b972baf7509 100644 --- a/developer/src/kmc-ldml/src/compiler/compiler.ts +++ b/developer/src/kmc-ldml/src/compiler/compiler.ts @@ -343,11 +343,7 @@ export class LdmlKeyboardCompiler implements KeymanCompiler { } const sect = section.compile(globalSections); - /* c8 ignore next 7 */ if(!sect) { - // This should not happen -- validate() should have told us - // if something is going to fail to compile - this.callbacks.reportMessage(CompilerMessages.Fatal_SectionCompilerFailed({sect:section.id})); passed = false; continue; } diff --git a/developer/src/kmc-ldml/src/compiler/messages.ts b/developer/src/kmc-ldml/src/compiler/messages.ts index e93340e2297..a4f19f170a6 100644 --- a/developer/src/kmc-ldml/src/compiler/messages.ts +++ b/developer/src/kmc-ldml/src/compiler/messages.ts @@ -1,9 +1,9 @@ -import { util, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def, CompilerMessageSpecWithException } from "@keymanapp/common-types"; +import { util, CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def } from "@keymanapp/common-types"; // const SevInfo = CompilerErrorSeverity.Info | CompilerErrorNamespace.LdmlKeyboardCompiler; const SevHint = CompilerErrorSeverity.Hint | CompilerErrorNamespace.LdmlKeyboardCompiler; const SevWarn = CompilerErrorSeverity.Warn | CompilerErrorNamespace.LdmlKeyboardCompiler; const SevError = CompilerErrorSeverity.Error | CompilerErrorNamespace.LdmlKeyboardCompiler; -const SevFatal = CompilerErrorSeverity.Fatal | CompilerErrorNamespace.LdmlKeyboardCompiler; +// const SevFatal = CompilerErrorSeverity.Fatal | CompilerErrorNamespace.LdmlKeyboardCompiler; /** * @internal @@ -59,9 +59,7 @@ export class CompilerMessages { static Error_MustBeAtLeastOneLayerElement = () => m(this.ERROR_MustBeAtLeastOneLayerElement, `The source file must contain at least one layer element.`); - static FATAL_SectionCompilerFailed = SevFatal | 0x000F; - static Fatal_SectionCompilerFailed = (o:{sect: string}) => - CompilerMessageSpecWithException(this.FATAL_SectionCompilerFailed, null, `The compiler for '${def(o.sect)}' failed unexpectedly.`); + // 0x000F - available /** annotate the to= or id= entry */ private static outputOrKeyId(o:{output?: string, keyId?: string}) { diff --git a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-bad-tran-2.xml b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-bad-tran-2.xml index fba5698c000..24d904f7f2d 100644 --- a/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-bad-tran-2.xml +++ b/developer/src/kmc-ldml/test/fixtures/sections/tran/fail-bad-tran-2.xml @@ -5,6 +5,13 @@ + + + + + + + diff --git a/developer/src/kmc-ldml/test/test-compiler-e2e.ts b/developer/src/kmc-ldml/test/test-compiler-e2e.ts index aa014e15a62..63b01ccb23e 100644 --- a/developer/src/kmc-ldml/test/test-compiler-e2e.ts +++ b/developer/src/kmc-ldml/test/test-compiler-e2e.ts @@ -117,4 +117,16 @@ describe('compiler-tests', function() { ]); assert.isNotNull(kmx); }); + it('should fail on extra escapes - sections/tran/fail-bad-tran-2.xml', async function() { + const inputFilename = makePathToFixture('sections/tran/fail-bad-tran-2.xml'); + const kmx = await compileKeyboard(inputFilename, { ...compilerTestOptions, saveDebug: true, shouldAddCompilerVersion: false }, + [ + CompilerMessages.Error_InvalidQuadEscape({ cp: 295 }), + ], + true, // validation should fail + [ + // compiler messages (not reached, we've already failed) + ]); + assert.isNull(kmx); // should fail post-validate + }); }); diff --git a/developer/src/kmc-ldml/test/test-tran.ts b/developer/src/kmc-ldml/test/test-tran.ts index 277eaaf1664..2ee82fd2d20 100644 --- a/developer/src/kmc-ldml/test/test-tran.ts +++ b/developer/src/kmc-ldml/test/test-tran.ts @@ -292,6 +292,7 @@ describe('tran', function () { ], }, { + // also used in test-compiler-e2e.ts subpath: `sections/tran/fail-bad-tran-2.xml`, errors: [ CompilerMessages.Error_InvalidQuadEscape({ cp: 295 }),