Commit Graph

2463 Commits

Author SHA1 Message Date
Grigorii Kirgizov e2b3c21b2f Change semantics of implicit ListFeature: treat as wildcard, not as empty list
Motivation is that implicit (non-overriden) list features must unify
with list of any length. Consider an example:
`classifier(cls: node-ptr/A/) = classifier(cls: node-ptr/A/ param: [B,C])`
With previous approach it would fail, which seems counter-intuitive to me.
So, if empty list (e.g. of type parameters) is meant, then it must be
specified explicitly.

There's one thing to remember, though: such wildcard list features
won't match with MetaLogicalArrays in rule heads.
(e.g. see dpromote_* rules and consider what happens when
a classifier with unbound `parameter` feature comes in)
2020-05-21 16:38:36 +03:00
Grigorii Kirgizov 3a99a1569a Add typechecking for AlternativeType. Move & refactor genDecl macro a bit.
Introduce common 'parameterized(child typeParams)' term
to allow unifying processing of GenericDeclarations.
Collect type variables from enclosing GenericDeclaration.
Will be needed to simplify instantiation of nested generic decls
(e.g. generic method inside generic class) using `genDecl`
machinery instead of TypeVarSubstitution.
2020-05-21 16:38:30 +03:00
Grigorii Kirgizov 3047926ce4 Fix typechecking for vararg param decls: treat them as arrays. 2020-05-21 16:31:41 +03:00
Grigorii Kirgizov 9bbcf6ecef Allow terms to inherit features from ancestor terms
Avoides the need to exactly duplicate features of ancestors.
Opens possibility to match on super-terms
with partially provided (overriden) features.

For example, suppose there's `typeParameterized(child: param)`
term which is extended by `classifier` and `methodSignature`.
Then it becomes possible to write a common rule for both terms,
matching on `typeParameterized(param=[Smth])`.
2020-05-21 16:31:36 +03:00
Grigorii Kirgizov 8b07402d48 Refactor checking type arguments into call macro. Fix type decls for checkArgs rules 2020-05-21 16:31:34 +03:00
Grigorii Kirgizov 9051e71f84 Handle case of type vars having other type vars as bounds for inference
Also uncomment hasBound_check rule which now is required
to check such type vars when their bounds become ground.
2020-05-21 16:31:27 +03:00
Grigorii Kirgizov 08743b444c Avoid producing typeOf in checkVariableDecl for unknown types (types without macros) 2020-05-21 16:31:18 +03:00
Grigorii Kirgizov ac2e3f97d2 Add typechecking for implicitly typed closure arg, add tests 2020-05-14 20:07:01 +03:00
Grigorii Kirgizov 36606e5740 Add a test for AspectClique for the case of asepct with branches 2020-05-11 15:20:37 +03:00
Fedor Isakov 9c234cac2a Quickfix: add support for AlternativeType. 2020-05-09 16:05:48 +02:00
Fedor Isakov 2ab4ae24d2 Switch to using MPS 2020.1 RC for build. 2020-05-09 15:22:03 +02:00
Fedor Isakov 82f0229aca Rebuild project. 2020-05-09 15:08:47 +02:00
Fedor Isakov da43822154 Manually migrate try statements that were not auto-migrated. 2020-05-09 15:07:06 +02:00
Fedor Isakov 14780b5561 Apply automatic migrations. 2020-05-09 15:04:25 +02:00
Fedor Isakov d1163fc883 Open and rebuild the project with MPS 2020.1. 2020-05-09 15:02:20 +02:00
Fedor Isakov f3b16186e6 Fix build scripts and regenerate. 2020-05-09 10:54:18 +02:00
Fedor Isakov acd6234415 Force save all. 2020-05-09 10:54:18 +02:00
Fedor Isakov c4fc687f76 Refactor and simplify code in AspectClique. Write tests.
Treat a language and its sidekick (if any) as a single vertex.
Add all extended languages to the pool before building the graph.
Drop dubious invariant check.
Fix the second pass in findAspectCliques ingnoring the fact
that there might be leafs without aspects.
2020-05-09 10:53:40 +02:00
Fedor Isakov 5bac140e61 Drop unnecessary test languages. 2020-05-07 10:23:04 +02:00
Fedor Isakov f2bcaffccc Revert "Upd coderules buildscript, regen build.xml"
This reverts commit 6b826334
2020-05-07 10:18:16 +02:00
Fedor Isakov 65429c800e Test for AspectClique. Use test model instead of real languages. 2020-05-07 10:16:55 +02:00
Fedor Isakov 4744081e36 Refactor AspectLookup and related interfaces for testability.
Simplify interfaces, abstract away the direct dependency
on LanguageRutime, make the code in AspectClique testable.
2020-05-07 10:16:53 +02:00
Fedor Isakov aa2785cc7a Document procedure to diagnose gradle build failure. 2020-05-07 08:40:28 +02:00
Grigorii Kirgizov 6b82633450 Upd coderules buildscript, regen build.xml 2020-05-07 02:37:35 +03:00
Grigorii Kirgizov cd3e56c16a Handle case of language cycles in AspectClique, add simple test with lang cycle (MPSCR-60) 2020-05-07 02:21:26 +03:00
Grigorii Kirgizov e7d23f9b6d Redefine how Aspect Cliques are found (fixes MPSCR-60)
Now algorithm for finding aspect cliques includes 3 stages:
1) topological sort (as before)
2) bottom-up pass with initial assignment of clique ids (as before)
3) top-down pass (i.e. in reverse topo sort order) (added stage)

