Skip to content

Commit

Permalink
Revert "Merge pull request dotnet#65407 from Youssef1313/scoped-ide"
Browse files Browse the repository at this point in the history
This reverts commit 62646c2, reversing
changes made to 35ac8cb.
  • Loading branch information
allisonchou committed Nov 28, 2022
1 parent 91d6e86 commit bf2b164
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 1,026 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2617,45 +2617,6 @@ static void staticLocalFunction() { }|]
Punctuation.CloseCurly);
}

[Theory]
[CombinatorialData]
public async Task TestScopedVar(TestHost testHost)
{
await TestAsync("""
static void method(scoped in S s)
{
scoped var rs1 = s;
}

file readonly ref struct S { }
""", testHost,
Keyword("static"),
Keyword("void"),
Method("method"),
Static("method"),
Punctuation.OpenParen,
Keyword("scoped"),
Keyword("in"),
Struct("S"),
Parameter("s"),
Punctuation.CloseParen,
Punctuation.OpenCurly,
Keyword("scoped"),
Keyword("var"),
Local("rs1"),
Operators.Equals,
Parameter("s"),
Punctuation.Semicolon,
Punctuation.CloseCurly,
Keyword("file"),
Keyword("readonly"),
Keyword("ref"),
Keyword("struct"),
Struct("S"),
Punctuation.OpenCurly,
Punctuation.CloseCurly);
}

[Theory]
[CombinatorialData]
public async Task Lambda_DefaultParameterValue(TestHost testHost)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion.Providers;
using Microsoft.CodeAnalysis.CSharp;
Expand Down Expand Up @@ -11965,67 +11964,11 @@ class C
await VerifyAnyItemExistsAsync(source);
}

[Fact]
public async Task AfterScopedInsideMethod()
{
var source = @"
class C
{
void M()
{
scoped $$
}
}
ref struct MyRefStruct { }
";
await VerifyItemExistsAsync(MakeMarkup(source), "MyRefStruct");
}

[Fact]
public async Task AfterScopedGlobalStatement_FollowedByType()
{
var source = @"
scoped $$
ref struct MyRefStruct { }
";
await VerifyItemExistsAsync(MakeMarkup(source), "MyRefStruct");
}

[Fact]
public async Task AfterScopedGlobalStatement_NotFollowedByType()
{
var source = """
using System;

scoped $$
""";

await VerifyItemExistsAsync(MakeMarkup(source), "ReadOnlySpan", displayTextSuffix: "<>");
}

[Fact]
public async Task AfterScopedInParameter()
{
var source = @"
class C
{
void M(scoped $$)
{
}
}
ref struct MyRefStruct { }
";
await VerifyItemExistsAsync(MakeMarkup(source), "MyRefStruct");
}

private static string MakeMarkup(string source, string languageVersion = "Preview")
{
return $$"""
<Workspace>
<Project Language="C#" AssemblyName="Assembly" CommonReferencesNet6="true" LanguageVersion="{{languageVersion}}">
<Project Language="C#" AssemblyName="Assembly" CommonReferences="true" LanguageVersion="{{languageVersion}}">
<Document FilePath="Test.cs">
{{source}}
</Document>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,24 +510,6 @@ void M(ref int [|p|])
}");
}

[Fact]
public async Task AssignmentThroughScopedRefLocal()
{
await TestAsync(
@"
using System;
class C
{
void M(ref int [|p|])
{
scoped ref var [|local|] = ref [|p|];
[|local|] = 0;
[|local|] = 1;
Console.WriteLine([|local|]);
}
}");
}

[Fact]
public async Task TestRefLocalReassignment()
{
Expand Down Expand Up @@ -671,23 +653,6 @@ void M()
}");
}

[Fact]
public async Task TestScopedReadonlyRefLocalWithNoReassignment()
{
await TestAsync(
@"
using System;
class C
{
void M()
{
int p = 0;
scoped ref readonly int refP = ref p;
Console.WriteLine(p);
}
}");
}

[Fact]
public async Task TestReadonlyRefLocalWithNoReassignment1()
{
Expand All @@ -705,23 +670,6 @@ void M()
}");
}

[Fact]
public async Task TestScopedReadonlyRefLocalWithNoReassignment1()
{
await TestAsync(
@"
using System;
class C
{
void M1()
{
int p = 0;
scoped ref readonly int refP = ref p!;
Console.WriteLine(p);
}
}");
}

[Fact]
public async Task TestPointerCausingPossibleReassignment()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,5 @@ await VerifyKeywordAsync(
@"$$
[assembly: Call()]");
}

[Fact]
public async Task TestAfterScoped()
{
await VerifyKeywordAsync("scoped $$");
await VerifyKeywordAsync(AddInsideMethod("scoped $$"));
}
}
}
Loading

0 comments on commit bf2b164

Please sign in to comment.