text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle;
using Microsoft.CodeAnalysis.CSharp.TypeStyle;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics.UseExplicitType
{
    public partial class UseExplicitTypeTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest
    {
        public UseExplicitTypeTests(ITestOutputHelper logger)
          : base(logger)
        {
        }

        internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace)
            => (new CSharpUseExplicitTypeDiagnosticAnalyzer(), new UseExplicitTypeCodeFixProvider());

        private readonly CodeStyleOption2<bool> offWithSilent = new CodeStyleOption2<bool>(false, NotificationOption2.Silent);
        private readonly CodeStyleOption2<bool> onWithInfo = new CodeStyleOption2<bool>(true, NotificationOption2.Suggestion);
        private readonly CodeStyleOption2<bool> offWithInfo = new CodeStyleOption2<bool>(false, NotificationOption2.Suggestion);
        private readonly CodeStyleOption2<bool> offWithWarning = new CodeStyleOption2<bool>(false, NotificationOption2.Warning);
        private readonly CodeStyleOption2<bool> offWithError = new CodeStyleOption2<bool>(false, NotificationOption2.Error);

        // specify all options explicitly to override defaults.
        private OptionsCollection ExplicitTypeEverywhere() =>
            new OptionsCollection(GetLanguage())
            {
                { CSharpCodeStyleOptions.VarElsewhere, offWithInfo },
                { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithInfo },
                { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo },
            };

        private OptionsCollection ExplicitTypeExceptWhereApparent() =>
            new OptionsCollection(GetLanguage())
            {
                { CSharpCodeStyleOptions.VarElsewhere, offWithInfo },
                { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithInfo },
                { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo },
            };

        private OptionsCollection ExplicitTypeForBuiltInTypesOnly() =>
            new OptionsCollection(GetLanguage())
            {
                { CSharpCodeStyleOptions.VarElsewhere, onWithInfo },
                { CSharpCodeStyleOptions.VarWhenTypeIsApparent, onWithInfo },
                { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo },
            };

        private OptionsCollection ExplicitTypeEnforcements() =>
            new OptionsCollection(GetLanguage())
            {
                { CSharpCodeStyleOptions.VarElsewhere, offWithWarning },
                { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithError },
                { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithInfo },
            };

        private OptionsCollection ExplicitTypeSilentEnforcement() =>
            new OptionsCollection(GetLanguage())
            {
                { CSharpCodeStyleOptions.VarElsewhere, offWithSilent },
                { CSharpCodeStyleOptions.VarWhenTypeIsApparent, offWithSilent },
                { CSharpCodeStyleOptions.VarForBuiltInTypes, offWithSilent },
            };

        #region Error Cases

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnFieldDeclaration()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    [|var|] _myfield = 5;
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnFieldLikeEvents()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    public event [|var|] _myevent;
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task OnAnonymousMethodExpression()
        {
            var before =
@"using System;

class Program
{
    void Method()
    {
        [|var|] comparer = delegate (string value) {
            return value != ""0"";
        };
    }
}";
            var after =
@"using System;

class Program
{
    void Method()
    {
        Func<string, bool> comparer = delegate (string value) {
            return value != ""0"";
        };
    }
}";
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task OnLambdaExpression()
        {
            var before =
@"using System;

class Program
{
    void Method()
    {
        [|var|] x = (int y) => y * y;
    }
}";
            var after =
@"using System;

class Program
{
    void Method()
    {
        Func<int, int> x = (int y) => y * y;
    }
}";
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnDeclarationWithMultipleDeclarators()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] x = 5, y = x;
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnDeclarationWithoutInitializer()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] x;
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotDuringConflicts()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] p = new var();
    }

    class var
    {
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotIfAlreadyExplicitlyTyped()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|Program|] p = new Program();
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(27221, "https://github.com/dotnet/roslyn/issues/27221")]
        public async Task NotIfRefTypeAlreadyExplicitlyTyped()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

