59 references to Captured
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (59)
Semantics\PrimaryConstructorTests.cs (59)
6528("0017", Captured | Success, "void M() { p1 = 0; }"),
6529("0018", Captured | Success, "int P { get { return p1; } }"),
6530("0019", Captured | Success, "int P { set { p1 = 0; } }"),
6531("0020", Captured | Success, "int P { set {} get { return p1; } }"),
6532("0021", Captured | Success, "int P { get => 0; set { p1 = 0; } }"),
6533("0022", Captured | Success, "event System.Action E { add { p1 = 0; } remove {} }"),
6534("0023", Captured | Success, "event System.Action E { add {} remove { p1 = 0; } }"),
6535("0024", Captured | Success, "int this[int x] { get { return p1; } }"),
6536("0025", Captured | Success, "int this[int x] { set { p1 = 0; } }"),
6537("0026", Captured | Success, "int this[int x] { set {} get { return p1; } }"),
6538("0027", Captured | Success, "int this[int x] { get => 0; set { p1 = 0; } }"),
6539("0028", Captured | Success, "~C1() { p1 = 0; }"),
6540("0029", Captured | BadReference, "public C1() : this(p1) {}"),
6744("1101", Captured | BadReference | InNestedMethod, "public C1() : this(() => p1) {} C1(System.Func<int> x) : this(0) {}"),
6745("1102", Captured | BadReference | InNestedMethod, "public C1() : this(() => (System.Func<int>)(() => p1)) {} C1(System.Func<System.Func<int>> x) : this(0) {}"),
6746("1103", Captured | BadReference | InNestedMethod, "public C1() : this(() => { return local(); int local() => p1; }) {} C1(System.Func<int> x) : this(0) {}"),
6756("1409", Captured | InNestedMethod, "public System.Func<int> M() { return (() => p1); }"),
6757("1410", Captured | InNestedMethod, "public System.Func<System.Func<int>> M() { return (() => (System.Func<int>)(() => p1)); }"),
6758("1411", Captured | InNestedMethod, "public System.Func<int> M() { return () => { return local(); int local() => p1; }; }"),
6759("1412", Captured | InNestedMethod, "public void M() { local(); int local() { return p1; } }"),
6760("1413", Captured | InNestedMethod, "public void M() { local1(); void local1() { local2(); int local2() { return p1; } } }"),
6763("1502", Captured | Success, "public int P => p1;"),
6773("1517", Captured | Success, "void M() => p1 = 0;"),
6774("1518", Captured | Success, "int P { get => p1; }"),
6775("1519", Captured | Success, "int P { set => p1 = 0; }"),
6776("1520", Captured | Success, "int P { set {} get => p1; }"),
6777("1521", Captured | Success, "int P { get => 0; set => p1 = 0; }"),
6778("1524", Captured | Success, "int this[int x] { get => p1; }"),
6779("1525", Captured | Success, "int this[int x] { set => p1 = 0; }"),
6780("1526", Captured | Success, "int this[int x] { set {} get => p1; }"),
6781("1527", Captured | Success, "int this[int x] { get => 0; set => p1 = 0; }"),
6782("1528", Captured | Success, "~C1() => p1 = 0;"),
6814("1717", Captured | TwoBodies, "void M() {} => p1 = 0;"),
6815("1718", Captured | TwoBodies, "int P { get { return 0; } => p1; }"),
6816("1719", Captured | TwoBodies, "int P { set {} => p1 = 0; }"),
6817("1720", Captured | TwoBodies, "int P { set {} get { return 0; } => p1; }"),
6818("1721", Captured | TwoBodies, "int P { get => 0; set {} => p1 = 0; }"),
6819("1724", Captured | TwoBodies, "int this[int x] { get { return 0; } => p1; }"),
6820("1725", Captured | TwoBodies, "int this[int x] { set {} => p1 = 0; }"),
6821("1726", Captured | TwoBodies, "int this[int x] { set {} get { return 0; } => p1; }"),
6822("1727", Captured | TwoBodies, "int this[int x] { get => 0; set {} => p1 = 0; }"),
6823("1728", Captured | TwoBodies, "~C1() {} => p1 = 0;"),
6824("1730", Captured | TwoBodies, "public C1() : this(0) {} => p1 = 0;"),
7074yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10001", Captured | BadReference, "public C1() : this(0) { p1 = 0; }" };
7075yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10002", Captured, "public C1() : this(0) { p1 = 0; }" };
7076yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10003", Captured | BadReference, "public C1() : this(0) => p1 = 0;" };
7077yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10004", Captured, "public C1() : this(0) => p1 = 0;" };
7079yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10003", Captured | BadReference | InNestedMethod, "public C1() : this(0) { local(); int local() { return p1; } }" };
7080yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10004", Captured | InNestedMethod, "public C1() : this(0) { local(); int local() { return p1; } }" };
7082yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10005", Captured | BadReference | InNestedMethod, "public C1() : this(0) { local1(); void local1() { local2(); int local2() { return p1; } } }" };
7083yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10006", Captured | InNestedMethod, "public C1() : this(0) { local1(); void local1() { local2(); int local2() { return p1; } } }" };
7085yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10007", Captured | BadReference | InNestedMethod, "public C1() : this(0) => M(() => p1); void M(System.Func<int> x){}" };
7086yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10008", Captured | InNestedMethod, "public C1() : this(0) => M(() => p1); void M(System.Func<int> x){}" };
7088yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10009", Captured | BadReference | InNestedMethod, "public C1() : this(0) => M(() => (System.Func<int>)(() => p1)); void M(System.Func<System.Func<int>> x){}" };
7089yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10010", Captured | InNestedMethod, "public C1() : this(0) => M(() => (System.Func<int>)(() => p1)); void M(System.Func<System.Func<int>> x){}" };
7091yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10011", Captured | BadReference | InNestedMethod, "public C1() : this(0) => M(() => { return local(); int local() => p1; }); void M(System.Func<int> x){}" };
7092yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10012", Captured | InNestedMethod, "public C1() : this(0) => M(() => { return local(); int local() => p1; }); void M(System.Func<int> x){}" };
7168bool isCaptured = !shadow && (flags & TestFlags.Captured) != 0;
7343if (!isRecord && ((flags & TestFlags.NotUsedWarning) != 0 || (flags & TestFlags.Captured) != 0))