Skip to content

patterns: getRankCover(kindMatcher, …) incorrectly treats "copyBag" as a pass style #3052

@gibson042

Description

@gibson042

Describe the bug

The match:kind getRankCover has an incorrect list of known tags.

Steps to reproduce

import '@endo/init';
import { makePassableKit } from '@endo/marshal';
import { M, getRankCover } from '@endo/patterns';

const { encodePassable } = makePassableKit();

const goodMatcher = M.kind('copySet');
console.log(getRankCover(goodMatcher));
// => [ ':', ';' ]

const badMatcher = M.kind('copyBag');
console.log(getRankCover(badMatcher));
// => TypeError: Cannot read properties of undefined (reading 'cover')

const unknownMatcher = M.kind('foo');
console.log(getRankCover(unknownMatcher));
// => TypeError: Cannot read properties of undefined (reading 'cover')

Expected behavior

getRankCover treats copyBag matchers the same as copySet matchers. I also think it should emit a range covering all taggeds for an unknown kind matcher, but (for accommodating the possibility of introducing new pass styles in the future) a case could also be made for emitting a range that covers all values, or for preserving the current behavior of throwing an exception. But as noted elsewhere, I'm not comfortable with mixing known pass styles and known tag names into a single "kind" concept at all.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions