migrated to svn revision 33108
authorHannu Niemistö <hannu.niemisto@iki.fi>
Mon, 15 Aug 2016 09:38:14 +0000 (12:38 +0300)
committerHannu Niemistö <hannu.niemisto@iki.fi>
Mon, 15 Aug 2016 09:38:14 +0000 (12:38 +0300)
310 files changed:
bundles/com.famfamfam.silk/META-INF/MANIFEST.MF
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java
bundles/org.simantics.db.procore.server.environment/build.properties
bundles/org.simantics.db.procore.server.environment/src/msijni.dll [deleted file]
bundles/org.simantics.db.procore.server.environment/src/msijni64.dll [deleted file]
bundles/org.simantics.db.procore.ui/META-INF/MANIFEST.MF
bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/ProCoreUserAgent.java
bundles/org.simantics.db.server/build.properties
bundles/org.simantics.diagram.ontology/build.properties
bundles/org.simantics.document.server/build.properties
bundles/org.simantics.layer0/build.properties
bundles/org.simantics.nativemem/.classpath [new file with mode: 0644]
bundles/org.simantics.nativemem/.project [new file with mode: 0644]
bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
bundles/org.simantics.nativemem/.settings/org.eclipse.pde.core.prefs [new file with mode: 0644]
bundles/org.simantics.nativemem/META-INF/MANIFEST.MF [new file with mode: 0644]
bundles/org.simantics.nativemem/build.properties [new file with mode: 0644]
bundles/org.simantics.nativemem/jna-4.2.1.jar [new file with mode: 0644]
bundles/org.simantics.nativemem/jna-platform-4.2.1.jar [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/ProcessMemoryCounters.java [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Arch.java [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/OS.java [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Psapi32.java [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Psapi64.java [new file with mode: 0644]
bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Test.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/src/org/cojen/classfile/MethodDesc.java
bundles/org.simantics.scl.compiler/src/org/cojen/classfile/TypeDesc.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/CommandSession.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/commands/ValueToStringConverter.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/CompilationTimer.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/DocumentationGeneration.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/NameExistenceChecks.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/NamespaceOfModule.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeChecking.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeCheckingOld.java [deleted file]
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeCheckingScheduler.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeInferableDefinition.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/LocalBoxedArrayElementConstant.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/LocalVariableConstant.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/generic/ClassRef.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/contexts/SimplificationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/contexts/TranslationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/contexts/TypeTranslationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/contexts/TypingContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/equation/EqGuard.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ASTExpression.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Case.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/DecoratingExpression.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApply.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EApplyType.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAsPattern.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EBind.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEnforce.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEntityTypeAnnotation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EEquations.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EError.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EExternalConstant.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EFieldAccess.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EGetConstraint.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIf.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EIntegerLiteral.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambda.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELambdaType.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELet.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListComprehension.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EListLiteral.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELiteral.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EMatch.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EPreLet.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EPreRuleset.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERealLiteral.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERuleset.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESelect.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLambda.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ESimpleLet.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETransformation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ETypeAnnotation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EVariable.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EWhen.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/Expression.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ExpressionTransformer.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/GuardedExpressionGroup.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/StandardExpressionTransformer.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/ExpressionAccessor.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/accessor/FieldAccessor.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/block/GuardStatement.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListAssignment.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGenerator.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListGuard.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListQualifier.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListSeq.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/list/ListThen.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/printing/ExpressionToStringVisitor.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/MinigraphModule.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/macros/StandardMacroRule.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/modules/TypeClass.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/modules/TypeClassInstance.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractCombiner.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAbstractModifier.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QAtom.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QConjunction.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QDisjunction.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QExists.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QMapping.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/QNegation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/Query.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/compilation/ConstraintCollectionContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/compilation/DynamicProgrammingOrdering.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/compilation/ExpressionConstraint.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/query/pre/PreQuery.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/LocalRelation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/SCLRelation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/relations/TransitiveClosureRelation.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/rules/TransformationRule.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/AbstractLocalEnvironment.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/ConcreteEnvironment.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/EmptyNamespace.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/Environments.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/LocalEnvironment.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/Namespace.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/NamespaceImpl.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/NamespaceSpec.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/environment/filter/NamespaceFilters.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/errors/CompilationErrorFormatter.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/analysis/LoopAnalysis.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/analysis/StatementBrowser.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/optimization/OptimizationMap.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/references/BoundVar.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/references/Val.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/exits/Throw.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetApply.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/ssa/statements/LetFunctions.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/ClassBuilder.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/CopyContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/PrintingContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/SCLContextPreparationStep.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/SSAValidationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/writer/CodeWriter.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/writer/ModuleWriter.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/deriving/InstanceDerivers.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintEnvironment.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintSet.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/ConstraintSolver.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints/InstanceTree.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints2/ConstraintSolver.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/constraints2/ConstraintStore.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/matching/PatternMatchingCompiler.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/profiling/BranchPointInjector.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/subsumption/SubSolver.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/DecomposedRule.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/TransformationBuilder.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/transformations/UnifiableFactory.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/declarations/DRuleAst.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/parsing/translation/RelationRepository.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/types/TypeElaborationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/types/TypeHashCodeContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/types/effects/EffectIdMap.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/HierarchicalDocumentationRef.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/html/SCLDocumentationExtensionNodeHandler.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/inlines/Entities.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/inlines/Subject.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/internal/HtmlEscape.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/internal/MarkdownParser.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/markdown/internal/Scanner.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/LazyModule.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/module/repository/ModuleRepositories.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/ExpressionClassLoader.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/MutableClassLoader.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeEnvironmentImpl.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModuleMap.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/source/ClassModuleSource.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/source/repository/ClassModuleSourceRepository.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/source/repository/CompositeModuleSourceRepository.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/source/repository/FileModuleSourceRepository.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/source/repository/MapModuleSourceRepository.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/source/repository/ModuleSourceRepository.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionInterpretationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/SCLCompilerConfiguration.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Skeletons.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TApply.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TCon.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TForAll.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TFun.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TMetaVar.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TPred.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TUnion.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/TVar.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Type.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/Types.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/kinds/Kinds.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/util/TypeListener.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/util/TypeTree.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/ActiveTests.java
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/FindAllowedChars.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/FutureTests.java [deleted file]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/ModuleRegressionTests.java [moved from bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/RegressionTestsWithoutPrelude.java with 51% similarity]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/RegressionTests.java
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/RegressionTestsWithPrelude.java [deleted file]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestBase.java
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestClassNaming.java
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestExpressionEvaluator.java
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestTypeDesc.java [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/UnimplementedTests.java
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Deriving1.scl [deleted file]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/DifferentBranchTypes.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Formula.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Hashable1.scl [deleted file]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Hashable2.scl [deleted file]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/InvalidLambda.scl
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Matching3b.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/MatchingWithMissingParameter.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Overloading1.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Overloading2.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Overloading3.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/RecordShorthand.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Seq.scl [deleted file]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/StringEscape.scl [new file with mode: 0644]
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/UnexpectedToken.scl
bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/unit/TestNamespaceFilter.java
bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleModuleSource.java
bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/BundleTestScriptRunnable.java
bundles/org.simantics.scl.runtime/META-INF/MANIFEST.MF
bundles/org.simantics.scl.runtime/build.properties
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/Lists.java
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/SCLContext.java
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/equations/TestEquationContext.java
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/exceptions/MatchingException.java [new file with mode: 0644]
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/io/SclIO.java
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/minigraph/Minigraph.java
bundles/org.simantics.scl.runtime/src/org/simantics/scl/runtime/unification/UMapUtils.java
bundles/org.simantics.spreadsheet.ontology/build.properties
bundles/org.simantics.structural.ontology/build.properties
bundles/org.simantics.threadlog/.classpath [new file with mode: 0644]
bundles/org.simantics.threadlog/.project [new file with mode: 0644]
bundles/org.simantics.threadlog/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
bundles/org.simantics.threadlog/META-INF/MANIFEST.MF [new file with mode: 0644]
bundles/org.simantics.threadlog/build.properties [new file with mode: 0644]
bundles/org.simantics.threadlog/examples/org/simantics/threadlog/examples/Example1.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/Task.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/ThreadLog.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/internal/Activator.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/ui/Interval.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/ui/Lane.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/ui/ThreadLogController.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/ui/ThreadLogVisualizer.java [new file with mode: 0644]
bundles/org.simantics.threadlog/src/org/simantics/threadlog/ui/TimeLineViewer.java [new file with mode: 0644]
bundles/org.simantics.utils.datastructures/build.properties
bundles/pom.xml
bundles/winterwell.markdown/.classpath [new file with mode: 0644]
bundles/winterwell.markdown/.project [new file with mode: 0644]
bundles/winterwell.markdown/META-INF/MANIFEST.MF [new file with mode: 0644]
bundles/winterwell.markdown/build.properties [new file with mode: 0644]
bundles/winterwell.markdown/icons/coffee.png [new file with mode: 0644]
bundles/winterwell.markdown/icons/github-cat_yellow.png [new file with mode: 0644]
bundles/winterwell.markdown/icons/notepad.gif [new file with mode: 0644]
bundles/winterwell.markdown/icons/settings16_yellow.png [new file with mode: 0644]
bundles/winterwell.markdown/lib/markdownj-1.0.2b4-0.3.0.jar [new file with mode: 0644]
bundles/winterwell.markdown/lib/net.sf.paperclips_1.0.1.jar [new file with mode: 0644]
bundles/winterwell.markdown/lib/winterwell.utils.jar [new file with mode: 0644]
bundles/winterwell.markdown/plugin.xml [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/Activator.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/LogUtil.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/StringMethods.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/commands/OpenGfmView.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/commands/OpenMdView.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/commands/Preferences.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/ActionBarContributor.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/ColorManager.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/EmphasisRule.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/ExportHTMLAction.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/FormatAction.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/HeaderRule.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/HeaderWithUnderlineRule.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/LinkRule.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/ListRule.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/MDColorConstants.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/MDConfiguration.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/MDScanner.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/MDTextHover.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/MarkdownContentOutlinePage.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/MarkdownEditor.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/PrintAction.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/collapseall.gif [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/editors/synced.gif [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/pagemodel/MarkdownFormatter.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/pagemodel/MarkdownFormatterTest.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/pagemodel/MarkdownPage.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/pagemodel/MarkdownPageTest.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/preferences/MarkdownPreferencePage.java [new file with mode: 0644]
bundles/winterwell.markdown/src/winterwell/markdown/views/MarkdownPreview.java [new file with mode: 0644]
features/com.lowagie.text.feature/.gitignore [new file with mode: 0644]
features/com.lowagie.text.feature/.project [new file with mode: 0644]
features/com.lowagie.text.feature/build.properties [new file with mode: 0644]
features/com.lowagie.text.feature/feature.xml [new file with mode: 0644]
features/org.apache.lucene4.feature/.gitignore [new file with mode: 0644]
features/org.apache.lucene4.feature/.project [new file with mode: 0644]
features/org.apache.lucene4.feature/build.properties [new file with mode: 0644]
features/org.apache.lucene4.feature/feature.xml [new file with mode: 0644]
features/org.simantics.eclipsec.launcher.feature/.project [new file with mode: 0644]
features/org.simantics.eclipsec.launcher.feature/build.properties [new file with mode: 0644]
features/org.simantics.eclipsec.launcher.feature/feature.xml [new file with mode: 0644]
features/org.simantics.sdk.feature/feature.xml
features/org.simantics.ui.workbench.feature/feature.xml
features/pom.xml

index ed8297e4c8a67efab07ea87dd58cd0c6ec5a0192..7f1d30dab8aa875ed58fd48c4ba6fd902aee756c 100644 (file)
@@ -2,5 +2,5 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Silk icon set
 Bundle-SymbolicName: com.famfamfam.silk
-Bundle-Version: 1.3
+Bundle-Version: 1.3.0
 Bundle-Vendor: Semantum Oy
index 965ca6ee489131e437448c54f40adce09167e012..d3c44903b3c05235c41e3c40ec357b064fdf1008 100644 (file)
@@ -405,10 +405,10 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic
                                            if (parent != null) {\r
                                                _additions.add(new Object[] { ss.getRandomAccessId(parent), ss.getRandomAccessId(entry.component), name, types, id != null ? id.indexString() : "" });\r
                                            } else {\r
-                                                   System.err.println("resource " + entry.component + ": no parent for entry " + name + " " + types);\r
+                                                   //System.err.println("resource " + entry.component + ": no parent for entry " + name + " " + types);\r
                                            }\r
                                        } else {\r
-                                           System.err.println("resource " + entry.component + ": " + name + " " + types);\r
+                                           //System.err.println("resource " + entry.component + ": " + name + " " + types);\r
                                        }\r
                                    } else if(_entry instanceof ComponentModification) {\r
                                        ComponentModification entry = (ComponentModification)_entry;\r
index 6425a96133e072c749e7f7fccf374b9f52ac6a76..93557d6946ccc24a4e5cf264c860dc50e49c55ca 100644 (file)
@@ -13,8 +13,8 @@ source.. = src/
 output.. = bin/\r
 bin.includes = META-INF/,\\r
                .,\\r
-               bin/msijni.dll,\\r
-               bin/msijni64.dll,\\r
+               msijni.dll,\\r
+               msijni64.dll,\\r
                VC90.2008.SP1.KB2467174.redist.x64.exe,\\r
                VC90.2008.SP1.KB2467174.redist.x86.exe\r
 src.includes = native/\r
diff --git a/bundles/org.simantics.db.procore.server.environment/src/msijni.dll b/bundles/org.simantics.db.procore.server.environment/src/msijni.dll
deleted file mode 100644 (file)
index 8009884..0000000
Binary files a/bundles/org.simantics.db.procore.server.environment/src/msijni.dll and /dev/null differ
diff --git a/bundles/org.simantics.db.procore.server.environment/src/msijni64.dll b/bundles/org.simantics.db.procore.server.environment/src/msijni64.dll
deleted file mode 100644 (file)
index df74979..0000000
Binary files a/bundles/org.simantics.db.procore.server.environment/src/msijni64.dll and /dev/null differ
index 3965148e3a336a15f09587ae679d87530eba9930..f16e9813766a35fcd760545d0aae81211f33a8ad 100644 (file)
@@ -9,14 +9,13 @@ Bundle-Activator: org.simantics.db.procore.ui.internal.Activator
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Export-Package: org.simantics.db.procore.ui
 Import-Package: 
- org.osgi.framework;version="1.3.0",
+ org.eclipse.core.runtime,
  org.eclipse.jface.dialogs,
  org.eclipse.jface.operation,
- org.eclipse.core.runtime,
  org.eclipse.swt.widgets,
- org.eclipse.ui,
+ org.osgi.framework;version="1.3.0",
  org.simantics.db,
- org.simantics.db.exception,
  org.simantics.db.common.utils,
+ org.simantics.db.exception,
  org.simantics.db.server;visibility:=reexport
 Require-Bundle: org.simantics.db.procore;bundle-version="1.2.1"
index dc93b2f9d9a45918a546a42383fa396523104422..54b892070e70e4e0c28f534fe3ec98e5e13018eb 100644 (file)
@@ -2,28 +2,21 @@ package org.simantics.db.procore.ui;
 \r
 import org.eclipse.swt.widgets.Display;\r
 import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.IWorkbench;\r
-import org.eclipse.ui.IWorkbenchWindow;\r
 import org.simantics.db.DatabaseUserAgent;\r
 import org.simantics.db.exception.InternalException;\r
 import org.simantics.db.procore.ProCoreDriver;\r
 \r
 public final class ProCoreUserAgent implements DatabaseUserAgent {\r
-    private static Shell getShell(IWorkbench workbench) {\r
-        IWorkbenchWindow wbw = workbench.getActiveWorkbenchWindow();\r
+    private static Shell getShell() {\r
         Shell shell = null;\r
-        if (null != wbw) {\r
-            shell = wbw.getShell();\r
-        } else {\r
-            Display d = getDisplay();\r
-            if (d == null)\r
-                return null;\r
-            shell = d.getActiveShell();\r
-            if (null == shell) {\r
-                Shell[] shells = d.getShells();\r
-                if (null != shells && shells.length > 0)\r
-                    shell = shells[0];\r
-            }\r
+        Display d = getDisplay();\r
+        if (d == null)\r
+            return null;\r
+        shell = d.getActiveShell();\r
+        if (null == shell) {\r
+            Shell[] shells = d.getShells();\r
+            if (null != shells && shells.length > 0)\r
+                shell = shells[0];\r
         }\r
         return shell;\r
     }\r
@@ -33,13 +26,6 @@ public final class ProCoreUserAgent implements DatabaseUserAgent {
             d = Display.getDefault();\r
         return d;\r
     }\r
-    private IWorkbench workbench;\r
-    public ProCoreUserAgent(IWorkbench workbench) {\r
-        this.workbench = workbench;\r
-    }\r
-    private Shell getShell() {\r
-        return getShell(workbench);\r
-    }\r
     @Override\r
     public boolean handleStart(InternalException exception) {\r
         Shell shell = getShell();\r
index af1a5578701904d6f61dabb4f79185dc52db1a9e..657c95170833515c3e397e5920b9dce38429e360 100644 (file)
@@ -15,5 +15,4 @@ bin.includes = META-INF/,\
                .,\\r
                win32.x86/,\\r
                win32.x86_64/,\\r
-               linux.x86/,\\r
                linux.x86_64/\r
index 15454c697905796bfa54049ee6db50eb44c686fc..fb164279d32b25779889cf3b7a5500310f85e3ea 100644 (file)
@@ -2,6 +2,5 @@ source.. = src/
 output.. = bin/\r
 bin.includes = META-INF/,\\r
                .,\\r
-               graphs/*.tg,\\r
                graph.tg\r
 src.includes = graph/\r
index 5959d12ac39f99b5e10f143d1c241dcdc6dd6d0f..34f26f88677e827fb40b842f67bd47b7e2136e1d 100644 (file)
@@ -3,7 +3,6 @@ output.. = bin/
 bin.includes = META-INF/,\\r
                .,\\r
                plugin.xml,\\r
-               document.war,\\r
                webdefault.xml,\\r
                scl/,\\r
 src.includes = scl/\r
index 15454c697905796bfa54049ee6db50eb44c686fc..fb164279d32b25779889cf3b7a5500310f85e3ea 100644 (file)
@@ -2,6 +2,5 @@ source.. = src/
 output.. = bin/\r
 bin.includes = META-INF/,\\r
                .,\\r
-               graphs/*.tg,\\r
                graph.tg\r
 src.includes = graph/\r
diff --git a/bundles/org.simantics.nativemem/.classpath b/bundles/org.simantics.nativemem/.classpath
new file mode 100644 (file)
index 0000000..2854214
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry exported="true" kind="lib" path="jna-4.2.1.jar"/>\r
+       <classpathentry kind="lib" path="jna-platform-4.2.1.jar"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/bundles/org.simantics.nativemem/.project b/bundles/org.simantics.nativemem/.project
new file mode 100644 (file)
index 0000000..4d55767
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.simantics.nativemem</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.ManifestBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.SchemaBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.pde.PluginNature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.nativemem/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..11f6e46
--- /dev/null
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7\r
+org.eclipse.jdt.core.compiler.compliance=1.7\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.7\r
diff --git a/bundles/org.simantics.nativemem/.settings/org.eclipse.pde.core.prefs b/bundles/org.simantics.nativemem/.settings/org.eclipse.pde.core.prefs
new file mode 100644 (file)
index 0000000..b7e72d0
--- /dev/null
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1\r
+pluginProject.extensions=false\r
+resolve.requirebundle=false\r
diff --git a/bundles/org.simantics.nativemem/META-INF/MANIFEST.MF b/bundles/org.simantics.nativemem/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..d1de018
--- /dev/null
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Native Memory Tracking
+Bundle-SymbolicName: org.simantics.nativemem
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Semantum Oy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ClassPath: .,
+ jna-4.2.1.jar,
+ jna-platform-4.2.1.jar
+Export-Package: org.simantics.nativemem
diff --git a/bundles/org.simantics.nativemem/build.properties b/bundles/org.simantics.nativemem/build.properties
new file mode 100644 (file)
index 0000000..07df1f0
--- /dev/null
@@ -0,0 +1,6 @@
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+               .,\\r
+               jna-4.2.1.jar,\\r
+               jna-platform-4.2.1.jar\r
diff --git a/bundles/org.simantics.nativemem/jna-4.2.1.jar b/bundles/org.simantics.nativemem/jna-4.2.1.jar
new file mode 100644 (file)
index 0000000..c21183e
Binary files /dev/null and b/bundles/org.simantics.nativemem/jna-4.2.1.jar differ
diff --git a/bundles/org.simantics.nativemem/jna-platform-4.2.1.jar b/bundles/org.simantics.nativemem/jna-platform-4.2.1.jar
new file mode 100644 (file)
index 0000000..ca6ea47
Binary files /dev/null and b/bundles/org.simantics.nativemem/jna-platform-4.2.1.jar differ
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/NativeMem.java
new file mode 100644 (file)
index 0000000..cfccc21
--- /dev/null
@@ -0,0 +1,56 @@
+package org.simantics.nativemem;\r
+\r
+import org.simantics.nativemem.internal.Arch;\r
+import org.simantics.nativemem.internal.OS;\r
+import org.simantics.nativemem.internal.Psapi32;\r
+import org.simantics.nativemem.internal.Psapi64;\r
+\r
+import com.sun.jna.platform.win32.Kernel32;\r
+import com.sun.jna.platform.win32.WinNT.HANDLE;\r
+\r
+\r
+public class NativeMem {\r
+\r
+    /**\r
+     * @param out\r
+     *            the structure to write the result into or <code>null</code> to\r
+     *            create a new structure\r
+     * @return the result structure\r
+     */\r
+    public static ProcessMemoryCounters getMemoryCounters(ProcessMemoryCounters out) {\r
+        if (out == null)\r
+            out = new ProcessMemoryCounters();\r
+\r
+        OS os = OS.calculate();\r
+        Arch arch = Arch.calculate();\r
+        switch (os) {\r
+        case WINDOWS: {\r
+            HANDLE proc = Kernel32.INSTANCE.GetCurrentProcess();\r
+            switch (arch) {\r
+            case X86: {\r
+                Psapi32.PROCESS_MEMORY_COUNTERS_EX pmem = new Psapi32.PROCESS_MEMORY_COUNTERS_EX();\r
+                boolean ok = Psapi32.INSTANCE.GetProcessMemoryInfo(proc, pmem, pmem.size());\r
+                if (ok)\r
+                    pmem.writeTo(out);\r
+                return out;\r
+            }\r
+\r
+            case X86_64: {\r
+                Psapi64.PROCESS_MEMORY_COUNTERS_EX pmem = new Psapi64.PROCESS_MEMORY_COUNTERS_EX();\r
+                boolean ok = Psapi64.INSTANCE.GetProcessMemoryInfo(proc, pmem, pmem.size());\r
+                if (ok)\r
+                    pmem.writeTo(out);\r
+                return out;\r
+            }\r
+\r
+            default:\r
+                throw new UnsupportedOperationException("Architecture " + arch + " not supported on operating system " + os);\r
+            }\r
+        }\r
+\r
+        default:\r
+            throw new UnsupportedOperationException("Operating system " + os + " not supported");\r
+        }\r
+    }\r
+\r
+}
\ No newline at end of file
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/ProcessMemoryCounters.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/ProcessMemoryCounters.java
new file mode 100644 (file)
index 0000000..d2192d3
--- /dev/null
@@ -0,0 +1,54 @@
+package org.simantics.nativemem;\r
+\r
+/**\r
+ * Architecture-independent version of the Windows PsApi PROCESS_MEMORY_COUNTERS\r
+ * structure.\r
+ * \r
+ * @author Tuukka Lehtonen\r
+ */\r
+public class ProcessMemoryCounters {\r
+    public int PageFaultCount;\r
+    public long PeakWorkingSetSize;\r
+    public long WorkingSetSize;\r
+    public long QuotaPeakPagedPoolUsage;\r
+    public long QuotaPagedPoolUsage;\r
+    public long QuotaPeakNonPagedPoolUsage;\r
+    public long QuotaNonPagedPoolUsage;\r
+    public long PagefileUsage;\r
+    public long PeakPagefileUsage;\r
+    public long PrivateUsage;\r
+\r
+    @Override\r
+    public String toString() {\r
+        return "ProcessMemoryCounters [PageFaultCount="\r
+                + PageFaultCount + ", PeakWorkingSetSize=" + PeakWorkingSetSize\r
+                + ", WorkingSetSize=" + WorkingSetSize\r
+                + ", QuotaPeakPagedPoolUsage=" + QuotaPeakPagedPoolUsage\r
+                + ", QuotaPagedPoolUsage=" + QuotaPagedPoolUsage\r
+                + ", QuotaPeakNonPagedPoolUsage=" + QuotaPeakNonPagedPoolUsage\r
+                + ", QuotaNonPagedPoolUsage=" + QuotaNonPagedPoolUsage\r
+                + ", PagefileUsage=" + PagefileUsage + ", PeakPagefileUsage="\r
+                + PeakPagefileUsage + ", PrivateUsage=" + PrivateUsage + "]";\r
+    }\r
+\r
+    public String toHumanReadableString() {\r
+        StringBuilder sb = new StringBuilder();\r
+        sb.append("ProcessMemoryCounters [\n\tPageFaultCount             = ").append(PageFaultCount)\r
+        .append(",\n\tPeakWorkingSetSize         = ").append(toMb(PeakWorkingSetSize))\r
+        .append(" MB,\n\tWorkingSetSize             = ").append(toMb(WorkingSetSize))\r
+        .append(" MB,\n\tQuotaPeakPagedPoolUsage    = ").append(toMb(QuotaPeakPagedPoolUsage))\r
+        .append(" MB,\n\tQuotaPagedPoolUsage        = ").append(toMb(QuotaPagedPoolUsage))\r
+        .append(" MB,\n\tQuotaPeakNonPagedPoolUsage = ").append(toMb(QuotaPeakNonPagedPoolUsage))\r
+        .append(" MB,\n\tQuotaNonPagedPoolUsage     = ").append(toMb(QuotaNonPagedPoolUsage))\r
+        .append(" MB,\n\tPagefileUsage              = ").append(toMb(PagefileUsage))\r
+        .append(" MB,\n\tPeakPagefileUsage          = ").append(toMb(PeakPagefileUsage))\r
+        .append(" MB,\n\tPrivateUsage               = ").append(toMb(PrivateUsage))\r
+        .append(" MB]");\r
+        return sb.toString();\r
+    }\r
+\r
+    private double toMb(long bytes) {\r
+        return (double) bytes / 1048576.0;\r
+    }\r
+\r
+}
\ No newline at end of file
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Arch.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Arch.java
new file mode 100644 (file)
index 0000000..7910f06
--- /dev/null
@@ -0,0 +1,25 @@
+package org.simantics.nativemem.internal;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ */\r
+public enum Arch {\r
+    PPC, PPC_64, SPARC, X86, X86_64, UNKNOWN;\r
+\r
+    public static Arch calculate() {\r
+        String osArch = System.getProperty("os.arch");\r
+        assert osArch != null;\r
+        osArch = osArch.toLowerCase();\r
+        if (osArch.equals("i386") || osArch.equals("i586") || osArch.equals("i686") || osArch.equals("x86"))\r
+            return X86;\r
+        if (osArch.startsWith("amd64") || osArch.startsWith("x86_64"))\r
+            return X86_64;\r
+        if (osArch.equals("ppc"))\r
+            return PPC;\r
+        if (osArch.startsWith("ppc"))\r
+            return PPC_64;\r
+        if (osArch.startsWith("sparc"))\r
+            return SPARC;\r
+        return UNKNOWN;\r
+    }\r
+}\r
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/OS.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/OS.java
new file mode 100644 (file)
index 0000000..a1d0a48
--- /dev/null
@@ -0,0 +1,20 @@
+package org.simantics.nativemem.internal;\r
+\r
+public enum OS {\r
+    APPLE, LINUX, SUN, WINDOWS, UNKNOWN;\r
+\r
+    public static OS calculate() {\r
+        String osName = System.getProperty("os.name");\r
+        assert osName != null;\r
+        osName = osName.toLowerCase();\r
+        if (osName.startsWith("mac os x"))\r
+            return APPLE;\r
+        if (osName.startsWith("windows"))\r
+            return WINDOWS;\r
+        if (osName.startsWith("linux"))\r
+            return LINUX;\r
+        if (osName.startsWith("sun"))\r
+            return SUN;\r
+        return UNKNOWN;\r
+    }\r
+}\r
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Psapi32.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Psapi32.java
new file mode 100644 (file)
index 0000000..ba302c9
--- /dev/null
@@ -0,0 +1,67 @@
+package org.simantics.nativemem.internal;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import org.simantics.nativemem.ProcessMemoryCounters;\r
+\r
+import com.sun.jna.Native;\r
+import com.sun.jna.Structure;\r
+import com.sun.jna.platform.win32.WinNT.HANDLE;\r
+import com.sun.jna.win32.StdCallLibrary;\r
+\r
+public interface Psapi32 extends StdCallLibrary {\r
+\r
+    Psapi32 INSTANCE = (Psapi32) Native.loadLibrary("Psapi", Psapi32.class);\r
+\r
+    /*\r
+     * https://msdn.microsoft.com/en-us/library/windows/desktop/ms684874%28v=vs.85%29.aspx\r
+     */\r
+    public static class PROCESS_MEMORY_COUNTERS_EX extends Structure {\r
+        public int cb;\r
+        public int PageFaultCount;\r
+        public int PeakWorkingSetSize;\r
+        public int WorkingSetSize;\r
+        public int QuotaPeakPagedPoolUsage;\r
+        public int QuotaPagedPoolUsage;\r
+        public int QuotaPeakNonPagedPoolUsage;\r
+        public int QuotaNonPagedPoolUsage;\r
+        public int PagefileUsage;\r
+        public int PeakPagefileUsage;\r
+        public int PrivateUsage;\r
+\r
+        @SuppressWarnings("rawtypes")\r
+        @Override\r
+        protected List getFieldOrder() {\r
+            return PROCESS_MEMORY_COUNTERS_EX_FIELDS;\r
+        }\r
+\r
+        static final List<String> PROCESS_MEMORY_COUNTERS_EX_FIELDS = Arrays.asList(new String[] { \r
+                "cb", "PageFaultCount",\r
+                "PeakWorkingSetSize", "WorkingSetSize",\r
+                "QuotaPeakPagedPoolUsage", "QuotaPagedPoolUsage",\r
+                "QuotaPeakNonPagedPoolUsage", "QuotaNonPagedPoolUsage",\r
+                "PagefileUsage", "PeakPagefileUsage", "PrivateUsage"\r
+        });\r
+\r
+        public void writeTo(ProcessMemoryCounters to) {\r
+            to.PageFaultCount = PageFaultCount;\r
+            to.PeakWorkingSetSize = PeakWorkingSetSize;\r
+            to.WorkingSetSize = WorkingSetSize;\r
+            to.QuotaPeakPagedPoolUsage = QuotaPeakPagedPoolUsage;\r
+            to.QuotaPagedPoolUsage = QuotaPagedPoolUsage;\r
+            to.QuotaPeakNonPagedPoolUsage = QuotaPeakNonPagedPoolUsage;\r
+            to.QuotaNonPagedPoolUsage = QuotaNonPagedPoolUsage;\r
+            to.PagefileUsage = PagefileUsage;\r
+            to.PeakPagefileUsage = PeakPagefileUsage;\r
+            to.PrivateUsage = PrivateUsage;\r
+        }\r
+    }\r
+\r
+    /*\r
+     * https://msdn.microsoft.com/en-us/library/windows/desktop/ms683219%28v=vs.85%29.aspx\r
+     */\r
+    boolean GetProcessMemoryInfo(HANDLE Process, PROCESS_MEMORY_COUNTERS_EX ppsmemCounters, int cb);\r
+\r
+\r
+}
\ No newline at end of file
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Psapi64.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Psapi64.java
new file mode 100644 (file)
index 0000000..ba58251
--- /dev/null
@@ -0,0 +1,66 @@
+package org.simantics.nativemem.internal;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import org.simantics.nativemem.ProcessMemoryCounters;\r
+\r
+import com.sun.jna.Native;\r
+import com.sun.jna.Structure;\r
+import com.sun.jna.platform.win32.WinNT.HANDLE;\r
+import com.sun.jna.win32.StdCallLibrary;\r
+\r
+public interface Psapi64 extends StdCallLibrary {\r
+\r
+    Psapi64 INSTANCE = (Psapi64) Native.loadLibrary("Psapi", Psapi64.class);\r
+\r
+    /*\r
+     * https://msdn.microsoft.com/en-us/library/windows/desktop/ms684874%28v=vs.85%29.aspx\r
+     */\r
+    public static class PROCESS_MEMORY_COUNTERS_EX extends Structure {\r
+        public int cb;\r
+        public int PageFaultCount;\r
+        public long PeakWorkingSetSize;\r
+        public long WorkingSetSize;\r
+        public long QuotaPeakPagedPoolUsage;\r
+        public long QuotaPagedPoolUsage;\r
+        public long QuotaPeakNonPagedPoolUsage;\r
+        public long QuotaNonPagedPoolUsage;\r
+        public long PagefileUsage;\r
+        public long PeakPagefileUsage;\r
+        public long PrivateUsage;\r
+\r
+        @SuppressWarnings("rawtypes")\r
+        @Override\r
+        protected List getFieldOrder() {\r
+            return PROCESS_MEMORY_COUNTERS_EX_FIELDS;\r
+        }\r
+\r
+        private static final List<String> PROCESS_MEMORY_COUNTERS_EX_FIELDS = Arrays.asList(new String[] { \r
+                "cb", "PageFaultCount",\r
+                "PeakWorkingSetSize", "WorkingSetSize",\r
+                "QuotaPeakPagedPoolUsage", "QuotaPagedPoolUsage",\r
+                "QuotaPeakNonPagedPoolUsage", "QuotaNonPagedPoolUsage",\r
+                "PagefileUsage", "PeakPagefileUsage", "PrivateUsage"\r
+        });\r
+\r
+        public void writeTo(ProcessMemoryCounters to) {\r
+            to.PageFaultCount = PageFaultCount;\r
+            to.PeakWorkingSetSize = PeakWorkingSetSize;\r
+            to.WorkingSetSize = WorkingSetSize;\r
+            to.QuotaPeakPagedPoolUsage = QuotaPeakPagedPoolUsage;\r
+            to.QuotaPagedPoolUsage = QuotaPagedPoolUsage;\r
+            to.QuotaPeakNonPagedPoolUsage = QuotaPeakNonPagedPoolUsage;\r
+            to.QuotaNonPagedPoolUsage = QuotaNonPagedPoolUsage;\r
+            to.PagefileUsage = PagefileUsage;\r
+            to.PeakPagefileUsage = PeakPagefileUsage;\r
+            to.PrivateUsage = PrivateUsage;\r
+        }\r
+    }\r
+\r
+    /*\r
+     * https://msdn.microsoft.com/en-us/library/windows/desktop/ms683219%28v=vs.85%29.aspx\r
+     */\r
+    boolean GetProcessMemoryInfo(HANDLE Process, PROCESS_MEMORY_COUNTERS_EX ppsmemCounters, int cb);\r
+\r
+}
\ No newline at end of file
diff --git a/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Test.java b/bundles/org.simantics.nativemem/src/org/simantics/nativemem/internal/Test.java
new file mode 100644 (file)
index 0000000..d00db0c
--- /dev/null
@@ -0,0 +1,13 @@
+package org.simantics.nativemem.internal;\r
+\r
+import org.simantics.nativemem.NativeMem;\r
+import org.simantics.nativemem.ProcessMemoryCounters;\r
+\r
+public class Test {\r
+\r
+    public static void main(String[] args) {\r
+        ProcessMemoryCounters mem = NativeMem.getMemoryCounters(null);\r
+        System.out.println(mem.toHumanReadableString());\r
+    }\r
+\r
+}\r
index e9547699238991920ac5406956cad1e020b85e35..6a751c5b5a1ac1cffbe04c0550989dd1e1de71c1 100644 (file)
 
 package org.cojen.classfile;
 
-import java.io.Serializable;
 import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
 import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
 import java.io.ObjectStreamException;
+import java.io.Serializable;
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.cojen.util.WeakCanonicalSet;
 
index 084eb3dc85445cef536d561c0eec6cf6d1c2e002..cfc5a1deb0fcf7a303651c39782af93fc6e8742b 100644 (file)
 package org.cojen.classfile;
 
 import java.io.Serializable;
-import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.io.ObjectStreamException;
 import java.lang.ref.SoftReference;
 import java.lang.reflect.Array;
 import java.util.Collections;
@@ -510,10 +505,6 @@ public abstract class TypeDesc extends Descriptor implements Serializable {
         return false;
     }
 
-    Object writeReplace() throws ObjectStreamException {
-        return new External(mDescriptor);
-    }
-
     private static class PrimitiveType extends TypeDesc {
         private transient final int mCode;
         private transient TypeDesc mArrayType;
@@ -895,27 +886,4 @@ public abstract class TypeDesc extends Descriptor implements Serializable {
             }
         }
     }
-
-    private static class External implements Externalizable {
-        private String mDescriptor;
-
-        public External() {
-        }
-
-        public External(String desc) {
-            mDescriptor = desc;
-        }
-
-        public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeUTF(mDescriptor);
-        }
-
-        public void readExternal(ObjectInput in) throws IOException {
-            mDescriptor = in.readUTF();
-        }
-
-        public Object readResolve() throws ObjectStreamException {
-            return forDescriptor(mDescriptor);
-        }
-    }
 }
index 8ad47b0a093d9b6ebeecc121e603cf4e0ffaa6f7..e463a4e6a4ca420c8308e405c4dc0017dd321d8c 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.commands;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectProcedure;
-import gnu.trove.set.hash.THashSet;
-
 import java.io.BufferedReader;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -62,6 +58,10 @@ import org.simantics.scl.runtime.reporting.SCLReporting;
 import org.simantics.scl.runtime.reporting.SCLReportingHandler;
 import org.simantics.scl.runtime.tuple.Tuple0;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.procedure.TObjectProcedure;
+import gnu.trove.set.hash.THashSet;
+
 
 public class CommandSession {
 
index 07ca39015fb4f363f1d1f8484ece89ebbb5fb12f..51d5c456fcaf3e8690a5e9499cf08487fdfad762 100644 (file)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.commands;
 
-import gnu.trove.map.hash.THashMap;
-
 import org.simantics.scl.compiler.runtime.RuntimeEnvironment;
 import org.simantics.scl.compiler.top.ExpressionEvaluator;
 import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
@@ -9,6 +7,8 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.runtime.function.Function1;
 
+import gnu.trove.map.hash.THashMap;
+
 public class ValueToStringConverter {
     final RuntimeEnvironment environment;
     final THashMap<Type, Function1> showInstances = new THashMap<Type, Function1>(); 
index 91215886255e02c05d25f7b43835afa2cdb4c29f..0ad3627d89f5337ace03301b0d9e470eddcb4169 100644 (file)
@@ -1,9 +1,9 @@
 package org.simantics.scl.compiler.compilation;\r
 \r
-import gnu.trove.map.hash.TObjectLongHashMap;\r
-\r
 import java.util.ArrayList;\r
 \r
+import gnu.trove.map.hash.TObjectLongHashMap;\r
+\r
 public class CompilationTimer {\r
     private long initialTime, previousTime;\r
     private ArrayList<TimerEntry> entries = new ArrayList<TimerEntry>();\r
index e4124d9b79559a9c862386133d55bff50af14d55..b242431806efc334f6fd463f9dbcaa8eba48a8df 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.compilation;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.set.hash.THashSet;
-
 import java.util.ArrayList;
 
 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
@@ -13,6 +10,9 @@ import org.simantics.scl.compiler.internal.parsing.declarations.DDocumentationAs
 import org.simantics.scl.compiler.module.ConcreteModule;
 import org.simantics.scl.compiler.types.TCon;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.set.hash.THashSet;
+
 public class DocumentationGeneration {
     THashMap<String, DDocumentationAst> valueDocumentation;
     THashMap<String, DDocumentationAst> typeDocumentation;
index dc3bdc9e852c901acb0b0a360de15aedb15f8cd8..d331283fd76f3ddfd624f65a4fc7c03e288379a5 100644 (file)
@@ -1,7 +1,6 @@
 package org.simantics.scl.compiler.compilation;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
index 8204b5f604bea380e30625f97d8d77af70ebf47a..1f45c5f41a9d88c8345686e70fcd8b4834dd37ff 100644 (file)
@@ -5,22 +5,27 @@ import org.simantics.scl.compiler.elaboration.modules.TypeConstructor;
 import org.simantics.scl.compiler.environment.AmbiguousNameException;\r
 import org.simantics.scl.compiler.environment.Environment;\r
 import org.simantics.scl.compiler.errors.ErrorLog;\r
+import org.simantics.scl.compiler.top.SCLCompilerConfiguration;\r
 \r
 public class NameExistenceChecks {\r
     public static void checkIfValueExists(ErrorLog errorLog, long location,\r
             Environment environment, String name) {\r
-        try {\r
-            SCLValue value = environment.getLocalNamespace().getValue(name);\r
-            if(value != null)\r
+        if(SCLCompilerConfiguration.ALLOW_OVERLOADING)\r
+            return;\r
+        else {\r
+            try {\r
+                SCLValue value = environment.getLocalNamespace().getValue(name);\r
+                if(value != null)\r
+                    errorLog.log(location,\r
+                            "Value " + name + " is already defined in the module " + \r
+                                    value.getName().module + \r
+                            " that is imported to the default namespace.");\r
+            } catch(AmbiguousNameException e) {\r
                 errorLog.log(location,\r
-                        "Value " + name + " is already defined in the module " + \r
-                                value.getName().module + \r
-                        " that is imported to the default namespace.");\r
-        } catch(AmbiguousNameException e) {\r
-            errorLog.log(location,\r
-                    "Value " + name + " is already defined in the modules " + \r
-                            e.conflictingModules[0] + " and  " + e.conflictingModules[1] +  \r
-                    " that are imported to the default namespace.");\r
+                        "Value " + name + " is already defined in the modules " + \r
+                                e.conflictingModules[0] + " and  " + e.conflictingModules[1] +  \r
+                        " that are imported to the default namespace.");\r
+            }\r
         }\r
     }\r
     \r
index 7b2ee618f5dcf87d2becb248eb49c4e9b8ac6dda..8ade1602e23e730ba4e37227eb5ef09dd861eb7c 100644 (file)
@@ -1,7 +1,6 @@
 package org.simantics.scl.compiler.compilation;
 
-import gnu.trove.procedure.TObjectProcedure;
-
+import java.util.Arrays;
 import java.util.function.Consumer;
 
 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
@@ -18,8 +17,11 @@ import org.simantics.scl.compiler.environment.filter.AcceptAllNamespaceFilter;
 import org.simantics.scl.compiler.environment.filter.NamespaceFilter;
 import org.simantics.scl.compiler.internal.codegen.effects.EffectConstructor;
 import org.simantics.scl.compiler.module.Module;
+import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
 import org.simantics.scl.compiler.types.TCon;
 
+import gnu.trove.procedure.TObjectProcedure;
+
 public class NamespaceOfModule implements Namespace {
     private final Namespace base;
     private final Module module;
@@ -37,9 +39,30 @@ public class NamespaceOfModule implements Namespace {
     @Override
     public SCLValue getValue(String name) throws AmbiguousNameException {
         SCLValue value = module.getValue(name);
+        if(SCLCompilerConfiguration.ALLOW_OVERLOADING) {
+            SCLValue value2;
+            try {
+                value2 = base.getValue(name);
+            } catch(AmbiguousNameException e) {
+                if(value != null) {
+                    String[] conflictingModules = Arrays.copyOf(e.conflictingModules, e.conflictingModules.length+1);
+                    conflictingModules[e.conflictingModules.length] = module.getName();
+                    throw new AmbiguousNameException(Arrays.asList(conflictingModules), e.name);
+                }
+                else
+                    throw e;
+            }
+            if(value == null)
+                return value2;
+            if(value2 == null)
+                return value;
+            throw new AmbiguousNameException(Arrays.asList(value.getName().module, value2.getName().module), value.getName().name);
+        }
+        else {
         if(value != null)
             return value;
         return base.getValue(name);
+        }
     }
 
     @Override
index 97266d6e9781e16d2c5d77ba4d0107b80f8ee251..554a360811b69b2312151b9c4f8fe503d131c790 100644 (file)
@@ -5,16 +5,13 @@ import static org.simantics.scl.compiler.elaboration.expressions.Expressions.app
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.lambda;
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.loc;
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.vars;
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
+import org.simantics.scl.compiler.elaboration.expressions.EAmbiguous;
 import org.simantics.scl.compiler.elaboration.expressions.EPlaceholder;
 import org.simantics.scl.compiler.elaboration.expressions.ETransformation;
 import org.simantics.scl.compiler.elaboration.expressions.EVariable;
@@ -42,6 +39,11 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 import org.simantics.scl.compiler.types.util.Polarity;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
 public class TypeChecking {
     final ErrorLog errorLog;
     final Environment environment;
@@ -97,6 +99,8 @@ public class TypeChecking {
                             context.pushEffectUpperBound(expression.location, Types.PROC);
                             expression = expression.checkType(context, value.getType());
                             context.popEffectUpperBound();
+                            for(EAmbiguous overloaded : context.overloadedExpressions)
+                                overloaded.assertResolved(errorLog);
                             value.setExpression(expression);
                             
                             ArrayList<EVariable> constraintDemand = context.getConstraintDemand();
@@ -199,6 +203,7 @@ public class TypeChecking {
                         @Override
                         public void run() {
                             Type type = value.getType();
+
                             Expression expression = value.getExpression();
 
                             try {
@@ -211,6 +216,8 @@ public class TypeChecking {
                                 context.pushEffectUpperBound(expression.location, Types.PROC);
                                 expression = expression.checkType(context, type);
                                 context.popEffectUpperBound();
+                                for(EAmbiguous overloaded : context.overloadedExpressions)
+                                    overloaded.assertResolved(errorLog);
                                 expression.getType().addPolarity(Polarity.POSITIVE);
                                 context.solveSubsumptions(expression.getLocation());
                                 ArrayList<EVariable> demands = context.getConstraintDemand();
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeCheckingOld.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/TypeCheckingOld.java
deleted file mode 100644 (file)
index c5ef573..0000000
+++ /dev/null
@@ -1,349 +0,0 @@
-package org.simantics.scl.compiler.compilation;
-
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.apply;
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.applyTypes;
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.lambda;
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.loc;
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.vars;
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
-import java.util.ArrayList;
-
-import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
-import org.simantics.scl.compiler.elaboration.expressions.EPlaceholder;
-import org.simantics.scl.compiler.elaboration.expressions.EVariable;
-import org.simantics.scl.compiler.elaboration.expressions.Expression;
-import org.simantics.scl.compiler.elaboration.expressions.Variable;
-import org.simantics.scl.compiler.elaboration.modules.SCLValue;
-import org.simantics.scl.compiler.elaboration.rules.MappingRelation;
-import org.simantics.scl.compiler.elaboration.rules.TransformationRule;
-import org.simantics.scl.compiler.environment.Environment;
-import org.simantics.scl.compiler.errors.ErrorLog;
-import org.simantics.scl.compiler.errors.Locations;
-import org.simantics.scl.compiler.internal.elaboration.constraints.Constraint;
-import org.simantics.scl.compiler.internal.elaboration.constraints.ConstraintEnvironment;
-import org.simantics.scl.compiler.internal.elaboration.constraints.ConstraintSolver;
-import org.simantics.scl.compiler.internal.elaboration.constraints.ExpressionAugmentation;
-import org.simantics.scl.compiler.internal.elaboration.constraints.ReducedConstraints;
-import org.simantics.scl.compiler.internal.elaboration.utils.StronglyConnectedComponents;
-import org.simantics.scl.compiler.module.ConcreteModule;
-import org.simantics.scl.compiler.types.TPred;
-import org.simantics.scl.compiler.types.TVar;
-import org.simantics.scl.compiler.types.Type;
-import org.simantics.scl.compiler.types.Types;
-import org.simantics.scl.compiler.types.kinds.Kinds;
-import org.simantics.scl.compiler.types.util.Polarity;
-
-public class TypeCheckingOld {
-    public static final boolean PRINT_VALUES = false;
-    
-    ErrorLog errorLog;
-    Environment environment;
-    ConcreteModule module;
-    
-    ConstraintEnvironment ce;
-    ArrayList<SCLValue[]> valuesWithoutTypeAnnotation = new ArrayList<SCLValue[]>(); 
-    ArrayList<SCLValue> valuesWithTypeAnnotation = new ArrayList<SCLValue>();
-    
-    public TypeCheckingOld(ErrorLog errorLog, Environment environment,
-            ConcreteModule module) {
-        this.errorLog = errorLog;
-        this.environment = environment;
-        this.module = module;
-    }
-    
-    public void typeCheck() {
-        ce = new ConstraintEnvironment(environment);
-        groupValueDefinitionsByDependency();
-        typeCheckValuesWithoutTypeAnnotations();
-        typeCheckValuesWithTypeAnnotations();
-        typeCheckRules();
-    }
-
-    private void groupValueDefinitionsByDependency() {
-        // Collect all untyped names
-        final ArrayList<SCLValue> values = new ArrayList<SCLValue>();
-        for(SCLValue value : module.getValues()) {
-            if(value.getExpression() != null) {
-                if(value.getType() == null)
-                    values.add(value);
-                else
-                    valuesWithTypeAnnotation.add(value);   
-            }            
-        }
-        
-        // Create inverse
-        final TObjectIntHashMap<Object> allRefs = 
-                new TObjectIntHashMap<Object>(values.size()*2, 0.5f, -1);
-        for(int i=0;i<values.size();++i)
-            allRefs.put(values.get(i), i);
-        
-        // Create groups       
-        new StronglyConnectedComponents(values.size()) {
-            
-            TIntHashSet set = new TIntHashSet();
-            
-            @Override
-            protected void reportComponent(int[] component) {
-                SCLValue[] valueComponent = new SCLValue[component.length];
-                for(int i=0;i<component.length;++i)
-                    valueComponent[i] = values.get(component[i]);
-                valuesWithoutTypeAnnotation.add(valueComponent);
-            }
-            
-            @Override
-            protected int[] findDependencies(int u) {
-                Expression expression = values.get(u).getExpression();
-                expression.collectRefs(allRefs, set);
-                
-                int[] result = set.toArray();
-                set.clear();
-                
-                return result;
-            }
-            
-        }.findComponents();
-    }
-    
-    private void typeCheckValuesWithoutTypeAnnotations() {
-        for(SCLValue[] group : valuesWithoutTypeAnnotation) {
-            if(PRINT_VALUES) {
-                System.out.println("---------------------------------------------");
-                System.out.print("---");
-                for(SCLValue value : group)
-                    System.out.print(" " + value.getName());
-                System.out.println();
-            }
-            
-            for(int i=0;i<group.length;++i)
-                group[i].setType(Types.metaVar(Kinds.STAR));
-            
-            TypingContext context = new TypingContext(errorLog, environment);
-            context.recursiveValues = new THashSet<SCLValue>();
-            for(SCLValue value : group)
-                context.recursiveValues.add(value);
-                    
-            @SuppressWarnings("unchecked")
-            ArrayList<EVariable>[] constraintDemands = new ArrayList[group.length];
-            
-            @SuppressWarnings("unchecked")
-            ArrayList<EPlaceholder>[] recursiveReferences = new ArrayList[group.length];
-            for(int i=0;i<group.length;++i) {
-                context.recursiveReferences = new ArrayList<EPlaceholder>();
-                
-                SCLValue value = group[i];
-                Expression expression = value.getExpression();
-                expression = expression.checkType(context, value.getType());
-                value.setExpression(expression);
-                
-                ArrayList<EVariable> constraintDemand = context.getConstraintDemand();
-                if(!constraintDemand.isEmpty()) {
-                    constraintDemands[i] = constraintDemand;
-                    context.resetConstraintDemand();
-                }
-                
-                recursiveReferences[i] = context.recursiveReferences;
-            }
-
-            for(Type type : Types.getTypes(group))
-                type.addPolarity(Polarity.POSITIVE);
-            context.solveSubsumptions(group[0].getExpression().getLocation());
-            ArrayList<Constraint> allUnsolvedConstraints = new ArrayList<Constraint>(); 
-            
-            @SuppressWarnings("unchecked")
-            ArrayList<Variable>[] freeEvidence = new ArrayList[group.length];  
-            for(int i=0;i<group.length;++i) {
-                if(constraintDemands[i] != null) {
-                    SCLValue value = group[i];
-                    Expression expression = value.getExpression();
-                    
-                    ReducedConstraints red = ConstraintSolver.solve(
-                            ce, new ArrayList<TPred>(0), constraintDemands[i],
-                            true /*!Types.isFunction(expression.getType())*/);                                        
-                    
-                    expression = ExpressionAugmentation.augmentSolved(
-                            red.solvedConstraints, 
-                            expression);
-                    value.setExpression(expression);
-                    value.setType(expression.getType());
-                    
-                    for(Constraint c : red.unsolvedConstraints)
-                        if(c.constraint.isGround()) {
-                            errorLog.log(c.getDemandLocation(), "There is no instance for <"+c.constraint+">.");
-                        }          
-                    
-                    ArrayList<Variable> fe = new ArrayList<Variable>(red.unsolvedConstraints.size());
-                    for(Constraint c : red.unsolvedConstraints) {
-                        allUnsolvedConstraints.add(c);
-                        fe.add(c.evidence);
-                    }
-                    freeEvidence[i] = fe;
-                }
-                else {
-                    group[i].setExpression(group[i].getExpression().decomposeMatching());
-                    freeEvidence[i] = new ArrayList<Variable>(0);
-                }
-            }
-
-            THashSet<TVar> varSet = new THashSet<TVar>(); 
-            for(int i=0;i<group.length;++i) {
-                SCLValue value = group[i];
-                Type type = value.getType();
-                type = type.convertMetaVarsToVars();
-                value.setType(type);
-                varSet.addAll(Types.freeVars(type));
-            }
-            
-            TVar[] vars = varSet.toArray(new TVar[varSet.size()]);
-            
-            // Collect all constraints needed in the group
-            THashSet<TPred> constraintSet = new THashSet<TPred>();
-            for(int i=0;i<group.length;++i) {
-                for(Variable evidence : freeEvidence[i]) {
-                    constraintSet.add((TPred)evidence.getType());
-                }
-            }
-            TPred[] constraints = constraintSet.toArray(new TPred[constraintSet.size()]);
-            for(TPred constraint : constraints)
-                if(constraint.containsMetaVars()) {
-                    for(Constraint c : allUnsolvedConstraints) {
-                        if(Types.equals(c.constraint, constraint)) {
-                            errorLog.log(c.getDemandLocation(), 
-                                    "Constrain " + constraint + 
-                                    " contains free variables not mentioned in the type of the value.");
-                            break;
-                        }
-                    }
-                }
-
-
-            // TODO copy to TypeChecking2 from this onwards
-            for(int i=0;i<group.length;++i) {                
-                // Create evidence array of every value in the group that has the variables
-                // in the same array as in the shared array
-                ArrayList<Variable> fe = freeEvidence[i];
-                THashMap<TPred, Variable> indexedEvidence = new THashMap<TPred, Variable>(fe.size());
-                for(Variable v : fe)
-                    indexedEvidence.put((TPred)v.getType(), v);
-                fe.clear();
-                for(TPred c : constraints) {
-                    Variable var = indexedEvidence.get(c);
-                    if(var == null) {
-                        // These are variables that are not directly needed in 
-                        // this definition but in the definitions that are
-                        // recursively called
-                        var = new Variable("evX");
-                        var.setType(c);
-                        fe.add(var);
-                    }
-                    fe.add(var);
-                }
-                
-                // Add evidence parameters to the functions
-                SCLValue value = group[i];
-                value.setExpression(lambda(Types.NO_EFFECTS, fe, value.getExpression())
-                        .closure(vars));
-                value.setType(Types.forAll(vars, 
-                        Types.constrained(constraints, value.getType())));
-                
-                // Add evidence parameters to recursive calls
-                for(EPlaceholder ref : recursiveReferences[i]) {
-                    ref.expression = loc(ref.expression.location, apply(
-                            Types.NO_EFFECTS,
-                            applyTypes(ref.expression, vars),
-                            vars(fe)));
-                }
-            }
-        }
-    }
-    
-    private void typeCheckValuesWithTypeAnnotations() {
-        ArrayList<TPred> givenConstraints = new ArrayList<TPred>();
-        for(SCLValue value : valuesWithTypeAnnotation) {            
-            Type type = value.getType();
-            if(type != null) {
-                if(PRINT_VALUES) {
-                    System.out.println("---------------------------------------------");
-                    System.out.println("--- " + value.getName() + " :: " + type);
-                }
-                Expression expression = value.getExpression();
-                ArrayList<TVar> vars = new ArrayList<TVar>();
-                type = Types.removeForAll(type, vars);                
-                type = Types.removePred(type, givenConstraints);
-                
-                /*System.out.println("---------------------------------------------");
-                TypeUnparsingContext tuc = new TypeUnparsingContext();
-                System.out.println("--- " + value.getName() + " :: " + type.toString(tuc));
-                for(TPred t : givenConstraints)
-                    System.out.println(">>> " + t.toString(tuc));
-                */
-                TypingContext context = new TypingContext(errorLog, environment);
-                //System.out.println(expression);
-                expression = expression.checkType(context, type);
-                //System.out.println(expression);
-                expression.getType().addPolarity(Polarity.POSITIVE);
-                context.solveSubsumptions(expression.getLocation());
-                ArrayList<EVariable> demands = context.getConstraintDemand();
-                if(!demands.isEmpty() || !givenConstraints.isEmpty()) {
-                    ReducedConstraints red = 
-                            ConstraintSolver.solve(ce, givenConstraints, demands, true);    
-                    givenConstraints.clear();
-                    for(Constraint c :  red.unsolvedConstraints) {
-                        errorLog.log(c.getDemandLocation(), 
-                                "Constraint <"+c.constraint+"> is not given and cannot be derived.");
-                    }
-                    if(errorLog.isEmpty()) { // To prevent exceptions
-                        expression = ExpressionAugmentation.augmentSolved(
-                                red.solvedConstraints,
-                                expression);
-                        expression = ExpressionAugmentation.augmentUnsolved(
-                                red.givenConstraints, 
-                                expression); 
-                    }
-                }
-                else {
-                    if(errorLog.isEmpty()) // To prevent exceptions
-                        expression = expression.decomposeMatching();
-                }
-                expression = expression.closure(vars.toArray(new TVar[vars.size()]));
-                value.setExpression(expression);
-            }
-        }
-    }
-
-    public void typeCheckRules() {
-        TypingContext context = new TypingContext(errorLog, environment);
-        for(TransformationRule rule : module.getRules()) {
-            context.pushEffectUpperBound(rule.location, Types.metaVar(Kinds.EFFECT));
-            rule.checkType(context);
-            rule.setEffect(Types.canonical(context.popEffectUpperBound()));
-        }
-        context.solveSubsumptions(Locations.NO_LOCATION);
-        
-        ArrayList<EVariable> demands = context.getConstraintDemand();
-        if(!demands.isEmpty()) {
-            ReducedConstraints red = 
-                    ConstraintSolver.solve(ce, new ArrayList<TPred>(), demands, true);
-            for(Constraint c :  red.unsolvedConstraints) {
-                errorLog.log(c.getDemandLocation(), 
-                        "Constraint <"+c.constraint+"> is not given and cannot be derived.");
-            }
-        }
-        
-        for(MappingRelation mappingRelation : module.getMappingRelations())
-            for(Type parameterType : mappingRelation.parameterTypes)
-                if(!parameterType.isGround()) {
-                    errorLog.log(mappingRelation.location, "Parameter types of the mapping relation are not completely determined.");
-                    break;
-                }
-        
-        /*for(Rule rule : module.getRules()) {
-            System.out.println(rule.name);
-            for(Variable variable : rule.variables)
-                System.out.println("    " + variable.getName() + " :: " + variable.getType());
-        }*/
-    }
-}
index c3fb2dda7076d74f0e9924e8eed00197e950f557..cb6752527605e5dc9c1d659515c2272234cd3aa9 100644 (file)
@@ -1,11 +1,5 @@
 package org.simantics.scl.compiler.compilation;
 
-import gnu.trove.impl.Constants;
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.ArrayList;
 
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
@@ -18,6 +12,12 @@ import org.simantics.scl.compiler.internal.elaboration.utils.StronglyConnectedCo
 import org.simantics.scl.compiler.types.TPred;
 import org.simantics.scl.compiler.types.TVar;
 
+import gnu.trove.impl.Constants;
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
 /**
  * Schedules the order of type checking.
  * 
index 34c6c1b85189fca05dff5536f094f4439370bf2c..17b165d7f2312ebf64aba4ffde902426b15b8d22 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.compilation;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.ArrayList;
 import java.util.Collection;
 
@@ -13,6 +9,10 @@ import org.simantics.scl.compiler.internal.elaboration.constraints.Constraint;
 import org.simantics.scl.compiler.types.TPred;
 import org.simantics.scl.compiler.types.TVar;
 
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
 public interface TypeInferableDefinition {
     long getLocation();
     Collection<Object> getDefinedObjects();
index a26ee9d750dbc3493f3345e6ab1433f5e14c9cc8..b7114a441e57a674de875efa81a529c6aaa5178b 100644 (file)
@@ -1,7 +1,7 @@
 package org.simantics.scl.compiler.constants;
 
-import org.simantics.scl.compiler.internal.codegen.utils.LocalVariable;
 import org.cojen.classfile.TypeDesc;
+import org.simantics.scl.compiler.internal.codegen.utils.LocalVariable;
 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
 import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder;
 import org.simantics.scl.compiler.types.Type;
index 782f34e390d475eae7a2c442ffc21f1166ac21f6..7de438d151e57844f05c9c065435870ed6f129c7 100644 (file)
@@ -1,7 +1,7 @@
 package org.simantics.scl.compiler.constants;
 
-import org.simantics.scl.compiler.internal.codegen.utils.LocalVariable;
 import org.cojen.classfile.TypeDesc;
+import org.simantics.scl.compiler.internal.codegen.utils.LocalVariable;
 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilder;
 import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder;
 import org.simantics.scl.compiler.types.Type;
index 5686d63400b231afd9de38cc1b647edc962124fc..2ff26cf2dc5d5132259de6b317153af7382f4983 100644 (file)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.constants.generic;
 
-import gnu.trove.map.hash.THashMap;
-
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
@@ -20,6 +18,8 @@ import org.simantics.scl.compiler.constants.generic.MethodRef.StaticFieldRef;
 import org.simantics.scl.compiler.constants.generic.MethodRef.StaticMethodRef;
 import org.simantics.scl.compiler.internal.codegen.utils.MethodBuilderBase;
 
+import gnu.trove.map.hash.THashMap;
+
 /**
  * This class is a reference to a Java class that contains a map of MethodRef for each
  * method declared by the referenced class.
index e983e1277e0a93f27ab0964e3083ecf588583531..90e93f3d00a014b6de9d1dc13e5f0bffe05f4ecd 100755 (executable)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.elaboration.contexts;
 
-import gnu.trove.list.array.TLongArrayList;
-import gnu.trove.map.hash.THashMap;
-
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.constants.Constant;
@@ -30,6 +27,9 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.util.MultiFunction;
 
+import gnu.trove.list.array.TLongArrayList;
+import gnu.trove.map.hash.THashMap;
+
 public class SimplificationContext implements EnvironmentalContext {
     Environment environment;
     ErrorLog errorLog;
index 961fa902b9db552469b998f2e30e8255f806dcc1..b5f9f93e942cb17bcf21c411d7e37702244bd415 100644 (file)
@@ -1,10 +1,5 @@
 package org.simantics.scl.compiler.elaboration.contexts;
 
-import gnu.trove.list.array.TIntArrayList;
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectProcedure;
-import gnu.trove.set.hash.THashSet;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 
@@ -12,6 +7,7 @@ import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.common.precedence.Associativity;
 import org.simantics.scl.compiler.common.precedence.Precedence;
 import org.simantics.scl.compiler.elaboration.expressions.Case;
+import org.simantics.scl.compiler.elaboration.expressions.EAmbiguous;
 import org.simantics.scl.compiler.elaboration.expressions.EConstant;
 import org.simantics.scl.compiler.elaboration.expressions.EEntityTypeAnnotation;
 import org.simantics.scl.compiler.elaboration.expressions.EError;
@@ -36,6 +32,13 @@ import org.simantics.scl.compiler.environment.filter.AcceptAllNamespaceFilter;
 import org.simantics.scl.compiler.errors.ErrorLog;
 import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.parsing.declarations.DValueAst;
+import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
+import org.simantics.scl.compiler.types.Type;
+
+import gnu.trove.list.array.TIntArrayList;
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.procedure.TObjectProcedure;
+import gnu.trove.set.hash.THashSet;
 
 public class TranslationContext extends TypeTranslationContext implements EnvironmentalContext {
 
@@ -147,7 +150,45 @@ public class TranslationContext extends TypeTranslationContext implements Enviro
     }
     
     private Expression resolveIn(long location, Namespace namespace, String name) {
-        SCLValue value = resolveValueIn(location, namespace, name);
+        SCLValue value;
+        try {
+            value = resolveValueIn(location, namespace, name);
+        } catch (AmbiguousNameException e) {
+            if(SCLCompilerConfiguration.ALLOW_OVERLOADING) {
+                EAmbiguous.Alternative[] alternatives = new EAmbiguous.Alternative[e.conflictingModules.length];
+                //System.out.println("Overloading:");
+                for(int i=0;i<e.conflictingModules.length;++i) {
+                    Name altName = Name.create(e.conflictingModules[i], e.name);
+                    //System.out.println("    " + altName);
+                    SCLValue altValue = environment.getValue(altName);
+                    alternatives[i] = new EAmbiguous.Alternative() {
+                        @Override
+                        public Type getType() {
+                            return altValue.getType();
+                        }
+    
+                        @Override
+                        public Expression realize() {
+                            EConstant expression = new EConstant(altValue);
+                            expression.location = location;
+                            return expression;
+                        }
+                        
+                        @Override
+                        public String toString() {
+                            return altValue.getName().toString().replace('/', '.');
+                        }
+                    };
+                }
+                EAmbiguous expression = new EAmbiguous(alternatives);
+                expression.location = location;
+                return expression;
+            }
+            else {
+                errorLog.log(location, e.getMessage());
+                value = null;
+            }
+        }
         if(value == null)
             return new EError(location);
         return new EConstant(location, value);
@@ -340,8 +381,7 @@ public class TranslationContext extends TypeTranslationContext implements Enviro
             return prec;
     }
 
-    private SCLValue resolveValueIn(long location, Namespace namespace, final String name) {
-        try {
+    private SCLValue resolveValueIn(long location, Namespace namespace, final String name) throws AmbiguousNameException {
             SCLValue value = namespace.getValue(name);
             if(value == null) {
                 StringBuilder message = new StringBuilder();
@@ -391,10 +431,6 @@ public class TranslationContext extends TypeTranslationContext implements Enviro
                 return null;
             }
             return value;
-        } catch (AmbiguousNameException e) {
-            errorLog.log(location, e.getMessage());
-            return null;
-        }
     }
     
     public Case translateCase(Expression lhs, Expression rhs) {        
index 29b9028e6d721e6a21d1f5e5d9d998c41762e35b..b9dbb4be823b1e3d7c1bb769073c91f7bbe654c3 100644 (file)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.elaboration.contexts;
 
-import gnu.trove.map.hash.THashMap;
-
 import org.simantics.scl.compiler.environment.Environment;
 import org.simantics.scl.compiler.errors.ErrorLog;
 import org.simantics.scl.compiler.internal.parsing.exceptions.SCLSyntaxErrorException;
@@ -15,6 +13,8 @@ import org.simantics.scl.compiler.types.exceptions.KindUnificationException;
 import org.simantics.scl.compiler.types.kinds.Kind;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 
+import gnu.trove.map.hash.THashMap;
+
 public class TypeTranslationContext {
     
     Environment environment;
index de58a05cdb6c7838d02f4a108a77ac4127b98444..850f077db32d3ec9c8b81a2ebe5b4f6b32b30aa6 100644 (file)
@@ -1,13 +1,11 @@
 package org.simantics.scl.compiler.elaboration.contexts;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.set.hash.THashSet;
-
 import java.util.ArrayList;
 
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.constants.NoRepConstant;
+import org.simantics.scl.compiler.elaboration.expressions.EAmbiguous;
 import org.simantics.scl.compiler.elaboration.expressions.EApply;
 import org.simantics.scl.compiler.elaboration.expressions.EConstant;
 import org.simantics.scl.compiler.elaboration.expressions.EError;
@@ -41,6 +39,9 @@ import org.simantics.scl.compiler.types.exceptions.UnificationException;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.set.hash.THashSet;
+
 public class TypingContext implements EnvironmentalContext {
 
     private ErrorLog errorLog;
@@ -64,6 +65,9 @@ public class TypingContext implements EnvironmentalContext {
     public THashSet<SCLValue> recursiveValues;
     public ArrayList<EPlaceholder> recursiveReferences;
     
+    // Overloading
+    public ArrayList<EAmbiguous> overloadedExpressions = new ArrayList<EAmbiguous>(); 
+    
     //TypeUnparsingContext tuc = new TypeUnparsingContext();   
     
     Environment environment;
@@ -258,7 +262,7 @@ public class TypingContext implements EnvironmentalContext {
      * Instantiates type abstractions and constraints from the value.
      */
     public Expression instantiate(Expression expr) {
-        Type type = Types.weakCanonical(expr.getType());
+        Type type = Types.canonical(expr.getType());
         while(type instanceof TForAll) {
             TForAll forAll = (TForAll)type;
             TVar var = forAll.var;
@@ -297,7 +301,7 @@ public class TypingContext implements EnvironmentalContext {
      * type applications, lambdas and effect subsumptions.
      */
     public Expression subsume(Expression expr, Type b) {
-        b = Types.weakCanonical(b);
+        b = Types.canonical(b);
         /*if(b instanceof TForAll) {
             TForAll forAll = (TForAll)b;
             TVar var = forAll.var;
index c753924e64eb7fc5e99576e2e6fa2e4c13200475..8b24943478792887543d9a6cc363ff63fe1281b7 100644 (file)
@@ -56,7 +56,7 @@ public class EqGuard extends Equation {
 \r
     @Override\r
     public void checkType(TypingContext context) {\r
-        guard = guard.inferType(context);\r
+        guard = guard.checkIgnoredType(context);\r
     }\r
 \r
     @Override\r
index aeeb1ec1ea8c4ce80b4ff052d695e5c50d8d0bba..af0a43d0896c495f31b0c1d9280ff46dc4dce483 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -11,6 +7,10 @@ import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public abstract class ASTExpression extends SimplifiableExpression {\r
     public ASTExpression() {\r
     }\r
index 219cce461a10adb586c484a3713a546152e7772c..50eda1c130d6840475875276a71f011760ce53ce 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -13,6 +9,10 @@ import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator
 import org.simantics.scl.compiler.internal.parsing.Symbol;\r
 import org.simantics.scl.compiler.types.Type;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class Case extends Symbol {\r
     public Expression[] patterns;\r
     public Expression value;\r
@@ -99,6 +99,17 @@ public class Case extends Symbol {
             patterns[i] = patterns[i].checkTypeAsPattern(context, parameterTypes[i]);\r
         value = value.checkType(context, requiredType);\r
     }\r
+    \r
+    public void checkIgnoredType(TypingContext context, Type[] parameterTypes) {\r
+        if(patterns.length != parameterTypes.length) {\r
+            context.getErrorLog().log(location, "This case has different arity ("+patterns.length+\r
+                    ") than than the first case (+"+parameterTypes.length+"+).");\r
+            return;\r
+        }\r
+        for(int i=0;i<patterns.length;++i)\r
+            patterns[i] = patterns[i].checkTypeAsPattern(context, parameterTypes[i]);\r
+        value = value.checkIgnoredType(context);\r
+    }\r
         \r
     public void decorate(ExpressionDecorator decorator) {\r
         for(int i=0;i<patterns.length;++i)\r
index 224bd17b96979e6d64b0e761fb0b42b90f2715f8..95b18efd62abd266e90af0b7a6237172899302d2 100644 (file)
@@ -128,4 +128,10 @@ public abstract class DecoratingExpression extends SimplifiableExpression {
         expression = expression.checkBasicType(context, requiredType);
         return this;
     }
+    
+    @Override
+    public Expression checkIgnoredType(TypingContext context) {
+        expression = expression.checkIgnoredType(context);
+        return this;
+    }
 }
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java
new file mode 100644 (file)
index 0000000..6121a57
--- /dev/null
@@ -0,0 +1,227 @@
+package org.simantics.scl.compiler.elaboration.expressions;
+
+import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
+import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
+import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
+import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
+import org.simantics.scl.compiler.errors.ErrorLog;
+import org.simantics.scl.compiler.errors.Locations;
+import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;
+import org.simantics.scl.compiler.types.Skeletons;
+import org.simantics.scl.compiler.types.TMetaVar;
+import org.simantics.scl.compiler.types.Type;
+import org.simantics.scl.compiler.types.Types;
+import org.simantics.scl.compiler.types.exceptions.MatchException;
+import org.simantics.scl.compiler.types.exceptions.UnificationException;
+import org.simantics.scl.compiler.types.util.TypeListener;
+import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
+
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
+public class EAmbiguous extends SimplifiableExpression {
+    public static final boolean DEBUG = false;
+    
+    Alternative[] alternatives;
+    boolean[] active;
+    int activeCount;
+    transient TypingContext context;
+    Expression resolvedExpression;
+    
+    public abstract static class Alternative {
+        public abstract Type getType();
+        public abstract Expression realize();
+    }
+    
+    public EAmbiguous(Alternative[] alternatives) {
+        this.alternatives = alternatives;
+        this.active = new boolean[alternatives.length];
+        for(int i=0;i<alternatives.length;++i)
+            this.active[i] = true;
+        this.activeCount = alternatives.length;
+    }
+
+    @Override
+    public void collectRefs(TObjectIntHashMap<Object> allRefs,
+            TIntHashSet refs) {
+    }
+
+    @Override
+    public void collectVars(TObjectIntHashMap<Variable> allVars,
+            TIntHashSet vars) {
+    }
+
+    @Override
+    public void forVariables(VariableProcedure procedure) {
+    }
+
+    @Override
+    protected void updateType() throws MatchException {
+        throw new InternalCompilerError();
+    }
+    
+    private Type getCommonSkeleton() {
+        Type[] types = new Type[activeCount];
+        for(int i=0,j=0;i<alternatives.length;++i)
+            if(active[i])
+                types[j++] = Types.instantiateAndStrip(alternatives[i].getType());
+        return Skeletons.commonSkeleton(context.getEnvironment(), types);
+    }
+
+    private void filterActive() {
+        THashMap<TMetaVar,Type> unifications = new THashMap<TMetaVar,Type>(); 
+        Type requiredType = getType();
+        if(DEBUG)
+            System.out.println("EAmbigious.filterActive with " + requiredType);
+        for(int i=0;i<alternatives.length;++i)
+            if(active[i]) {
+                unifications.clear();
+                Type alternativeType = Types.instantiateAndStrip(alternatives[i].getType());
+                if(DEBUG)
+                    System.out.println("    " + alternativeType);
+                if(!Skeletons.areSkeletonsCompatible(unifications, alternativeType, requiredType)) {
+                    active[i] = false;
+                    --activeCount;
+                }
+            }
+        if(DEBUG)
+            System.out.println("    activeCount = " + activeCount);
+    }
+
+    private String getNoMatchDescription(Type requiredType) {
+        StringBuilder b = new StringBuilder();
+        b.append("Expected <");
+        requiredType.toString(new TypeUnparsingContext(), b);
+        b.append(">, but no alteratives match the type: ");
+        for(int i=0;i<alternatives.length;++i) {
+            b.append("\n    ");
+            b.append(alternatives[i]);
+            b.append(" :: ");
+            alternatives[i].getType().toString(new TypeUnparsingContext(), b);
+        }
+        b.append('.');
+        return b.toString();
+    }
+    
+    private String getAmbiguousDescription(Type requiredType) {
+        StringBuilder b = new StringBuilder();
+        b.append("Expected <");
+        requiredType.toString(new TypeUnparsingContext(), b);
+        b.append(">, but multiple values match the type: ");
+        for(int i=0;i<alternatives.length;++i) {
+            b.append("\n    ");
+            b.append(alternatives[i]);
+            b.append(" :: ");
+            alternatives[i].getType().toString(new TypeUnparsingContext(), b);
+        }
+        b.append('.');
+        return b.toString();
+    }
+
+
+    private void resolveTo(int i) {
+        if(DEBUG)
+            System.out.println("EAmbigious.resolve to " + alternatives[i]);
+        resolvedExpression = context.instantiate(alternatives[i].realize());
+        Type requiredType = getType();
+        try {
+            Types.unify(resolvedExpression.getType(), requiredType);
+        } catch (UnificationException e) {
+            context.getErrorLog().log(location, getNoMatchDescription(requiredType));
+        }
+    }
+    
+    private void listenType() {
+        if(DEBUG)
+            System.out.println("EAmbigious.listenType " + getType());
+        new TypeListener() {
+            @Override
+            public void notifyAboutChange() {
+                if(DEBUG)
+                    System.out.println("EAmbigious.notifyAboutChange " + getType());
+                Type requiredType = getType();
+                filterActive();
+                if(activeCount == 0) {
+                    context.getErrorLog().log(location, getNoMatchDescription(requiredType));
+                    return;
+                }   
+                else if(activeCount == 1) {
+                    for(int i=0;i<alternatives.length;++i)
+                        if(active[i]) {
+                            resolveTo(i);
+                            return;
+                        }
+                }
+                Type commonType = getCommonSkeleton();
+                try {
+                    Skeletons.unifySkeletons(requiredType, commonType);
+                    listenType();
+                } catch (UnificationException e) {
+                    context.getErrorLog().log(location, getNoMatchDescription(requiredType));
+                }
+            }
+        }.listenSkeleton(getType());
+    }
+    
+    @Override
+    public Expression inferType(TypingContext context) {
+        this.context = context;
+        context.overloadedExpressions.add(this);
+        setType(getCommonSkeleton());
+        listenType();
+        return this;
+    }
+    
+    @Override
+    public void collectFreeVariables(THashSet<Variable> vars) {
+    }
+
+    @Override
+    public Expression resolve(TranslationContext context) {
+        throw new InternalCompilerError("EAmbiguousConstant should not exist in resolve phase.");
+    }
+
+    @Override
+    public void setLocationDeep(long loc) {
+        if(location == Locations.NO_LOCATION)
+            location = loc;
+    }
+
+    @Override
+    public Expression decorate(ExpressionDecorator decorator) {
+        return this;
+    }
+
+    @Override
+    public void collectEffects(THashSet<Type> effects) {
+        // TODO Auto-generated method stub
+    }
+
+    @Override
+    public void accept(ExpressionVisitor visitor) {
+        // TODO Auto-generated method stub
+    }
+    
+    @Override
+    public Expression simplify(SimplificationContext context) {
+        if(resolvedExpression != null)
+            return resolvedExpression;
+        else {
+            context.getErrorLog().log(location, getAmbiguousDescription(getType()));
+            return this;
+        }
+    }
+    
+    public void assertResolved(ErrorLog errorLog) {
+        if(resolvedExpression == null)
+            errorLog.log(location, getAmbiguousDescription(getType()));
+    }
+    
+    @Override
+    public Expression accept(ExpressionTransformer transformer) {
+        return transformer.transform(this);
+    }
+
+}
index fb27b9198afbf00ef9b6ae9b08eac1585eabbe97..8df327362560bc8574eefc96542d9e6f4da4de4a 100755 (executable)
@@ -1,12 +1,9 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.names.Name;\r
+import org.simantics.scl.compiler.constants.NoRepConstant;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -26,6 +23,8 @@ import org.simantics.scl.compiler.internal.interpreted.IApply;
 import org.simantics.scl.compiler.internal.interpreted.IExpression;\r
 import org.simantics.scl.compiler.internal.interpreted.IListLiteral;\r
 import org.simantics.scl.compiler.top.ExpressionInterpretationContext;\r
+import org.simantics.scl.compiler.types.Skeletons;\r
+import org.simantics.scl.compiler.types.TFun;\r
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
@@ -33,6 +32,10 @@ import org.simantics.scl.compiler.types.exceptions.UnificationException;
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 import org.simantics.scl.compiler.types.util.MultiFunction;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EApply extends Expression {\r
     Expression function;\r
     Expression[] parameters;\r
@@ -248,8 +251,7 @@ public class EApply extends Expression {
         return new IApply(function.toIExpression(target), parametersI);\r
     }\r
     \r
-    @Override\r
-    public Expression inferType(TypingContext context) {\r
+    private void inferType(TypingContext context, boolean ignoreResult) {\r
         function = function.inferType(context);\r
         function = context.instantiate(function);\r
         MultiFunction mfun;\r
@@ -265,7 +267,12 @@ public class EApply extends Expression {
             setType(Types.metaVar(Kinds.STAR));\r
             for(int i=0;i<parameters.length;++i)\r
                 parameters[i] = parameters[i].inferType(context);\r
-            return this;\r
+            return;\r
+        }\r
+        if((ignoreResult && Skeletons.canonicalSkeleton(mfun.returnType) instanceof TFun &&\r
+                Types.canonical(mfun.effect) == Types.NO_EFFECTS) ||\r
+                (context.isInPattern() && Skeletons.canonicalSkeleton(mfun.returnType) instanceof TFun)) {\r
+            context.getErrorLog().log(location, "The function is applied with too few parameters.");\r
         }\r
         \r
         // Check parameter types\r
@@ -276,7 +283,19 @@ public class EApply extends Expression {
         \r
         context.declareEffect(location, mfun.effect);\r
         setType(mfun.returnType);\r
-\r
+    }\r
+    \r
+    @Override\r
+    public Expression inferType(TypingContext context) {\r
+        inferType(context, false);\r
+        return this;\r
+    }\r
+    \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        inferType(context, true);\r
+        if(Types.canonical(getType()) != Types.UNIT)\r
+            return new ESimpleLet(location, null, this, new ELiteral(NoRepConstant.PUNIT));\r
         return this;\r
     }\r
 \r
index 3cdbabf7816ae25b60911b5b9ef23742f0c05371..98c9aaedbfde9aa5b317ef533b4cc1b10c365538 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
@@ -20,6 +16,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EApplyType extends Expression {    \r
     Expression expression;\r
     Type parameter;\r
index 0a11d9b99b169e4787bc4526babd8384cbc01a6a..8f6892a42f4f8cfb1e5a78e91386aef908c11c5e 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
@@ -17,6 +13,10 @@ import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EAsPattern extends Expression {\r
 \r
     Variable var;\r
index c7b0b80ef3518554c6714f67fbcfed7b65f2221c..fc6eda2eedb898ca531f8de148f6f77c632399e2 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -20,6 +16,10 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.exceptions.UnificationException;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EBind extends SimplifiableExpression {\r
     public Expression pattern;\r
     public Expression value;\r
index 45fb72d6340e1e95bc1cd41f5bfd179b76c14472..590cbbd96bf75ab80fd0d7d674b7c47d9164e6d6 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.names.Name;\r
@@ -35,6 +31,10 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.util.MultiFunction;\r
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EConstant extends Expression {\r
     SCLValue value;\r
     Type[] typeParameters;\r
@@ -232,7 +232,7 @@ public class EConstant extends Expression {
             return this;\r
         }\r
         else\r
-            return this;\r
+            return applyPUnit(context);\r
     }\r
 \r
     @Override\r
index 11bc4b63357f3f459a61d6505b629d63a9a029d7..92608b7177707d8bffc0142ea7571f1b4eaac42a 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
@@ -18,6 +14,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EEnforce extends SimplifiableExpression {\r
     \r
     Query query;\r
index 108b4b707557ce188a44761f693b56c5588c0951..67fe2db7c37937b29975f75b4c29e98cd19375ea 100644 (file)
@@ -1,7 +1,6 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.*;\r
-import gnu.trove.map.hash.THashMap;\r
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.loc;\r
 \r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.java.EqRelation;\r
@@ -15,6 +14,8 @@ import org.simantics.scl.compiler.environment.Environments;
 import org.simantics.scl.compiler.errors.Locations;\r
 import org.simantics.scl.compiler.internal.parsing.Token;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+\r
 public class EEntityTypeAnnotation extends ASTExpression {\r
     \r
     Expression expression;\r
index 41cea63ffb212e0aaad8f3eb56feb2d674ddcfb5..cf3774f2168628edba17b2fef342b761bbbe88ee 100644 (file)
@@ -107,6 +107,11 @@ public class EEquations extends SimplifiableExpression {
         return this;\r
     }\r
     \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        return inferType(context);\r
+    }\r
+\r
     @Override\r
     public Expression simplify(SimplificationContext context) {\r
         context.getErrorLog().log(location, "Equations should be transformed into other expressions before simplification phase.");\r
index d9a24618103c301defc751a8f6150b8a3f6d326b..d3f37281dfef771c4c69ab226f9b681ad5255b24 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -18,6 +14,10 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EError extends Expression {\r
 \r
     public EError(long loc, Type type) {\r
index afbe9d64f16c5bd5f98d322406e079d6cf96a3fb..56ea79a2a458bbe0d01e1065fd428dde31480ad2 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
@@ -24,6 +20,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EExternalConstant extends Expression {\r
     Object value;\r
     \r
index bcb7bf37b867d300306aa17ed8e4727c0e94212b..b49999c06e72c35b021f99bacba81c02b54dd2b9 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.names.Name;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -15,6 +11,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EFieldAccess extends SimplifiableExpression {\r
 \r
     private static final Type VARIABLE = Types.con("Simantics/Variables", "Variable");\r
index ef5412c7bb093f8e275adb984f8ee8c7faba7e5f..55fd9b4939991348bd65e8d81abbe35f1bfca776 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -13,6 +9,10 @@ import org.simantics.scl.compiler.types.TPred;
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EGetConstraint extends SimplifiableExpression {\r
     TPred constraint;\r
     EVariable evidence;\r
index 420875999216f685b99da760e4b861ad219351d8..e1ccd53ddc3bc2a7bdf99d30fe12eb7ac19e6044 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -20,6 +16,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EIf extends Expression {\r
     public Expression condition;\r
     public Expression then_;\r
@@ -117,6 +117,14 @@ public class EIf extends Expression {
         return this;\r
     }\r
     \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        condition = condition.checkType(context, Types.BOOLEAN);\r
+        then_ = then_.checkIgnoredType(context);\r
+        else_ = else_.checkIgnoredType(context);\r
+        return this;\r
+    }\r
+    \r
     @Override\r
     public Expression decorate(ExpressionDecorator decorator) {\r
         condition = condition.decorate(decorator);\r
index 7ccd66d0a3b8240fd25d70b37bb56bca94e07cf5..101e00b840fc67c1e37c3d7f7f32d82d5092d158 100755 (executable)
@@ -1,10 +1,6 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.constants.DoubleConstant;\r
 import org.simantics.scl.compiler.constants.FloatConstant;\r
@@ -20,6 +16,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EIntegerLiteral extends SimplifiableExpression {\r
     public String value;\r
     EVariable constraint;\r
index 1d46b80c6b98d6760a048399a0f85109a81eabe4..abf4c89da4f282a79425f3a08eba5d03357e9d21 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -17,6 +13,10 @@ import org.simantics.scl.compiler.types.exceptions.UnificationException;
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 import org.simantics.scl.compiler.types.util.MultiFunction;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ELambda extends SimplifiableExpression {\r
     public Case[] cases;\r
     Type effect = Types.NO_EFFECTS;\r
index a1505e0dd8f34d97bfc8eb4768083f6a84215464..8e9a74cd5146ea0fbb1212b660726a8fa1353366 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
@@ -21,6 +17,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ELambdaType extends Expression {\r
     public TVar[] parameters;\r
     public Expression value;\r
index a128e50634f49d88240ebe915d07463b937f5bc1..bbbc25c4de4ed7e7841172fb44f96834c5a15b85 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
@@ -25,6 +21,10 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ELet extends Expression {\r
     public Assignment[] assignments;\r
     public Expression in;\r
@@ -202,6 +202,13 @@ public class ELet extends Expression {
         in = in.checkType(context, requiredType);\r
         return this;\r
     }\r
+    \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        checkAssignments(context);\r
+        in = in.checkIgnoredType(context);\r
+        return this;\r
+    }\r
 \r
     @Override\r
     public Expression decorate(ExpressionDecorator decorator) {\r
index a7e36247ef7b70f5a4c0e769ab655cc832b57b87..abfeb2bc70c84431e30b5aa9409e87b08785f1ae 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -15,6 +11,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EListComprehension extends SimplifiableExpression {\r
 \r
     public Expression head;\r
index 4cdcc6f847f237038bccf8732d3688ffce700a53..b7165e975364cee2524239b2a01455a328d7b5d7 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -20,6 +16,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EListLiteral extends SimplifiableExpression {\r
 \r
     Expression[] components;\r
index 383e212f6b8f6fcfcfcba57897a76bccb9dbe351..15201e7f0f19e935f825ffff57f974c5c1ae957e 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.constants.Constant;\r
@@ -23,6 +19,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ELiteral extends Expression {\r
     Constant value;\r
     \r
index a218b95c38bf04913f983ba5c0978cb169b16e34..11877a60e086e9d0e6ba16f7eac4aaaccedd8cac 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
@@ -13,6 +9,7 @@ import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
 import org.simantics.scl.compiler.environment.Environment;\r
 import org.simantics.scl.compiler.errors.Locations;\r
 import org.simantics.scl.compiler.internal.codegen.references.IVal;\r
+import org.simantics.scl.compiler.internal.codegen.ssa.exits.Throw;\r
 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;\r
 import org.simantics.scl.compiler.internal.elaboration.matching.PatternMatchingCompiler;\r
 import org.simantics.scl.compiler.internal.elaboration.matching.Row;\r
@@ -21,6 +18,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EMatch extends Expression {\r
 \r
     public Expression[] scrutinee;\r
@@ -75,7 +76,7 @@ public class EMatch extends Expression {
            CodeWriter joinPoint = w.createBlock(getType());\r
            CodeWriter failurePoint = w.createBlock(); // TODO generate only one failurePoint per function\r
            PatternMatchingCompiler.split(w, env, scrutineeVals, joinPoint.getContinuation(), failurePoint.getContinuation(), rows);\r
-           failurePoint.throw_(location, "Matching failure at: " + toString());\r
+           failurePoint.throw_(location, Throw.MatchingException, "Matching failure at: " + toString());\r
            w.continueAs(joinPoint);\r
            return w.getParameters()[0];\r
     }\r
@@ -149,6 +150,19 @@ public class EMatch extends Expression {
         setType(requiredType);\r
         return this;\r
     }\r
+    \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        Type[] scrutineeTypes = new Type[scrutinee.length];\r
+        for(int i=0;i<scrutinee.length;++i) {\r
+            scrutinee[i] = scrutinee[i].checkType(context, Types.metaVar(Kinds.STAR));\r
+            scrutineeTypes[i] = scrutinee[i].getType();\r
+        }\r
+        for(Case case_ : cases)\r
+            case_.checkIgnoredType(context, scrutineeTypes);\r
+        setType(Types.UNIT);\r
+        return this;\r
+    }\r
 \r
     @Override\r
     public Expression decorate(ExpressionDecorator decorator) {\r
index 64d5cc3c64126675f950fddb467fa7abefdeb0ec..8d8883eae66f5e0fe2f20832f922aa7ca37ffe7e 100755 (executable)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.THashMap;\r
-import gnu.trove.procedure.TObjectObjectProcedure;\r
-\r
 import java.util.ArrayList;\r
 import java.util.List;\r
 \r
@@ -13,6 +10,9 @@ import org.simantics.scl.compiler.elaboration.expressions.lhstype.FunctionDefini
 import org.simantics.scl.compiler.elaboration.expressions.lhstype.LhsType;\r
 import org.simantics.scl.compiler.errors.Locations;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+import gnu.trove.procedure.TObjectObjectProcedure;\r
+\r
 public class EPreLet extends ASTExpression {\r
 \r
     List<LetStatement> assignments;\r
index ff27eb03a4ef066b0fa3f13d81080eede5a31e73..74f24ebb82496048e0d1c5c599c20350c642f646 100644 (file)
@@ -1,13 +1,13 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.THashMap;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.expressions.ERuleset.DatalogRule;\r
 import org.simantics.scl.compiler.elaboration.expressions.block.RuleStatement;\r
 import org.simantics.scl.compiler.elaboration.relations.LocalRelation;\r
 import org.simantics.scl.compiler.errors.Locations;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+\r
 public class EPreRuleset extends ASTExpression {\r
 \r
     RuleStatement[] statements;\r
index 644e31ab6968cdfd984f69ed852704b4673fc2b4..f2e17aa00cf6b78f418d993e6615149acb171ff3 100755 (executable)
@@ -1,10 +1,6 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.constants.DoubleConstant;\r
 import org.simantics.scl.compiler.constants.FloatConstant;\r
@@ -19,6 +15,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ERealLiteral extends SimplifiableExpression {\r
     public String value;\r
     EVariable constraint;\r
index cbb69a34be75153b04d99a9d78ccb234676a9194..32999dcb48877a689c980d7e7c1bc73973b46345 100644 (file)
@@ -52,8 +52,29 @@ public class ERecord extends ASTExpression {
             return new EError(constructor.location);
         }
         THashMap<String,FieldAssignment> recordMap = new THashMap<String,FieldAssignment>(fields.length);
-        for(FieldAssignment field : fields)
-            recordMap.put(field.name, field);
+        for(FieldAssignment field : fields) {
+            if(field.value == null) {
+                String bestMatch = null;
+                int bestMatchLength = 0;
+                for(int i=0;i<fieldNames.length;++i) {
+                    String fieldName = fieldNames[i];
+                    if(field.name.startsWith(fieldName) && fieldName.length() > bestMatchLength) {
+                        bestMatch = fieldName;
+                        bestMatchLength = fieldName.length();
+                    }
+                }
+                if(bestMatch == null) {
+                    context.getErrorLog().log(field.location, "Invalid shorthand field " + field.name + " is defined twice.");
+                    return new EError(location);
+                }
+                field.value = new EVar(field.location, field.name);
+                field.name = bestMatch;
+            }
+            if(recordMap.put(field.name, field) != null) {
+                context.getErrorLog().log(field.location, "Field " + field.name + " is defined more than once.");
+                return new EError(location);
+            }
+        }
         Expression[] parameters = new Expression[fieldNames.length];
         boolean error = false;
         for(int i=0;i<fieldNames.length;++i) {
@@ -91,7 +112,8 @@ public class ERecord extends ASTExpression {
         if(location == Locations.NO_LOCATION) {
             location = loc;
             for(FieldAssignment field : fields)
-                field.value.setLocationDeep(loc);
+                if(field.value != null)
+                    field.value.setLocationDeep(loc);
         }
     }
     
index e512460298d5bb40e0316d5b4020d0c21f8184a3..02b8c9ddc0c4922765cbbf5ff321726e4d05ff86 100644 (file)
@@ -131,6 +131,13 @@ public class ERuleset extends SimplifiableExpression {
         return compile(context);\r
     }\r
     \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        checkRuleTypes(context);\r
+        in = in.checkIgnoredType(context);\r
+        return compile(context);\r
+    }\r
+    \r
     @Override\r
     public void collectFreeVariables(THashSet<Variable> vars) {\r
         for(DatalogRule rule : rules) {\r
index 9a0bb040d6acb15ff0aa9edba0f894aa1c28434b..1e92952330fba5b4626eac399021349c31b84688 100644 (file)
@@ -8,9 +8,6 @@ import static org.simantics.scl.compiler.elaboration.expressions.Expressions.new
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.seq;\r
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.tuple;\r
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.var;\r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.common.names.Name;\r
@@ -30,6 +27,10 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ESelect extends SimplifiableExpression {\r
 \r
     private final Type ARRAY_LIST = Types.con("ArrayList", "T"); \r
index 071588ab9d5a33745ebb6c38b22d8f6cbde9fa78..e1efb30457b25973dd60ee3110930dede5b6bc38 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
@@ -27,6 +23,10 @@ import org.simantics.scl.compiler.types.exceptions.UnificationException;
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 import org.simantics.scl.compiler.types.util.MultiFunction;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ESimpleLambda extends Expression {\r
     public Variable parameter;\r
     public Expression value;\r
index 53984840d65ca851ecceec5a82c63a5e7f633772..8e73b2392fd3add380c8e656df2eae19777c2211 100755 (executable)
@@ -141,7 +141,7 @@ public class ESimpleLet extends Expression {
 \r
     private void checkBinding(TypingContext context) {\r
         if(variable == null)\r
-            value = value.inferType(context);\r
+            value = value.checkIgnoredType(context);\r
         else if(variable.getType() == null) {\r
             value = value.inferType(context);\r
             variable.setType(value.getType());\r
@@ -168,6 +168,13 @@ public class ESimpleLet extends Expression {
         in = in.checkType(context, requiredType);\r
         return this;\r
     }\r
+    \r
+    @Override\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        checkBinding(context);\r
+        in = in.checkIgnoredType(context);\r
+        return this;\r
+    }\r
 \r
     @Override\r
     public Expression decorate(ExpressionDecorator decorator) {\r
index 63fee96ca7e8096e4454749a074052dac67c9188..24584fe65cee8a0a457925bcba857ce2aa4c2927 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 import java.util.Collections;\r
 import java.util.Comparator;\r
@@ -20,6 +16,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ETransformation extends SimplifiableExpression {\r
     public static final Object TRANSFORMATION_RULES_TYPECHECKED = new Object();\r
     \r
index 48969e77b77b770ea4c2366db7ffbb2b7b3204c0..cfeab99f4e0b783c171ecf8ac61a874d09f99a43 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -13,6 +9,10 @@ import org.simantics.scl.compiler.internal.parsing.types.TypeAst;
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ETypeAnnotation extends SimplifiableExpression {\r
     Expression value;\r
     Type type;\r
index 553677626cdfc8ba7c283a500d87ce451b8d362a..ca87d72c4e8d878ac3cb30c445758578b43a9295 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
@@ -25,6 +21,10 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 import org.simantics.scl.compiler.types.util.TypeUnparsingContext;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EVariable extends Expression {\r
     public static final EVariable[] EMPTY_ARRAY = new EVariable[0];\r
     \r
@@ -144,9 +144,12 @@ public class EVariable extends Expression {
     \r
     @Override\r
     public Expression inferType(TypingContext context) {\r
-        if(context.isInPattern())\r
+        if(context.isInPattern()) {\r
             variable.setType(Types.metaVar(Kinds.STAR));\r
-        return this;\r
+            return this;\r
+        }\r
+        else\r
+            return applyPUnit(context);\r
     }\r
     \r
     @Override\r
index e7907f3578e62599536bfd89687bebc78e55ab4c..8021c407bee5687f055212c54db0ae157ef2c18a 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
@@ -22,6 +18,10 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.exceptions.UnificationException;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class EWhen extends SimplifiableExpression {\r
 \r
     public Query query;\r
@@ -79,7 +79,7 @@ public class EWhen extends SimplifiableExpression {
         for(Variable variable : variables)\r
             variable.setType(Types.metaVar(Kinds.STAR));\r
         query.checkType(context);\r
-        action.checkType(context, Types.UNIT);\r
+        action.checkIgnoredType(context);\r
         \r
         // Compile query\r
         return compile(context);\r
index 83d7ec4e7bb5290a407df6dc3d79dff8b7fed328..edf93841b5c9ba1adf7420238ee7c24451ed81c6 100755 (executable)
@@ -1,13 +1,11 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.common.precedence.Precedence;\r
+import org.simantics.scl.compiler.constants.NoRepConstant;\r
+import org.simantics.scl.compiler.elaboration.contexts.EnvironmentalContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -36,6 +34,10 @@ import org.simantics.scl.compiler.types.exceptions.MatchException;
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 import org.simantics.scl.compiler.types.util.Typed;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public abstract class Expression extends Symbol implements Typed {\r
     public static final Expression[] EMPTY_ARRAY = new Expression[0];\r
     \r
@@ -77,10 +79,30 @@ public abstract class Expression extends Symbol implements Typed {
     public Expression inferType(TypingContext context) {\r
         return checkBasicType(context, Types.metaVar(Kinds.STAR));\r
     }\r
-       \r
-       public Expression checkBasicType(TypingContext context, Type requiredType) {\r
-           return context.subsume(inferType(context), requiredType);\r
-       }\r
+\r
+    public Expression checkBasicType(TypingContext context, Type requiredType) {\r
+        return context.subsume(inferType(context), requiredType);\r
+    }\r
+    \r
+    protected Expression applyPUnit(EnvironmentalContext context) {\r
+        Type type = Types.canonical(getType());\r
+        if(type instanceof TFun) {\r
+            TFun fun = (TFun)type;\r
+            if(fun.getCanonicalDomain() == Types.PUNIT) {\r
+                EApply result = new EApply(location, this, new ELiteral(NoRepConstant.PUNIT));\r
+                result.effect = fun.getCanonicalEffect();\r
+                return result;\r
+            }\r
+        }\r
+        return this;\r
+    }\r
+\r
+    public Expression checkIgnoredType(TypingContext context) {\r
+        Expression expression = inferType(context);\r
+        if(Types.canonical(expression.getType()) != Types.UNIT)\r
+            expression = new ESimpleLet(location, null, expression, new ELiteral(NoRepConstant.PUNIT));\r
+        return expression;\r
+    }\r
        \r
        /**\r
         * Checks the type of the expression against the given type. Adds type\r
@@ -89,7 +111,7 @@ public abstract class Expression extends Symbol implements Typed {
        public final Expression checkType(TypingContext context, Type requiredType) {\r
            //System.out.println("checkType: " + this + " :: " + requiredType);\r
            if(!context.isInPattern()) {\r
-               requiredType = Types.weakCanonical(requiredType);\r
+               requiredType = Types.canonical(requiredType);\r
            if(requiredType instanceof TForAll) {\r
                 TForAll forAll = (TForAll)requiredType;\r
                 TVar var = forAll.var;\r
index 1bd50bb6a32124834519204e10055ac360309cce..baeedd0f00a51df1e8308dfb737dd77886cb81af 100644 (file)
@@ -2,6 +2,7 @@ package org.simantics.scl.compiler.elaboration.expressions;
 
 public interface ExpressionTransformer {
     
+    Expression transform(EAmbiguous expression);
     Expression transform(EApply expression);
     Expression transform(EApplyType expression);
     Expression transform(EAsPattern expression);
index 9bec115127b2a0d5a8a32c5edc0f552743eb463a..48f72eeac0b1a3f743fb0a042eb5c78b32e54619 100755 (executable)
@@ -1,10 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
-import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
@@ -13,12 +8,17 @@ import org.simantics.scl.compiler.environment.Environment;
 import org.simantics.scl.compiler.errors.Locations;\r
 import org.simantics.scl.compiler.internal.codegen.continuations.ICont;\r
 import org.simantics.scl.compiler.internal.codegen.references.IVal;\r
+import org.simantics.scl.compiler.internal.codegen.ssa.exits.Throw;\r
 import org.simantics.scl.compiler.internal.codegen.writer.CodeWriter;\r
 import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;\r
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.exceptions.MatchException;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class GuardedExpressionGroup extends Expression {\r
     public GuardedExpression[] expressions;\r
 \r
@@ -58,7 +58,7 @@ public class GuardedExpressionGroup extends Expression {
         CodeWriter failure = w.createBlock();\r
         compile(env, w, success.getContinuation(), failure.getContinuation());\r
         w.continueAs(success);\r
-        failure.throw_(location, "Matching failure at: " + toString());\r
+        failure.throw_(location, Throw.MatchingException, "Matching failure at: " + toString());\r
         return result;\r
         //throw new InternalCompilerError("GuardedExpressionGroup should be handled in match compilation.");\r
     }\r
index 17f13889d9471098c9a14e48a60cc14adc654055..1a2f451eeab205b8aff61a0ae5d655a2750660f4 100644 (file)
@@ -38,6 +38,11 @@ public class StandardExpressionTransformer implements
 ExpressionTransformer, QueryTransformer, ListQualifierTransformer, StatementVisitor,
 EquationVisitor {
 
+    @Override
+    public Expression transform(EAmbiguous expression) {
+        return expression;
+    }
+
     @Override
     public Expression transform(EApply expression) {
         expression.function = expression.function.accept(this);
index 0d8da56d45fd194aad28ff83c2104b833ead823e..db1da2bd8fee8e976dfdb557980d8c82c1eca11d 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.accessor;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -14,6 +10,10 @@ import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;\r
 import org.simantics.scl.compiler.types.Types;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ExpressionAccessor extends FieldAccessor {\r
     public Expression fieldName;\r
 \r
index 349623178ecbbe96648d769b4d67db949ab36087..a6eeb3f55d0db6573011a10d8000185af8427710 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.accessor;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -13,6 +9,10 @@ import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure;
 import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;\r
 import org.simantics.scl.compiler.internal.parsing.Symbol;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public abstract class FieldAccessor extends Symbol {\r
     public char accessSeparator;\r
 \r
index 23733e9c179f412c6f57960beaf2c42526cdc2db..59aa3ebe2b2e777e2ba614477712de1b695d4e75 100755 (executable)
@@ -19,11 +19,12 @@ public class GuardStatement extends Statement {
 \r
     @Override\r
     public Expression toExpression(EnvironmentalContext context, boolean monadic, Expression in) {\r
-        Variable var = new Variable("_");\r
-        if(monadic)\r
+        if(monadic) {\r
+            Variable var = new Variable("_");\r
             return new EBind(location, new EVariable(location, var), value, in);\r
+        }\r
         else\r
-            return new ESimpleLet(location, var, value, in);\r
+            return new ESimpleLet(location, null, value, in);\r
     }\r
     \r
     @Override\r
index 5c82a5aea887e9acbd5ca169ddc5870d72bacb36..5f042ff93d77c61a5873b5139826045afa50ba0f 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.list;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -16,6 +12,10 @@ import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;\r
 import org.simantics.scl.compiler.types.Type;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ListAssignment extends ListQualifier {\r
     public Expression pattern;\r
     public Expression value;\r
index 7b4cae6bdf25ea2af7fceb6f6b3686fb3282de33..622b53842e212699a3e16704821b6c9c4d04067b 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.list;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -19,6 +15,10 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ListGenerator extends ListQualifier {\r
     public Expression pattern;\r
     public Expression value;\r
index d591652a26e3f78de26e8330ecda2d66267a66fc..0a47f04b1713ddf62b6e97160b4d9e4bcd3210b8 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.list;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -15,6 +11,10 @@ import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.Types;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ListGuard extends ListQualifier {\r
     public Expression condition;\r
 \r
index e05501e1e311907508e4437b35a78f1dd935f1a2..270c3ffc767491ab4848f1da681b60c30a84adbc 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.list;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -13,6 +9,10 @@ import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator
 import org.simantics.scl.compiler.internal.parsing.Symbol;\r
 import org.simantics.scl.compiler.types.Type;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public abstract class ListQualifier extends Symbol {\r
 \r
     public abstract void checkType(TypingContext context);\r
index c5affbf96fbdf97fb699ca9ae42aa35479598727..84fa63e9ce848284cdd656ab182bf552e31ea2a4 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.list;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -14,6 +10,10 @@ import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.internal.elaboration.utils.ExpressionDecorator;\r
 import org.simantics.scl.compiler.types.Type;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ListSeq extends ListQualifier {\r
     public ListQualifier a;\r
     public ListQualifier b;\r
index 5867a5cfe6fb8b3a67b3c236808893577ad2719f..c79714c4e406a8f118f2280cf5526a3507ae5712 100755 (executable)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.expressions.list;\r
 \r
-import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.set.hash.THashSet;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;\r
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;\r
@@ -18,6 +14,10 @@ import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.exceptions.UnificationException;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.TObjectIntHashMap;\r
+import gnu.trove.set.hash.THashSet;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ListThen extends ListQualifier {\r
     public ListQualifier left;\r
     public Expression transformer;\r
index c5f8f3621187b02caf6e19b4437071bddbd4105c..6cbdb6f6b19aedef68bf8f69321650fca39123dd 100644 (file)
@@ -9,6 +9,7 @@ import org.simantics.scl.compiler.elaboration.expressions.EApplyType;
 import org.simantics.scl.compiler.elaboration.expressions.EAsPattern;\r
 import org.simantics.scl.compiler.elaboration.expressions.EBind;\r
 import org.simantics.scl.compiler.elaboration.expressions.EConstant;\r
+import org.simantics.scl.compiler.elaboration.expressions.ECoveringBranchPoint;\r
 import org.simantics.scl.compiler.elaboration.expressions.EEnforce;\r
 import org.simantics.scl.compiler.elaboration.expressions.EEquations;\r
 import org.simantics.scl.compiler.elaboration.expressions.EError;\r
@@ -25,7 +26,6 @@ import org.simantics.scl.compiler.elaboration.expressions.EListLiteral;
 import org.simantics.scl.compiler.elaboration.expressions.ELiteral;\r
 import org.simantics.scl.compiler.elaboration.expressions.EMatch;\r
 import org.simantics.scl.compiler.elaboration.expressions.EPlaceholder;\r
-import org.simantics.scl.compiler.elaboration.expressions.ECoveringBranchPoint;\r
 import org.simantics.scl.compiler.elaboration.expressions.ERealLiteral;\r
 import org.simantics.scl.compiler.elaboration.expressions.ERuleset;\r
 import org.simantics.scl.compiler.elaboration.expressions.ESelect;\r
@@ -331,7 +331,7 @@ public class ExpressionToStringVisitor implements ExpressionVisitor, QueryVisito
             ESimpleLet let = (ESimpleLet)expression;\r
             Variable variable = let.getVariable();\r
             Expression value = let.getValue();\r
-            if("_".equals(variable.getName()))\r
+            if(variable == null || "_".equals(variable.getName()))\r
                 printAsDo(value);\r
             else {\r
                 newLine();\r
index b9534f76b98147a6d6d4f73a229067a3ffe0abe4..6bdaaea7bfda2b0d26a89944b09e6f6be0a1d289 100644 (file)
@@ -1,7 +1,10 @@
 package org.simantics.scl.compiler.elaboration.java;
 
 
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.*;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.apply;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.constant;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.string;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.var;
 
 import org.cojen.classfile.TypeDesc;
 import org.simantics.scl.compiler.constants.generic.CallJava;
index 6319e58b25d07dbc749059cfbd42a793b29a3627..a154dff2304f55200f9f3ea45221349279f13076 100755 (executable)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.elaboration.macros;
 
-import gnu.trove.map.hash.THashMap;
-
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
 import org.simantics.scl.compiler.elaboration.expressions.EApply;
@@ -13,6 +11,8 @@ import org.simantics.scl.compiler.elaboration.expressions.Variable;
 import org.simantics.scl.compiler.types.TVar;
 import org.simantics.scl.compiler.types.Type;
 
+import gnu.trove.map.hash.THashMap;
+
 /**
  * This is a macro rule that replaces an application with
  * the definition of the function.
index ef73ea6af1ec0745071c22c452bee333e1535866..49301b151d93e3fd7d54acc5adc7f1990d0a5beb 100755 (executable)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.elaboration.modules;\r
 \r
-import gnu.trove.map.hash.THashMap;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.cojen.classfile.TypeDesc;\r
@@ -16,6 +14,8 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.kinds.Kinds;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+\r
 public class TypeClass extends TypeConstructor {\r
     public final TPred[] context;\r
     public final TCon name;\r
index c9bfa6fdefe6be4a41237baf28b580ae47a2413d..681c66972a415bcb6c955ff514cd21439c470fb3 100755 (executable)
@@ -1,12 +1,12 @@
 package org.simantics.scl.compiler.elaboration.modules;\r
 \r
-import gnu.trove.map.hash.THashMap;\r
-\r
 import org.simantics.scl.compiler.constants.Constant;\r
 import org.simantics.scl.compiler.elaboration.errors.ElabNode;\r
 import org.simantics.scl.compiler.types.TPred;\r
 import org.simantics.scl.compiler.types.TVar;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+\r
 public class TypeClassInstance extends ElabNode {\r
     public final TypeClass typeClass;\r
     public final TPred[] context;    \r
index 0fc36b6d7a5ce7ca3a497e27625ec4b861ab998c..53eb780fdaf2174393a8235d15a755aa8363d5be 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.Arrays;
 
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
@@ -16,7 +12,10 @@ import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure;
 import org.simantics.scl.compiler.elaboration.query.pre.QPreExists;
 import org.simantics.scl.compiler.elaboration.query.pre.QPreGuard;
 import org.simantics.scl.compiler.errors.Locations;
-import org.simantics.scl.compiler.types.Type;
+
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
 
 public abstract class QAbstractCombiner extends Query {
     public Query[] queries;
index 1f05e4734d3b3d15ca58cc17e6e4cb9c38c981c3..e04246e40e7d4224837205d7622c404527bae0aa 100644 (file)
@@ -1,15 +1,14 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import org.simantics.scl.compiler.elaboration.contexts.TranslationContext;
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
 import org.simantics.scl.compiler.elaboration.expressions.VariableProcedure;
 import org.simantics.scl.compiler.errors.Locations;
-import org.simantics.scl.compiler.types.Type;
+
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
 
 public abstract class QAbstractModifier extends Query {
     public Query query;
index 95760513b5383e80136b8005ff9ed50ce4a8b82a..fd7dacb799b625984ccf280c1b4f96380701c950 100644 (file)
@@ -1,11 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.ArrayList;
 import java.util.Set;
 
@@ -31,16 +25,22 @@ import org.simantics.scl.compiler.types.TVar;
 import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
 public class QAtom extends Query {
     public SCLRelation relation;
     public Type[] typeParameters;
     public Expression[] parameters;
-    
+
     public QAtom(SCLRelation relation, Expression ... parameters) {
         this.relation = relation;
         this.parameters = parameters;
     }
-    
+
     public QAtom(SCLRelation relation, Type[] typeParameters, Expression ... parameters) {
         this.relation = relation;
         this.typeParameters = typeParameters;
@@ -52,7 +52,7 @@ public class QAtom extends Query {
         for(Expression parameter : parameters)
             parameter.collectFreeVariables(vars);
     }
-    
+
     @Override
     public void checkType(TypingContext context) {
         // Type parameters
@@ -60,7 +60,7 @@ public class QAtom extends Query {
         typeParameters = new Type[typeVariables.length];
         for(int i=0;i<typeVariables.length;++i)
             typeParameters[i] = Types.metaVar(typeVariables[i].getKind());
-        
+
         // Check parameter types
         Type[] parameterTypes = relation.getParameterTypes();
         if(parameterTypes.length != parameters.length)
@@ -70,7 +70,7 @@ public class QAtom extends Query {
                 parameters[i] = parameters[i]
                         .checkType(context, parameterTypes[i].replace(typeVariables, typeParameters));
     }
-    
+
     public Expression generateEnforce(EnforcingContext context) {
         Variable[] variables = new Variable[parameters.length];
         for(int i=0;i<variables.length;++i)
@@ -92,7 +92,7 @@ public class QAtom extends Query {
     private static class VariableMaskProcedure implements VariableProcedure {
         ConstraintCollectionContext context;
         long requiredVariablesMask = 0L;
-        
+
         public VariableMaskProcedure(ConstraintCollectionContext context) {
             this.context = context;
         }
@@ -104,7 +104,7 @@ public class QAtom extends Query {
                 requiredVariablesMask |= 1L << id;
         }
     }
-    
+
     @Override
     public void collectConstraints(ConstraintCollectionContext context) {
         try {
@@ -133,20 +133,20 @@ public class QAtom extends Query {
                     }
                 }
             }
-                   
+
             // Combine required and optional variables
             TIntHashSet allVariablesSet = new TIntHashSet();
             for(int v : optionalVariableByParameter)
                 if(v >= 0)
                     allVariablesSet.add(v);
-            
+
             context.addConstraint(new RelationConstraint(allVariablesSet.toArray(), varParameters, this,
                     optionalVariableByParameter, procedure.requiredVariablesMask));
         } catch(Exception e) {
             context.getQueryCompilationContext().getTypingContext().getErrorLog().log(location, e);
         }
     }
-    
+
     private static void collectRefs(SCLRelation relation, TObjectIntHashMap<Object> allRefs,
             TIntHashSet refs) {
         if(relation instanceof CompositeRelation) {
@@ -167,7 +167,7 @@ public class QAtom extends Query {
         for(Expression parameter : parameters)
             parameter.collectRefs(allRefs, refs);
     }
-    
+
     @Override
     public void collectVars(TObjectIntHashMap<Variable> allVars,
             TIntHashSet vars) {
@@ -215,7 +215,7 @@ public class QAtom extends Query {
             return new Diff[] { new Diff(diffable.id, new QConjunction(eqs)) };
         }
     }
-    
+
     private static boolean containsReferenceTo(
             CompositeRelation relation,
             THashMap<SCLRelation, Diffable> diffables) {
@@ -235,7 +235,7 @@ public class QAtom extends Query {
         else
             return this;
     }
-    
+
     @Override
     public void setLocationDeep(long loc) {
         if(location == Locations.NO_LOCATION) {
@@ -244,7 +244,7 @@ public class QAtom extends Query {
                 parameter.setLocationDeep(loc);
         }
     }
-    
+
     @Override
     public void accept(QueryVisitor visitor) {
         visitor.visit(this);
@@ -266,7 +266,7 @@ public class QAtom extends Query {
         }
         list.add(this);
     }
-    
+
     @Override
     public Query accept(QueryTransformer transformer) {
         return transformer.transform(this);
index 95bb7b454145638403eb824fe2d59505467947b1..07a1f4556a37d32a68246c8d2ad04fb2acb2871c 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Set;
@@ -22,6 +19,9 @@ import org.simantics.scl.compiler.elaboration.relations.LocalRelation;
 import org.simantics.scl.compiler.elaboration.relations.SCLRelation;
 import org.simantics.scl.compiler.types.Types;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+
 
 public class QConjunction extends QAbstractCombiner {
 
index f27926414da581dd3e5b35f326bcd00aefe4941f..fc1c769ff67b98a91e4904523e2b8ab145b66332 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TLongObjectHashMap;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.ArrayList;
 import java.util.Set;
 
@@ -25,6 +21,10 @@ import org.simantics.scl.compiler.elaboration.relations.SCLRelation;
 import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.types.Types;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TLongObjectHashMap;
+import gnu.trove.set.hash.TIntHashSet;
+
 
 public class QDisjunction extends QAbstractCombiner {
 
index cdb0a5726da1e5a02a989fde2bcebb0fd3d84f02..5356eccc2708987042bb174f215a2ab374782084 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.set.hash.THashSet;
-
 import java.util.Collection;
 import java.util.Set;
 
@@ -20,6 +17,9 @@ import org.simantics.scl.compiler.elaboration.relations.SCLRelation;
 import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.set.hash.THashSet;
+
 public class QExists extends QAbstractModifier {
     Variable[] variables;
     
index fa0794fb4b037b0a727eeb8bba56f80af42ede61..ca9378c89f19da98d41b699e95ef88c75f497048 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
@@ -17,6 +13,10 @@ import org.simantics.scl.compiler.elaboration.rules.MappingRelation;
 import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.types.Type;
 
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
 public class QMapping extends Query {
     public final MappingRelation mappingRelation;
     public final Expression[] parameters;
index 20147c7dfd21288b43637019ebd196857d1beb2a..373efa413ddbb09a6e5d7ec302f8e823f866c858 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.set.hash.TIntHashSet;
-
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.elaboration.contexts.ReplaceContext;
 import org.simantics.scl.compiler.elaboration.expressions.EApply;
@@ -15,6 +12,9 @@ import org.simantics.scl.compiler.elaboration.query.compilation.UnsolvableQueryE
 import org.simantics.scl.compiler.elaboration.relations.LocalRelation;
 import org.simantics.scl.compiler.types.Type;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.set.hash.TIntHashSet;
+
 
 public class QNegation extends QAbstractModifier {
 
index 5154495f5472dcdcb1b2e326673c6e9e3d9f3958..0ac54e22ec29d72b8468bde640220c4676a4ed39 100644 (file)
@@ -1,11 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.ArrayList;
 import java.util.Set;
 
@@ -32,6 +26,12 @@ import org.simantics.scl.compiler.elaboration.relations.LocalRelation;
 import org.simantics.scl.compiler.elaboration.relations.SCLRelation;
 import org.simantics.scl.compiler.internal.parsing.Symbol;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
+
 public abstract class Query extends Symbol {
     public static final Query[] EMPTY_ARRAY = new Query[0];
     
index 7b2bfc60909cd984029fc53f546ab55d0f343222..e77e52c8a2b7d2292d005ec67814b1e4cfe883ea 100644 (file)
@@ -1,12 +1,12 @@
 package org.simantics.scl.compiler.elaboration.query.compilation;
 
-import gnu.trove.impl.Constants;
-import gnu.trove.map.hash.TObjectIntHashMap;
-
 import java.util.ArrayList;
 
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
 
+import gnu.trove.impl.Constants;
+import gnu.trove.map.hash.TObjectIntHashMap;
+
 public class ConstraintCollectionContext {
     QueryCompilationContext context;
     ArrayList<Variable> variables = new ArrayList<Variable>();
index 0506f410c9e971e83dedd8ba05a04daf0d71a23f..d53e4d1f27e383e18d397f2438114f3dedd80fee 100644 (file)
@@ -1,11 +1,11 @@
 package org.simantics.scl.compiler.elaboration.query.compilation;
 
-import gnu.trove.map.hash.TLongObjectHashMap;
-import gnu.trove.procedure.TLongObjectProcedure;
-
 import java.util.ArrayList;
 import java.util.Collections;
 
+import gnu.trove.map.hash.TLongObjectHashMap;
+import gnu.trove.procedure.TLongObjectProcedure;
+
 public class DynamicProgrammingOrdering {
     final ConstraintCollectionContext collectionContext;
     int variableCount;
index 0c7c21e3d0b8929e141bb702ce81c7ddd97efab8..c80d59f37f1f0f8191f230b343dc1644c3197fed 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query.compilation;\r
 \r
-import gnu.trove.map.hash.THashMap;\r
-import gnu.trove.procedure.TObjectObjectProcedure;\r
-import gnu.trove.set.hash.TIntHashSet;\r
-\r
 import java.util.ArrayList;\r
 \r
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;\r
@@ -15,6 +11,10 @@ import org.simantics.scl.compiler.errors.Locations;
 import org.simantics.scl.compiler.types.TVar;\r
 import org.simantics.scl.compiler.types.Type;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+import gnu.trove.procedure.TObjectObjectProcedure;\r
+import gnu.trove.set.hash.TIntHashSet;\r
+\r
 public class ExpressionConstraint extends QueryConstraint {\r
     Variable variable;\r
     Expression expression;\r
index 049625f6b44917eca6ea66f854e9b06613c14885..ee96433d3e11e35c7e98370916de82f6b3c0d7f8 100644 (file)
@@ -1,9 +1,5 @@
 package org.simantics.scl.compiler.elaboration.query.pre;
 
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.THashSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.ArrayList;
 
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
@@ -16,7 +12,10 @@ import org.simantics.scl.compiler.elaboration.query.QExists;
 import org.simantics.scl.compiler.elaboration.query.Query;
 import org.simantics.scl.compiler.elaboration.query.QueryVisitor;
 import org.simantics.scl.compiler.elaboration.query.compilation.ConstraintCollectionContext;
-import org.simantics.scl.compiler.types.Type;
+
+import gnu.trove.map.hash.TObjectIntHashMap;
+import gnu.trove.set.hash.THashSet;
+import gnu.trove.set.hash.TIntHashSet;
 
 /**
  * Query classes that may exist before resolving
index 900c9627bc1fbbd2b98acedff7d44c45364de4c3..0a193d6c1e89806b0daff39a8b2ffc7c87ea2622 100644 (file)
@@ -1,6 +1,10 @@
 package org.simantics.scl.compiler.elaboration.relations;
 
-import static org.simantics.scl.compiler.elaboration.expressions.Expressions.*;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.apply;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.newVar;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.tuple;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.var;
+import static org.simantics.scl.compiler.elaboration.expressions.Expressions.vars;
 
 import org.simantics.scl.compiler.common.exceptions.InternalCompilerError;
 import org.simantics.scl.compiler.common.names.Name;
index a14ddaf062b7435d96dcea3c7b974d3fa6c9e858..7b2f2a19e840e6f8dbde246e8631f99925ae3353 100644 (file)
@@ -4,7 +4,6 @@ import org.simantics.scl.compiler.elaboration.expressions.Expression;
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
 import org.simantics.scl.compiler.elaboration.query.compilation.EnforcingContext;
 import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;
-import org.simantics.scl.compiler.types.TPred;
 import org.simantics.scl.compiler.types.TVar;
 import org.simantics.scl.compiler.types.Type;
 
index fb59470b37151cf6d2ee8031b05fed638190f65d..26111e0b43bf781e3e922debfb61ca1eb61e09b8 100644 (file)
@@ -9,14 +9,11 @@ import static org.simantics.scl.compiler.elaboration.expressions.Expressions.tup
 import static org.simantics.scl.compiler.elaboration.expressions.Expressions.var;
 
 import org.simantics.scl.compiler.common.names.Name;
-import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
 import org.simantics.scl.compiler.elaboration.expressions.EApply;
 import org.simantics.scl.compiler.elaboration.expressions.EVariable;
 import org.simantics.scl.compiler.elaboration.expressions.Expression;
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
 import org.simantics.scl.compiler.elaboration.query.compilation.QueryCompilationContext;
-import org.simantics.scl.compiler.errors.Locations;
-import org.simantics.scl.compiler.types.TPred;
 import org.simantics.scl.compiler.types.TVar;
 import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
index d70bf785e250622fbb2d7987fc65550cf97b804c..6bf0f781bd04ac8edeca2772a4a8f655df458c56 100644 (file)
@@ -1,10 +1,5 @@
 package org.simantics.scl.compiler.elaboration.rules;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectObjectProcedure;
-import gnu.trove.procedure.TObjectProcedure;
-import gnu.trove.set.hash.THashSet;
-
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.elaboration.contexts.TypingContext;
 import org.simantics.scl.compiler.elaboration.expressions.Variable;
@@ -15,6 +10,11 @@ import org.simantics.scl.compiler.types.Type;
 import org.simantics.scl.compiler.types.Types;
 import org.simantics.scl.compiler.types.kinds.Kinds;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.procedure.TObjectObjectProcedure;
+import gnu.trove.procedure.TObjectProcedure;
+import gnu.trove.set.hash.THashSet;
+
 public class TransformationRule extends Symbol {
     public static final TransformationRule[] EMPTY_ARRAY = new TransformationRule[0];
     
index 9b9647ee19bedfd7343fe3bfb79a6ad35bc46123..98e2467fa6d637fd1ffae602569d85723c2d0142 100644 (file)
@@ -1,14 +1,13 @@
 package org.simantics.scl.compiler.environment;\r
 \r
-import gnu.trove.procedure.TObjectProcedure;\r
-\r
 import org.simantics.scl.compiler.elaboration.expressions.ESimpleLambda;\r
 import org.simantics.scl.compiler.elaboration.expressions.Expression;\r
 import org.simantics.scl.compiler.elaboration.expressions.Variable;\r
 import org.simantics.scl.compiler.types.Type;\r
-import org.simantics.scl.compiler.types.Types;\r
 import org.simantics.scl.compiler.types.util.ProcedureType;\r
 \r
+import gnu.trove.procedure.TObjectProcedure;\r
+\r
 public abstract class AbstractLocalEnvironment implements LocalEnvironment {\r
 \r
     @Override\r
index 2fb5e41d769c1d02da6548407cd30347da92771d..e3280daf6e731494e40f2e968093dea2e0aae9ea 100644 (file)
@@ -1,12 +1,12 @@
 package org.simantics.scl.compiler.environment;
 
-import gnu.trove.map.hash.THashMap;
-
 import java.util.Collection;
 
 import org.simantics.scl.compiler.elaboration.rules.TransformationRule;
 import org.simantics.scl.compiler.module.Module;
 
+import gnu.trove.map.hash.THashMap;
+
 public class ConcreteEnvironment extends AbstractEnvironment {
 
     private final THashMap<String, Module> moduleMap;
index 9bffef06b5d93d3bfb4644e3dcf74640c287a49d..ed08b7b690864191f88cec3baf47cfd5d84c2ef9 100644 (file)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.environment;
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.function.Consumer;
 
 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
@@ -16,6 +14,8 @@ import org.simantics.scl.compiler.environment.filter.NamespaceFilter;
 import org.simantics.scl.compiler.internal.codegen.effects.EffectConstructor;
 import org.simantics.scl.compiler.types.TCon;
 
+import gnu.trove.procedure.TObjectProcedure;
+
 public enum EmptyNamespace implements Namespace {
     INSTANCE;
 
index 11bc2577dfcaf41d92186bcbfa584387f440d16a..5a55a6ca130f81132d59a9ccf5dbe51884c9e346 100644 (file)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.environment;
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.List;
@@ -27,6 +25,8 @@ import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
 import org.simantics.scl.compiler.types.TCon;
 import org.simantics.scl.compiler.types.Type;
 
+import gnu.trove.procedure.TObjectProcedure;
+
 public class Environments {
     /**
      * Get the SCLValue object representing an SCL value defined in a given environment.
index 4ea77a0e23e779942584cfbe3177c7a1e7f5bb2d..b40bd9cdbd16f7b2aea1d685c03220bb5a7688e6 100644 (file)
@@ -1,11 +1,11 @@
 package org.simantics.scl.compiler.environment;\r
 \r
-import gnu.trove.procedure.TObjectProcedure;\r
-\r
 import org.simantics.scl.compiler.elaboration.expressions.Expression;\r
 import org.simantics.scl.compiler.types.Type;\r
 import org.simantics.scl.compiler.types.util.ProcedureType;\r
 \r
+import gnu.trove.procedure.TObjectProcedure;\r
+\r
 /**\r
  * Provides local variable names for expressions\r
  * that do not need to defined in any module.\r
index dc388a72c2ebfe2392cd58d8172113f7c9137baa..921b9029d2d2e7e028e8a1a746908f5305ef6324 100644 (file)
@@ -1,7 +1,5 @@
 package org.simantics.scl.compiler.environment;
 
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.function.Consumer;
 
 import org.simantics.scl.compiler.elaboration.modules.SCLValue;
@@ -16,6 +14,8 @@ import org.simantics.scl.compiler.environment.filter.NamespaceFilter;
 import org.simantics.scl.compiler.internal.codegen.effects.EffectConstructor;
 import org.simantics.scl.compiler.types.TCon;
 
+import gnu.trove.procedure.TObjectProcedure;
+
 public interface Namespace {
        /**
         * Find a sub-namespace with a given name
index 9fd58989d1f3b0e4953a8952990caa542b428311..bb98f1aa529b019274cf1252069126595a8db0df 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.scl.compiler.environment;
 
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectProcedure;
-
 import java.util.ArrayList;
 import java.util.function.Consumer;
 
@@ -20,6 +17,9 @@ import org.simantics.scl.compiler.internal.codegen.effects.EffectConstructor;
 import org.simantics.scl.compiler.module.Module;
 import org.simantics.scl.compiler.types.TCon;
 
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.procedure.TObjectProcedure;
+
 public class NamespaceImpl implements Namespace {
 
     private final THashMap<String, Namespace> namespaceMap;
index 3739edb528a76e475da7707751b8aee6f2544e80..8d97123f2e960e18392a2ee18e7bec8458cd0f9b 100644 (file)
@@ -1,11 +1,11 @@
 package org.simantics.scl.compiler.environment;\r
 \r
-import gnu.trove.map.hash.THashMap;\r
-\r
 import java.util.Map;\r
 \r
 import org.simantics.scl.compiler.environment.NamespaceImpl.ModuleImport;\r
 \r
+import gnu.trove.map.hash.THashMap;\r
+\r
 public class NamespaceSpec {\r
     public final THashMap<String, NamespaceSpec> namespaceMap = new THashMap<String, NamespaceSpec>();\r
     public final THashMap<String, ModuleImport> moduleMap = new THashMap<String, ModuleImport>();\r
index 57159b861d7d42254266dda514db36410137157f..2749ae3050b271c92a6398ede78058d8e3b8002d 100644 (file)
@@ -1,10 +1,10 @@
 package org.simantics.scl.compiler.environment.filter;\r
 \r
-import gnu.trove.set.hash.THashSet;\r
-\r
 import org.simantics.scl.compiler.elaboration.expressions.EVar;\r
 import org.simantics.scl.compiler.module.ImportDeclaration.ImportSpec;\r
 \r
+import gnu.trove.set.hash.THashSet;\r
+\r
 public class NamespaceFilters {\r
     public static NamespaceFilter createFromSpec(ImportSpec spec) {\r
         if(spec.hiding) {\r
index bd29b328b6328df57e063268485852dd6dc3e377..d754170124477850d66050d20e98c70685672d4d 100644 (file)
@@ -1,11 +1,11 @@
 package org.simantics.scl.compiler.errors;
 
-import gnu.trove.list.array.TIntArrayList;
-
 import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
 
+import gnu.trove.list.array.TIntArrayList;
+
 public class CompilationErrorFormatter {
 
     public static int[] rows(Reader reader) throws IOException {