The 3rd stage handles case when hierarchy of langs with
required aspect include branching point (with no join further down),
as in the case of closuresExt & collectionsExt both extending blExt,
but unrelated to each other (neither extends the other).
2020-05-07 01:28:14 +03:00
Grigorii Kirgizov bb5412230a Fix topo sort in Aspect Clique and add check for graph acyclicity (MPSCR-60) 2020-05-07 01:28:14 +03:00
Grigorii Kirgizov e1af32b97c Add tests for closuresExt concerned with yield and sequence, reproduces MPSCR-60 2020-05-07 01:28:14 +03:00
Grigorii Kirgizov e6b1fe12a7 Don't generate main closureLiteral rule when there's error with return vs. yield 2020-05-07 01:28:14 +03:00
Fedor Isakov 76991aabe7 Fix dependencies among rule tables.
Observing the invariant: whenever a constraint is used in
rule's head, the rule table containing it must extend the
one that constraint.

Also drop unused constraint from the head in ConversionFunctionIFace.
2020-05-05 16:23:13 +02:00
Fedor Isakov 2c363f85f4 Tidy up helper methods contract, drop unnecessary method.
BaseHelper.getListContents() accepts a dataform that must be
an instance of ListNode or be resolved to one via DataFormUtil.ground().
2020-05-05 15:58:48 +02:00
Fedor Isakov 587711a3e8 Drop deprecated class and its usages. 2020-05-05 15:58:48 +02:00
Fedor Isakov 6904af04ce Drop instances of deprecated concept. 2020-05-05 15:58:48 +02:00
Fedor Isakov d3a72049e8 Drop deprecated stuff from coderules lang. 2020-05-05 15:58:48 +02:00
Grigorii Kirgizov f13b5b3176 Fix a way to get needed clique in incremental tests 2020-05-05 16:45:27 +03:00
Grigorii Kirgizov 54c9af37a3 Add checking of loop statements in blExt 2020-05-05 16:45:27 +03:00
Grigorii Kirgizov c388aa25b6 Reorganise rule table extends dependencies in blExt
Mainly, avoid extending TypeOf by ConversionMain (unnecessary dependency).
It's also more logical structure: tables defining declarations go first, then typeOf-related.
So rule tables which require only decls can depend only on such tables.

Core tables extends relationship now:
TypeBound <- CheckAll <- Generics <- TypeOf
TypeBound <- ConversionMain [<- other langs' conversions]
2020-05-05 16:45:27 +03:00
Fedor Isakov 66d2896fff Ensure type variable bounds are processed in coerce query.
This fixes constraint errors in model check while running
typechecking with coderules.
2020-05-05 13:20:59 +02:00
Fedor Isakov 56c341f615 Fix apparent memory leak in coderules messages view.
Use SoftReference wrapping TraceObject to avoid out of memory
error.
2020-05-05 11:42:25 +02:00
Fedor Isakov a15a6b3f1d Fix target statement (not allowed within constraint rule). 2020-05-05 10:19:38 +02:00
Fedor Isakov ab9a22a013 Rebuild project. 2020-05-05 10:19:38 +02:00
Fedor Isakov 2dc2191be3 Editor improvement: auto-substitute name from target concept for rule templates. 2020-05-05 10:19:38 +02:00
Fedor Isakov 2f9c23581f Fix substitution menu for LogicalItemExpression.
Prevent LogicalItemExpression from wrapping ExpressionItem.
2020-05-05 10:19:38 +02:00
Fedor Isakov 4666ca5349 Deprecate an obsolete concept. 2020-05-05 10:19:38 +02:00
Fedor Isakov f43b262e7f Introduce helper behaivour methods to be used from typesystem. 2020-05-05 10:19:38 +02:00
Fedor Isakov ea687efb21 Types for j.m.logic language. 2020-05-05 10:19:32 +02:00
Grigorii Kirgizov 27b7917a1a Add conversion of closures to functional classifiers, add tests 2020-05-04 16:38:00 +03:00
Grigorii Kirgizov f75f87f13f Fix TypecheckingTestHelper to handle case of error types appearing with a reason
Error types can appear in cases similar to those of "no type"
because of addittion of "error()" term to typesystem.
2020-05-04 15:16:47 +03:00
Grigorii Kirgizov c6e20d00c2 Handle case of free vars for ternary operation and primitive subtyping (needed for closures) 2020-05-04 15:16:47 +03:00
Grigorii Kirgizov f6ebd46cb6 Disallow using OriginSpec inside rule bodies (such use case isn't handled) 2020-05-04 15:16:47 +03:00