59 references to Captured
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (59)
Semantics\PrimaryConstructorTests.cs (59)
7154("0017", Captured | Success, "void M() { p1 = 0; }"),
7155("0018", Captured | Success, "int P { get { return p1; } }"),
7156("0019", Captured | Success, "int P { set { p1 = 0; } }"),
7157("0020", Captured | Success, "int P { set {} get { return p1; } }"),
7158("0021", Captured | Success, "int P { get => 0; set { p1 = 0; } }"),
7159("0022", Captured | Success, "event System.Action E { add { p1 = 0; } remove {} }"),
7160("0023", Captured | Success, "event System.Action E { add {} remove { p1 = 0; } }"),
7161("0024", Captured | Success, "int this[int x] { get { return p1; } }"),
7162("0025", Captured | Success, "int this[int x] { set { p1 = 0; } }"),
7163("0026", Captured | Success, "int this[int x] { set {} get { return p1; } }"),
7164("0027", Captured | Success, "int this[int x] { get => 0; set { p1 = 0; } }"),
7165("0028", Captured | Success, "~C1() { p1 = 0; }"),
7166("0029", Captured | BadReference, "public C1() : this(p1) {}"),
7370("1101", Captured | BadReference | InNestedMethod, "public C1() : this(() => p1) {} C1(System.Func<int> x) : this(0) {}"),
7371("1102", Captured | BadReference | InNestedMethod, "public C1() : this(() => (System.Func<int>)(() => p1)) {} C1(System.Func<System.Func<int>> x) : this(0) {}"),
7372("1103", Captured | BadReference | InNestedMethod, "public C1() : this(() => { return local(); int local() => p1; }) {} C1(System.Func<int> x) : this(0) {}"),
7382("1409", Captured | InNestedMethod, "public System.Func<int> M() { return (() => p1); }"),
7383("1410", Captured | InNestedMethod, "public System.Func<System.Func<int>> M() { return (() => (System.Func<int>)(() => p1)); }"),
7384("1411", Captured | InNestedMethod, "public System.Func<int> M() { return () => { return local(); int local() => p1; }; }"),
7385("1412", Captured | InNestedMethod, "public void M() { local(); int local() { return p1; } }"),
7386("1413", Captured | InNestedMethod, "public void M() { local1(); void local1() { local2(); int local2() { return p1; } } }"),
7389("1502", Captured | Success, "public int P => p1;"),
7399("1517", Captured | Success, "void M() => p1 = 0;"),
7400("1518", Captured | Success, "int P { get => p1; }"),
7401("1519", Captured | Success, "int P { set => p1 = 0; }"),
7402("1520", Captured | Success, "int P { set {} get => p1; }"),
7403("1521", Captured | Success, "int P { get => 0; set => p1 = 0; }"),
7404("1524", Captured | Success, "int this[int x] { get => p1; }"),
7405("1525", Captured | Success, "int this[int x] { set => p1 = 0; }"),
7406("1526", Captured | Success, "int this[int x] { set {} get => p1; }"),
7407("1527", Captured | Success, "int this[int x] { get => 0; set => p1 = 0; }"),
7408("1528", Captured | Success, "~C1() => p1 = 0;"),
7440("1717", Captured | TwoBodies, "void M() {} => p1 = 0;"),
7441("1718", Captured | TwoBodies, "int P { get { return 0; } => p1; }"),
7442("1719", Captured | TwoBodies, "int P { set {} => p1 = 0; }"),
7443("1720", Captured | TwoBodies, "int P { set {} get { return 0; } => p1; }"),
7444("1721", Captured | TwoBodies, "int P { get => 0; set {} => p1 = 0; }"),
7445("1724", Captured | TwoBodies, "int this[int x] { get { return 0; } => p1; }"),
7446("1725", Captured | TwoBodies, "int this[int x] { set {} => p1 = 0; }"),
7447("1726", Captured | TwoBodies, "int this[int x] { set {} get { return 0; } => p1; }"),
7448("1727", Captured | TwoBodies, "int this[int x] { get => 0; set {} => p1 = 0; }"),
7449("1728", Captured | TwoBodies, "~C1() {} => p1 = 0;"),
7450("1730", Captured | TwoBodies, "public C1() : this(0) {} => p1 = 0;"),
7700yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10001", Captured | BadReference, "public C1() : this(0) { p1 = 0; }" };
7701yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10002", Captured, "public C1() : this(0) { p1 = 0; }" };
7702yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10003", Captured | BadReference, "public C1() : this(0) => p1 = 0;" };
7703yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10004", Captured, "public C1() : this(0) => p1 = 0;" };
7705yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10003", Captured | BadReference | InNestedMethod, "public C1() : this(0) { local(); int local() { return p1; } }" };
7706yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10004", Captured | InNestedMethod, "public C1() : this(0) { local(); int local() { return p1; } }" };
7708yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10005", Captured | BadReference | InNestedMethod, "public C1() : this(0) { local1(); void local1() { local2(); int local2() { return p1; } } }" };
7709yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10006", Captured | InNestedMethod, "public C1() : this(0) { local1(); void local1() { local2(); int local2() { return p1; } } }" };
7711yield return new object[] { keyword, /*shadow:*/ false, isPartial, isRecord, "10007", Captured | BadReference | InNestedMethod, "public C1() : this(0) => M(() => p1); void M(System.Func<int> x){}" };
7712yield return new object[] { keyword, /*shadow:*/ true, isPartial, isRecord, "10008", Captured | InNestedMethod, "public C1() : this(0) => M(() => p1); void M(System.Func<int> x){}" };
7714yield 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){}" };
7715yield 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){}" };
7717yield 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){}" };
7718yield 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){}" };
7794bool isCaptured = !shadow && (flags & TestFlags.Captured) != 0;
7969if (!isRecord && ((flags & TestFlags.NotUsedWarning) != 0 || (flags & TestFlags.Captured) != 0))