Commit Graph

838 Commits

Author SHA1 Message Date
Fedor Isakov 73d50ef39c Add typing rules for string operations in BL 2021-07-22 13:59:19 +02:00
Fedor Isakov 7e132a8604 Drop creating blockmap file 2021-07-22 13:59:19 +02:00
Fedor Isakov d1f7932aae Generate blockmap and hash for plugin update site 2021-06-29 18:10:21 +02:00
Fedor Isakov bad065229f Rebuild project 2021-06-29 18:10:21 +02:00
Fedor Isakov 17e1bc4589 Applied migration 2021-06-29 14:51:10 +02:00
Fedor Isakov 9ea7ae2067 Better naming scheme for downloadable artefacts 2021-06-21 18:35:48 +02:00
Fedor Isakov 9826290f78 Fix building and packaging the plugins 2021-06-21 17:50:00 +02:00
Fedor Isakov 0b26d6cf7c Package mpscore languages into a separate plugin 2021-06-18 18:41:01 +02:00
Fedor Isakov 9527a097b8 Migrate to the latest MPS release, apply migrations 2021-06-18 18:41:01 +02:00
Fedor Isakov bcb4ea2499 Temporarily disable tricky to solve test case (nested generics) 2021-05-18 13:07:14 +02:00
Fedor Isakov 054ecf5c25 Adjust error annotations to reflect proper typechecking errors 2021-05-18 13:07:03 +02:00
Fedor Isakov 1e3c67949d Fix BL types: conditional op, raw types, capture conversion 2021-05-18 13:07:03 +02:00
Fedor Isakov 632d33ed0f Ensure the sample project is open with coderules plugin 2021-05-18 12:32:03 +02:00
Fedor Isakov 0cea4073cc Fix BL types: ensure proper type inference and incremental typechecking 2021-05-18 12:32:03 +02:00
Fedor Isakov f434d34d95 Test integrating stream API and smodel 2021-05-18 12:32:03 +02:00
Fedor Isakov 0691ca6a1b Drop last usage of "kind" feature 2021-05-13 15:54:44 +02:00
Fedor Isakov f623846f6c Fix function types: observe function type variance, drop wildcards 2021-05-13 15:54:44 +02:00
Fedor Isakov 6d655c4707 Update resolve info in models after renaming 2021-05-13 15:54:44 +02:00
Fedor Isakov d9225a4516 Test code for smodel/stream sample 2021-05-13 15:54:44 +02:00
Fedor Isakov bb4aa7e6e1 Fix sequence types: correctly process raw types 2021-05-13 15:54:44 +02:00
Fedor Isakov 65ec6d9d35 Fix BL types: reimplement raw type, many small fixes
Fix type inference from containment, change priority for var-ground containment.
Fix variable reference type, property, plus operation, binary ops.
Fix type variables and bounds.
Fix checking overridden methods.
Introduce stripBounds for cleaning up wildcards.
Introduce containment string ≤ String.
2021-05-13 15:54:44 +02:00
Fedor Isakov d5a91b91e5 Fix closures types: convertsTo of function type
Instead of solving convertsTo for function type in functional domain,
try to find the expected classifier type and solve for it instead.
2021-05-13 15:54:43 +02:00
Fedor Isakov 33476c837c Minor fix coderules types: ensure correct incremental processing 2021-05-13 15:54:43 +02:00
Fedor Isakov 582d62749e Minor fix generatorContext types: avoid exception on rule application 2021-05-13 15:54:43 +02:00
Fedor Isakov fc7d97f015 Fix closures types: observe function type's inherent variance 2021-05-13 15:54:43 +02:00
Fedor Isakov 7e4eff91de Fix smodel types: more precise conversion to/from classifier 2021-05-13 15:54:43 +02:00
Fedor Isakov cba508dc01 Fix collections types: indexOf accepts Object 2021-05-13 15:54:43 +02:00
Fedor Isakov 2ae85d4dae Types for j.m.lang.pattern language 2021-05-13 15:54:43 +02:00
Fedor Isakov 5a6db97aed Types for j.m.lang.scopes language 2021-05-13 15:54:43 +02:00
Fedor Isakov 827089d8ae Fix smodel types: ofconcept, attribute access, children 2021-05-13 15:54:43 +02:00
Fedor Isakov abbbfe5141 Fix behaviour types: fix wrong term 2021-05-13 15:54:43 +02:00
Fedor Isakov ab28b66981 Fix coderules types: avoid exception 2021-05-13 15:54:43 +02:00
Fedor Isakov 71cb954cba Temporary stub for NamedTuple type, to be completed later 2021-05-13 15:54:43 +02:00
Fedor Isakov a08c730ece Migrate to NodeRefItem 2021-05-13 15:54:43 +02:00
Fedor Isakov 637da7d966 Apply migration and rebuild project 2021-05-04 18:24:30 +02:00
Fedor Isakov ea6e930954 Apply migration and rebuild project 2021-05-04 18:24:29 +02:00
Fedor Isakov 81d025298c Update build script and rebuild 2021-05-04 11:07:14 +02:00
Fedor Isakov 5e4dfb249e Add tests for type variables inference 2021-05-03 13:29:13 +02:00
Fedor Isakov 0194dcdfcc Fix closure test failing after recent changes 2021-05-03 13:14:11 +02:00
Fedor Isakov 47e6e07039 Refactor processing of inference variables
Introduce hasTarget and resolveVar constraints for delayed resolving
of inference variables. In invocation context variables are not
inferred eagerly, but wait for the end of all conversions, and then
resolved via resolveVar.
2021-05-03 13:14:11 +02:00
Fedor Isakov e488399229 Minor refactoring in collections types 2021-05-03 13:14:11 +02:00
Fedor Isakov 998fa3b925 Fix BL types: make capture processing generic, couple of minor fixes 2021-05-03 13:14:11 +02:00
Fedor Isakov ae63863299 Minor code fix to ensure typechecking 2021-04-29 14:53:19 +02:00
Fedor Isakov 6a3834d91d Drop instances of a deprecated concept 2021-04-29 14:53:19 +02:00
Fedor Isakov 7cef550a08 Fix logic and coderules types: logical and termlist conversions to classfier 2021-04-29 14:53:19 +02:00
Fedor Isakov d407eb2676 Fix sequence types: support covariance with upper bound type 2021-04-29 14:53:19 +02:00
Fedor Isakov 8df5c22c8b Fix pattern terms used in typeOf: always specify concept
For SModel types that reference AbstractConceptDeclaration
a type term created without specifying the reference
automatically becomes a pattern.
A pattern can't be used in typeOf, so the default
concept (BaseConcept) is provided explicitly.
This may be later refactored into a default value in the term
table.
2021-04-29 14:53:19 +02:00
Fedor Isakov d45ef7815a Fix BL types: avoid failing on incomplete source data 2021-04-29 14:53:19 +02:00
Fedor Isakov 1c82991112 Ensure classifier type is created as pattern where applicable
List features in a term are by defualt created as empty list.
When a pattern is required, one must provide explicitly a
wildcard variable to capture either NIL or CONS list term.
2021-04-28 08:55:00 +02:00
Fedor Isakov 2f25f5566b Fix coderules types: avoid failing on incomplete source 2021-04-28 08:55:00 +02:00
Fedor Isakov c893d3280e Fix collection types: support DowncastExpression 2021-04-28 08:55:00 +02:00
Fedor Isakov cf386d848c Fix smodel types: make gendecl processed correctly, generify dpromote 2021-04-28 08:55:00 +02:00
Fedor Isakov 0eb826d00e Minor fix: typesystem types 2021-04-28 08:55:00 +02:00
Fedor Isakov da11b2cc76 Fix smodel types: enable capturing patterns for coerce, minor fix 2021-04-28 08:55:00 +02:00
Fedor Isakov 2d98b4cf67 Fix types for j.m.l.behavior -- rename sidekick language 2021-04-28 08:55:00 +02:00
Fedor Isakov fa795caedc Fix smodel types: correctly process lub type, other minor stuff 2021-04-28 08:54:25 +02:00
Fedor Isakov c6c9a6e281 BL types: drop boxing/unboxing for strong converts/coerce queries 2021-04-28 08:54:25 +02:00
Fedor Isakov ab87c8a129 Support strong convert/coerce queries 2021-04-28 08:54:25 +02:00
Fedor Isakov 870966bd70 Types for j.m.lang.script language 2021-04-28 08:54:25 +02:00
Fedor Isakov a9db172297 Smodel types: conversion for concept and conceptNode types 2021-04-28 08:54:25 +02:00
Fedor Isakov fceef17a64 Fix typechecking errors 2021-04-28 08:54:25 +02:00
Fedor Isakov 7d0e765381 Fix coderules types
Require statement accepts node-ptr
Fix coderules types: fix logical type in LateParameter
2021-04-28 08:54:25 +02:00
Fedor Isakov 118602b2fd Fix BL types: classifier type with other types as parameters
Also fix code constructs that caused typechecking errors.
2021-04-28 08:54:25 +02:00
Fedor Isakov 5dd55a4dae Ignore error messages in test 2021-04-28 08:54:25 +02:00
Fedor Isakov c0154026ef WIP Fix smodel types: reflective conversion 2021-04-28 08:54:25 +02:00
Fedor Isakov a204df222a Optimize BL types and queries
Make expectType optional (auxiliary).
Drop checkDecls from typeof query (unnecessary).
2021-04-28 08:54:25 +02:00
Fedor Isakov d918fa5c12 Optimize BL types
Switch to pull style boundOf instead of typeVarBound.
Drop importDecls.
2021-04-21 10:45:09 +02:00
Fedor Isakov bf7939b350 Fix logic types: check for null reference 2021-04-19 22:55:09 +02:00
Fedor Isakov 09149fd688 Types for j.m.l.smodel.query lang 2021-04-15 18:06:07 +02:00
Fedor Isakov 2f4f3dae6f Minor optimization in smodel types: pull-style constraint
Instead of reactively create push-style constraint conceptHierarchy,
make it available on request, pull-style.
2021-04-15 16:56:11 +02:00
Fedor Isakov ff6b5ec6ae Apply migrations and rebuild project 2021-04-14 13:19:50 +02:00
Fedor Isakov 6ed5c3329d Fix typing errors: specify correct type annotations 2021-04-14 11:59:09 +02:00
Fedor Isakov 700a7f56b4 Fix generator types 2021-04-14 10:55:29 +02:00
Fedor Isakov 8dbe0c212d Fix smodel types 2021-04-14 10:54:10 +02:00
Fedor Isakov 3a70382202 Fix typesystem types: support for meet/join 2021-04-14 10:53:41 +02:00
Fedor Isakov e76dab0d84 Fix logic and coderules types 2021-04-14 10:53:17 +02:00
Fedor Isakov 49357ab87a Drop all usages of "principal store" and "preamble" feature 2021-04-13 22:57:06 +02:00
Fedor Isakov c0601cb099 Optimizing types for more efficient evaluation
Replace "push" style genDecl constraint with "pull" schemeOf.
Mark rules as "auxiliary" to avoid these being included in
processing as dependencies.
2021-04-12 12:47:44 +02:00
Fedor Isakov ca7f630235 Rebuild build solution 2021-04-08 09:08:24 +02:00
Fedor Isakov 3793b78efb Types for j.m.baseLanguage.classifiers 2021-04-08 08:55:33 +02:00
Fedor Isakov 27420433dc Types for j.m.lang.behavior 2021-04-08 08:55:33 +02:00
Fedor Isakov 5c13129daa Fix type of logical variables in coderules types 2021-04-08 08:55:32 +02:00
Fedor Isakov 65b32a4f48 Fix lub processing in BL types 2021-04-08 08:54:46 +02:00
Fedor Isakov 1eadb46611 Fix smodel types: assign void type to operations w/o returned value 2021-04-08 08:54:22 +02:00
Fedor Isakov d527d5a114 Suppress errors in test code 2021-04-08 08:53:30 +02:00
Fedor Isakov d7ff661670 Types for j.m.l.test lang 2021-04-08 08:53:29 +02:00
Fedor Isakov 105fe1dd7e Fix dataform type conversion to term/termlist 2021-04-08 08:51:39 +02:00
Fedor Isakov 6b3e74dda2 Fix conversions in tuple types 2021-04-08 08:50:50 +02:00
Fedor Isakov f5b4b0edb0 Fix binary op in collections lang 2021-04-08 08:50:28 +02:00
Fedor Isakov 693c760618 Add types for j.m.l.test language. 2021-03-23 12:48:07 +01:00
Fedor Isakov 99e248c5b3 Fix incremental update of reported feedback
Correctly detect cache up-to-date.
Refactor feedback reporting, provide origin node as the key.
Drop invalidated feedback correctly.
Code cleanup.
2021-03-23 12:48:06 +01:00
Fedor Isakov 258a190fde Rebuild project. 2021-03-23 12:48:06 +01:00
Fedor Isakov 5fc019caca Mark an exhastive check rule as "auxiliary" to avoid including it as dependency. 2021-03-08 12:34:40 +01:00
Fedor Isakov a9ff6730ca Fix concept type conversion to classifier with undefined concept. 2021-03-08 12:34:40 +01:00
Fedor Isakov c36679bcc6 Fix logic inconsistent type error
Naive check won't suffice to ensure multilogical are used properly.
Need more sophisticated type check.
2021-03-08 12:34:39 +01:00
Fedor Isakov b70d2cc87b Drop unused dependencies 2021-02-14 15:48:08 +01:00
Fedor Isakov 4755c0dfa0 Extract test helper classes into separate redistributable module 2021-02-14 15:12:58 +01:00
Fedor Isakov 8a529758ea Remove build solution from mpscore project 2021-02-14 15:04:29 +01:00
Fedor Isakov fc1c5b8021 Drop project libraries, switch to using the plugin for loading CR modules. 2021-02-13 10:25:24 +01:00
Fedor Isakov 81831db86a Move experimental controlflow aspect to a separate language 2021-02-06 15:28:03 +01:00
Fedor Isakov caca5e606f Fix failing CI build because of empty test case 2021-02-05 12:12:48 +01:00
Fedor Isakov dee5db0e96 Drop instances of TermFeature.final property 2021-02-04 18:01:10 +01:00
Fedor Isakov d362da6a60 Rebuild project 2021-02-04 18:01:10 +01:00
Fedor Isakov ed55370a01 Fix model imports (hamcrest lib has been moved to another solution) 2021-02-04 12:27:55 +01:00
Fedor Isakov 7fe5a5ad7a Auto-updated files after migrating to MPS 2021.1 EAP 2021-02-04 12:26:59 +01:00
Fedor Isakov ecf7eec55a SModel types: fix type of isSubtypeExpression 2021-02-04 08:51:00 +01:00
Fedor Isakov 2f0f2e5b13 BL types: support coerce to target type query kind 2021-02-04 08:51:00 +01:00
Fedor Isakov 4d1cdacfe2 BL types: avoid failure on typechecking BaseMethodCall
BaseMethodCall doesn't always have an enclosing classifier.
2021-02-04 08:51:00 +01:00
Fedor Isakov ad269bb6b5 Ensure typechecking state is properly disposed of on reload 2021-02-04 08:51:00 +01:00
Grigorii Kirgizov 40a93d5ba9 Temporarily disable one failing test in IncrClassHierarchy; Preamble tests
Preamble tests should be reviewed. It's also unclear
whether preamble feature is effective and needed at all.
2021-01-29 16:21:57 +03:00
Grigorii Kirgizov 64762bf100 Fix bl tests (several test were failing after some of changes) 2021-01-29 13:39:35 +03:00
Grigorii Kirgizov 4dac9e794a Fix assignment of 'null' ret type in closures with insufficient infer info. Add require. 2021-01-29 13:39:35 +03:00
Grigorii Kirgizov 148223a842 Add incremental tests for lambda calc. Enable ignored tests for closures. 2021-01-29 13:39:35 +03:00
Fedor Isakov 2b46ab0413 BL types: ensure any type converts to Type 2021-01-23 16:59:46 +01:00
Fedor Isakov 2b6de60ebc BL types: Drop runtimeType term and its usages 2021-01-23 16:59:42 +01:00
Fedor Isakov 1389f9429f Rebuild project 2021-01-08 11:00:02 +01:00
Fedor Isakov 62e8e7d013 Switch to MPS 2020.3 release. 2021-01-08 11:00:02 +01:00
Fedor Isakov 0a77dcb33b Coderules types: fix unifiable relation, add missing typing rules 2021-01-06 12:43:55 +01:00
Fedor Isakov a9643c03b8 Logic types: fix indexed variable, make logical a supertype of its parameter 2021-01-06 12:43:55 +01:00
Fedor Isakov aec8c3f9d9 SModel types: type for concept method call 2021-01-06 12:43:55 +01:00
Fedor Isakov 143fb9cf57 Generator lang types: fix a typo 2020-12-30 18:28:46 +01:00
Fedor Isakov 6f92d666f7 BL types: a few fixes, stabilize typechecking
Support Type type.
Simplify depdendency of var decl to its type.
Covariant subtyping for UpperBoundType.
Straightforward dependencies on type's parameters.
Specify BaseConcept as general type's concept.
Fix method reference.
2020-12-30 18:28:46 +01:00
Fedor Isakov 4acae7a1b7 SModel types: minor fixes
Support SConceptLiteralType.
Drop rogue .pointer operation.
Build proper term for enumMember type.
2020-12-30 18:28:46 +01:00
Fedor Isakov 51d5687e1a Add missing language modules to mpscore project 2020-12-30 18:28:45 +01:00
Fedor Isakov 862d7f62c2 Replace direct usages of test data with proper references, fix generation 2020-12-27 21:04:51 +01:00
Fedor Isakov 67c208a360 Drop support for a few concepts that have been dropped 2020-12-27 21:04:51 +01:00
Fedor Isakov 0584d05c4f Drop support for a concept that has been apparently dropped upstream 2020-12-27 20:42:07 +01:00
Fedor Isakov 66f04fe92a Replace direct usages of test data with proper references, fix generation 2020-12-27 20:42:07 +01:00
Fedor Isakov 435a8d4ec8 Replace direct usages of test data with proper references, fix generation 2020-12-27 20:20:21 +01:00
Fedor Isakov f5c9ed7c4b Temporarily change the extends clause of Array rule table
This particular extends clause breaks an internal invariant
of rules plan, namely the topological sorting of rule tables.
This results in broken rule index, which needs to be fixed.

