public void ErrorSpansAllKinds() { TestErrorSpansAllKinds(StatementSyntaxComparer.IsLabeledKind); TestErrorSpansAllKinds(kind => TopSyntaxComparer.HasLabel(kind, ignoreVariableDeclarations: false)); }
public void ErrorSpans_TopLevel() { string source = @" /*<span>*/extern alias A;/*</span>*/ /*<span>*/using Z = Foo.Bar;/*</span>*/ [assembly: /*<span>*/A(1,2,3,4)/*</span>*/, /*<span>*/B/*</span>*/] /*<span>*/namespace N.M/*</span>*/ { } [A, B] /*<span>*/struct S<[A]T>/*</span>*/ : B /*<span>*/where T : new, struct/*</span>*/ { } [A, B] /*<span>*/public abstract partial class C/*</span>*/ { } /*<span>*/interface I/*</span>*/ : J, K, L { } [A] /*<span>*/enum E1/*</span>*/ { } /*<span>*/enum E2/*</span>*/ : uint { } /*<span>*/public enum E3/*</span>*/ { Q, [A]R = 3 } [A] /*<span>*/public delegate void D1<T>()/*</span>*/ where T : struct; /*<span>*/delegate C<T> D2()/*</span>*/; [/*<span>*/Attrib/*</span>*/] /*<span>*/[Attrib]/*</span>*/ /*<span>*/public class Z/*</span>*/ { /*<span>*/int f/*</span>*/; [A]/*<span>*/int f = 1/*</span>*/; /*<span>*/public static readonly int f/*</span>*/; /*<span>*/int M1()/*</span>*/ { } [A]/*<span>*/int M2()/*</span>*/ { } [A]/*<span>*/int M3<T1, T2>()/*</span>*/ where T1 : bar where T2 : baz { } [A]/*<span>*/abstract C<T> M4()/*</span>*/; int M5([A]/*<span>*/Z d = 2345/*</span>*/, /*<span>*/ref int x/*</span>*/, /*<span>*/params int[] x/*</span>*/) { return 1; } [A]/*<span>*/event A E1/*</span>*/; [A]/*<span>*/public event A E2/*</span>*/; [A]/*<span>*/public abstract event A E3/*</span>*/ { /*<span>*/add/*</span>*/; /*<span>*/remove/*</span>*/; } [A]/*<span>*/public abstract event A E4/*</span>*/ { [A, B]/*<span>*/add/*</span>*/ { } [A]/*<span>*/internal remove/*</span>*/ { } } [A]/*<span>*/int P/*</span>*/ { get; set; } [A]/*<span>*/internal string P/*</span>*/ { /*<span>*/internal get/*</span>*/ { } [A]/*<span>*/set/*</span>*/ { }} [A]/*<span>*/internal string this[int a, int b]/*</span>*/ { /*<span>*/get/*</span>*/ { } /*<span>*/set/*</span>*/ { } } [A]/*<span>*/string this[[A]int a = 123]/*</span>*/ { get { } set { } } [A]/*<span>*/public static explicit operator int(Z d)/*</span>*/ { return 1; } [A]/*<span>*/operator double(Z d)/*</span>*/ { return 1; } [A]/*<span>*/public static operator int +(Z d, int x)/*</span>*/ { return 1; } [A]/*<span>*/operator int +(Z d, int x)/*</span>*/ { return 1; } } "; TestSpans(source, kind => TopSyntaxComparer.HasLabel(kind, ignoreVariableDeclarations: false)); }
public void ErrorSpansAllKinds() { TestErrorSpansAllKinds(StatementSyntaxComparer.IgnoreLabeledChild); TestErrorSpansAllKinds(kind => TopSyntaxComparer.HasLabel(kind)); }