This commit is contained in:
Alexander Algasov 2018-10-24 21:18:53 +03:00
parent a2702ecb73
commit 694c75454e
6 changed files with 67 additions and 1 deletions

View file

@ -0,0 +1,12 @@
type
t1 = class end;
t2 = class end;
i1 = interface end;
begin
var a1: t1;
var a2: t2;
var a3: i1;
if a1 is t2(var o) then;
end.

View file

@ -0,0 +1,12 @@
type
t1 = class end;
t2 = class end;
i1 = interface end;
begin
var a1: t1;
var a2: t2;
var a3: i1;
if a2 is t1(var o) then;
end.

View file

@ -0,0 +1,12 @@
type
t1 = class end;
t2 = class end;
i1 = interface end;
begin
var a1: t1;
var a2: t2;
var a3: i1;
if a3 is t1(var o) then;
end.

View file

@ -0,0 +1,12 @@
type
t1 = class end;
t2 = class end;
i1 = interface end;
begin
var a1: t1;
var a2: t2;
var a3: i1;
if a3 is t2(var o) then;
end.

View file

@ -0,0 +1,18 @@
type
t1 = class end;
t2 = class end;
i1 = interface end;
begin
var a1: t1;
var a2: t2;
var a3: i1;
if a1 is t1(var o) then;
if a1 is i1(var o) then;
if a2 is t2(var o) then;
if a2 is i1(var o) then;
if a3 is i1(var o) then;
end.

View file

@ -254,7 +254,7 @@ namespace PascalABCCompiler.TreeConverter
if (type_table.is_derived(type, expression) ||
type_table.is_derived(expression, type) ||
AreTheSameType(type, expression) ||
type.IsInterface && expression.IsInterface)
type.IsInterface)
return;
AddError(get_location(matchedExpression), "EXPRESSION_OF_TYPE_{0}_CANNOT_BE_MATCHED_AGAINST_PATTERN_WITH_TYPE_{1}", expression.name, type.name);