Also, disable a suspect rule that relies no typeof()
*not* being present, which is a transient condition.
2020-12-27 16:39:22 +01:00
Fedor Isakov d87afd868e Closure types: use lub to compute the type of closure literal
Multiple "exit points" in closure literal may have different types.
Calculate lub of these types and use it as returned type.
2020-12-27 16:04:06 +01:00
Fedor Isakov 182ea97cc1 BL internal types: support internal class 2020-12-27 16:04:06 +01:00
Fedor Isakov 2ef3176bc2 BL types: extend lub to primitive types via boxing 2020-12-27 16:04:06 +01:00
Fedor Isakov 621cdaa912 Implement lub for sequence type
Using the fact that sequence type is covariant, just forward
to lub for parameters.
2020-12-27 16:04:06 +01:00
Fedor Isakov 70d6dfefa1 Fix failing generation by disabling typechecking of cast expression
Cast expression must check the type of the argument expression
and ensure comparabitiy of types.
2020-12-27 16:04:06 +01:00
Fedor Isakov 1228ff036b BL types: substring expression, string conversion to classifier 2020-12-27 16:04:06 +01:00
Fedor Isakov 2a5163c0f4 BL types: support concept function and Void classifier 2020-12-27 10:36:00 +01:00
Fedor Isakov 7ecad792e0 Types for generator.generationContext lang 2020-12-27 10:36:00 +01:00
Fedor Isakov 4c0a06f904 Types for generator lang 2020-12-27 10:36:00 +01:00
Fedor Isakov b2c026d74a Fix closures types to populate functional classifier's parameters
On looking up the default functional classifier corresponding to a
function type, the classifier's type parameters are to be appropriately
populated from the function type.
2020-12-27 10:36:00 +01:00
Fedor Isakov cf85151dad Types for constraints lang 2020-12-27 10:36:00 +01:00
Fedor Isakov b2abb1fda2 Types for quotation lang 2020-12-27 10:36:00 +01:00
Fedor Isakov 8ab783657c Types for typesystem lang 2020-12-27 10:35:59 +01:00
Grigorii Kirgizov 27ed01c447 refactoring: Adjust uniqueTag usages for Rule.Tag refactoring
Fix rule basetag generation to coincide with templateName

Needed for PrincipalStore (occurrence cache) which uses
info about occurrence source rule template name.
2020-12-15 17:59:09 +03:00
Grigorii Kirgizov 3eccaf81a1 Introduce occurrence store as cache for their reuse in Queries strategy
It's important that program that uses occurrences from cache
shouldn't include rules that could produce their duplicates.
So implementation of occurence cache includes 2 parts:
on reactor level & in ProrgramFactory.

When RuleBuilders are produced, cache is queried whether
there're already  occurrences associated with the rule template
in question. If so -- then those RuleBuilders are not included
into the program (as well as all RuleBuilders required by it).
2020-12-15 17:59:05 +03:00
Grigorii Kirgizov 0dc072413e minor fix in BL typesystem: always check returns, it can influence resultiing type 2020-12-15 17:51:27 +03:00
Grigorii Kirgizov 61dccfd2d9 BL types: simplify array typing & fix minor errors 2020-12-15 17:51:27 +03:00
Grigorii Kirgizov b4c441a41e Add few incremental tests, tried reproduce MPSCR-82
Unsuccessfully. Algorithm is ok, problem is in UpdatesRecorder.
2020-12-15 17:51:23 +03:00
Fedor Isakov 1acd35baca SModel types: support conversion of SConcept to concept<> type 2020-12-15 13:30:13 +01:00
Fedor Isakov c7dd00bb7e Sequence types: support covariant subtyping of sequence<> type 2020-12-15 13:29:24 +01:00
Fedor Isakov 034f7afa98 BL types: add rules for NPE-safe comparison operators 2020-12-15 13:28:44 +01:00
Fedor Isakov c5fed5f2e0 BL and closure types: add necessary explicit dependencies. Fix tests.
In order to ensure properly functioning incremental typechecking
some explicit dependencies are to be declared.
2020-12-11 12:03:17 +01:00
Fedor Isakov 415590f2b2 Minor optimization: memoize calculation of functional methods. 2020-12-11 12:03:17 +01:00
Fedor Isakov c7eaa1dbf3 Clean up ProgramEvaluator API. Straighten up passing of session token. Drop RulesDiff usages. 2020-12-08 22:57:36 +01:00
Fedor Isakov 2ee4c30233 Add explicit dependencies to required sources. 2020-12-08 22:57:35 +01:00
Fedor Isakov b35aab4912 Minor types optimization: change memoizer key. 2020-12-01 22:50:01 +01:00
Fedor Isakov 60f59a7a80 Fix BL types: anonymous class creator has optional ref to constructor. 2020-11-29 00:16:51 +01:00
Fedor Isakov 044b707b77 Implement handlers for typeOf query in all types aspects. 2020-11-24 13:41:25 +01:00
Fedor Isakov a6fe5327ff Rebuild project. 2020-11-24 13:41:24 +01:00
Fedor Isakov 8691da9ad7 Update build script. 2020-11-24 13:41:24 +01:00
Fedor Isakov f313c1af9a Smodel types: support (unchecked) conversion classifier to node/nodeptr. 2020-11-24 13:41:24 +01:00
Fedor Isakov 80d2152df1 BL types: support as and instanceof 2020-11-24 13:41:24 +01:00
Fedor Isakov 17ad3b0ff7 Tuples types: conversions to unknown tuple and to classifier. 2020-11-24 13:41:24 +01:00
Fedor Isakov f627773585 Collections types: support coercion to sequence type, fix multi foreach.
Coerce to sequence type w/o element type is needed to find out
the element type of a collection.
2020-11-24 13:41:24 +01:00
Fedor Isakov 29f5992ff9 Fix logical type's conversion to classifier; fix generation.
Specifically treat convertsTo of LogicalType to ClassifierType, support
convertsTo classifier type w/o specified classifier.
Fix typeOf LogicalItemValueExpression by to rely on logical's type.
Accept LogicalItem in LogicalItemValueExpression's logical slot to enable
replacement of it with an expression at generation time.
2020-11-24 13:41:24 +01:00
Fedor Isakov fe16b80132 Refactor types in all mps foundation langs. Drop node-ptr usage as anchor in terms.
Drop node-ptr in node features, macro calls.
Drop node-ptr types in rule templates and recover closures,
fix BiConsumer params
Drop node-ptr// refs where appropriate.
Drop pointer operations from macro calls and term ctor's; add resolve to FunctionTypeLookup static table.
Drop node pointer operations from constraints, add require statements in SModel types macro table.
2020-11-24 13:41:24 +01:00
Fedor Isakov ba39d7d047 Fix NPE during processing of classifier type with null classifier. 2020-11-24 13:41:24 +01:00
Fedor Isakov bb5bddcc36 Add missing rules in coderules types. 2020-11-24 13:41:24 +01:00
Fedor Isakov 75f97618c9 Introduce cancelContravariance in closures types, fix type inference.
When inferencing the type of a closure within a method call context,
it's important to strip occasional contravariant indicator from the
closure's input variable.

