forked from sorbet/sorbet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--stripe-packages missing export errors (sorbet#4925)
* --stripe-packages error for missing export * Add CLI test * update tests * format * clarify error msg
- Loading branch information
Showing
15 changed files
with
219 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
# typed: strict | ||
# enable-packager: true | ||
|
||
class Foo::MyPackage < PackageSpec | ||
import Foo::Bar::OtherPackage | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# typed: strict | ||
|
||
module Foo | ||
module MyPackage::Buuzz | ||
class FooClass | ||
Foo::Bar::OtherPackage::OtherClass | ||
Bar::OtherPackage::OtherClass | ||
|
||
# Following are all not exported: | ||
Foo::Bar::OtherPackage::NotExported | ||
Bar::OtherPackage::NotExported | ||
Foo::Bar::OtherPackage::Inner::AlsoNotExported | ||
Bar::OtherPackage::Inner::AlsoNotExported | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# typed: strict | ||
|
||
class Foo::Bar::OtherPackage < PackageSpec | ||
export Foo::Bar::OtherPackage::OtherClass | ||
end |
12 changes: 12 additions & 0 deletions
12
test/cli/package-error-missing-export/other/other_class.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# typed: strict | ||
|
||
module Foo::Bar::OtherPackage | ||
class OtherClass | ||
end | ||
|
||
class NotExported | ||
end | ||
|
||
class Inner::AlsoNotExported | ||
end | ||
end |
44 changes: 44 additions & 0 deletions
44
test/cli/package-error-missing-export/package-error-missing-export.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
foo_class.rb:10: Unable to resolve constant `NotExported` https://srb.help/5002 | ||
10 | Foo::Bar::OtherPackage::NotExported | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
other/__package.rb:3: Do you need to `export Foo::Bar::OtherPackage::NotExported` in package `Foo::Bar::OtherPackage`? | ||
3 |class Foo::Bar::OtherPackage < PackageSpec | ||
4 | export Foo::Bar::OtherPackage::OtherClass | ||
5 |end | ||
other/other_class.rb:7: Constant `Foo::Bar::OtherPackage::NotExported` is defined here: | ||
7 | class NotExported | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
foo_class.rb:11: Unable to resolve constant `NotExported` https://srb.help/5002 | ||
11 | Bar::OtherPackage::NotExported | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
other/__package.rb:3: Do you need to `export Foo::Bar::OtherPackage::NotExported` in package `Foo::Bar::OtherPackage`? | ||
3 |class Foo::Bar::OtherPackage < PackageSpec | ||
4 | export Foo::Bar::OtherPackage::OtherClass | ||
5 |end | ||
other/other_class.rb:7: Constant `Foo::Bar::OtherPackage::NotExported` is defined here: | ||
7 | class NotExported | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
foo_class.rb:12: Unable to resolve constant `Inner` https://srb.help/5002 | ||
12 | Foo::Bar::OtherPackage::Inner::AlsoNotExported | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
other/__package.rb:3: Do you need to `export Foo::Bar::OtherPackage::Inner` in package `Foo::Bar::OtherPackage`? | ||
3 |class Foo::Bar::OtherPackage < PackageSpec | ||
4 | export Foo::Bar::OtherPackage::OtherClass | ||
5 |end | ||
other/other_class.rb:10: Constant `Foo::Bar::OtherPackage::Inner` is defined here: | ||
10 | class Inner::AlsoNotExported | ||
^^^^^ | ||
|
||
foo_class.rb:13: Unable to resolve constant `Inner` https://srb.help/5002 | ||
13 | Bar::OtherPackage::Inner::AlsoNotExported | ||
^^^^^^^^^^^^^^^^^^^^^^^^ | ||
other/__package.rb:3: Do you need to `export Foo::Bar::OtherPackage::Inner` in package `Foo::Bar::OtherPackage`? | ||
3 |class Foo::Bar::OtherPackage < PackageSpec | ||
4 | export Foo::Bar::OtherPackage::OtherClass | ||
5 |end | ||
other/other_class.rb:10: Constant `Foo::Bar::OtherPackage::Inner` is defined here: | ||
10 | class Inner::AlsoNotExported | ||
^^^^^ | ||
Errors: 4 |
3 changes: 3 additions & 0 deletions
3
test/cli/package-error-missing-export/package-error-missing-export.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cd test/cli/package-error-missing-export || exit 1 | ||
|
||
../../../main/sorbet --silence-dev-message --stripe-packages --max-threads=0 . 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
main_lib/lib.rb:8: Unable to resolve constant `TestOnly` https://srb.help/5002 | ||
8 | Project::TestOnly::SomeHelper.new | ||
^^^^^^^^^^^^^^^^^ | ||
test_only/__package.rb:5: Do you need to `import` package `Project::TestOnly`? | ||
test_only/__package.rb:5: Do you need to `export Project::TestOnly` in package `Project::TestOnly`? | ||
5 |class Project::TestOnly < PackageSpec | ||
6 | export Project::TestOnly::SomeHelper | ||
7 |end | ||
test_only/some_helper.rb:4: Constant `Project::TestOnly` is defined here: | ||
4 |class Project::TestOnly::SomeHelper | ||
^^^^^^^^^^^^^^^^^ | ||
Errors: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters