Skip to main content

UninitializedPatternMatch

rascal-0.40.17

Synopsis

Pattern matching has not been properly initialized.

Description

Pattern matching requires two ingredients:

  • One of the many patterns.
  • A non-void subject value to which the pattern is applied.

This error is generated when the subject is void.

Remedy: replace the subject by a non-void value.

Examples

Here is a (contrived) example that produces this error:

rascal>void dummy() { return; }
void (): function(|prompt:///|(0,24,<1,0>,<1,24>))
rascal>int n := dummy();
|prompt:///|(9,5,<1,9>,<1,14>): Uninitialized pattern match: trying to match a value of the type 'void'
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UninitializedPatternMatch|
ok

Benefits

  • As far as we know there is no other way to trigger this static error.

Pitfalls

  • The error message seems to point to the pattern for the cause but the cause is in the static type (void) of the subject on the right.