A method may declare its argument to be an SMI with the type(s) of
its functional method's arguments as ? super T to facilitate subtyping.
This must not affect the inferred type of the closure's input variable.
2020-11-24 13:41:24 +01:00
Fedor Isakov 1180f33ef4 Add missing rule in BL internal types. 2020-11-24 13:41:24 +01:00
Fedor Isakov 24ed929715 Fix default class creator typechecking in baseLang.
Ensure valid list of context type var decls is passed to
instantiateScheme macro.

The code in MethodCall needs to be fixed in order to respect
context type variables in case of instantiation of a non-static inner class.
2020-11-24 13:41:24 +01:00
Grigorii Kirgizov f9239e4e40 minor: upd build.xml 2020-11-20 12:19:57 +03:00
Grigorii Kirgizov c44e3a7fd8 Upd buildscripts 2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 271c93abfa Implement hashCode() in Hierarchy.Vertex classes to adhere to contract of constraint args
Contract stems from the fact that constraint args influence Rules hashes (unique tags)
and so must be stable under irrelevant changes for incremental logic
2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 42bc7a88fd Modify incremental tests to allow testing other queries, add test 2020-11-18 11:36:28 +03:00
Grigorii Kirgizov 15cfd8a51b Refactor bl queries: separate "independent" query parts for Preamble 2020-11-18 11:36:28 +03:00
Fedor Isakov 51606b56c7 Rebuild project. 2020-10-23 12:26:31 +02:00
Grigorii Kirgizov 8bd1ba6590 Fix require statements given restriction of their semantics
Also explicitly require classifiers in Hierarchy rule table
2020-10-23 12:26:30 +02:00
Grigorii Kirgizov 9476f4bba5 Revert introduction of 'runtimeType" superterm (fixes MPSCR-74) 2020-10-23 12:26:30 +02:00
Grigorii Kirgizov 544e630ecb minor fixes in bl typesystem rules
Remove spurious input oriigin in dpromote_induction rule.
Remove unneeded CheckAll extends TypeBound.
Drop several unused rules.
2020-10-23 12:26:30 +02:00
Grigorii Kirgizov d9a35005e2 Fix cycle in coersion of functional type to unknown classifier (fixes MPSCR-72)
Use statically built FunctionTypes table in closures for
finding canonical functional type for a given closure.
2020-09-24 11:43:17 +03:00
Fedor Isakov 9886f0ec25 Re-saved models -- update resolve info. 2020-09-10 09:59:42 +02:00
Fedor Isakov 6da0ebee3f Update coderules/logic type templates (unfinished). 2020-08-20 15:02:54 +02:00
Fedor Isakov caa13a3533 Minor update: smodel type templates (unfinished). 2020-08-20 15:02:54 +02:00
Fedor Isakov e4a23ee50f Keep "types" model from deletion with a placeholder. 2020-08-20 15:02:54 +02:00
Fedor Isakov 89843bfac4 Fix build script for mpscore sample. 2020-08-17 20:30:01 +02:00
Fedor Isakov c9e4ddccbf Initial support for baseLanguageInternal types. 2020-08-17 17:19:34 +02:00
Fedor Isakov 8df7783b5b Typechecking BL: introduce templates for GenericLValueExpression. 2020-08-17 17:19:34 +02:00
Fedor Isakov 54439e255e Refactor typechecking state/cache subsystem.
Refactor whe way TypecheckingResultsCache is updated:
all mutatiting methods extracted to Update subclass, which is
only available to the updater.

