Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,9 @@ void makeNotNullMembersMaybeNull()
case PropertySymbol:
// skip any manually implemented non-required properties.
continue;
case FieldSymbol { OriginalDefinition: SynthesizedPrimaryConstructorParameterBackingFieldSymbol }:
// Skip primary constructor capture fields, compiler initializes them with parameters' values
continue;
case FieldSymbol { IsConst: true }:
continue;
case FieldSymbol { AssociatedSymbol: PropertySymbol prop }:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15389,6 +15389,73 @@ .property instance int32 P2()
".Replace("[mscorlib]", ExecutionConditionUtil.IsDesktop ? "[mscorlib]" : "[netstandard]"));
}

[Fact]
[WorkItem("https://github.com/dotnet/roslyn/issues/68384")]
public void ParameterCapturing_152_NullableAnalysis()
{
var source = @"
#nullable enable

class B(string s)
{
public string S { get; } = s;
}

class C(B b)
: B(b.S)
{
string T() => b.S;
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseDll);
comp.VerifyDiagnostics();
}

[Fact]
[WorkItem("https://github.com/dotnet/roslyn/issues/68384")]
public void ParameterCapturing_153_NullableAnalysis()
{
var source = @"
#nullable enable

class B(System.Func<string> s)
{
public string S { get; } = s();
}

class C(B b)
: B(() => b.S)
{
string T() => b.S;
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseDll);
comp.VerifyDiagnostics();
}

[Fact]
[WorkItem("https://github.com/dotnet/roslyn/issues/68384")]
public void ParameterCapturing_154_NullableAnalysis()
{
var source = @"
#nullable enable

class B(System.Func<string> s)
{
public string S { get; } = s();
}

class C(B b)
: B(() =>
{
string local() => b.S;
return local();
})
{
string T() => b.S;
}";
var comp = CreateCompilation(source, options: TestOptions.ReleaseDll);
comp.VerifyDiagnostics();
}

[Fact]
public void CycleDueToIndexerNameAttribute_01()
{
Expand Down