Package: groovy.typecheckers

## [Groovy] Class MonadicChecker

- groovy.typecheckers.MonadicChecker

-     @Incubating
      class MonadicChecker
      extends TypeCheckingDSL

  Teaches `@CompileStatic`/`@TypeChecked` about the `DO` macro's desugared output: calls to `org.apache.groovy.runtime.Comprehensions.bind` and `.map`, declared `(Object, Closure):Object`. Three jobs:

  - Enforce receiver shape: the carrier must participate (allow-list, structural `flatMap`/`map`, or `@Monadic`); otherwise a precise compile error naming the type and the missing shape.
  - Enforce closure-return shape (trusted carriers only — registry or `@Monadic`, not structural): `bind`'s closure must yield the same carrier (catches a bare body or a cross-carrier body inside `DO`, which the erased dispatcher signature otherwise lets through); `map`'s closure must not yield the same carrier (the `M<M<T>>` foot-gun for hand-written `Comprehensions.map`).
  - Assist inference: type the generator closure's parameter as the carrier's element type (so the body type-checks), and restore the comprehension's result type (so `.get()`/nesting type-check) instead of the erased `Object` the dispatcher signature would yield.
  Closure-parameter typing works by pre-setting `CLOSURE_ARGUMENTS` on the closure node, which `StaticTypeCheckingVisitor.getTypeFromClosureArguments` consults by parameter name — independent of the `Closure<?>` parameter not being a SAM type. Activate with `@CompileStatic(extensions='groovy.typecheckers.MonadicChecker')`.
  Since:
    6.0.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `MonadicChecker()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `Object` | `run()`

- - ### Constructor Detail

    - #### MonadicChecker()

  - ### Method Detail

    - #### @Override
      Object run()