Make TypecheckingState a regular container for (unit) caches.
Make TypecheckingService responsible for managing caches.

Extract TypeModuleOwner and TypeModelHandler classes.
Get rid of QueryResultsCache, merge into TypecheckingResultsCache.
TypeModuleOwner to manage "repository" cache.
2020-08-14 16:57:36 +02:00
Fedor Isakov 905e11ac33 Refactor TypecheckingService API: simplify usage, extract Request.
Request is to keep all the parameters of a given API call,
whereas TypecheckingService is to handle the state between
calls.
2020-08-14 16:17:23 +02:00
Fedor Isakov 02182f4f2f Closures lang types: add template for ClosureArgReference concept. 2020-08-12 12:38:51 +02:00
Fedor Isakov 3bac60215e Rebuild samples. 2020-08-06 17:53:20 +02:00
Grigorii Kirgizov f138e725f2 minor: provide ConvertsContexts constructors for common scenarios (eg assignment, invocation contexts) (MPSCR-63) 2020-08-04 12:38:24 +03:00
Grigorii Kirgizov ef2b299124 Refactor unchecked conversion for raw types (MPSCR-63)
Now whether unchecked conversion is allowed is controlled
by ConvertsContext.Options of convertsTo relation.
Introduce 'erased()' term to be used in raw type params.
Drop 'uncheckedConversion' parameter in all macros.
Classifier kind:"raw" is now used only for Recover.
Allow unchecked conversions by default. Forbid for sequences.
2020-08-04 12:06:07 +03:00
Grigorii Kirgizov 8c1234519f minor: substitute several usages of unification-as-inference for optional maybeUni (MPSCR-63) 2020-07-31 17:50:41 +03:00
Grigorii Kirgizov 5257e4e627 minor: rename customizable 'convertsToAlt' to 'convertsTo' (MPSCR-63)
convertsTo is now defaultConvertsTo
2020-07-31 12:36:47 +03:00
Grigorii Kirgizov 59da240fd6 Enable back some of the relaxed typechecking tests after fix for MPSCR-63 2020-07-31 11:36:02 +03:00
Grigorii Kirgizov 14130be21f Relax another test in bl typechecking (Ignore error types)
It's unclear for now how exactly this case should be handled
2020-07-31 11:36:02 +03:00
Grigorii Kirgizov 856210a5ba Migrate langs extending 'convertsTo' handling from blExt types (MPSCR-63) 2020-07-31 11:36:02 +03:00
Grigorii Kirgizov 6fdc42ac78 Add script for migraiting convertsTo relation to use ConvertsContext (MPSCR-63) 2020-07-31 11:36:02 +03:00
Grigorii Kirgizov 42240e4ba7 Relax one test for bl typechecking (ignore error types)
Can't properly handle this case now.
To handle this case of no type of initializer in assignment context
need to discern cause of this "no type". If it's because of error --
then can't assign to it any type. If there were no error
(e.g. case of test) -- then type can be inferred from assignment ctx.

