Entering a Session multiple times to parse a file only emits diagnostics on the first execution
let path = Path::new("src/Counter.sol");
let human = HumanEmitter::new(io::stdout(), solar_interface::ColorChoice::Auto);
let dcx = DiagCtxt::new(Box::new(human));
// Create a new session with a buffer emitter.
// This is required to capture the emitted diagnostics and to return them at the end.
let sess = Session::builder().dcx(dcx).build();
// Enter the context and parse the file. This session emits diagnostics
let _ = sess.enter(|| -> solar_interface::Result<()> {
let mut pcx = solar_sema::ParsingContext::new(&sess);
pcx.load_file(path).unwrap();
pcx.parse_and_resolve();
Ok(())
});
println!("Enter second session");
// Enter the second context and parse the file. This session DOES NOT emit diagnostics
let _ = sess.enter(|| -> solar_interface::Result<()> {
let mut pcx = solar_sema::ParsingContext::new(&sess);
pcx.load_file(path).unwrap();
pcx.parse_and_resolve();
Ok(())
});
Describe the feature
Entering a
Session
multiple times to parse a file only emits diagnostics on the first executionAdditional context
No response