Emit an error message. This tries to emit an error message at the location specified by `context`, falling back to the location specified by `ctx.context`. This is helpful when the only context information about where you want to put the error message may be None (like it is for `Callab
(ctx: PluginContext, msg: str, context: Context | None)
| 70 | |
| 71 | |
| 72 | def fail(ctx: PluginContext, msg: str, context: Context | None) -> None: |
| 73 | """Emit an error message. |
| 74 | |
| 75 | This tries to emit an error message at the location specified by `context`, falling back to the |
| 76 | location specified by `ctx.context`. This is helpful when the only context information about |
| 77 | where you want to put the error message may be None (like it is for `CallableType.definition`) |
| 78 | and falling back to the location of the calling function is fine.""" |
| 79 | # TODO: figure out if there is some more reliable way of getting context information, so this |
| 80 | # function isn't necessary |
| 81 | if context is not None: |
| 82 | err_context = context |
| 83 | else: |
| 84 | err_context = ctx.context |
| 85 | ctx.api.fail(msg, err_context) |
| 86 | |
| 87 | |
| 88 | def create_singledispatch_function_callback(ctx: FunctionContext) -> Type: |
no test coverage detected
searching dependent graphs…