struct Program
{
    void Method()
    {
        ref [|Program|] p = Ref();
    }
    ref Program Ref() => throw null;
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnRHS()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class C
{
    void M()
    {
        var c = new [|var|]();
    }
}

class var
{
}");
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnErrorSymbol()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] x = new Goo();
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WorkItem(29718, "https://github.com/dotnet/roslyn/issues/29718")]
        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnErrorConvertedType_ForEachVariableStatement()
        {
            await TestMissingInRegularAndScriptAsync(
 @"using System;
using System.Collections.Generic;

class C
{
    void M()
    {
        // Error CS1061: 'KeyValuePair<int, int>' does not contain a definition for 'Deconstruct' and no accessible extension method 'Deconstruct' accepting a first argument of type 'KeyValuePair<int, int>' could be found (are you missing a using directive or an assembly reference?)
        // Error CS8129: No suitable 'Deconstruct' instance or extension method was found for type 'KeyValuePair<int, int>', with 2 out parameters and a void return type.
        foreach ([|var|] (key, value) in new Dictionary<int, int>())
        {
        }
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WorkItem(29718, "https://github.com/dotnet/roslyn/issues/29718")]
        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnErrorConvertedType_AssignmentExpressionStatement()
        {
            await TestMissingInRegularAndScriptAsync(
 @"using System;
using System.Collections.Generic;

class C
{
    void M(C c)
    {
        // Error CS1061: 'C' does not contain a definition for 'Deconstruct' and no accessible extension method 'Deconstruct' accepting a first argument of type 'C' could be found (are you missing a using directive or an assembly reference?)
        // Error CS8129: No suitable 'Deconstruct' instance or extension method was found for type 'C', with 2 out parameters and a void return type.
        [|var|] (key, value) = c;
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        #endregion

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InArrayType()
        {
            var before = @"
class Program
{
    void Method()
    {
        [|var|] x = new Program[0];
    }
}";
            var after = @"
class Program
{
    void Method()
    {
        Program[] x = new Program[0];
    }
}";
            // The type is apparent and not intrinsic
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeExceptWhereApparent()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InArrayTypeWithIntrinsicType()
        {
            var before = @"
class Program
{
    void Method()
    {
        [|var|] x = new int[0];
    }
}";
            var after = @"
class Program
{
    void Method()
    {
        int[] x = new int[0];
    }
}";
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent()); // preference for builtin types dominates
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InNullableIntrinsicType()
        {
            var before = @"
class Program
{
    void Method(int? x)
    {
        [|var|] y = x;
    }
}";
            var after = @"
class Program
{
    void Method(int? x)
    {
        int? y = x;
    }
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(42986, "https://github.com/dotnet/roslyn/issues/42986")]
        public async Task InNativeIntIntrinsicType()
        {
            var before = @"
class Program
{
    void Method(nint x)
    {
        [|var|] y = x;
    }
}";
            var after = @"
class Program
{
    void Method(nint x)
    {
        nint y = x;
    }
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(42986, "https://github.com/dotnet/roslyn/issues/42986")]
        public async Task InNativeUnsignedIntIntrinsicType()
        {
            var before = @"
class Program
{
    void Method(nuint x)
    {
        [|var|] y = x;
    }
}";
            var after = @"
class Program
{
    void Method(nuint x)
    {
        nuint y = x;
    }
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(27221, "https://github.com/dotnet/roslyn/issues/27221")]
        public async Task WithRefIntrinsicType()
        {
            var before = @"
class Program
{
    void Method()
    {
        ref [|var|] y = Ref();
    }
    ref int Ref() => throw null;
}";
            var after = @"
class Program
{
    void Method()
    {
        ref int y = Ref();
    }
    ref int Ref() => throw null;
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(27221, "https://github.com/dotnet/roslyn/issues/27221")]
        public async Task WithRefIntrinsicTypeInForeach()
        {
            var before = @"
class E
{
    public ref int Current => throw null;
    public bool MoveNext() => throw null;
    public E GetEnumerator() => throw null;

    void M()
    {
        foreach (ref [|var|] x in this) { }
    }
}";
            var after = @"
class E
{
    public ref int Current => throw null;
    public bool MoveNext() => throw null;
    public E GetEnumerator() => throw null;

    void M()
    {
        foreach (ref int x in this) { }
    }
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InArrayOfNullableIntrinsicType()
        {
            var before = @"
class Program
{
    void Method(int?[] x)
    {
        [|var|] y = x;
    }
}";
            var after = @"
class Program
{
    void Method(int?[] x)
    {
        int?[] y = x;
    }
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InNullableCustomType()
        {
            var before = @"
struct Program
{
    void Method(Program? x)
    {
        [|var|] y = x;
    }
}";
            var after = @"
struct Program
{
    void Method(Program? x)
    {
        Program? y = x;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NullableType()
        {
            var before = @"
#nullable enable
class Program
{
    void Method(Program x)
    {
        [|var|] y = x;
        y = null;
    }
}";
            var after = @"
#nullable enable
class Program
{
    void Method(Program x)
    {
        Program? y = x;
        y = null;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task ObliviousType()
        {
            var before = @"
#nullable enable
class Program
{
    void Method(Program x)
    {
#nullable disable
        [|var|] y = x;
        y = null;
    }
}";
            var after = @"
#nullable enable
class Program
{
    void Method(Program x)
    {
#nullable disable
        Program y = x;
        y = null;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NotNullableType()
        {
            var before = @"
class Program
{
    void Method(Program x)
    {
#nullable enable
        [|var|] y = x;
        y = null;
    }
}";
            var after = @"
class Program
{
    void Method(Program x)
    {
#nullable enable
        Program? y = x;
        y = null;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NullableType_OutVar()
        {
            var before = @"
#nullable enable
class Program
{
    void Method(out Program? x)
    {
        Method(out [|var|] y1);
        throw null!;
    }
}";
            var after = @"
#nullable enable
class Program
{
    void Method(out Program? x)
    {
        Method(out Program? y1);
        throw null!;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NotNullableType_OutVar()
        {
            var before = @"
#nullable enable
class Program
{
    void Method(out Program x)
    {
        Method(out [|var|] y1);
        throw null!;
    }
}";
            var after = @"
#nullable enable
class Program
{
    void Method(out Program x)
    {
        Method(out Program? y1);
        throw null!;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task ObliviousType_OutVar()
        {
            var before = @"
class Program
{
    void Method(out Program x)
    {
        Method(out [|var|] y1);
        throw null;
    }
}";
            var after = @"
class Program
{
    void Method(out Program x)
    {
        Method(out Program y1);
        throw null;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/40925"), Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        [WorkItem(40925, "https://github.com/dotnet/roslyn/issues/40925")]
        public async Task NullableTypeAndNotNullableType_VarDeconstruction()
        {
            var before = @"
#nullable enable
class Program2 { }
class Program
{
    void Method(Program? x, Program2 x2)
    {
        [|var|] (y1, y2) = (x, x2);
    }
}";
            var after = @"
#nullable enable
class Program2 { }
class Program
{
    void Method(Program? x, Program2 x2)
    {
        (Program? y1, Program2? y2) = (x, x2);
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task ObliviousType_VarDeconstruction()
        {
            var before = @"
#nullable enable
class Program2 { }
class Program
{
    void Method(Program x, Program2 x2)
    {
#nullable disable
        [|var|] (y1, y2) = (x, x2);
    }
}";
            var after = @"
#nullable enable
class Program2 { }
class Program
{
    void Method(Program x, Program2 x2)
    {
#nullable disable
        (Program y1, Program2 y2) = (x, x2);
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task ObliviousType_Deconstruction()
        {
            var before = @"
#nullable enable
class Program
{
    void Method(Program x)
    {
#nullable disable
        ([|var|] y1, Program y2) = (x, x);
    }
}";
            var after = @"
#nullable enable
class Program
{
    void Method(Program x)
    {
#nullable disable
        (Program y1, Program y2) = (x, x);
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NotNullableType_Deconstruction()
        {
            var before = @"
class Program
{
    void Method(Program x)
    {
#nullable enable
        ([|var|] y1, Program y2) = (x, x);
    }
}";
            var after = @"
class Program
{
    void Method(Program x)
    {
#nullable enable
        (Program? y1, Program y2) = (x, x);
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NullableType_Deconstruction()
        {
            var before = @"
class Program
{
    void Method(Program? x)
    {
#nullable enable
        ([|var|] y1, Program y2) = (x, x);
    }
}";
            var after = @"
class Program
{
    void Method(Program? x)
    {
#nullable enable
        (Program? y1, Program y2) = (x, x);
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task ObliviousType_Foreach()
        {
            var before = @"
#nullable enable
class Program
{
    void Method(System.Collections.Generic.IEnumerable<Program> x)
    {
#nullable disable
        foreach ([|var|] y in x)
        {
        }
    }
}";
            var after = @"
#nullable enable
class Program
{
    void Method(System.Collections.Generic.IEnumerable<Program> x)
    {
#nullable disable
        foreach ([|Program|] y in x)
        {
        }
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NotNullableType_Foreach()
        {
            var before = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<Program> x)
    {
#nullable enable
        foreach ([|var|] y in x)
        {
        }
    }
}";
            var after = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<Program> x)
    {
#nullable enable
        foreach (Program? y in x)
        {
        }
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NullableType_Foreach()
        {
            var before = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<Program> x)
    {
#nullable enable
        foreach ([|var|] y in x)
        {
        }
    }
}";
            var after = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<Program> x)
    {
#nullable enable
        foreach (Program? y in x)
        {
        }
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/37491"), Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NotNullableType_ForeachVarDeconstruction()
        {
            // Semantic model doesn't yet handle var deconstruction foreach
            // https://github.com/dotnet/roslyn/issues/37491
            // https://github.com/dotnet/roslyn/issues/35010
            var before = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<(Program, Program)> x)
    {
#nullable enable
        foreach ([|var|] (y1, y2) in x)
        {
        }
    }
}";
            var after = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<(Program, Program)> x)
    {
#nullable enable
        foreach ((Program? y1, Program? y2) in x)
        {
        }
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(40477, "https://github.com/dotnet/roslyn/issues/40477")]
        public async Task NotNullableType_ForeachDeconstruction()
        {
            var before = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<(Program, Program)> x)
    {
#nullable enable
        foreach (([|var|] y1, var y2) in x)
        {
        }
    }
}";
            var after = @"
class Program
{
    void Method(System.Collections.Generic.IEnumerable<(Program, Program)> x)
    {
#nullable enable
        foreach ((Program? y1, var y2) in x)
        {
        }
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InPointerTypeWithIntrinsicType()
        {
            var before = @"
unsafe class Program
{
    void Method(int* y)
    {
        [|var|] x = y;
    }
}";
            var after = @"
unsafe class Program
{
    void Method(int* y)
    {
        int* x = y;
    }
}";
            // The type is intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent()); // preference for builtin types dominates
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task InPointerTypeWithCustomType()
        {
            var before = @"
unsafe class Program
{
    void Method(Program* y)
    {
        [|var|] x = y;
    }
}";
            var after = @"
unsafe class Program
{
    void Method(Program* y)
    {
        Program* x = y;
    }
}";
            // The type is not intrinsic and not apparent
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23893, "https://github.com/dotnet/roslyn/issues/23893")]
        public async Task InOutParameter()
        {
            var before = @"
class Program
{
    void Method(out int x)
    {
        Method(out [|var|] x);
    }
}";
            var after = @"
class Program
{
    void Method(out int x)
    {
        Method(out int x);
    }
}";
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeForBuiltInTypesOnly());
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnDynamic()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|dynamic|] x = 1;
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnForEachVarWithAnonymousType()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Linq;

class Program
{
    void Method()
    {
        var values = Enumerable.Range(1, 5).Select(i => new { Value = i });

        foreach ([|var|] value in values)
        {
            Console.WriteLine(value.Value);
        }
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnDeconstructionVarParens()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        [|var|] (x, y) = new Program();
    }
    void Deconstruct(out int i, out string s) { i = 1; s = ""hello""; }
}", @"using System;
class Program
{
    void M()
    {
        (int x, string y) = new Program();
    }
    void Deconstruct(out int i, out string s) { i = 1; s = ""hello""; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task OnDeconstructionVar()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        ([|var|] x, var y) = new Program();
    }
    void Deconstruct(out int i, out string s) { i = 1; s = ""hello""; }
}", @"using System;
class Program
{
    void M()
    {
        (int x, var y) = new Program();
    }
    void Deconstruct(out int i, out string s) { i = 1; s = ""hello""; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnNestedDeconstructionVar()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        [|var|] (x, (y, z)) = new Program();
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", @"using System;
class Program
{
    void M()
    {
        (int x, (int y, Program z)) = new Program();
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnBadlyFormattedNestedDeconstructionVar()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        [|var|](x,(y,z)) = new Program();
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", @"using System;
class Program
{
    void M()
    {
        (int x, (int y, Program z)) = new Program();
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnForeachNestedDeconstructionVar()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        foreach ([|var|] (x, (y, z)) in new[] { new Program() } { }
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", @"using System;
class Program
{
    void M()
    {
        foreach ((int x, (int y, Program z)) in new[] { new Program() } { }
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnNestedDeconstructionVarWithTrivia()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        /*before*/[|var|]/*after*/ (/*x1*/x/*x2*/, /*yz1*/(/*y1*/y/*y2*/, /*z1*/z/*z2*/)/*yz2*/) /*end*/ = new Program();
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", @"using System;
class Program
{
    void M()
    {
        /*before*//*after*/(/*x1*/int x/*x2*/, /*yz1*/(/*y1*/int y/*y2*/, /*z1*/Program z/*z2*/)/*yz2*/) /*end*/ = new Program();
    }
    void Deconstruct(out int i, out Program s) { i = 1; s = null; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnDeconstructionVarWithDiscard()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        [|var|] (x, _) = new Program();
    }
    void Deconstruct(out int i, out string s) { i = 1; s = ""hello""; }
}", @"using System;
class Program
{
    void M()
    {
        (int x, string _) = new Program();
    }
    void Deconstruct(out int i, out string s) { i = 1; s = ""hello""; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23752, "https://github.com/dotnet/roslyn/issues/23752")]
        public async Task OnDeconstructionVarWithErrorType()
        {
            await TestInRegularAndScriptAsync(
@"using System;
class Program
{
    void M()
    {
        [|var|] (x, y) = new Program();
    }
    void Deconstruct(out int i, out Error s) { i = 1; s = null; }
}", @"using System;
class Program
{
    void M()
    {
        (int x, Error y) = new Program();
    }
    void Deconstruct(out int i, out Error s) { i = 1; s = null; }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task OnForEachVarWithExplicitType()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Linq;

class Program
{
    void Method()
    {
        var values = Enumerable.Range(1, 5);

        foreach ([|var|] value in values)
        {
            Console.WriteLine(value.Value);
        }
    }
}",
@"using System;
using System.Linq;

class Program
{
    void Method()
    {
        var values = Enumerable.Range(1, 5);

        foreach (int value in values)
        {
            Console.WriteLine(value.Value);
        }
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnAnonymousType()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] x = new { Amount = 108, Message = ""Hello"" };
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnArrayOfAnonymousType()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] x = new[] { new { name = ""apple"", diam = 4 }, new { name = ""grape"", diam = 1 } };
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnEnumerableOfAnonymousTypeFromAQueryExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    void Method()
    {
        var products = new List<Product>();
        [|var|] productQuery = from prod in products
                           select new { prod.Color, prod.Price };
    }
}

class Product
{
    public ConsoleColor Color { get; set; }
    public int Price { get; set; }
}");
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnLocalWithIntrinsicTypeString()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|var|] s = ""hello"";
    }
}",
@"using System;

class C
{
    static void M()
    {
        string s = ""hello"";
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnIntrinsicType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|var|] s = 5;
    }
}",
@"using System;

class C
{
    static void M()
    {
        int s = 5;
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnFrameworkType()
        {
            await TestInRegularAndScriptAsync(
@"using System.Collections.Generic;

class C
{
    static void M()
    {
        [|var|] c = new List<int>();
    }
}",
@"using System.Collections.Generic;

class C
{
    static void M()
    {
        List<int> c = new List<int>();
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnUserDefinedType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    void M()
    {
        [|var|] c = new C();
    }
}",
@"using System;

class C
{
    void M()
    {
        C c = new C();
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnGenericType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C<T>
{
    static void M()
    {
        [|var|] c = new C<int>();
    }
}",
@"using System;

class C<T>
{
    static void M()
    {
        C<int> c = new C<int>();
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnSingleDimensionalArrayTypeWithNewOperator()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|var|] n1 = new int[4] { 2, 4, 6, 8 };
    }
}",
@"using System;

class C
{
    static void M()
    {
        int[] n1 = new int[4] { 2, 4, 6, 8 };
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnSingleDimensionalArrayTypeWithNewOperator2()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|var|] n1 = new[] { 2, 4, 6, 8 };
    }
}",
@"using System;

class C
{
    static void M()
    {
        int[] n1 = new[] { 2, 4, 6, 8 };
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnSingleDimensionalJaggedArrayType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|var|] cs = new[] {
            new[] { 1, 2, 3, 4 },
            new[] { 5, 6, 7, 8 }
        };
    }
}",
@"using System;

class C
{
    static void M()
    {
        int[][] cs = new[] {
            new[] { 1, 2, 3, 4 },
            new[] { 5, 6, 7, 8 }
        };
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnDeclarationWithObjectInitializer()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        [|var|] cc = new Customer { City = ""Chennai"" };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}",
@"using System;

class C
{
    static void M()
    {
        Customer cc = new Customer { City = ""Chennai"" };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnDeclarationWithCollectionInitializer()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        [|var|] digits = new List<int> { 1, 2, 3 };
    }
}",
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        List<int> digits = new List<int> { 1, 2, 3 };
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnDeclarationWithCollectionAndObjectInitializers()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        [|var|] cs = new List<Customer>
        {
            new Customer { City = ""Chennai"" }
        };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}",
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        List<Customer> cs = new List<Customer>
        {
            new Customer { City = ""Chennai"" }
        };
    }

    private class Customer
    {
        public string City { get; set; }
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnForStatement()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        for ([|var|] i = 0; i < 5; i++)
        {
        }
    }
}",
@"using System;

class C
{
    static void M()
    {
        for (int i = 0; i < 5; i++)
        {
        }
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnForeachStatement()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        var l = new List<int> { 1, 3, 5 };
        foreach ([|var|] item in l)
        {
        }
    }
}",
@"using System;
using System.Collections.Generic;

class C
{
    static void M()
    {
        var l = new List<int> { 1, 3, 5 };
        foreach (int item in l)
        {
        }
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnQueryExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;
using System.Linq;

class C
{
    static void M()
    {
        var customers = new List<Customer>();
        [|var|] expr = from c in customers
                   where c.City == ""London""
                   select c;
    }

    private class Customer
    {
        public string City { get; set; }
    }
}
}",
@"using System;
using System.Collections.Generic;
using System.Linq;

class C
{
    static void M()
    {
        var customers = new List<Customer>();
        IEnumerable<Customer> expr = from c in customers
                   where c.City == ""London""
                   select c;
    }

    private class Customer
    {
        public string City { get; set; }
    }
}
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInUsingStatement()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        using ([|var|] r = new Res())
        {
        }
    }

    private class Res : IDisposable
    {
        public void Dispose()
        {
            throw new NotImplementedException();
        }
    }
}",
@"using System;

class C
{
    static void M()
    {
        using (Res r = new Res())
        {
        }
    }

    private class Res : IDisposable
    {
        public void Dispose()
        {
            throw new NotImplementedException();
        }
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnInterpolatedString()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|var|] s = $""Hello, {name}""
    }
}",
@"using System;

class Program
{
    void Method()
    {
        string s = $""Hello, {name}""
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnExplicitConversion()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        double x = 1234.7;
        [|var|] a = (int)x;
    }
}",
@"using System;

class C
{
    static void M()
    {
        double x = 1234.7;
        int a = (int)x;
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnConditionalAccessExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        C obj = new C();
        [|var|] anotherObj = obj?.Test();
    }

    C Test()
    {
        return this;
    }
}",
@"using System;

class C
{
    static void M()
    {
        C obj = new C();
        C anotherObj = obj?.Test();
    }

    C Test()
    {
        return this;
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInCheckedExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        long number1 = int.MaxValue + 20L;
        [|var|] intNumber = checked((int)number1);
    }
}",
@"using System;

class C
{
    static void M()
    {
        long number1 = int.MaxValue + 20L;
        int intNumber = checked((int)number1);
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInAwaitExpression()
        {
            await TestInRegularAndScriptAsync(
@"using System;
using System.Threading.Tasks;

class C
{
    public async void ProcessRead()
    {
        [|var|] text = await ReadTextAsync(null);
    }

    private async Task<string> ReadTextAsync(string filePath)
    {
        return string.Empty;
    }
}",
@"using System;
using System.Threading.Tasks;

class C
{
    public async void ProcessRead()
    {
        string text = await ReadTextAsync(null);
    }

    private async Task<string> ReadTextAsync(string filePath)
    {
        return string.Empty;
    }
}", options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInBuiltInNumericType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void ProcessRead()
    {
        [|var|] text = 1;
    }
}",
@"using System;

class C
{
    public void ProcessRead()
    {
        int text = 1;
    }
}", options: ExplicitTypeForBuiltInTypesOnly());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInBuiltInCharType()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void ProcessRead()
    {
        [|var|] text = GetChar();
    }

    public char GetChar() => 'c';
}",
@"using System;

class C
{
    public void ProcessRead()
    {
        char text = GetChar();
    }

    public char GetChar() => 'c';
}", options: ExplicitTypeForBuiltInTypesOnly());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInBuiltInType_string()
        {
            // though string isn't an intrinsic type per the compiler
            // we in the IDE treat it as an intrinsic type for this feature.
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void ProcessRead()
    {
        [|var|] text = string.Empty;
    }
}",
@"using System;

class C
{
    public void ProcessRead()
    {
        string text = string.Empty;
    }
}", options: ExplicitTypeForBuiltInTypesOnly());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeInBuiltInType_object()
        {
            // object isn't an intrinsic type per the compiler
            // we in the IDE treat it as an intrinsic type for this feature.
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    public void ProcessRead()
    {
        object j = new C();
        [|var|] text = j;
    }
}",
@"using System;

class C
{
    public void ProcessRead()
    {
        object j = new C();
        object text = j;
    }
}", options: ExplicitTypeForBuiltInTypesOnly());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeNotificationLevelSilent()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|var|] n1 = new C();
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ExplicitTypeSilentEnforcement(),
                diagnosticId: IDEDiagnosticIds.UseExplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Hidden);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeNotificationLevelInfo()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|var|] s = 5;
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ExplicitTypeEnforcements(),
                diagnosticId: IDEDiagnosticIds.UseExplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Info);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task SuggestExplicitTypeNotificationLevelWarning()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|var|] n1 = new[] { new C() }; // type not apparent and not intrinsic
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ExplicitTypeEnforcements(),
                diagnosticId: IDEDiagnosticIds.UseExplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Warning);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeNotificationLevelError()
        {
            var source =
@"using System;
class C
{
    static void M()
    {
        [|var|] n1 = new C();
    }
}";
            await TestDiagnosticInfoAsync(source,
                options: ExplicitTypeEnforcements(),
                diagnosticId: IDEDiagnosticIds.UseExplicitTypeDiagnosticId,
                diagnosticSeverity: DiagnosticSeverity.Error);
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnLocalWithIntrinsicTypeTuple()
        {
            await TestInRegularAndScriptAsync(
@"class C
{
    static void M()
    {
        [|var|] s = (1, ""hello"");
    }
}",
@"class C
{
    static void M()
    {
        (int, string) s = (1, ""hello"");
    }
}",
options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnLocalWithIntrinsicTypeTupleWithNames()
        {
            await TestInRegularAndScriptAsync(
@"class C
{
    static void M()
    {
        [|var|] s = (a: 1, b: ""hello"");
    }
}",
@"class C
{
    static void M()
    {
        (int a, string b) s = (a: 1, b: ""hello"");
    }
}",
options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task SuggestExplicitTypeOnLocalWithIntrinsicTypeTupleWithOneName()
        {
            await TestInRegularAndScriptAsync(
@"class C
{
    static void M()
    {
        [|var|] s = (a: 1, ""hello"");
    }
}",
@"class C
{
    static void M()
    {
        (int a, string) s = (a: 1, ""hello"");
    }
}",
options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20437, "https://github.com/dotnet/roslyn/issues/20437")]
        public async Task SuggestExplicitTypeOnDeclarationExpressionSyntax()
        {
            await TestInRegularAndScriptAsync(
@"using System;

class C
{
    static void M()
    {
        DateTime.TryParse(string.Empty, [|out var|] date);
    }
}",
@"using System;

class C
{
    static void M()
    {
        DateTime.TryParse(string.Empty, out DateTime date);
    }
}",
options: ExplicitTypeEverywhere());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames1()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Method()
    {
        [|String|] test = new String(' ', 4);
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames2()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        foreach ([|String|] test in new String[] { ""test1"", ""test2"" })
        {
        }
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames3()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        [|Int32[]|] array = new[] { 1, 2, 3 };
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames4()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        [|Int32[][]|] a = new Int32[][]
        {
            new[] { 1, 2 },
            new[] { 3, 4 }
        };
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames5()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class Program
{
    void Main()
    {
        [|IEnumerable<Int32>|] a = new List<Int32> { 1, 2 }.Where(x => x > 1);
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames6()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        String name = ""name"";
        [|String|] s = $""Hello, {name}""
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames7()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        Object name = ""name"";
        [|String|] s = (String) name;
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames8()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Threading.Tasks;

class C
{
    public async void ProcessRead()
    {
        [|String|] text = await ReadTextAsync(null);
    }

    private async Task<string> ReadTextAsync(string filePath)
    {
        return String.Empty;
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames9()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        String number = ""12"";
        Int32.TryParse(name, out [|Int32|] number)
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames10()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;

class Program
{
    void Main()
    {
        for ([|Int32|] i = 0; i < 5; i++)
        {
        }
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(20244, "https://github.com/dotnet/roslyn/issues/20244")]
        public async Task ExplicitTypeOnPredefinedTypesByTheirMetadataNames11()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class Program
{
    void Main()
    {
        [|List<Int32>|] a = new List<Int32> { 1, 2 };
    }
}", new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(26923, "https://github.com/dotnet/roslyn/issues/26923")]
        public async Task NoSuggestionOnForeachCollectionExpression()
        {
            await TestMissingInRegularAndScriptAsync(
@"using System;
using System.Collections.Generic;

class Program
{
    void Method(List<int> var)
    {
        foreach (int value in [|var|])
        {
            Console.WriteLine(value.Value);
        }
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        public async Task NotOnConstVar()
        {
            // This error case is handled by a separate code fix (UseExplicitTypeForConst).
            await TestMissingInRegularAndScriptAsync(
@"class C
{
    void M()
    {
        const [|var|] v = 0;
    }
}", new TestParameters(options: ExplicitTypeEverywhere()));
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task WithNormalFuncSynthesizedLambdaType()
        {
            var before = @"
class Program
{
    void Method()
    {
        [|var|] x = (int i) => i.ToString();
    }
}";
            var after = @"
class Program
{
    void Method()
    {
        System.Func<int, string> x = (int i) => i.ToString();
    }
}";
            // The type is not apparent and not intrinsic
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeEverywhere());
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestInRegularAndScriptAsync(before, after, options: ExplicitTypeExceptWhereApparent());
        }

        [WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExplicitType)]
        [WorkItem(23907, "https://github.com/dotnet/roslyn/issues/23907")]
        public async Task WithAnonymousSynthesizedLambdaType()
        {
            var before = @"
class Program
{
    void Method()
    {
        [|var|] x = (ref int i) => i.ToString();
    }
}";
            // The type is apparent and not intrinsic
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeEverywhere()));
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeForBuiltInTypesOnly()));
            await TestMissingInRegularAndScriptAsync(before, new TestParameters(options: ExplicitTypeExceptWhereApparent()));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Skewed X chromosome inactivation and female preponderance in autoimmune thyroid disease: an association study and meta-analysis.
Simmonds MJ., Kavvoura FK., Brand OJ., Newby PR., Jackson LE., Hargreaves CE., Franklyn JA., Gough SCL.
CONTEXT: A number of small data sets have suggested a potential role for skewed X chromosome activation (XCI), away from the expected 50:50 parent of origin ratio, as an explanation for the strong female preponderance seen in the common autoimmune thyroid diseases (AITD), Graves' disease (GD), and Hashimoto's thyroiditis (HT). OBJECTIVE: The objective of the study was to confirm a role for XCI skewing as a potential explanation for the strong female preponderance seen in AITD. DESIGN: The design of the study was to screen XCI in the largest GD, HT, and control case-control cohort and family cohort to date and undertake a meta-analysis of previous AITD XCI reports. SETTING: The study was conducted at a research laboratory. PATIENTS: Three hundred and nine GD, 490 HT, and 325 female UK Caucasians controls, 273 UK Caucasian GD families, and a meta-analysis of 454 GD, 673 HT, and 643 female Caucasian controls were included in the study. MAIN OUTCOME MEASURES: Case-control and family-based association studies and meta-analysis were measured. RESULTS: Skewed XCI was observed with GD [odds ratio (OR) 2.17 [95% confidence interval (CI) 1.43-3.30], P=2.1×10(-4)] and a trend toward skewing with HT (P=.08) compared with the control cohort. A meta-analysis of our UK data and that of four previous non-UK Caucasian studies confirmed significant skewing of XCI with GD [OR 2.54 (95% CI 1.58-4.10), P=1.0×10(-4), I2=30.2%] and HT [OR 2.40 (95% CI 1.10-5.26), P=.03, I2=74.3%]. CONCLUSIONS: Convincing evidence exists to support a role for skewed XCI in female subjects with AITD, which may, in part, explain the strong female preponderance observed in this disease.
10.1210/jc.2013-2667
J Clin Endocrinol Metab
E127 - E131
Adult, Case-Control Studies, European Continental Ancestry Group, Female, Genetic Association Studies, Genetic Predisposition to Disease, Humans, Male, Middle Aged, Pedigree, Sex Factors, Thyroiditis, Autoimmune, United Kingdom, X Chromosome Inactivation, Young Adult

redpajama_set_name: RedPajamaCommonCrawl


text:
VEHICLE REVIEW 2016 Nissan Titan XD: All-new truck for an all-inclusive world
Special to the online edition of Windy City Times by Sam Gomez, Gaywheels.com
This article shared 1963 times since Tue Aug 23, 2016
Pride is not just a celebration for you June bugs anymore. Still to come in 2016 are Pride events in Austin, Dallas and Atlanta. ( Leave it to the gays to heat things up just as the weather starts to cool down in these hot cities. )
For those of you who need a reliable truck to be as hard-working as you butch types are, and want a truck that you can lend to your favorite Gay Pride contingent so they will really get noticed, this year's Nissan Titan XD could be the Match.com dream date you hoped you would find before your free three-month membership expires.
The all-new 2016 Nissan Titan is a big improvement over the Titan from 2015. It's bulkier, it's bigger and can now tow more than 8,500 pounds, putting it at the high-end of towing capacity in the large truck category. That's a lot of bears. That's a lot of queens. That's a lot of hauling ass — and accessories, equipment ( i.e. helium tanks, coffee tanks, bubble machines ) and early-morning carbs.
I was the designated driver this summer for the Front Range Bears ( none were ever as skinny as Anderson Cooper or Neil Patrick Harris are ) and we had quite a presence thanks to Nissan USA, which jumped at the chance to be our Pride parade sponsor. ( Thank you, Steve. ) These pics by photographer Gary Van Dorn show all the fun we had. What stands out most in all those photos? The 2016 Nissan Titan XD. Making a slow, impressive entrance on a big busy street is tough: let the Titan show you why it's called the Titan.
This truck stays cool even when it is hot, hot, hot. Picture it: Pride Parade, Denver, 2016. The temperature was fast approaching 100 degrees, we were towing a trailer and the traffic was clearly stop and go. Yet with the Titan XD everyone stopped, looked and applauded, perhaps because there was no steam coming from under the hood, as was the case with other trucks in the parade. In years past, I have struggled with driving at parade speed while not overheating the engine. Sure, my towing skills have improved a smidge, but with this year's Titan, everything stayed cooled even while the bears, butches and other beauties were clearly overheating.
With a truck this big, you need all the help you can get. One feature I really love ( and am surprised more manufacturers don't install it ) is a power steering-column adjuster. Rather than disengage a latch on the column, adjust the steering wheel height and distance and then lock the latch back in place, all you have to do is move the power button up, down, back, forth whatever works for you. This will allow you to save your strength for dealing with all the details you'll have to address in back of the truck. ( Someone is always spilling a double-whip, triple-dip no-fart espresso-yourself of latte-day saints, but with Nissan's Factory-Applied Spray-On bed-liner ( optional ), thrills and spills clean up in a jiffy. )
Also with this behemoth ( a term of endearment in my gay world ), there are automatic seat adjusters, which in this case will allow you to lower your seat as much as needed so your cowboy hat or beehive hair will not hit the ceiling or go crunch as you run over something considerably smaller ( hopefully without a vertebrae ).
Many reviewers see the new 2016 Titan as a nice midpoint between the basic truck of American life and all the fancy, expensive trucks that now flood the market. It's luxurious but in a practical way. It's big and imposing but it can also handle over four tons of payload. That's my way of saying you really should check out this truck, especially as the model year end draws to a close.
Fellow Gaywheels.com writer Dave Bear beat me to the punch on applause for the new Titan XD: "Redesigned with rugged good looks and the powerful combination of a Cummins Turbo Diesel coupled to an Allison six-speed transmission, it's a perfect blend of form meeting function." That's his way of saying this truck is really, really butch. Check out his full review at Gaywheels.com/2016/06/the-2016-nissan-titan-xd-comes-out-to-show-its-pride/ .
I admit, I am still in awe of how LGBTs have come from being openly threatened and arrested for even knowing people with AIDS to a commodity so hot that even PTAs across the country want to get on board.
The progress will only continue—unless Donald Trump gets into the White House. How to prevent that from happening? VOTE! Find out how and where at CommonCause.org .
See more articles at Gaywheels.com .
Chicago Auto Show to take place Feb. 12-21 2022-01-10
- The Chicago Auto Show is slated to return to its traditional February dates: Feb. 12-21 at McCormick Place. The show is open 10 a.m. to 10 p.m. each day, except for the final day (Presidents Day), ...
Now, only five of Chicago's 50 aldermen reject automatic pay raises 2021-09-16
- Forty-five out of 50 Chicago aldermen have opted to accept a 5.5% pay increase in 2022 that will push the highest paid among them to an annual salary of more than $130,000, according to The Chicago Tribune. ...
AUTOS 2021 BMW 430i: Hard Top or Soft? 2021-08-06
- This year's BMW 430i xDrive really is the classic sportscar. You can get it as a coupe or as a convertible, the only two trims available. Basically, it's just two doors and you can have it with a year-round hard top ...
Chicago Auto Show taking place July 15-19 2021-07-14
- An abridged version of the annual Chicago Auto Show will take place July 15-19 at McCormick Place, 2301 S. King Dr. The auto show will be one of McCormick Place's first live, in-person events since the ...
Pritzker announces $10M vaccination lottery 2021-06-18
- As Illinois continues to lead the Midwest in vaccinating our residents, Gov. JB Pritzker announced a new $10 million "All In for the Win" promotion that will reward vaccinated Illinoisans by automatically entering them into a ...
Chicago Auto Show to return to McCormick Place in July 2021-05-04
- On May 4, Illinois Gov. JB Pritzker and Chicago Mayor Lori E. Lightfoot joined elected officials, tourism backers and labor leaders to announce the return of the annual Chicago Auto Show. The event—the nation's largest and ...
THEATER 'A Portrait of My Mother' to start streaming May 9 2021-04-08
- Jarrott Productions will present the world premiere of A Portrait of My Mother, written and performed by Carlo Lorenzo Garcia and directed by David R. Jarrott. The autobiographical tribute to Garcia's mother, Maria, begins streaming on ...
AUTOS 2020 Cadillac XT6 is the stylish transport for you and your posse 2020-08-18
- Cadillac has long hosted fashion shows with acres of flat sheetmetal, glistening chrome, and cabins drenched with all the finest materials. This once meant block-long sedans, but people aren't buying ...
Billy Masters 2020-06-10
- "Alone we can achieve so little; together we can achieve so much."—Tiffany Trump. Actually, the Trump spawn was quoting Helen Keller—because, when I think of one, I automatically think of the other. Tiff's tweet had the ...
Driver-service facilities to expand hours June 1 2020-05-25
- Illinois Secretary of State Jesse White announced his office's reopening plan —starting June 1—with the first two months focused on serving ONLY new drivers, customers with expired driver's licenses/ID cards ...
AUTOS Elegant 2020 BMW 840i knows how to butter your rolls 2020-05-25
- I've been craving a grilled chicken sandwich and rolls from the Beef House Restaurant near Covington, Indiana. With a BMW 840i in the driveway, an 80-mile drive for a yummy snack no longer seemed excessive. Given ...
No Pride during the pandemic? Buffalo Grove steps in 2020-04-29
by Randy Stern, Gaywheels.com - What if we told you that a new kind of pride celebration will be happening in a suburb of Chicago? And it's one that fits within the framework of what we are dealing with during this health crisis. Last year, the ...
- "You're full of shit. I support the Second Amendment. I'm not taking your gun away. I did not say that."—Joe Biden responds to a worker at an automobile plant in Detroit who accused him of "actively ...
AUTOS 2020 Jeep Wrangler, diesel go together like Grace and Frankie 2020-03-03
- One of my guilty pleasures for the last few years has been Netflix's series Grace and Frankie starring Jane Fonda and Lilly Tomlin. Individually, the two are icons. Together, they are a match made in Heaven ...
Chicago Auto Show Feb. 8-17 2020-02-01
- The next Chicago Auto Show will take place Feb. 8-17 at McCormick Place, 2301 S. Lake Shore Dr. North America's largest auto show, the event spans more than 1 million square feet of floor space of ...


text:
Sir William Waller, född omkring 1597, död den 19 september 1668, var en engelsk krigare.

Waller var som yngling soldat i venetiansk och böhmisk tjänst. Han deltog i Horace Veres engelska expedition till Pfalz 1620—1622 och erhöll 1622 knightvärdighet. Waller var presbyterian, valdes 1640 till ledamot av "Långa parlamentet" och blev vid inbördeskrigets utbrott 1642 rytteriöverste i parlamentsarmén. En rad framgångar hösten samma år, bland annat erövringen av Portsmouth, gav honom ryktbarhet (han kallades William the Conqueror). År 1643 blev han generalmajor, hade flera framgångar vid Gloucester och i Wales på våren, men besegrades i juli vid Roundway Down av rojalister från Oxford under ledning av Henry Wilmot. Även 1644 var Wallers krigslycka växlande; han förordade den arméreorganisation Cromwell sedan genomförde och nedlade 1645 sitt befäl för att i stället som presbyterianernas ledare i underhuset återupptaga sitt parlamentsarbete. Därvid kom han i skarp konflikt med armébefälet, uteslöts ur parlamentet vid "rensningen" i december 1648 och fick i tre år sitta fängslad utan rannsakning. Under protektoratet blev han ånyo två gånger fängslad (1658 och 1659), knöt förbindelser med monarkisterna och återfick i februari 1660 sin plats i parlamentet, där han sedan medverkade till restaurationen. Som general utmärkte sig Waller särskildt för skicklig defensivtaktik.

Källor

Engelska generaler
Engelska militärer under 1600-talet
Födda 1597
Avlidna 1668
Män
Ugglan

redpajama_set_name: RedPajamaWikipedia


The truth is, while we may sometimes be limited in time, space, motivation, energy, equipment or (insert excuse here)--you too can crunch in a solid workout that'll "push that wall" further towards your fitness goals.
So whilst perusing the good ole <( dot dot dot )> , I happened upon a swell fitness challenge called "The Dead Man's Burpee Challenge" (via bodyrock.tv) and decided to call us out on a little experiment and challenge.
Complete 100 burpees (or as close as you can get to 100) in 10 minutes and post your reps in the comments below (or on Spacebook). GO (space)!


So you'd love a small BMW but don't like the 1-series' impractical coupe body? You fancy yourself young and sophisticated and would buy a 135i if you could just get it in chic hot-hatch form? Well, we have good news: come this fall, you can get a subcompact 1-series hatchback with either four- or six-cylinder firepower. Even better news: it's cheaper than the 1-series coupe.
Here's the catch: you'll have to put up with an X badge, which of course means the new 2013 X1 isn't just a 1-series hatch, it's a 1-series hatch with a lift kit. A crossover, if you will. Oh, you think crossovers are stupid and you'd rather just have the hatch? Then you're probably not going to like the mandatory automatic transmission, either.
What looks at first like it might be the OMG RWD BMW GTI we've wanted for so long isn't actually a car for enthusiasts — it's an aspirational vehicle for when your girlfriend's paychecks outgrow her Honda CR-V payments. Shame, that, because even though the X1 doesn't strike us as an enthusiast-friendly vehicle, it goes like the dickens. If you can overlook its crossover-ness (or look over it, as the X1's roof is 4.3 inches lower than a CR-V's) you might just like it.
The base X1 — available for just $31,545 — undercuts the 128i by $550, making it the least expensive BMW available in America. Filling barely half of the long engine compartment is the delightful N20 2.0-liter four-cylinder turbo engine, whose 240 hp and 255 lb-ft of torque more than fill the rear wheels with anger. Yup, the X1 is the first rear-wheel drive BMW to wear an X badge. That's cool, except you won't want this X1. It gets the best gas mileage (the Bavarian crystal ball predicts 24/33 mpg EPA ratings), but it's not the drift machine the rear-wheel drive layout implies. Even when turned off, stability control will allow no silly sideways shenanigans. And when you're driving along like a nun, you'll be praying to your local deity for some steering feel — electric power steering has sacrificed it in the name of saving dinosaur juice.
So that leaves the X1 xDrive28i, the $33,245 base four-wheel drive version. Sure, it carries a $1700 premium over the rear-drive X1 and it loses 2 mpg city and 3 on the highway, but the extra dough and gas is worth it for the steering alone. See, the X1's four-wheel drive system resides in the place where parts of the electric steering system go — so xDrive X1s have good, old-fashioned hydraulic assistance. If you're sitting at home and wondering why we're continually mourning the disappearance of hydraulic steering, go drive these two X1s back-to-back. The difference is like trading in your favorite late-night 1-900 number habit for a real girlfriend. Only one of them touches you back.
If you're a rear-drive purist maniac at the helm (and we're not judging here, either), you might want to invest in the M Sport Package so you can get BMW's Performance Control. That changes the AWD system's steady-state cornering balance by sending eighty percent of the engine's power to the rear. Paradoxically, it also includes staggered tires that induce howling understeer. Well, you can fix that with aftermarket wheels.
But wait, there's more! BMW is giving us a little present for having waited so patiently for the X1. See, the subcompact crossover went on sale in 2009, but worldwide demand was so great that there was no production capacity left for us. A new plant has just come online to manufacture Chinese-market X1s in China, and the freed-up capacity in BMW's Regensburg, Germany plant is now at our disposal. The gift for waiting is six delicious cylinders under the hood — an engine that no other country will get in the X1.
The X1 xDrive35i comes exclusively with all-wheel drive and costs $39,345. (That's $850 cheaper than a 135i with rear-wheel drive, by the way.) In place of BMW's new (and still somewhat cumbersome) shifter is the old PNRDL — and that's a sign that you're also getting last-generation goods in the transmission department too. See, the 300-hp N55 straight-six is bolted to the old six-speed automatic, which was the benchmark transmission in its day. By contrast, the four-cylinder gets ZF's latest 8-speed, which is the benchmark transmission today — and there's a lot more going on than just having two additional gears. First, the 8-speed can tolerate automatic start/stop — which helps fuel economy in city traffic. The turbo four produces only about fifteen percent less peak torque than the six, and it weighs considerably less. As a result, the 35i feels no faster off the line, and its six-speed transmission has a much shorter top gear — meaning the six-cylinder is spinning much more quickly on the highway. That doesn't help efficiency, and EPA ratings drop accordingly. BMW says the six is a full second faster to 60 mph (achieving the stunt in 5.3 seconds versus 6.3 for the four-wheel drive four-cylinder) but it sure doesn't feel faster. The four-cylinder xDrive28i is definitely the X1 to get.
Finding a pothole on a German road is like discovering a smooth road in Manhattan — not going to happen — so we'll know more about the X1's ride once we drive one at home. It felt firm but not harsh, however, and the remainder of the X1 works extraordinarily well. The cabin is well finished, with only the occasional hard plastic to be found. The rear seats are split 40/20/40, and fold flat to create a large load floor. The total cargo capacity isn't quite as large as the upcoming 3-series wagon's, but if buyers really cared about rational things like practicality, we'd all be driving wagons and hatchbacks, not crossovers.
Best of all, the X1 is based on the 1-series, which means itself was based on the last-generation E90-chassis 3-series. Getting some seat time in the X1 reminded us just how much better the old 3-series worked. Sure, it doesn't have quite as many gadgets and gizmos — and neither the 1-series, the X1, nor the old 3-series is as pretty as the new 3-series — but those earlier cars have a fundamental, built-in "just right" factor. The steering, the brakes, the ride, the handling, and all the secondary controls and instruments just feel perfect. The volume control is on the correct (left) side of the steering wheel; the cruise control is an easy-to-operate stalk. You don't have to select some ridiculous "Eco Pro" mode to save fuel or "Sport" to waste it — you just start the X1 and it drives right. Just like the last 3-series did.
So if you'd like to have a hot-hatch based on the last 3-series, but with BMW's latest generation of engine and transmission, the X1 xDrive28i makes one hell of a package. Even if it's not the quite hot hatch you've wanted all these years.