Anyway it's not very important corner case, can leave this test relaxed.
2020-07-31 11:36:02 +03:00
Grigorii Kirgizov e94ea9955c Refactor primitive conversion with narrowing option and fix var decl checking (MPSCR-63)
According to JLS, narrowing is allowed in assignment context,
but forbidden e.g. in invocation context.
2020-07-31 11:36:02 +03:00
Grigorii Kirgizov e2eb0f4647 Add context options to conversion relation (MPSCR-63) 2020-07-31 11:36:01 +03:00
Fedor Isakov db78950cf3 Rebuild sample. 2020-07-30 17:39:21 +02:00
Fedor Isakov fe1df249d5 Reinstate "specific" rules in ExpectType, avoid slowdown.
Matching on two constraints without an "anchor" (origin)
is essentialy quadratic. On a large root there may be
many typeof/expectType instances and it slows down the
computation considerably.
2020-07-30 17:14:40 +02:00
Fedor Isakov 3377001494 Avoid recursing into method body when processing signature. 2020-07-30 17:14:40 +02:00
Fedor Isakov 102d13df0a Typechecking templates: use memo to cache expensive computations. 2020-07-30 17:14:40 +02:00
Fedor Isakov 4f74f192b4 Refactor typechecking state/results API for readability.
A bunch of renames:
TypesIndex -> TypecheckingResultsCache,
TypecheckingCache -> TypecheckingState.
Simplify methods that update caches.
2020-07-30 17:14:36 +02:00
Fedor Isakov 301c0993d7 Execute outstanding migrations. 2020-07-30 17:14:32 +02:00
Grigorii Kirgizov 0fd3311c04 minor: upd test model dependencies (import j.m.lang.text) 2020-07-22 15:51:56 +03:00
Fedor Isakov 3c2b3a2ee2 Fix incremental tests by checking for error type. 2020-07-22 15:27:46 +03:00
Fedor Isakov 4fc8e0cc34 Fix tests by disabling checks that fail because of missing features.
Error type is produced where there was no type before.
2020-07-22 15:27:45 +03:00
Fedor Isakov a3a5fca318 Disable "specific" rules in favour of "generic" ones in ExpectType.
The generic rules make the code more compact and readable.
2020-07-22 15:27:45 +03:00
Grigorii Kirgizov 5bea95f1ab Change `convertsToSafe` signature so it isn't considered principal (required for MPSCR-64)
Just wrap used 'node'-typed argument in a term constructor.
It's not principal according to incrementality contract described in MPSCR-66
2020-07-22 13:09:52 +03:00
Fedor Isakov 24a471a2c9 Re-save models. 2020-07-21 17:03:41 +02:00
Fedor Isakov 0088532d87 Temporary fix for "raw" types: set allowUncheckedConversion=true in coerceTo query.
In with the above flag set to false a conversion of list<T> to list (raw type)
fails, because the latter is represented as list<Object>. (T is any type).
This situation usually arises from queries like coerce(T to concept=ListType).
2020-07-21 17:02:17 +02:00
Fedor Isakov 90e90540dc Initial support for j.m.lang.typesystem lang's types. 2020-07-21 17:02:17 +02:00
Fedor Isakov 028ddfe93c Fix typechecking tests. 2020-07-16 10:33:44 +02:00
Fedor Isakov 2119fbc591 Introduce explicit dependency on SRepository, stop trying to recover it from node.
TypecheckingService and provider component are explicitly dependent
on SRepository.
The repository instance comes from the first opened project, which
is a dirty hack and is temporary until Typechecking Facade API
is fixed to provide appropriate instance.
2020-07-16 10:33:44 +02:00
Fedor Isakov d5a259bbde Re-apply all re-runnable migrations (one fix). 2020-07-11 15:59:51 +02:00
Fedor Isakov 936190bca9 Apply migrations. 2020-07-11 15:13:08 +02:00
Fedor Isakov 2bfcdba6d9 Fix tests for "raw" sequence type and raw Iterator.
TBD. This is a temporary fix, still unclear what "raw" sequence is.
2020-07-09 13:41:26 +02:00
Fedor Isakov 42ae077945 Use free var for type parameter when allowUncheckedConversion=true.
Drop the obsolete "null" type hack in case allowUncheckedConversion=true.
Ensure the flag doesn't work recursively.
2020-07-09 13:41:26 +02:00
Fedor Isakov a8907bedf2 Add types for blTypes lang. For the sake of PrimitiveType. Fix mpscore project. 2020-07-09 11:50:16 +02:00
Fedor Isakov ca973ddc51 Fix test compilation. 2020-07-07 13:50:43 +02:00
Fedor Isakov 8731ca0fce Fix typechecking baseMethodCall: correctly idenify this type. 2020-07-03 16:23:00 +02:00
Fedor Isakov d2b270b14c Rebuild mpscore buildscript. 2020-07-03 16:23:00 +02:00
Grigorii Kirgizov 7e996c8772 Disable checking local types in 2 tests (in anticipation of MPSCR-63 fix) 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 2df90d00c5 minor: fix buildscript depndencies 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov cba5ff86ed Remove 'error' type-like term from bl typesystem
It was aimed at precluding cascading typechecking failures.
(There was some case with typechecking 'hasBound' after incorrect bind.)

