Code review comment: Identifying the narrowest type will remove the requirement to add `string` here.

Code under review:
public void testNegativeErrorVariables() {
        CompileResult resultNegative = BCompileUtil.
                compile("test-src/statements/variabledef/error_variable_definition_stmt_negative.bal");
        Assert.assertEquals(resultNegative.getErrorCount(), 15);
        int i = -1;
        BAssertUtil.validateError(resultNegative, ++i, "redeclared symbol 'reason11'", 27, 9);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'SMS', found 'SMA'", 28, 85);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'boolean', found 'string'", 30, 26);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 31, 28);
        BAssertUtil.validateError(resultNegative, ++i, "redeclared symbol 'reason11'", 41, 9);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'boolean', found 'string'", 44, 26);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 45, 28);
        BAssertUtil.validateError(resultNegative, ++i,
                "redeclared symbol 'message'", 54, 26);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'int', found 'map<(anydata|error|string)>'", 56, 18);
        BAssertUtil.validateError(resultNegative, ++i,
                "invalid error variable; expecting an error type but found 'int' in type definition", 57, 47);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'boolean', found 'string'", 63, 17);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 64, 16);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 70, 16);
        BAssertUtil.validateError(resultNegative, ++i,
                "no new variables on left side", 75, 9);
        BAssertUtil.validateError(resultNegative, ++i,
                "no new variables on left side", 76, 9);
    }

Line commented on: "incompatible types: expected 'int', found 'map<(anydata|error|string)>'", 56, 18);

Revised code:
public void testNegativeErrorVariables() {
        CompileResult resultNegative = BCompileUtil.
                compile("test-src/statements/variabledef/error_variable_definition_stmt_negative.bal");
        Assert.assertEquals(resultNegative.getErrorCount(), 15);
        int i = -1;
        BAssertUtil.validateError(resultNegative, ++i, "redeclared symbol 'reason11'", 27, 9);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'SMS', found 'SMA'", 28, 85);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'boolean', found 'string'", 30, 26);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 31, 28);
        BAssertUtil.validateError(resultNegative, ++i, "redeclared symbol 'reason11'", 41, 9);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'boolean', found 'string'", 44, 26);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 45, 28);
        BAssertUtil.validateError(resultNegative, ++i,
                "redeclared symbol 'message'", 54, 26);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'int', found 'map<(anydata|error)>'", 56, 18);
        BAssertUtil.validateError(resultNegative, ++i,
                "invalid error variable; expecting an error type but found 'int' in type definition", 57, 47);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'boolean', found 'string'", 63, 17);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 64, 16);
        BAssertUtil.validateError(resultNegative, ++i,
                "incompatible types: expected 'string', found 'string?'", 70, 16);
        BAssertUtil.validateError(resultNegative, ++i,
                "no new variables on left side", 75, 9);
        BAssertUtil.validateError(resultNegative, ++i,
                "no new variables on left side", 76, 9);
    }