@@ -655,17 +655,17 @@ def test_validate_multiple
655655 Dir . mktmpdir do |dir |
656656 ( Pathname ( dir ) + 'a.rbs' ) . write ( <<~RBS )
657657 class Foo
658- def foo: (void) -> void
659- def bar: (void) -> void
658+ type foo = self
659+ type bar = instance
660660 end
661661 RBS
662662
663663 assert_cli_success do
664664 cli . run ( [ "-I" , dir , "--log-level=warn" , "validate" ] )
665665 end
666666
667- assert_include stdout . string , "a.rbs:2:11 ...2:25 : `void ` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)"
668- assert_include stdout . string , "a.rbs:3:11 ...3:25 : `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)"
667+ assert_include stdout . string , "a.rbs:2:13 ...2:17 : `self ` type is not allowed in this context (RBS::WillSyntaxError)"
668+ assert_include stdout . string , "a.rbs:3:13 ...3:21 : `instance` or `class` type is not allowed in this context (RBS::WillSyntaxError)"
669669 end
670670 end
671671 end
@@ -675,16 +675,16 @@ def test_validate_multiple_with_fail_fast
675675 Dir . mktmpdir do |dir |
676676 ( Pathname ( dir ) + 'a.rbs' ) . write ( <<~RBS )
677677 class Foo
678- def foo: (void) -> void
679- def bar: (void) -> void
678+ type foo = self
679+ type bar = instance
680680 end
681681 RBS
682682
683683 assert_cli_success do
684684 cli . run ( [ "-I" , dir , "--log-level=warn" , "validate" , "--fail-fast" ] )
685685 end
686- assert_include stdout . string , "a.rbs:2:11 ...2:25 : `void ` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)"
687- assert_include stdout . string , "a.rbs:3:11 ...3:25 : `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)"
686+ assert_include stdout . string , "a.rbs:2:13 ...2:17 : `self ` type is not allowed in this context (RBS::WillSyntaxError)"
687+ assert_include stdout . string , "a.rbs:3:13 ...3:21 : `instance` or `class` type is not allowed in this context (RBS::WillSyntaxError)"
688688 end
689689 end
690690 end
@@ -694,16 +694,16 @@ def test_validate_multiple_with_exit_error_on_syntax_error
694694 Dir . mktmpdir do |dir |
695695 ( Pathname ( dir ) + 'a.rbs' ) . write ( <<~RBS )
696696 class Foo
697- def foo: (void) -> void
698- def bar: (void) -> void
697+ type foo = self
698+ type bar = instance
699699 end
700700 RBS
701701
702702 refute_cli_success do
703703 cli . run ( [ "-I" , dir , "--log-level=warn" , "validate" , "--exit-error-on-syntax-error" ] )
704704 end
705- assert_include stdout . string , "a.rbs:2:11 ...2:25 : `void ` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)"
706- assert_include stdout . string , "a.rbs:3:11 ...3:25 : `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)"
705+ assert_include stdout . string , "a.rbs:2:13 ...2:17 : `self ` type is not allowed in this context (RBS::WillSyntaxError)"
706+ assert_include stdout . string , "a.rbs:3:13 ...3:21 : `instance` or `class` type is not allowed in this context (RBS::WillSyntaxError)"
707707 end
708708 end
709709 end
@@ -713,16 +713,16 @@ def test_validate_multiple_with_fail_fast_and_exit_error_on_syntax_error
713713 Dir . mktmpdir do |dir |
714714 ( Pathname ( dir ) + 'a.rbs' ) . write ( <<~RBS )
715715 class Foo
716- def foo: (void ) -> void
717- def bar: (void ) -> void
716+ def foo: (T ) -> void
717+ def bar: (T ) -> void
718718 end
719719 RBS
720720
721721 refute_cli_success do
722722 cli . run ( [ "-I" , dir , "--log-level=warn" , "validate" , "--fail-fast" , "--exit-error-on-syntax-error" ] )
723723 end
724- assert_include stdout . string , "a.rbs:2:11 ...2:25: `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError )"
725- assert_not_include stdout . string , "a.rbs:3:11 ...3:25: `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError )"
724+ assert_include stdout . string , "/ a.rbs:2:12 ...2:13: Could not find T (RBS::NoTypeFoundError )"
725+ assert_not_include stdout . string , "/ a.rbs:3:12 ...3:13: Could not find T (RBS::NoTypeFoundError )"
726726 end
727727 end
728728 end
@@ -732,7 +732,6 @@ def test_validate_multiple_with_many_errors
732732 refute_cli_success do
733733 cli . run ( %w( --log-level=warn -I test/multiple_error.rbs validate ) )
734734 end
735- assert_include ( stdout . string , "`void` type is only allowed in return type or generics parameter" )
736735 assert_include ( stdout . string , "test/multiple_error.rbs:6:17...6:24: ::TypeArg expects parameters [T], but given args [] (RBS::InvalidTypeApplicationError)" )
737736 assert_include ( stdout . string , "test/multiple_error.rbs:8:0...9:3: Detected recursive ancestors: ::RecursiveAncestor < ::RecursiveAncestor (RBS::RecursiveAncestorError)" )
738737 assert_include ( stdout . string , "test/multiple_error.rbs:11:15...11:22: Could not find Nothing (RBS::NoTypeFoundError)" )
@@ -762,8 +761,6 @@ def test_validate_multiple_fail_fast
762761 refute_cli_success do
763762 cli . run ( %w( --log-level=warn -I test/multiple_error.rbs validate --fail-fast ) )
764763 end
765- assert_include ( stdout . string , "test/multiple_error.rbs:2:11...2:25: `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)" )
766- assert_include ( stdout . string , "test/multiple_error.rbs:3:11...3:25: `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError)" )
767764 assert_include ( stdout . string , "test/multiple_error.rbs:6:17...6:24: ::TypeArg expects parameters [T], but given args []" )
768765 end
769766 end
@@ -773,17 +770,12 @@ def test_validate_multiple_fail_fast_and_exit_error_on_syntax_error
773770 refute_cli_success do
774771 cli . run ( %w( --log-level=warn -I test/multiple_error.rbs validate --fail-fast --exit-error-on-syntax-error ) )
775772 end
776- assert_include ( stdout . string , "test/multiple_error.rbs:2:11 ...2:25: `void` type is only allowed in return type or generics parameter (RBS::WillSyntaxError )" )
773+ assert_include ( stdout . string , "test/multiple_error.rbs:6:17 ...6:24: ::TypeArg expects parameters [T], but given args [] (RBS::InvalidTypeApplicationError )" )
777774 end
778775 end
779776
780777 def test_context_validation
781778 tests = [
782- <<~RBS ,
783- class Foo
784- def foo: (void) -> untyped
785- end
786- RBS
787779 <<~RBS ,
788780 class Bar[A]
789781 end
0 commit comments