Skip to content

Commit

Permalink
FIXED: появлялись переменные e.Call при обобщении сигнатур (#319)
Browse files Browse the repository at this point in the history
Когда обнаруживалось зацикливание по Хигману-Крускалу, после построения
обобщённого вызова не восстанавливались вызовы в нём — оставались заглушки
e.Call.
  • Loading branch information
Mazdaywik committed Jul 18, 2020
1 parent 8ab4c95 commit 68b7a69
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions autotests/opt-tree-spec5-call-vars.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
* TREE

$ENTRY Go {
/* empty */
= '*' : s.Sym
= <G (s.Sym) 'abcd'> : '*abcd'
= /* empty */;
}

$SPEC G (e.RES) e.str;

G {
(e.Res) t.Term e.Tail = <G (e.Res <H t.Term>) e.Tail>;
(e.Res) /* empty */ = e.Res;
}

H {
e.X = e.X;
}
5 changes: 3 additions & 2 deletions src/compiler/OptTree-Spec.ref
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ SpecCall-Aux {
(e.Signature) (e.HistorySignature) (e.Argument)
(e.SpecPattern) (e.StaticMatches) (e.Name)
(e.Body) s.NextNumber (e.Signatures) (e.DynamicMatches)
(e.History)
(e.History) (e.Calls)
>;

False
Expand Down Expand Up @@ -1412,7 +1412,7 @@ MakeGeneralization {
(e.Signature) (e.HistorySignature) (e.Argument)
(e.SpecPattern) (e.StaticMatches) (e.Name)
(e.Body) s.NextNumber (e.Signatures) (e.DynamicMatches)
(e.History)
(e.History) (e.Calls)

/* Получаем обобщение двух сигнатур */
= <GetSignaturesGeneralization
Expand Down Expand Up @@ -1469,6 +1469,7 @@ MakeGeneralization {

/* К новому вызову применяем подстановку*/
= <ApplySubst-Expr (e.RealSubst) t.NewCall> : t.NewCall^
= <ApplySubst-Expr (e.Calls) t.NewCall> : t.NewCall^

= t.Info
t.NewCall
Expand Down

0 comments on commit 68b7a69

Please sign in to comment.