-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove
compile_bin_package
(#4099)
# Description ## Problem\* Resolves #2608 ## Summary\* This PR removes the `compile_bin_package` function as it's pretty unnecessary. At the same time I've added filters to other commands which only make sense on binary packages to avoid #2608 ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
1 parent
7f3abbb
commit 2e71444
Showing
11 changed files
with
123 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::path::Path; | ||
|
||
use fm::FileId; | ||
use noirc_driver::{file_manager_with_stdlib, prepare_crate, CompileOptions, ErrorsAndWarnings}; | ||
use noirc_errors::CustomDiagnostic; | ||
use noirc_frontend::hir::{def_map::parse_file, Context}; | ||
|
||
#[test] | ||
fn reject_crates_containing_multiple_contracts() -> Result<(), ErrorsAndWarnings> { | ||
let source = " | ||
contract Foo {} | ||
contract Bar {}"; | ||
|
||
let root = Path::new(""); | ||
let file_name = Path::new("main.nr"); | ||
let mut file_manager = file_manager_with_stdlib(root); | ||
file_manager.add_file_with_source(file_name, source.to_owned()).expect( | ||
"Adding source buffer to file manager should never fail when file manager is empty", | ||
); | ||
let parsed_files = file_manager | ||
.as_file_map() | ||
.all_file_ids() | ||
.map(|&file_id| (file_id, parse_file(&file_manager, file_id))) | ||
.collect(); | ||
|
||
let mut context = Context::new(file_manager, parsed_files); | ||
let root_crate_id = prepare_crate(&mut context, file_name); | ||
|
||
let errors = | ||
noirc_driver::compile_contract(&mut context, root_crate_id, &CompileOptions::default()) | ||
.unwrap_err(); | ||
|
||
assert_eq!( | ||
errors, | ||
vec![CustomDiagnostic::from_message("Packages are limited to a single contract") | ||
.in_file(FileId::default())], | ||
"stdlib is producing warnings" | ||
); | ||
|
||
Ok(()) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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