59 references to Captured
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (59)
Semantics\PrimaryConstructorTests.cs (59)
7143("0017", Captured | Success, "void M() { p1 = 0; }"),
7144("0018", Captured | Success, "int P { get { return p1; } }"),
7145("0019", Captured | Success, "int P { set { p1 = 0; } }"),
7146("0020", Captured | Success, "int P { set {} get { return p1; } }"),
7147("0021", Captured | Success, "int P { get => 0; set { p1 = 0; } }"),
7148("0022", Captured | Success, "event System.Action E { add { p1 = 0; } remove {} }"),
7149("0023", Captured | Success, "event System.Action E { add {} remove { p1 = 0; } }"),
7150("0024", Captured | Success, "int this[int x] { get { return p1; } }"),
7151("0025", Captured | Success, "int this[int x] { set { p1 = 0; } }"),
7152("0026", Captured | Success, "int this[int x] { set {} get { return p1; } }"),
7153("0027", Captured | Success, "int this[int x] { get => 0; set { p1 = 0; } }"),
7154("0028", Captured | Success, "~C1() { p1 = 0; }"),
7155("0029", Captured | BadReference, "public C1() : this(p1) {}"),
7359("1101", Captured | BadReference | InNestedMethod, "public C1() : this(() => p1) {} C1(System.Func<int> x) : this(0) {}"),
7360("1102", Captured | BadReference | InNestedMethod, "public C1() : this(() => (System.Func<int>)(() => p1)) {} C1(System.Func<System.Func<int>> x) : this(0) {}"),
7361("1103", Captured | BadReference | InNestedMethod, "public C1() : this(() => { return local(); int local() => p1; }) {} C1(System.Func<int> x) : this(0) {}"),
7371("1409", Captured | InNestedMethod, "public System.Func<int> M() { return (() => p1); }"),
7372("1410", Captured | InNestedMethod, "public System.Func<System.Func<int>> M() { return (() => (System.Func<int>)(() => p1)); }"),
7373("1411", Captured | InNestedMethod, "public System.Func<int> M() { return () => { return local(); int local() => p1; }; }"),
7374("1412", Captured | InNestedMethod, "public void M() { local(); int local() { return p1; } }"),
7375("1413", Captured | InNestedMethod, "public void M() { local1(); void local1() { local2(); int local2() { return p1; } } }"),
7378("1502", Captured | Success, "public int P => p1;"),
7388("1517", Captured | Success, "void M() => p1 = 0;"),
7389("1518", Captured | Success, "int P { get => p1; }"),
7390("1519", Captured | Success, "int P { set => p1 = 0; }"),
7391("1520", Captured | Success, "int P { set {} get => p1; }"),
7392("1521", Captured | Success, "int P { get => 0; set => p1 = 0; }"),
7393("1524", Captured | Success, "int this[int x] { get => p1; }"),
7394("1525", Captured | Success, "int this[int x] { set => p1 = 0; }"),
7395("1526", Captured | Success, "int this[int x] { set {} get => p1; }"),
7396("1527", Captured | Success, "int this[int x] { get => 0; set => p1 = 0; }"),
7397("1528", Captured | Success, "~C1() => p1 = 0;"),
7429("1717", Captured | TwoBodies, "void M() {} => p1 = 0;"),
7430("1718", Captured | TwoBodies, "int P { get { return 0; } => p1; }"),
7431("1719", Captured | TwoBodies, "int P { set {} => p1 = 0; }"),
7432("1720", Captured | TwoBodies, "int P { set {} get { return 0; } => p1; }"),
7433("1721", Captured | TwoBodies, "int P { get => 0; set {} => p1 = 0; }"),
7434("1724", Captured | TwoBodies, "int this[int x] { get { return 0; } => p1; }"),
7435("1725", Captured | TwoBodies, "int this[int x] { set {} => p1 = 0; }"),
7436("1726", Captured | TwoBodies, "int this[int x] { set {} get { return 0; } => p1; }"),
7437("1727", Captured | TwoBodies, "int this[int x] { get => 0; set {} => p1 = 0; }"),
7438("1728", Captured | TwoBodies, "~C1() {} => p1 = 0;"),
7439("1730", Captured | TwoBodies, "public C1() : this(0) {} => p1 = 0;"),
7689yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10001", Captured | BadReference, "public C1() : this(0) { p1 = 0; }" };
7690yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10002", Captured, "public C1() : this(0) { p1 = 0; }" };
7691yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10003", Captured | BadReference, "public C1() : this(0) => p1 = 0;" };
7692yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10004", Captured, "public C1() : this(0) => p1 = 0;" };
7694yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10003", Captured | BadReference | InNestedMethod, "public C1() : this(0) { local(); int local() { return p1; } }" };
7695yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10004", Captured | InNestedMethod, "public C1() : this(0) { local(); int local() { return p1; } }" };
7697yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10005", Captured | BadReference | InNestedMethod, "public C1() : this(0) { local1(); void local1() { local2(); int local2() { return p1; } } }" };
7698yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10006", Captured | InNestedMethod, "public C1() : this(0) { local1(); void local1() { local2(); int local2() { return p1; } } }" };
7700yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10007", Captured | BadReference | InNestedMethod, "public C1() : this(0) => M(() => p1); void M(System.Func<int> x){}" };
7701yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10008", Captured | InNestedMethod, "public C1() : this(0) => M(() => p1); void M(System.Func<int> x){}" };
7703yield 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){}" };
7704yield 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){}" };
7706yield 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){}" };
7707yield 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){}" };
7783bool isCaptured = !shadow && (flags & TestFlags.Captured) != 0;
7958if (!isRecord && ((flags & TestFlags.NotUsedWarning) != 0 || (flags & TestFlags.Captured) != 0))