private IEnumerable <Parameter> GetTypedParameters(IEnumerable <Parameter> parameters) { foreach (var parameter in parameters) { if (parameter.IsImplicitlyTyped) { yield return(parameter.WithType(TypeVariable.CreateNonGeneric())); } else { yield return(parameter.WithType(TypeOf(parameter.DeclaredTypeName))); } } }
public void HasATypeInWhichOnlyGenericTypeVariablesAreFreshenedOnEachScopeLookup() { using (TypeVariable.TestFactory()) { //Prevent type '1' from being freshened on type lookup by marking it as non-generic: var typeVariable0 = TypeVariable.CreateGeneric(); var typeVariable1 = TypeVariable.CreateNonGeneric(); var expectedTypeAfterLookup = new NamedType("A", new TypeVariable(8), typeVariable1, new NamedType("B", new TypeVariable(8), typeVariable1)); var definedType = new NamedType("A", typeVariable0, typeVariable1, new NamedType("B", typeVariable0, typeVariable1)); var typeChecker = new TypeChecker(); var globalScope = new GlobalScope(); var localScope = new LocalScope(globalScope); localScope.Bind("foo", definedType); Type("foo", localScope, typeChecker).ShouldEqual(expectedTypeAfterLookup); } }