Providing new forms to shplait

I would like a single module to provide both a new datatype and new expression form to importing shplait modules. The expression form is defined as a macro but AFAICT isn’t expressible using shplait’s restricted macros. Hence, my module (provider.rhm, say) is written in rhombus, like

#lang rhombus/and_meta

module foo ~lang shplait:
  type Foo
  | bar(i :: Int)
  | baz(b :: Boolean)

import self!foo open
export all_from(self!foo)

expr.macro 'test $x':
  ~op_stx self
  Syntax.replace_scopes(
    'match $x
     | bar(i): i
     | baz(b): if b | 10 | 12',
    self
  )

My understanding is that this use of Syntax.replace_scopes will produce code as if it appeared literally in the macro use module so that, if the importing module is in shplait, match, implicits, etc. will refer to shplait’s bindings and it will be interpreted essentially as shplait code. However, while

#lang shplait
import: open: "provider.rhm"

match bar(10)
| bar(i): i
| baz(b): if b | 10 | 12

produces 10, the module

#lang shplait
import: open: "provider.rhm"

test bar(10)

produces an error *parsed: no type available, possibly an unbound identifier; in: bar(10)*.

The error suggests to me that the macro is not hooking into shplait’s type system as it should, and discourages me that I may not be able to generate vanilla shplait code but must invoke some type hooks as well.

Is there a way to write the macro I want–in rhombus, that produces shplait code, that an importing shplait module can use, and alongside a new type definition?

If not, how should I be thinking about integrating into shplait’s type system? As in, where am I obligated to interact with it? (I’m somewhat familiar with the macros it defines in its private implementation as I’m currently generating the code to which shplait code expands–not generating shplait directly.)

Thank you for any help anyone is willing to give.

To follow up, I discovered that the syntax pattern 'test $x’ results in a parsed form bound to x. Changing it to 'test $x …’ addressed the issue in this case. This encourages me that careful matching will allow me to generate shplait code.