It seems controversial. Typechecking with it is no more predictable
than with free variables left unbound in case of error.
With current tests almost nothing changes after removing it.
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 424b473b8d Fix error on checking recursive type var bounds (Recursion root) 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov ebddf94c42 minor: remove unnecessary head dependencies in few rules
These unused in bodies constraints were for tracking certain
cases of incremental dependencies. Now it's handled by minor
algorithm extension introduced in several previous commits.
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov a37bd44de0 disable tests on inremental typechecking of recursive closure 'invoke'
To fix them need either extending incr algo to handle rules which
postpone binding logicals in principal constraints (i.e. typeOf)
(see rules in Closures for 'invoke' expression)
or rewriting these rules to not produce typeOf with free logicals.
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov f9ca9f2766 Handle usedDataHash computation for macros
Fixes IncrClosureInference.changeFunctionalInterfaceParam test.
Temporary rules built as macro applications weren't computing hash
due to origin!=null condition. Also macro inputs weren't processed.

Stable hash for TypeVarSubstitution is defined because it's used in macro args.
In general, any classes used as constraint/predicate/macro args
must adhere to stable hashCode() contract: hash should change
if there're important changes that may influence typechecking result.
Otherwise there may be unnecessary incremental recomputations.
Relevant for MPSCR-62
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 672b46dc65 minor: fix mistake in IncrClosureInference.changeFunctionalInterfaceParams test 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 1943157cd0 update samples test models dependencies & regen build.xml 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov a16756bfdb Fix error reporting in bl.closures for conversion to functional interface
Add 'genDecl' constraint in heads of toFunctionalCls* rules
to handle incremental changes to respective classifier.
Also fail instead of just reporting error to break execution and
report on correct node according to calling rule.
2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 8ccfa63111 Add test methods for ensuring incremental logic for rules diff 2020-07-01 14:36:48 +03:00
Grigorii Kirgizov 51b0438888 Add tests for incremental processing of closure type inference 2020-07-01 14:36:45 +03:00
Grigorii Kirgizov 827d2e5c42 Add tests for generic method calls 2020-07-01 14:36:45 +03:00
Grigorii Kirgizov 36e4e01f2e Аdd tests for changes to class hierarchy with generics 2020-07-01 14:36:45 +03:00
Fedor Isakov d4602c50d6 Ensure relevant input concepts are in query scope. 2020-06-28 17:14:35 +02:00
Fedor Isakov 9c1d3aad92 Move Result class to commonly-used runtime solution. 2020-06-25 14:30:30 +02:00
Fedor Isakov 11b9709ab1 Provide lift type macro for UndefinedType.
UndefinedType should leave the logical variable unassigned.
Type is an abstract superconcept, so reaching it means
there should have an override for lift macro.
2020-06-24 14:36:31 +02:00
Fedor Isakov 82b37d8103 Add module dependencies to test modules.
This ensures the tests can be launched on a test module in isolation.
2020-06-24 13:59:58 +02:00
Fedor Isakov ecb2569bad Types for smodel lang. 2020-06-22 13:38:09 +02:00
Fedor Isakov ab99a0245c Introduce runtime support module j.m.coderules.runtime. 2020-06-21 23:17:33 +02:00
Fedor Isakov 8441ebc5e1 Minor refactoring in HierarchyGraph: introduce OriginPath.
Use OriginPath for origin vertices instead of InstPath.
Also separate buildPath into two methods for clarity.
2020-06-19 17:34:18 +02:00
Fedor Isakov 3c46f210ca Rebuild build script. 2020-06-18 13:12:02 +02:00
Fedor Isakov be76070914 Replace unification with match where applicable, minor cleanup.
Replace unification with the intent of capturing term feature
with match constraint.
Drop unused term feature from head pattern.
Provide better context for failed class inheritance test.
2020-06-18 13:05:24 +02:00