File tree Expand file tree Collapse file tree 1 file changed +84
-0
lines changed
pkg/analysis_server/test/lsp Expand file tree Collapse file tree 1 file changed +84
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,90 @@ class [!A!] {
363363 );
364364 }
365365
366+ Future <void > test_dotShorthand_constructor_named () async {
367+ var contents = '''
368+ f() {
369+ A a = .nam^ed();
370+ }
371+
372+ class A {
373+ A.[!named!]();
374+ }
375+ ''' ;
376+
377+ await testContents (contents);
378+ }
379+
380+ Future <void > test_dotShorthand_constructor_unnamed () async {
381+ var contents = '''
382+ f() {
383+ A a = .ne^w();
384+ }
385+
386+ class A {
387+ [!A!]();
388+ }
389+ ''' ;
390+
391+ await testContents (contents);
392+ }
393+
394+ Future <void > test_dotShorthand_enum () async {
395+ var contents = '''
396+ enum A {
397+ [!one!],
398+ }
399+
400+ f() {
401+ A a = .on^e;
402+ }
403+ ''' ;
404+
405+ await testContents (contents);
406+ }
407+
408+ Future <void > test_dotShorthand_extensionType () async {
409+ var contents = '''
410+ f() {
411+ A a = .fie^ld;
412+ }
413+
414+ extension type A(int x) {
415+ static A get [!field!] => A(1);
416+ }
417+ ''' ;
418+
419+ await testContents (contents);
420+ }
421+
422+ Future <void > test_dotShorthand_field () async {
423+ var contents = '''
424+ f() {
425+ A a = .fie^ld;
426+ }
427+
428+ class A {
429+ static A [!field!] = A();
430+ }
431+ ''' ;
432+
433+ await testContents (contents);
434+ }
435+
436+ Future <void > test_dotShorthand_method () async {
437+ var contents = '''
438+ f() {
439+ A a = .meth^od();
440+ }
441+
442+ class A {
443+ static A [!method!]() => A();
444+ }
445+ ''' ;
446+
447+ await testContents (contents);
448+ }
449+
366450 Future <void > test_field_underscore () async {
367451 var contents = '''
368452class A {
You can’t perform that action at this time.
0 commit comments