Exemplo n.º 1
0
        public void TwoConstructorTypesWithDifferentConstructorNames_Unify_TypeMismatchReported()
        {
            TypeVariableSet       typeVariableSet  = new TypeVariableSet();
            TypeVariableReference constructorType1 = typeVariableSet.CreateReferenceToOptionType(
                typeVariableSet.CreateTypeVariableReferenceFromNIType(NITypes.Int32));
            TypeVariableReference constructorType2 = typeVariableSet.CreateReferenceToLockingCellType(
                typeVariableSet.CreateTypeVariableReferenceFromNIType(NITypes.Int32));
            var typeUnificationResult = new TestTypeUnificationResult();

            typeVariableSet.Unify(constructorType1, constructorType2, typeUnificationResult);

            Assert.IsTrue(typeUnificationResult.TypeMismatch);
        }
Exemplo n.º 2
0
        bool IDfirNodeVisitor <bool> .VisitLockTunnel(LockTunnel lockTunnel)
        {
            Terminal lockInput       = lockTunnel.InputTerminals.ElementAt(0),
                     referenceOutput = lockTunnel.OutputTerminals.ElementAt(0);
            LifetimeTypeVariableGroup lifetimeTypeVariableGroup = LifetimeTypeVariableGroup.CreateFromTerminal(lockInput);
            TypeVariableReference     dataVariableType          = _typeVariableSet.CreateReferenceToNewTypeVariable();
            TypeVariableReference     lockType = _typeVariableSet.CreateReferenceToLockingCellType(dataVariableType);

            CreateTerminalLifetimeGroup(InputReferenceMutability.AllowImmutable, lifetimeTypeVariableGroup)
            .AddTerminalFacade(lockInput, lockType, default(TypeVariableReference));

            Lifetime innerLifetime = referenceOutput.GetDiagramLifetime();
            TypeVariableReference referenceType = _typeVariableSet.CreateReferenceToReferenceType(
                true,
                lockType,
                _typeVariableSet.CreateReferenceToLifetimeType(innerLifetime));

            _nodeFacade[referenceOutput] = new SimpleTerminalFacade(referenceOutput, referenceType);
            return(true);
        }