diff --git a/packages/patterns/src/patterns/patternMatchers.js b/packages/patterns/src/patterns/patternMatchers.js index 6611d07d20..14c0ea23fc 100644 --- a/packages/patterns/src/patterns/patternMatchers.js +++ b/packages/patterns/src/patterns/patternMatchers.js @@ -941,11 +941,19 @@ const makePatternKit = () => { return false; } const { label } = remotableDesc; + const passStyle = passStyleOf(specimen); + const kindDetails = + passStyle !== 'tagged' + ? // Pass style can be embedded in details without quotes. + b(passStyle) + : // Tag must be quoted because it is potentially attacker-controlled + // (unlike `kindOf`, this does not reject unrecognized tags). + q(getTag(specimen)); return check( false, // `label` can be embedded without quotes because it is provided by // local code like `M.remotable("...")`. - X`${specimen} - Must be a remotable (${b(label)})`, + X`${kindDetails} ${specimen} - Must be a remotable (${b(label)})`, ); // We would like to use the commented out code below rather than the // the similar code immediately above. The new code improves the error @@ -953,14 +961,6 @@ const makePatternKit = () => { // depend on the error message emitted by the code above. // TODO use the code below when we can. // - // const passStyle = passStyleOf(specimen); - // const kindDetails = - // passStyle !== 'tagged' - // ? // Pass style can be embedded in details without quotes. - // b(passStyle) - // : // Tag must be quoted because it is potentially attacker-controlled - // // (unlike `kindOf`, this does not reject unrecognized tags). - // q(getTag(specimen)); // return check( // false, // // `label` can be embedded without quotes because it is provided by