From 2acdc48bf60957f9ccc9a34fe1ac234f521ded5e Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Wed, 14 Jun 2023 17:20:23 -0700 Subject: [PATCH] test(patterns): revert error msg improvement that breaks old tests --- .../patterns/src/patterns/patternMatchers.js | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/patterns/src/patterns/patternMatchers.js b/packages/patterns/src/patterns/patternMatchers.js index ee49e4d29d..6611d07d20 100644 --- a/packages/patterns/src/patterns/patternMatchers.js +++ b/packages/patterns/src/patterns/patternMatchers.js @@ -941,20 +941,31 @@ 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)}, not ${kindDetails}`, + X`${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 + // message, which is great. However, currently agoric-sdk has tests that + // 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 + // // local code like `M.remotable("...")`. + // X`${specimen} - Must be a remotable ${b(label)}, not ${kindDetails}`, }, checkIsWellFormed: (allegedRemotableDesc, check) =>