base_commit
stringlengths
40
40
patch
stringlengths
274
342k
instance_id
stringlengths
13
40
pull_number
int64
14
15.2k
hints_text
stringlengths
0
37.4k
issue_numbers
listlengths
1
3
version
stringlengths
3
5
repo
stringlengths
8
35
created_at
stringdate
2016-10-28 09:07:07
2025-01-01 11:25:06
test_patch
stringlengths
308
274k
problem_statement
stringlengths
25
44.3k
environment_setup_commit
stringlengths
40
40
FAIL_TO_PASS
listlengths
1
1.1k
PASS_TO_PASS
listlengths
0
7.38k
FAIL_TO_FAIL
listlengths
0
1.72k
PASS_TO_FAIL
listlengths
0
49
updated_at
stringdate
2016-10-29 01:18:22
2025-04-25 03:48:57
1beea8c3df2e44f6fa17b8f21ad57bf5a6e8b620
diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ categories = ["algorithms", "database-implementations"] [dependencies] log = "0.4.1" -protobuf = "1.2" +protobuf = "~1.5" quick-error = "1.2.1" rand = "0.4" fxhash = "0.2.1" diff --git a/src/raft.rs b/src/raft.rs --- a/src/raft.rs +++ b/src/raft.rs @@ -828,6 +828,7 @@ impl<T: Storage> Raft<T> { return; } + // Only send vote request to voters. let prs = self.take_prs(); prs.voters() .keys() diff --git a/src/raft.rs b/src/raft.rs --- a/src/raft.rs +++ b/src/raft.rs @@ -1016,24 +1017,6 @@ impl<T: Storage> Raft<T> { debug!("{} ignoring MsgHup because already leader", self.tag); }, MessageType::MsgRequestVote | MessageType::MsgRequestPreVote => { - if self.is_learner { - // TODO: learner may need to vote, in case of node down when confchange. - info!( - "{} [logterm: {}, index: {}, vote: {}] ignored {:?} from {} \ - [logterm: {}, index: {}] at term {}: learner can not vote", - self.tag, - self.raft_log.last_term(), - self.raft_log.last_index(), - self.vote, - m.get_msg_type(), - m.get_from(), - m.get_log_term(), - m.get_index(), - self.term, - ); - return Ok(()); - } - // We can vote if this is a repeat of a vote we've already cast... let can_vote = (self.vote == m.get_from()) || // ...we haven't voted and we don't think there's a leader yet in this term...
tikv__raft-rs-58
58
PTAL @xiang90 @Hoverbear
[ "57" ]
0.1
tikv/raft-rs
2018-05-09T08:12:10Z
diff --git a/tests/cases/test_raft.rs b/tests/cases/test_raft.rs --- a/tests/cases/test_raft.rs +++ b/tests/cases/test_raft.rs @@ -3784,21 +3784,6 @@ fn test_learner_promotion() { assert_eq!(network.peers[&2].state, StateRole::Leader); } -// TestLearnerCannotVote checks that a learner can't vote even it receives a valid Vote request. -#[test] -fn test_learner_cannot_vote() { - let mut n2 = new_test_learner_raft(2, vec![1], vec![2], 10, 1, new_storage()); - n2.become_follower(1, INVALID_ID); - - let mut msg_vote = new_message(1, 2, MessageType::MsgRequestVote, 0); - msg_vote.set_term(2); - msg_vote.set_log_term(11); - msg_vote.set_index(11); - n2.step(msg_vote).unwrap(); - - assert_eq!(n2.msgs.len(), 0); -} - // TestLearnerLogReplication tests that a learner can receive entries from the leader. #[test] fn test_learner_log_replication() { diff --git a/tests/cases/test_raft.rs b/tests/cases/test_raft.rs --- a/tests/cases/test_raft.rs +++ b/tests/cases/test_raft.rs @@ -3964,3 +3949,31 @@ fn test_remove_learner() { assert!(n1.prs().nodes().is_empty()); assert!(n1.prs().learner_nodes().is_empty()); } + +#[test] +fn test_learner_respond_vote() { + let mut n1 = new_test_learner_raft(1, vec![1, 2], vec![3], 10, 1, new_storage()); + n1.become_follower(1, INVALID_ID); + n1.reset_randomized_election_timeout(); + + let mut n3 = new_test_learner_raft(3, vec![1, 2], vec![3], 10, 1, new_storage()); + n3.become_follower(1, INVALID_ID); + n3.reset_randomized_election_timeout(); + + let do_campaign = |nw: &mut Network| { + let msg = new_message(1, 1, MessageType::MsgHup, 0); + nw.send(vec![msg]); + }; + + let mut network = Network::new(vec![Some(n1), None, Some(n3)]); + network.isolate(2); + + // Can't elect new leader because 1 won't send MsgRequestVote to 3. + do_campaign(&mut network); + assert_eq!(network.peers[&1].state, StateRole::Candidate); + + // After promote 3 to voter, election should success. + network.peers.get_mut(&1).unwrap().add_node(3); + do_campaign(&mut network); + assert_eq!(network.peers[&1].state, StateRole::Leader); +}
Learner should respond to request vote but don't accept votes Consider following case, a cluster has three nodes A, B, C, and A is Leader. And then add learner D, E to the cluster. D, E is promoted to voter then, but D is isolated from A, so D doesn't know himself is promoted. When A, B both crash, the cluster still has three voters C, D, E, which should be able to form a quorum. However, D can't vote in the current implementation, since it doesn't know it's not learner anymore. One solution to this problem is let learner respond to vote request and let candidate check if the response is from a valid peer. Because we won't let a voter step back as learner, so when candidate consider a node is a voter, then it's definitely a voter from that point to infinite future. So the candidate check should be safe. In the situation described above, the quorum can be formed again, and the cluster can recover automatically. /cc @xiang90 @siddontang any thoughts?
1beea8c3df2e44f6fa17b8f21ad57bf5a6e8b620
[ "cases::test_raft::test_learner_respond_vote" ]
[ "errors::tests::test_error_equal", "log_unstable::test::test_maybe_first_index", "log_unstable::test::test_maybe_last_index", "log_unstable::test::test_maybe_term", "errors::tests::test_storage_error_equal", "log_unstable::test::test_restore", "log_unstable::test::test_stable_to", "log_unstable::test::test_truncate_and_append", "progress::test::test_inflight_add", "progress::test::test_inflight_free_first_one", "progress::test::test_inflight_free_to", "raft_log::test::test_append", "raft_log::test::test_commit_to", "raft_log::test::test_has_next_ents", "raft_log::test::test_find_conflict", "raft_log::test::test_compaction_side_effects", "raft_log::test::test_is_outofbounds", "raft_log::test::test_log_restore", "raft_log::test::test_is_up_to_date", "raft_log::test::test_compaction", "raft_log::test::test_log_maybe_append", "raft_log::test::test_next_ents", "raft_log::test::test_slice", "raft_log::test::test_stable_to", "raft_log::test::test_stable_to_with_snap", "raft_log::test::test_term", "raft_log::test::test_term_with_unstable_snapshot", "raft_log::test::test_unstable_ents", "raw_node::test::test_is_local_msg", "storage::test::test_storage_apply_snapshot", "storage::test::test_storage_append", "storage::test::test_storage_compact", "storage::test::test_storage_create_snapshot", "storage::test::test_storage_first_index", "storage::test::test_storage_entries", "storage::test::test_storage_term", "storage::test::test_storage_last_index", "cases::test_raft::test_add_node", "cases::test_raft::test_add_learner", "cases::test_raft::test_add_node_check_quorum", "cases::test_raft::test_all_server_stepdown", "cases::test_raft::test_bcast_beat", "cases::test_raft::test_campaign_while_leader", "cases::test_raft::test_candidate_reset_term_msg_append", "cases::test_raft::test_candidate_reset_term_msg_heartbeat", "cases::test_raft::test_commit_after_remove_node", "cases::test_raft::test_commit_without_new_term_entry", "cases::test_raft::test_cannot_commit_without_new_term_entry", "cases::test_raft::test_commit", "cases::test_raft::test_candidate_concede", "cases::test_raft::test_disruptive_follower", "cases::test_raft::test_handle_heartbeat", "cases::test_raft::test_dueling_pre_candidates", "cases::test_raft::test_disruptive_follower_pre_vote", "cases::test_raft::test_handle_heartbeat_resp", "cases::test_raft::test_free_stuck_candidate_with_check_quorum", "cases::test_raft::test_leader_append_response", "cases::test_raft::test_leader_cycle", "cases::test_raft::test_handle_msg_append", "cases::test_raft::test_leader_cycle_pre_vote", "cases::test_raft::test_dueling_candidates", "cases::test_raft::test_leader_election_overwrite_newer_logs", "cases::test_raft::test_ignore_providing_snapshot", "cases::test_raft::test_leader_stepdown_when_quorum_active", "cases::test_raft::test_leader_increase_next", "cases::test_raft::test_leader_election_overwrite_newer_logs_pre_vote", "cases::test_raft::test_leader_transfer_ignore_proposal", "cases::test_raft::test_leader_transfer_receive_higher_term_vote", "cases::test_raft::test_leader_superseding_with_check_quorum", "cases::test_raft::test_learner_election_timeout", "cases::test_raft::test_leader_election_with_check_quorum", "cases::test_raft::test_leader_transfer_second_transfer_to_another_node", "cases::test_raft::test_progress_become_replicate", "cases::test_raft::test_msg_append_response_wait_reset", "cases::test_raft::test_progress_become_probe", "cases::test_raft::test_node_with_smaller_term_can_complete_election", "cases::test_raft::test_learner_receive_snapshot", "cases::test_raft::test_prevote_from_any_state", "cases::test_raft::test_new_leader_pending_config", "cases::test_raft::test_leader_transfer_to_uptodate_node", "cases::test_raft::test_learner_log_replication", "cases::test_raft::test_leader_transfer_remove_node", "cases::test_raft::test_leader_transfer_back", "cases::test_raft::test_leader_stepdown_when_quorum_lost", "cases::test_raft::test_leader_transfer_to_non_existing_node", "cases::test_raft::test_progress_become_snapshot", "cases::test_raft::test_leader_transfer_after_snapshot", "cases::test_raft::test_pre_campaign_while_leader", "cases::test_raft::test_old_messages", "cases::test_raft::test_leader_transfer_to_uptodate_node_from_follower", "cases::test_raft::test_leader_transfer_timeout", "cases::test_raft::test_progress_resume", "cases::test_raft::test_progress_paused", "cases::test_raft::test_progress_is_paused", "cases::test_raft::test_progress_update", "cases::test_raft::test_raft_nodes", "cases::test_raft::test_progress_maybe_decr", "cases::test_raft::test_remove_learner", "cases::test_raft::test_leader_transfer_to_slow_follower", "cases::test_raft::test_restore_from_snap_msg", "cases::test_raft::test_recv_msg_unreachable", "cases::test_raft::test_restore_learner_promotion", "cases::test_raft::test_leader_transfer_to_self", "cases::test_raft::test_leader_transfer_second_transfer_to_same_node", "cases::test_raft::test_learner_promotion", "cases::test_raft::test_leader_transfer_with_check_quorum", "cases::test_raft::test_remove_node", "cases::test_raft::test_recv_msg_request_vote", "cases::test_raft::test_send_append_for_progress_snapshot", "cases::test_raft::test_raft_frees_read_only_mem", "cases::test_raft::test_read_only_option_lease_without_check_quorum", "cases::test_raft::test_read_only_for_new_leader", "cases::test_raft::test_single_node_candidate", "cases::test_raft::test_progress_resume_by_heartbeat_resp", "cases::test_raft::test_recv_msg_beat", "cases::test_raft::test_sinle_node_pre_candidate", "cases::test_raft::test_step_ignore_config", "cases::test_raft::test_pass_election_timeout", "cases::test_raft::test_promotable", "cases::test_raft::test_provide_snap", "cases::test_raft::test_non_promotable_voter_which_check_quorum", "cases::test_raft::test_read_only_option_lease", "cases::test_raft::test_proposal_by_proxy", "cases::test_raft::test_vote_from_any_state", "cases::test_raft::test_step_config", "cases::test_raft::test_restore", "cases::test_raft::test_restore_ignore_snapshot", "cases::test_raft::test_restore_with_learner", "cases::test_raft::test_read_only_option_safe", "cases::test_raft::test_slow_node_restore", "cases::test_raft::test_send_append_for_progress_replicate", "cases::test_raft_paper::test_follower_update_term_from_message", "cases::test_raft::test_log_replicatioin", "cases::test_raft_paper::test_leader_bcast_beat", "cases::test_raft_paper::test_leader_commit_entry", "cases::test_raft::test_proposal", "cases::test_raft_flow_control::test_msg_app_flow_control_recv_heartbeat", "cases::test_raft::test_step_ignore_old_term_msg", "cases::test_raft_paper::test_follower_append_entries", "cases::test_raft::test_leader_election", "cases::test_raft::test_send_append_for_progress_probe", "cases::test_raft_paper::test_leader_acknowledge_commit", "cases::test_raft::test_leader_election_pre_vote", "cases::test_raft::test_single_node_commit", "cases::test_raft_paper::test_follower_commit_entry", "cases::test_raft::test_transfer_non_member", "cases::test_raft_paper::test_candidate_update_term_from_message", "cases::test_raft_paper::test_follower_start_election", "cases::test_raft_paper::test_follower_vote", "cases::test_raft_paper::test_leader_start_replication", "cases::test_raft_paper::test_leader_only_commits_log_from_current_term", "cases::test_raft::test_restore_invalid_learner", "cases::test_raft_paper::test_candidate_fallback", "cases::test_raft_paper::test_leader_commit_preceding_entries", "cases::test_raft_paper::test_candidate_start_new_election", "cases::test_raft_paper::test_leader_election_in_one_round_rpc", "cases::test_raft_paper::test_follower_check_msg_append", "cases::test_raft_flow_control::test_msg_app_flow_control_full", "cases::test_raft::test_state_transition", "cases::test_raft_paper::test_start_as_follower", "cases::test_raft_paper::test_leader_sync_follower_log", "cases::test_raw_node::test_raw_node_propose_and_conf_change", "cases::test_raft_snap::test_snapshot_abort", "cases::test_raw_node::test_raw_node_propose_add_duplicate_node", "cases::test_raw_node::test_raw_node_step", "cases::test_raw_node::test_skip_bcast_commit", "cases::test_raw_node::test_raw_node_restart_from_snapshot", "cases::test_raw_node::test_raw_node_restart", "cases::test_raw_node::test_raw_node_read_index", "cases::test_raw_node::test_raw_node_start", "cases::test_raft_snap::test_snapshot_failure", "cases::test_raft_paper::test_vote_request", "cases::test_raft_snap::test_snapshot_succeed", "cases::test_raft_paper::test_reject_stale_term_message", "cases::test_raft_paper::test_voter", "cases::test_raft_snap::test_sending_snapshot_set_pending_snapshot", "cases::test_raft_snap::test_pending_snapshot_pause_replication", "cases::test_raft_paper::test_leader_update_term_from_message", "cases::test_raw_node::test_raw_node_propose_add_learner_node", "cases::test_raw_node::test_raw_node_read_index_to_old_leader", "cases::test_raft_flow_control::test_msg_app_flow_control_move_forward", "cases::test_raft_paper::test_follower_election_timeout_nonconflict", "cases::test_raft_paper::test_acandidates_election_timeout_nonconf", "cases::test_raft_paper::test_follower_election_timeout_randomized", "cases::test_raft_paper::test_candidate_election_timeout_randomized", "src/lib.rs - prelude (line 70)" ]
[]
[]
2018-07-05T16:30:24Z
94f4ad731ffae32474ae4362c5f74507a86b564e
diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -140,10 +140,7 @@ impl Path { /// Reversed version of this path with edge loops are specified in the opposite /// order. pub fn reversed(&self) -> Self { - let mut builder = Path::builder(); - reverse_path(self.as_slice(), &mut builder); - - builder.build() + reverse_path(self.as_slice()) } fn apply_transform(&mut self, transform: &Transform2D) { diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -256,6 +253,12 @@ impl<'l> PathSlice<'l> { pub fn is_empty(&self) -> bool { self.verbs.is_empty() } + + /// Returns a slice over an endpoint's custom attributes. + #[inline] + pub fn attributes(&self, endpoint: EndpointId) -> &[f32] { + interpolated_attributes(self.num_attributes, &self.points, endpoint) + } } impl<'l> IntoIterator for PathSlice<'l> { diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -981,6 +984,10 @@ impl<'l> Iterator for IdIter<'l> { #[inline] fn interpolated_attributes(num_attributes: usize, points: &[Point], endpoint: EndpointId) -> &[f32] { + if num_attributes == 0 { + return &[]; + } + let idx = endpoint.0 as usize + 1; assert!(idx + (num_attributes + 1) / 2 <= points.len()); diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -990,8 +997,9 @@ fn interpolated_attributes(num_attributes: usize, points: &[Point], endpoint: En } } -// TODO: Handle custom attributes. -fn reverse_path(path: PathSlice, builder: &mut dyn PathBuilder) { +fn reverse_path(path: PathSlice) -> Path { + let mut builder = Path::builder_with_attributes(path.num_attributes()); + let attrib_stride = (path.num_attributes() + 1) / 2; let points = &path.points[..]; // At each iteration, p points to the first point after the current verb. diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -1001,12 +1009,14 @@ fn reverse_path(path: PathSlice, builder: &mut dyn PathBuilder) { for v in path.verbs.iter().rev().cloned() { match v { Verb::Close => { + let idx = p - 1 - attrib_stride; need_close = true; - builder.move_to(points[p - 1]); + builder.move_to(points[idx], path.attributes(EndpointId(idx as u32))); } Verb::End => { + let idx = p - 1 - attrib_stride; need_close = false; - builder.move_to(points[p - 1]); + builder.move_to(points[idx], path.attributes(EndpointId(idx as u32))); } Verb::Begin => { if need_close { diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -1015,17 +1025,25 @@ fn reverse_path(path: PathSlice, builder: &mut dyn PathBuilder) { } } Verb::LineTo => { - builder.line_to(points[p - 2]); + let idx = p - 2 - attrib_stride * 2; + builder.line_to(points[idx], path.attributes(EndpointId(idx as u32))); } Verb::QuadraticTo => { - builder.quadratic_bezier_to(points[p - 2], points[p - 3]); + let ctrl_idx = p - attrib_stride - 2; + let to_idx = ctrl_idx - attrib_stride - 1; + builder.quadratic_bezier_to(points[ctrl_idx], points[to_idx], path.attributes(EndpointId(to_idx as u32))); } Verb::CubicTo => { - builder.cubic_bezier_to(points[p - 2], points[p - 3], points[p - 4]); + let ctrl1_idx = p - attrib_stride - 2; + let ctrl2_idx = ctrl1_idx - 1; + let to_idx = ctrl2_idx - attrib_stride - 1; + builder.cubic_bezier_to(points[ctrl1_idx], points[ctrl2_idx], points[to_idx], path.attributes(EndpointId(to_idx as u32))); } } p -= n_stored_points(v, attrib_stride); } + + builder.build() } fn n_stored_points(verb: Verb, attrib_stride: usize) -> usize {
nical__lyon-503
503
[ "501" ]
0.14
nical/lyon
2019-12-25T11:52:19Z
diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -1041,49 +1059,60 @@ fn n_stored_points(verb: Verb, attrib_stride: usize) -> usize { #[test] fn test_reverse_path() { - let mut builder = Path::builder(); - builder.move_to(point(0.0, 0.0)); - builder.line_to(point(1.0, 0.0)); - builder.line_to(point(1.0, 1.0)); - builder.line_to(point(0.0, 1.0)); - - builder.move_to(point(10.0, 0.0)); - builder.line_to(point(11.0, 0.0)); - builder.line_to(point(11.0, 1.0)); - builder.line_to(point(10.0, 1.0)); + let mut builder = Path::builder_with_attributes(1); + builder.move_to(point(0.0, 0.0), &[1.0]); + builder.line_to(point(1.0, 0.0), &[2.0]); + builder.line_to(point(1.0, 1.0), &[3.0]); + builder.line_to(point(0.0, 1.0), &[4.0]); + + builder.move_to(point(10.0, 0.0), &[5.0]); + builder.line_to(point(11.0, 0.0), &[6.0]); + builder.line_to(point(11.0, 1.0), &[7.0]); + builder.line_to(point(10.0, 1.0), &[8.0]); builder.close(); - builder.move_to(point(20.0, 0.0)); - builder.quadratic_bezier_to(point(21.0, 0.0), point(21.0, 1.0)); + builder.move_to(point(20.0, 0.0), &[9.0]); + builder.quadratic_bezier_to(point(21.0, 0.0), point(21.0, 1.0), &[10.0]); let p1 = builder.build(); - let mut builder = Path::builder(); - reverse_path(p1.as_slice(), &mut builder); - let p2 = builder.build(); + let p2 = p1.reversed(); + + let mut it = p2.iter_with_attributes(); + + // Using a function that explicits the argument types works around type inference issue. + fn check<'l>( + a: Option<Event<(Point, &'l[f32]), Point>>, + b: Option<Event<(Point, &'l[f32]), Point>>, + ) -> bool { + if a != b { + println!("left: {:?}", a); + println!("right: {:?}", b); + } - let mut it = p2.iter(); + a == b + } - assert_eq!(it.next(), Some(PathEvent::Begin { at: point(21.0, 1.0) })); - assert_eq!(it.next(), Some(PathEvent::Quadratic { - from: point(21.0, 1.0), + assert!(check(it.next(), Some(Event::Begin { at: (point(21.0, 1.0), &[10.0]) }))); + assert!(check(it.next(), Some(Event::Quadratic { + from: (point(21.0, 1.0), &[10.0]), ctrl: point(21.0, 0.0), - to: point(20.0, 0.0), - })); - assert_eq!(it.next(), Some(PathEvent::End { last: point(20.0, 0.0), first: point(21.0, 1.0), close: false })); - - assert_eq!(it.next(), Some(PathEvent::Begin { at: point(10.0, 1.0) })); - assert_eq!(it.next(), Some(PathEvent::Line { from: point(10.0, 1.0), to: point(11.0, 1.0) })); - assert_eq!(it.next(), Some(PathEvent::Line { from: point(11.0, 1.0), to: point(11.0, 0.0) })); - assert_eq!(it.next(), Some(PathEvent::Line { from: point(11.0, 0.0), to: point(10.0, 0.0) })); - assert_eq!(it.next(), Some(PathEvent::End { last: point(10.0, 0.0), first: point(10.0, 1.0), close: true })); - - assert_eq!(it.next(), Some(PathEvent::Begin { at: point(0.0, 1.0) })); - assert_eq!(it.next(), Some(PathEvent::Line { from: point(0.0, 1.0), to: point(1.0, 1.0) })); - assert_eq!(it.next(), Some(PathEvent::Line { from: point(1.0, 1.0), to: point(1.0, 0.0) })); - assert_eq!(it.next(), Some(PathEvent::Line { from: point(1.0, 0.0), to: point(0.0, 0.0) })); - assert_eq!(it.next(), Some(PathEvent::End { last: point(0.0, 0.0), first: point(0.0, 1.0), close: false })); - - assert_eq!(it.next(), None); + to: (point(20.0, 0.0), &[9.0]), + }))); + assert!(check(it.next(), Some(Event::End { last: (point(20.0, 0.0), &[9.0]), first: (point(21.0, 1.0), &[10.0]), close: false }))); + + assert!(check(it.next(), Some(Event::Begin { at: (point(10.0, 1.0), &[8.0]) }))); + assert!(check(it.next(), Some(Event::Line { from: (point(10.0, 1.0), &[8.0]), to: (point(11.0, 1.0), &[7.0]) }))); + assert!(check(it.next(), Some(Event::Line { from: (point(11.0, 1.0), &[7.0]), to: (point(11.0, 0.0), &[6.0]) }))); + assert!(check(it.next(), Some(Event::Line { from: (point(11.0, 0.0), &[6.0]), to: (point(10.0, 0.0), &[5.0]) }))); + assert!(check(it.next(), Some(Event::End { last: (point(10.0, 0.0), &[5.0]), first: (point(10.0, 1.0), &[8.0]), close: true }))); + + assert!(check(it.next(), Some(Event::Begin { at: (point(0.0, 1.0), &[4.0]) }))); + assert!(check(it.next(), Some(Event::Line { from: (point(0.0, 1.0), &[4.0]), to: (point(1.0, 1.0), &[3.0]) }))); + assert!(check(it.next(), Some(Event::Line { from: (point(1.0, 1.0), &[3.0]), to: (point(1.0, 0.0), &[2.0]) }))); + assert!(check(it.next(), Some(Event::Line { from: (point(1.0, 0.0), &[2.0]), to: (point(0.0, 0.0), &[1.0]) }))); + assert!(check(it.next(), Some(Event::End { last: (point(0.0, 0.0), &[1.0]), first: (point(0.0, 1.0), &[4.0]), close: false }))); + + assert!(check(it.next(), None)); } #[test] diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -1095,9 +1124,7 @@ fn test_reverse_path_no_close() { let p1 = builder.build(); - let mut builder = Path::builder(); - reverse_path(p1.as_slice(), &mut builder); - let p2 = builder.build(); + let p2 = p1.reversed(); let mut it = p2.iter(); diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -1111,9 +1138,7 @@ fn test_reverse_path_no_close() { #[test] fn test_reverse_empty_path() { let p1 = Path::builder().build(); - let mut builder = Path::builder(); - reverse_path(p1.as_slice(), &mut builder); - let p2 = builder.build(); + let p2 = p1.reversed(); assert_eq!(p2.iter().next(), None); } diff --git a/path/src/path.rs b/path/src/path.rs --- a/path/src/path.rs +++ b/path/src/path.rs @@ -1122,9 +1147,7 @@ fn test_reverse_single_moveto() { let mut builder = Path::builder(); builder.move_to(point(0.0, 0.0)); let p1 = builder.build(); - let mut builder = Path::builder(); - reverse_path(p1.as_slice(), &mut builder); - let p2 = builder.build(); + let p2 = p1.reversed(); let mut it = p2.iter(); assert_eq!(it.next(), Some(PathEvent::Begin { at: point(0.0, 0.0) })); assert_eq!(it.next(), Some(PathEvent::End { last: point(0.0, 0.0), first: point(0.0, 0.0), close: false }));
Path::reversed should preserve custom attributes Currently the custom attributes aren't in the output path.
94f4ad731ffae32474ae4362c5f74507a86b564e
[ "path::test_reverse_path" ]
[ "commands::simple_path", "commands::next_event", "iterator::test_from_polyline_open", "path::test_merge_paths", "iterator::test_from_polyline_closed", "path::test_path_builder_empty", "path::test_path_builder_1", "path::test_reverse_empty_path", "path::test_reverse_path_no_close", "path::test_path_builder_empty_move_to", "path::test_path_builder_line_to_after_close", "path::test_reverse_single_moveto", "polygon::event_ids", "path/src/iterator.rs - iterator::FromPolyline (line 236)", "path/src/iterator.rs - iterator (line 69)", "path/src/commands.rs - commands (line 22)", "path/src/lib.rs - (line 13)", "path/src/iterator.rs - iterator (line 12)" ]
[]
[]
2019-12-25T11:58:15Z
525037751f50afd145131feded64156e79dfaaa9
diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -184,7 +184,7 @@ impl EventQueue { after: TessEventId, ) -> TessEventId { debug_assert!(self.sorted); - debug_assert!(is_after(data.to, position)); + debug_assert!(is_after(data.to, position), "{:?} should be after {:?}", data.to, position); let idx = self.events.len() as TessEventId; self.events.push(Event { diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -194,6 +194,49 @@ impl EventQueue { }); self.edge_data.push(data); + self.insert_into_sorted_list(idx, position, after); + + idx + } + + pub(crate) fn insert_sibling(&mut self, sibling: TessEventId, position: Point, data: EdgeData) { + debug_assert!(is_after(data.to, position)); + let idx = self.events.len() as TessEventId; + let next_sibling = self.events[sibling as usize].next_sibling; + + self.events.push(Event { + position, + next_event: INVALID_EVENT_ID, + next_sibling, + }); + + self.edge_data.push(data); + + self.events[sibling as usize].next_sibling = idx; + } + + pub(crate) fn vertex_event_sorted( + &mut self, + position: Point, + endpoint_id: EndpointId, + after: TessEventId, + ) { + let idx = self.events.len() as TessEventId; + + self.push_unsorted(position); + self.edge_data.push(EdgeData { + to: point(f32::NAN, f32::NAN), + range: 0.0..0.0, + winding: 0, + is_edge: false, + from_id: endpoint_id, + to_id: endpoint_id, + }); + + self.insert_into_sorted_list(idx, position, after); + } + + fn insert_into_sorted_list(&mut self, idx: TessEventId, position: Point, after: TessEventId) { let mut prev = after; let mut current = after; while self.valid_id(current) { diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -213,24 +256,6 @@ impl EventQueue { prev = current; current = self.next_id(current); } - - idx - } - - pub(crate) fn insert_sibling(&mut self, sibling: TessEventId, position: Point, data: EdgeData) { - debug_assert!(is_after(data.to, position)); - let idx = self.events.len() as TessEventId; - let next_sibling = self.events[sibling as usize].next_sibling; - - self.events.push(Event { - position, - next_event: INVALID_EVENT_ID, - next_sibling, - }); - - self.edge_data.push(data); - - self.events[sibling as usize].next_sibling = idx; } pub(crate) fn clear(&mut self) { diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -710,7 +710,13 @@ impl FillTessellator { /// Enable/disable some verbose logging during the tessellation, for /// debugging purposes. pub fn set_logging(&mut self, is_enabled: bool) { - self.log = is_enabled; + #[cfg(debug_assertions)] + let forced = env::var("LYON_FORCE_LOGGING").is_ok(); + + #[cfg(not(debug_assertions))] + let forced = false; + + self.log = is_enabled || forced; } fn tessellator_loop( diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -732,7 +738,7 @@ impl FillTessellator { if let Err(e) = self.process_events(&mut scan, output) { // Something went wrong, attempt to salvage the state of the sweep // line - self.recover_from_error(e); + self.recover_from_error(e, output); // ... and try again. self.process_events(&mut scan, output)? } diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -819,6 +825,8 @@ impl FillTessellator { self.edges_below.len(), ); + tess_log!(self, "edges below (initially): {:#?}", self.edges_below); + // Step 1 - Scan the active edge list, deferring processing and detecting potential // ordering issues in the active edges. self.scan_active_edges(scan)?; diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -862,7 +870,7 @@ impl FillTessellator { } else { tess_log!( self, - r#" <path d="M {} {} L {} {}" class="edge", winding="{}" sort_x="{:.}" min_x="{:.}"/>"#, + r#" <path d="M {:.5?} {:.5?} L {:.5?} {:.5?}" class="edge", winding="{:>2}" sort_x="{:.}" min_x="{:.}"/>"#, e.from.x, e.from.y, e.to.x, diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -879,16 +887,18 @@ impl FillTessellator { #[cfg(debug_assertions)] fn check_active_edges(&self) { - let mut winding = 0; - for edge in &self.active.edges { + let mut winding = WindingState::new(); + for (idx, edge) in self.active.edges.iter().enumerate() { + winding.update(self.fill_rule, edge.winding); if edge.is_merge { - assert!(self.fill_rule.is_in(winding)); + assert!(self.fill_rule.is_in(winding.number)); } else { - assert!(!is_after(self.current_position, edge.to)); - winding += edge.winding; + assert!(!is_after(self.current_position, edge.to), "error at edge {}, position {:?}", idx, edge.to); } } - assert_eq!(winding, 0); + assert_eq!(winding.number, 0); + let expected_span_count = (winding.span_index + 1) as usize; + assert_eq!(self.fill.spans.len(), expected_span_count); } /// Scan the active edges to find the information we will need for the tessellation, without diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1268,7 +1278,8 @@ impl FillTessellator { }); tess_log!( self, - "add edge below {:?} -> {:?} ({:?})", + "split {:?}, add edge below {:?} -> {:?} ({:?})", + edge_idx, self.current_position, self.edges_below.last().unwrap().to, active_edge.winding, diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1309,13 +1320,13 @@ impl FillTessellator { winding.is_in ); tess_log!(self, "winding state before point: {:?}", winding); - tess_log!(self, "edges below: {:?}", self.edges_below); + tess_log!(self, "edges below: {:#?}", self.edges_below); self.sort_edges_below(); - if scan.split_event { - debug_assert!(self.edges_below.len() >= 2); + self.handle_coincident_edges_below(); + if scan.split_event { // Split event. // // ........... diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1553,17 +1564,7 @@ impl FillTessellator { let active_edge = &mut self.active.edges[active_edge_idx]; - if is_near(self.current_position, intersection_position) { - tess_log!(self, "fix intersection position to current_position"); - intersection_position = self.current_position; - // We moved the intersection to the current position to avoid breaking ordering. - // This means we won't be adding an intersection event and we have to treat - // splitting the two edges in a special way: - // - the edge below does not need to be split. - // - the active edge is split so that it's upper part now ends at the current - // position which means it must be removed, however removing edges ending at - // the current position happens before the intersection checks. So instead we - // modify it in place and don't add a new event. + if self.current_position == intersection_position { active_edge.from = intersection_position; active_edge.min_x = active_edge.min_x.min(intersection_position.x); let src_range = &mut self.events.edge_data[active_edge.src_edge as usize].range; diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1588,7 +1589,7 @@ impl FillTessellator { tess_log!(self, "intersection near below.to"); intersection_position = edge_below.to; } else if is_near(intersection_position, active_edge.to) { - tess_log!(self, "intersection near below.to"); + tess_log!(self, "intersection near active_edge.to"); intersection_position = active_edge.to; } diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1596,6 +1597,7 @@ impl FillTessellator { let b_src_edge_data = self.events.edge_data[edge_below.src_edge as usize].clone(); let mut inserted_evt = None; + let mut flipped_active = false; if active_edge.to != intersection_position && active_edge.from != intersection_position diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1620,6 +1622,7 @@ impl FillTessellator { )); } else { tess_log!(self, "flip active edge after intersection"); + flipped_active = true; self.events.insert_sorted( active_edge.to, EdgeData { diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1682,11 +1685,25 @@ impl FillTessellator { }, self.current_event_id, ); - }; + + if flipped_active { + // It is extremely rare but if we end up flipping both of the + // edges that are inserted in the event queue, then we created a + // merge event which means we have to insert a vertex event into + // the queue, otherwise the tessellator will skip over the end of + // these two edges. + self.events.vertex_event_sorted( + intersection_position, + b_src_edge_data.to_id, + self.current_event_id, + ); + } + } edge_below.to = intersection_position; edge_below.range_end = remapped_tb; } + } } diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1789,7 +1806,7 @@ impl FillTessellator { } } - fn recover_from_error(&mut self, _error: InternalError) { + fn recover_from_error(&mut self, _error: InternalError, output: &mut dyn FillGeometryBuilder) { tess_log!(self, "Attempt to recover error {:?}", _error); self.sort_active_edges(); diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1829,6 +1846,11 @@ impl FillTessellator { } } + while self.fill.spans.len() > (winding.span_index + 1) as usize { + self.fill.spans.last_mut().unwrap().tess.flush(output); + self.fill.spans.pop(); + } + tess_log!(self, "-->"); #[cfg(debug_assertions)] diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1840,6 +1862,69 @@ impl FillTessellator { .sort_by(|a, b| b.angle.partial_cmp(&a.angle).unwrap_or(Ordering::Equal)); } + fn handle_coincident_edges_below(&mut self) { + if self.edges_below.len() < 2 { + return; + } + + for idx in (0..(self.edges_below.len() - 1)).rev() { + let a_idx = idx; + let b_idx = idx + 1; + let a_angle = self.edges_below[a_idx].angle; + let b_angle = self.edges_below[b_idx].angle; + if (a_angle - b_angle).abs() > 0.001 { + continue; + } + + let a_to = self.edges_below[a_idx].to; + let b_to = self.edges_below[b_idx].to; + let (lower_idx, upper_idx, split) = match compare_positions(a_to, b_to) { + Ordering::Greater => (a_idx, b_idx, true), + Ordering::Less => (b_idx, a_idx, true), + Ordering::Equal => (a_idx, b_idx, false), + }; + + tess_log!(self, "coincident edges {:?} -> {:?} / {:?}", self.current_position, a_to, b_to); + + tess_log!(self, "update winding: {:?} -> {:?}", self.edges_below[upper_idx].winding, self.edges_below[upper_idx].winding + self.edges_below[lower_idx].winding); + self.edges_below[upper_idx].winding += self.edges_below[lower_idx].winding; + let split_point = self.edges_below[upper_idx].to; + + tess_log!(self, "remove coincident edge {:?}, split:{:?}", idx, split); + let edge = self.edges_below.remove(lower_idx); + + if !split { + continue; + } + + let src_edge_data = self.events.edge_data[edge.src_edge as usize].clone(); + + let t = LineSegment { + from: self.current_position, + to: edge.to, + }.solve_t_for_y(split_point.y); + + let src_range = src_edge_data.range.start..edge.range_end; + let t_remapped = remap_t_in_range(t, src_range); + + let edge_data = EdgeData { + range: t_remapped..edge.range_end, + winding: edge.winding, + to: edge.to, + is_edge: true, + ..src_edge_data + }; + + self.events.insert_sorted( + split_point, + edge_data, + self.current_event_id, + ); + } + + } + + fn reset(&mut self) { self.current_position = point(f32::MIN, f32::MIN); self.current_vertex = VertexId::INVALID; diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1878,7 +1963,7 @@ pub(crate) fn is_after(a: Point, b: Point) -> bool { #[inline] pub(crate) fn is_near(a: Point, b: Point) -> bool { - (a - b).square_length() < 0.0001 + (a - b).square_length() < 0.000000001 } #[inline]
nical__lyon-570
570
Thanks for filing this, I'll have a look shortly. @yanchith I made a testcase from the one you provided, unfortunately it doesn't reproduce, which probably means the defaut formatting parameters arent printing enough decimals to represent the problematic case. could you copy-pase this code somehwere where you know the issue to be happening: ```rust pub struct PrintPath(pub Path); use std::fmt; impl fmt::Debug for PrintPath { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn write_point(formatter: &mut fmt::Formatter, point: Point) -> fmt::Result { write!(formatter, " ")?; fmt::Debug::fmt(&point.x, formatter)?; write!(formatter, " ")?; fmt::Debug::fmt(&point.y, formatter) } write!(formatter, "\"")?; for evt in &self.0 { match evt { PathEvent::Begin { at } => { write!(formatter, " M")?; write_point(formatter, at)?; } PathEvent::End { close, .. } => { if close { write!(formatter, " Z")?; } } PathEvent::Line { to, .. } => { write!(formatter, " L")?; write_point(formatter, to)?; } PathEvent::Quadratic { ctrl, to, .. } => { write!(formatter, " Q")?; write_point(formatter, ctrl)?; write_point(formatter, to)?; } PathEvent::Cubic { ctrl1, ctrl2, to, .. } => { write!(formatter, " C")?; write_point(formatter, ctrl1)?; write_point(formatter, ctrl2)?; write_point(formatter, to)?; } } } write!(formatter, "\"") } } ``` And then print the path like so: ```rust println!("teste case: {:.10?}", PrintPath(path)); ``` Where `path` is the path that is causing the bug and `{:.10}` asks the formatter to print 10 decimals in the hope that the extra precision will let us reproduce the issue. Thanks for looking into this :heart: I also managed to find a shorter path that triggers the debug assert. This is what it looks like when I disable debug assertions (I think this is very much a self-intersection stress test - but the original one looked much more reasonable). ![tests__multi_polygon_with_interior_rings_and_perpendicular_jitter snap-new](https://user-images.githubusercontent.com/1099245/79479635-59569c80-800d-11ea-8d9d-7919415bbb31.png) ```text test case: " M -0.8207679987 -0.8688971996 L -0.7742307782 -0.4698247313 L -0.9393702745 -0.7329606414 L -0.8874540329 -0.4791899323 L -0.6889821887 -0.3329083622 L -0.9466785192 -0.4303660095 L -0.9553674459 -0.4662885368 L -0.6109700203 -0.4329875708 L -0.8780106306 -0.2906790078 L -0.7089020014 -0.0037546456 L -0.9252399802 -0.3360545635 L -0.6019649506 -0.2058033347 L -0.9361810684 -0.2352166176 L -0.7691872716 0.0383807607 L -0.9362862706 0.1513814330 L -0.9839019179 0.1125854850 L -0.9825191498 0.2456643283 L -0.7321746945 0.4003376067 L -0.8890044689 0.1631975025 L -0.8380209208 0.4772368073 L -0.9701194763 0.5021913648 L -0.7367070913 0.2689037919 L -0.7358176112 0.6697905064 L -0.6914564967 0.3767231107 L -0.6123800278 0.5280315280 L -0.8706598878 0.6932309866 L -0.9071409106 0.6241128445 L -0.7203786969 0.6186348200 L -0.6145810485 0.9656302929 L -0.4690067768 0.9501831532 L -0.3469378054 0.7343682051 L -0.3069479465 0.9191360474 L -0.4034126699 0.6937038302 L -0.2330733687 0.6626541615 L -0.1501235664 0.9988733530 L -0.4087678790 0.6151789427 L 0.0327531993 0.6849809885 L -0.0281501785 0.7090716362 L -0.0062232986 0.9773678780 L -0.1278214604 0.8432378769 L 0.1939027905 0.8591585755 L 0.3300049901 0.8875733614 L 0.3639574349 0.6280845404 L 0.1604323387 0.7211027145 L 0.4273755550 0.6901011467 L 0.2191886604 0.9439773560 L 0.5304970741 0.7559456229 L 0.3243722022 0.8788009286 L 0.4153606594 0.7539806962 L 0.5388184190 0.6816532612 L 0.4902615249 0.9468226433 L 0.6173663735 0.7645685673 L 0.5697485209 0.8907170892 L 0.7220833898 0.9401075840 L 0.5721384883 0.9590278864 L 0.6159927249 0.8150777817 L 0.6281648874 0.6590110064 L 0.6916612983 0.9661321640 L 0.9044094682 0.8271411657 L 0.8482701778 0.7764627337 L 0.8773511648 0.6899036765 L 0.7063522935 0.5091397762 L 0.9860303402 0.5289094448 L 0.6892720461 0.4567596316 L 0.7256108522 0.6777729392 L 0.7977727652 0.3747999072 L 0.8892844319 0.6062116027 L 0.8649919033 0.5319378376 L 0.6517596245 0.3154333532 L 0.7493754625 0.3097154498 L 0.7621957660 0.1760187447 L 0.6630446315 0.0364976227 L 0.8375625610 0.2034847587 L 0.7190288305 0.1170381978 L 0.6663711071 0.0178340431 L 0.9843230247 -0.1750037372 L 0.7383416295 -0.0666050613 L 0.9314814806 -0.1724732071 L 0.7649849653 -0.1852992028 L 0.7282105684 -0.1020315737 L 0.6196770668 -0.2739042342 L 0.9452752471 -0.4432985783 L 0.9982362390 -0.3612855077 L 0.6540633440 -0.6645803452 L 0.8614879251 -0.5267579556 L 0.7629716992 -0.6080643535 L 0.9766238928 -0.8175441027 L 0.7646185160 -0.7051171660 L 0.7472760677 -0.6478849649 L 0.6498739719 -0.7323002815 L 0.8403692245 -0.8088044524 L 0.7439565659 -0.7405111790 L 0.7546553016 -0.7617247701 L 0.7539277077 -0.6317175627 L 0.6747937202 -0.9688835144 L 0.5831738114 -0.6822947264 L 0.2710255384 -0.9212602377 L 0.3769182265 -0.8479776978 L 0.2064074278 -0.7769882679 L 0.3313184381 -0.9860298038 L 0.3113351464 -0.6504784822 L 0.1898880303 -0.6752232313 L 0.1689367890 -0.7522631288 L -0.0547610596 -0.7867913246 L -0.2459574640 -0.6926927567 L -0.0004239529 -0.7583431602 L -0.3928295970 -0.8158227205 L -0.3479290307 -0.6722153425 L -0.1622253656 -0.7698250413 L -0.3365449607 -0.9790642262 L -0.3164364696 -0.9615324140 L -0.3415712714 -0.8687605858 L -0.4360900223 -0.7086173296 L -0.5481178761 -0.6680613160 L -0.4678017199 -0.6904769540 L -0.5304602981 -0.8362509608 L -0.7404142022 -0.7646956444 L -0.8207679987 -0.8688971996 Z M -0.6103347540 -0.4546403587 L -0.4373104274 -0.3770174384 L -0.5713154078 -0.4916919470 L -0.3022333384 -0.4247310460 L -0.5027727485 -0.4506492913 L -0.4841670394 -0.3679628372 L -0.1511912346 -0.6495994329 L -0.3456022739 -0.3601520061 L -0.3149848580 -0.5312928557 L -0.1873361766 -0.6391361952 L 0.0833640397 -0.4321969151 L 0.0316221789 -0.3349926174 L 0.0312347040 -0.6730831861 L -0.0483473241 -0.3870794177 L -0.0645213202 -0.5983390212 L 0.2230887264 -0.4881301820 L 0.0357133001 -0.4856303632 L 0.3644523025 -0.4373076558 L 0.2783037126 -0.5246815681 L 0.4604045451 -0.5858781934 L 0.4078963697 -0.3316536546 L 0.3179360330 -0.6173570752 L 0.3963582516 -0.4108166099 L 0.6719979644 -0.5660122037 L 0.3090577424 -0.2779315114 L 0.4112541080 -0.3650614917 L 0.4903442562 -0.2728729844 L 0.3085053563 -0.2772275507 L 0.4387947619 -0.2452066839 L 0.3409250975 -0.0901858956 L 0.3143540621 -0.0997110605 L 0.4798444808 -0.0653616861 L 0.4718981385 0.3133855462 L 0.6216366291 0.0191372037 L 0.3037990928 0.2022005916 L 0.4845580757 0.5250537395 L 0.4636508524 0.3209675848 L 0.5203218460 0.5389408469 L 0.6316121817 0.5669875145 L 0.4591632485 0.4284194708 L 0.3364180923 0.4508785903 L 0.0780621916 0.5582271218 L 0.2733506858 0.3093393445 L 0.2833133340 0.3918714225 L 0.1808252931 0.5302590132 L -0.1752744466 0.6364661455 L -0.2096720189 0.6507015228 L -0.0349738188 0.5706411600 L -0.1468322128 0.5691297650 L -0.1100965440 0.4844444990 L -0.2021583617 0.6087667942 L -0.2902344763 0.3073914051 L -0.5706925988 0.5832292438 L -0.5657762289 0.6442109346 L -0.3674018383 0.2772150040 L -0.5790590048 0.4808012247 L -0.3829382062 0.1518871486 L -0.3636212945 0.3996013403 L -0.3719620109 0.2713861763 L -0.4994530678 0.3044236898 L -0.3159398735 -0.0201248005 L -0.6898441911 0.0840430409 L -0.4843970239 0.0263934806 L -0.4314195812 -0.2985772491 L -0.4801315963 -0.3063287437 L -0.4526919425 -0.1820725948 L -0.4226042926 -0.2801684141 L -0.3453123569 -0.4942801595 L -0.5826355219 -0.4949773252 L -0.6211405993 -0.4299353957 L -0.6103347540 -0.4546403587 Z M -0.2373057455 0.0438369736 L -0.3063875139 0.1355578899 L -0.1638046205 -0.0154281883 L -0.4687410593 0.1082780659 L -0.3651874065 0.1854619980 L -0.4115832448 0.0232470036 L -0.2175029218 0.3421458006 L 0.0326723754 0.2507743537 L -0.1664895564 0.2789841294 L -0.1799614131 0.1784405708 L -0.0920714140 0.3760473430 L -0.0125246756 0.1361679435 L -0.1416051686 0.2236121595 L 0.1511402875 0.3379152119 L -0.0910345316 0.4289065599 L 0.1443543136 0.2934197485 L 0.0810062289 0.0438074544 L 0.3063925505 0.2821950614 L -0.0449981466 0.2581389546 L 0.0854395926 0.0528362431 L 0.2224378735 0.2352965772 L 0.3515253663 0.0874702781 L 0.4534252882 0.2636899948 L 0.2431462258 0.0001910098 L 0.1015618742 0.0539262220 L 0.3285050988 -0.1832991391 L 0.2987216711 -0.0286900848 L 0.2384124398 -0.0759301260 L -0.0812912881 -0.3276998997 L -0.0164258555 -0.3455935419 L -0.0946191996 -0.2891138494 L -0.0497247949 -0.3069086671 L -0.2603819370 -0.3634280264 L 0.0993251204 -0.2322873771 L 0.0176783651 -0.1744873524 L -0.4210351408 -0.0997784734 L -0.2239840627 0.0462330282 L -0.2231680155 0.0495854318 L -0.2760682106 -0.0637637079 L -0.2373057455 0.0438369736 Z" ``` Let me know, if you need more precision. I still can't reproduce with the new test case. Could you crank up the number of decimals to something ridiculous like 30? I also ran the fuzzer again on 6 cores of a rather beefy desktop computer for about 2 days without running into any assertion (turned the assertions into a release asserts to tessellate as fast as possible). Lyon's fuzzer is all about generating random self-intersecting torture cases, but it could mean that there is something specific about how you generate these paths that the fuzzer isn't running into, so I'm interested in any detail you can provide about how you make these paths. I notice that the coordinate range is within `[-1, 1]` in both test cases so I'll try to force that and see if it helps. If you have some code somewhere online I can look at it might help. > Could you crank up the number of decimals to something ridiculous like 30? Sure I can, but wouldn't it help if I serialized the f32s as bits instead? Don't know the internals of the float parsing code in std, but I can imagine the f32 you get after de-serializing could be different from the one I serialized. I quickly checked and the values matched for this test case so that shouldn't be the problem, but still... Output with 30 decimal places of precision: ```text test case (30 decimal places): " M -0.820767998695373535156250000000 -0.868897199630737304687500000000 L -0.774230778217315673828125000000 -0.469824731349945068359375000000 L -0.939370274543762207031250000000 -0.732960641384124755859375000000 L -0.887454032897949218750000000000 -0.479189932346343994140625000000 L -0.688982188701629638671875000000 -0.332908362150192260742187500000 L -0.946678519248962402343750000000 -0.430366009473800659179687500000 L -0.955367445945739746093750000000 -0.466288536787033081054687500000 L -0.610970020294189453125000000000 -0.432987570762634277343750000000 L -0.878010630607604980468750000000 -0.290679007768630981445312500000 L -0.708902001380920410156250000000 -0.003754645586013793945312500000 L -0.925239980220794677734375000000 -0.336054563522338867187500000000 L -0.601964950561523437500000000000 -0.205803334712982177734375000000 L -0.936181068420410156250000000000 -0.235216617584228515625000000000 L -0.769187271595001220703125000000 0.038380760699510574340820312500 L -0.936286270618438720703125000000 0.151381433010101318359375000000 L -0.983901917934417724609375000000 0.112585484981536865234375000000 L -0.982519149780273437500000000000 0.245664328336715698242187500000 L -0.732174694538116455078125000000 0.400337606668472290039062500000 L -0.889004468917846679687500000000 0.163197502493858337402343750000 L -0.838020920753479003906250000000 0.477236807346343994140625000000 L -0.970119476318359375000000000000 0.502191364765167236328125000000 L -0.736707091331481933593750000000 0.268903791904449462890625000000 L -0.735817611217498779296875000000 0.669790506362915039062500000000 L -0.691456496715545654296875000000 0.376723110675811767578125000000 L -0.612380027770996093750000000000 0.528031527996063232421875000000 L -0.870659887790679931640625000000 0.693230986595153808593750000000 L -0.907140910625457763671875000000 0.624112844467163085937500000000 L -0.720378696918487548828125000000 0.618634819984436035156250000000 L -0.614581048488616943359375000000 0.965630292892456054687500000000 L -0.469006776809692382812500000000 0.950183153152465820312500000000 L -0.346937805414199829101562500000 0.734368205070495605468750000000 L -0.306947946548461914062500000000 0.919136047363281250000000000000 L -0.403412669897079467773437500000 0.693703830242156982421875000000 L -0.233073368668556213378906250000 0.662654161453247070312500000000 L -0.150123566389083862304687500000 0.998873353004455566406250000000 L -0.408767879009246826171875000000 0.615178942680358886718750000000 L 0.032753199338912963867187500000 0.684980988502502441406250000000 L -0.028150178492069244384765625000 0.709071636199951171875000000000 L -0.006223298609256744384765625000 0.977367877960205078125000000000 L -0.127821460366249084472656250000 0.843237876892089843750000000000 L 0.193902790546417236328125000000 0.859158575534820556640625000000 L 0.330004990100860595703125000000 0.887573361396789550781250000000 L 0.363957434892654418945312500000 0.628084540367126464843750000000 L 0.160432338714599609375000000000 0.721102714538574218750000000000 L 0.427375555038452148437500000000 0.690101146697998046875000000000 L 0.219188660383224487304687500000 0.943977355957031250000000000000 L 0.530497074127197265625000000000 0.755945622920989990234375000000 L 0.324372202157974243164062500000 0.878800928592681884765625000000 L 0.415360659360885620117187500000 0.753980696201324462890625000000 L 0.538818418979644775390625000000 0.681653261184692382812500000000 L 0.490261524915695190429687500000 0.946822643280029296875000000000 L 0.617366373538970947265625000000 0.764568567276000976562500000000 L 0.569748520851135253906250000000 0.890717089176177978515625000000 L 0.722083389759063720703125000000 0.940107583999633789062500000000 L 0.572138488292694091796875000000 0.959027886390686035156250000000 L 0.615992724895477294921875000000 0.815077781677246093750000000000 L 0.628164887428283691406250000000 0.659011006355285644531250000000 L 0.691661298274993896484375000000 0.966132164001464843750000000000 L 0.904409468173980712890625000000 0.827141165733337402343750000000 L 0.848270177841186523437500000000 0.776462733745574951171875000000 L 0.877351164817810058593750000000 0.689903676509857177734375000000 L 0.706352293491363525390625000000 0.509139776229858398437500000000 L 0.986030340194702148437500000000 0.528909444808959960937500000000 L 0.689272046089172363281250000000 0.456759631633758544921875000000 L 0.725610852241516113281250000000 0.677772939205169677734375000000 L 0.797772765159606933593750000000 0.374799907207489013671875000000 L 0.889284431934356689453125000000 0.606211602687835693359375000000 L 0.864991903305053710937500000000 0.531937837600708007812500000000 L 0.651759624481201171875000000000 0.315433353185653686523437500000 L 0.749375462532043457031250000000 0.309715449810028076171875000000 L 0.762195765972137451171875000000 0.176018744707107543945312500000 L 0.663044631481170654296875000000 0.036497622728347778320312500000 L 0.837562561035156250000000000000 0.203484758734703063964843750000 L 0.719028830528259277343750000000 0.117038197815418243408203125000 L 0.666371107101440429687500000000 0.017834043130278587341308593750 L 0.984323024749755859375000000000 -0.175003737211227416992187500000 L 0.738341629505157470703125000000 -0.066605061292648315429687500000 L 0.931481480598449707031250000000 -0.172473207116127014160156250000 L 0.764984965324401855468750000000 -0.185299202799797058105468750000 L 0.728210568428039550781250000000 -0.102031573653221130371093750000 L 0.619677066802978515625000000000 -0.273904234170913696289062500000 L 0.945275247097015380859375000000 -0.443298578262329101562500000000 L 0.998236238956451416015625000000 -0.361285507678985595703125000000 L 0.654063344001770019531250000000 -0.664580345153808593750000000000 L 0.861487925052642822265625000000 -0.526757955551147460937500000000 L 0.762971699237823486328125000000 -0.608064353466033935546875000000 L 0.976623892784118652343750000000 -0.817544102668762207031250000000 L 0.764618515968322753906250000000 -0.705117166042327880859375000000 L 0.747276067733764648437500000000 -0.647884964942932128906250000000 L 0.649873971939086914062500000000 -0.732300281524658203125000000000 L 0.840369224548339843750000000000 -0.808804452419281005859375000000 L 0.743956565856933593750000000000 -0.740511178970336914062500000000 L 0.754655301570892333984375000000 -0.761724770069122314453125000000 L 0.753927707672119140625000000000 -0.631717562675476074218750000000 L 0.674793720245361328125000000000 -0.968883514404296875000000000000 L 0.583173811435699462890625000000 -0.682294726371765136718750000000 L 0.271025538444519042968750000000 -0.921260237693786621093750000000 L 0.376918226480484008789062500000 -0.847977697849273681640625000000 L 0.206407427787780761718750000000 -0.776988267898559570312500000000 L 0.331318438053131103515625000000 -0.986029803752899169921875000000 L 0.311335146427154541015625000000 -0.650478482246398925781250000000 L 0.189888030290603637695312500000 -0.675223231315612792968750000000 L 0.168936789035797119140625000000 -0.752263128757476806640625000000 L -0.054761059582233428955078125000 -0.786791324615478515625000000000 L -0.245957463979721069335937500000 -0.692692756652832031250000000000 L -0.000423952937126159667968750000 -0.758343160152435302734375000000 L -0.392829596996307373046875000000 -0.815822720527648925781250000000 L -0.347929030656814575195312500000 -0.672215342521667480468750000000 L -0.162225365638732910156250000000 -0.769825041294097900390625000000 L -0.336544960737228393554687500000 -0.979064226150512695312500000000 L -0.316436469554901123046875000000 -0.961532413959503173828125000000 L -0.341571271419525146484375000000 -0.868760585784912109375000000000 L -0.436090022325515747070312500000 -0.708617329597473144531250000000 L -0.548117876052856445312500000000 -0.668061316013336181640625000000 L -0.467801719903945922851562500000 -0.690476953983306884765625000000 L -0.530460298061370849609375000000 -0.836250960826873779296875000000 L -0.740414202213287353515625000000 -0.764695644378662109375000000000 L -0.820767998695373535156250000000 -0.868897199630737304687500000000 Z M -0.610334753990173339843750000000 -0.454640358686447143554687500000 L -0.437310427427291870117187500000 -0.377017438411712646484375000000 L -0.571315407752990722656250000000 -0.491691946983337402343750000000 L -0.302233338356018066406250000000 -0.424731045961380004882812500000 L -0.502772748470306396484375000000 -0.450649291276931762695312500000 L -0.484167039394378662109375000000 -0.367962837219238281250000000000 L -0.151191234588623046875000000000 -0.649599432945251464843750000000 L -0.345602273941040039062500000000 -0.360152006149291992187500000000 L -0.314984858036041259765625000000 -0.531292855739593505859375000000 L -0.187336176633834838867187500000 -0.639136195182800292968750000000 L 0.083364039659500122070312500000 -0.432196915149688720703125000000 L 0.031622178852558135986328125000 -0.334992617368698120117187500000 L 0.031234703958034515380859375000 -0.673083186149597167968750000000 L -0.048347324132919311523437500000 -0.387079417705535888671875000000 L -0.064521320164203643798828125000 -0.598339021205902099609375000000 L 0.223088726401329040527343750000 -0.488130182027816772460937500000 L 0.035713300108909606933593750000 -0.485630363225936889648437500000 L 0.364452302455902099609375000000 -0.437307655811309814453125000000 L 0.278303712606430053710937500000 -0.524681568145751953125000000000 L 0.460404545068740844726562500000 -0.585878193378448486328125000000 L 0.407896369695663452148437500000 -0.331653654575347900390625000000 L 0.317936033010482788085937500000 -0.617357075214385986328125000000 L 0.396358251571655273437500000000 -0.410816609859466552734375000000 L 0.671997964382171630859375000000 -0.566012203693389892578125000000 L 0.309057742357254028320312500000 -0.277931511402130126953125000000 L 0.411254107952117919921875000000 -0.365061491727828979492187500000 L 0.490344256162643432617187500000 -0.272872984409332275390625000000 L 0.308505356311798095703125000000 -0.277227550745010375976562500000 L 0.438794761896133422851562500000 -0.245206683874130249023437500000 L 0.340925097465515136718750000000 -0.090185895562171936035156250000 L 0.314354062080383300781250000000 -0.099711060523986816406250000000 L 0.479844480752944946289062500000 -0.065361686050891876220703125000 L 0.471898138523101806640625000000 0.313385546207427978515625000000 L 0.621636629104614257812500000000 0.019137203693389892578125000000 L 0.303799092769622802734375000000 0.202200591564178466796875000000 L 0.484558075666427612304687500000 0.525053739547729492187500000000 L 0.463650852441787719726562500000 0.320967584848403930664062500000 L 0.520321846008300781250000000000 0.538940846920013427734375000000 L 0.631612181663513183593750000000 0.566987514495849609375000000000 L 0.459163248538970947265625000000 0.428419470787048339843750000000 L 0.336418092250823974609375000000 0.450878590345382690429687500000 L 0.078062191605567932128906250000 0.558227121829986572265625000000 L 0.273350685834884643554687500000 0.309339344501495361328125000000 L 0.283313333988189697265625000000 0.391871422529220581054687500000 L 0.180825293064117431640625000000 0.530259013175964355468750000000 L -0.175274446606636047363281250000 0.636466145515441894531250000000 L -0.209672018885612487792968750000 0.650701522827148437500000000000 L -0.034973818808794021606445312500 0.570641160011291503906250000000 L -0.146832212805747985839843750000 0.569129765033721923828125000000 L -0.110096544027328491210937500000 0.484444499015808105468750000000 L -0.202158361673355102539062500000 0.608766794204711914062500000000 L -0.290234476327896118164062500000 0.307391405105590820312500000000 L -0.570692598819732666015625000000 0.583229243755340576171875000000 L -0.565776228904724121093750000000 0.644210934638977050781250000000 L -0.367401838302612304687500000000 0.277215003967285156250000000000 L -0.579059004783630371093750000000 0.480801224708557128906250000000 L -0.382938206195831298828125000000 0.151887148618698120117187500000 L -0.363621294498443603515625000000 0.399601340293884277343750000000 L -0.371962010860443115234375000000 0.271386176347732543945312500000 L -0.499453067779541015625000000000 0.304423689842224121093750000000 L -0.315939873456954956054687500000 -0.020124800503253936767578125000 L -0.689844191074371337890625000000 0.084043040871620178222656250000 L -0.484397023916244506835937500000 0.026393480598926544189453125000 L -0.431419581174850463867187500000 -0.298577249050140380859375000000 L -0.480131596326828002929687500000 -0.306328743696212768554687500000 L -0.452691942453384399414062500000 -0.182072594761848449707031250000 L -0.422604292631149291992187500000 -0.280168414115905761718750000000 L -0.345312356948852539062500000000 -0.494280159473419189453125000000 L -0.582635521888732910156250000000 -0.494977325201034545898437500000 L -0.621140599250793457031250000000 -0.429935395717620849609375000000 L -0.610334753990173339843750000000 -0.454640358686447143554687500000 Z M -0.237305745482444763183593750000 0.043836973607540130615234375000 L -0.306387513875961303710937500000 0.135557889938354492187500000000 L -0.163804620504379272460937500000 -0.015428188256919384002685546875 L -0.468741059303283691406250000000 0.108278065919876098632812500000 L -0.365187406539916992187500000000 0.185461997985839843750000000000 L -0.411583244800567626953125000000 0.023247003555297851562500000000 L -0.217502921819686889648437500000 0.342145800590515136718750000000 L 0.032672375440597534179687500000 0.250774353742599487304687500000 L -0.166489556431770324707031250000 0.278984129428863525390625000000 L -0.179961413145065307617187500000 0.178440570831298828125000000000 L -0.092071413993835449218750000000 0.376047343015670776367187500000 L -0.012524675577878952026367187500 0.136167943477630615234375000000 L -0.141605168581008911132812500000 0.223612159490585327148437500000 L 0.151140287518501281738281250000 0.337915211915969848632812500000 L -0.091034531593322753906250000000 0.428906559944152832031250000000 L 0.144354313611984252929687500000 0.293419748544692993164062500000 L 0.081006228923797607421875000000 0.043807454407215118408203125000 L 0.306392550468444824218750000000 0.282195061445236206054687500000 L -0.044998146593570709228515625000 0.258138954639434814453125000000 L 0.085439592599868774414062500000 0.052836243063211441040039062500 L 0.222437873482704162597656250000 0.235296577215194702148437500000 L 0.351525366306304931640625000000 0.087470278143882751464843750000 L 0.453425288200378417968750000000 0.263689994812011718750000000000 L 0.243146225810050964355468750000 0.000191009836271405220031738281 L 0.101561874151229858398437500000 0.053926222026348114013671875000 L 0.328505098819732666015625000000 -0.183299139142036437988281250000 L 0.298721671104431152343750000000 -0.028690084815025329589843750000 L 0.238412439823150634765625000000 -0.075930126011371612548828125000 L -0.081291288137435913085937500000 -0.327699899673461914062500000000 L -0.016425855457782745361328125000 -0.345593541860580444335937500000 L -0.094619199633598327636718750000 -0.289113849401473999023437500000 L -0.049724794924259185791015625000 -0.306908667087554931640625000000 L -0.260381937026977539062500000000 -0.363428026437759399414062500000 L 0.099325120449066162109375000000 -0.232287377119064331054687500000 L 0.017678365111351013183593750000 -0.174487352371215820312500000000 L -0.421035140752792358398437500000 -0.099778473377227783203125000000 L -0.223984062671661376953125000000 0.046233028173446655273437500000 L -0.223168015480041503906250000000 0.049585431814193725585937500000 L -0.276068210601806640625000000000 -0.063763707876205444335937500000 L -0.237305745482444763183593750000 0.043836973607540130615234375000 Z" ``` Output as bits as defined by https://doc.rust-lang.org/stable/std/primitive.f32.html#method.to_bits : ```text test case (u32 bits): " M 3209829850 3210637324 L 3209049085 3203435742 L 3211819666 3208356687 L 3210948656 3203749986 L 3207618851 3198841591 L 3211942278 3202111727 L 3212088054 3203317087 L 3206310024 3202199692 L 3210790222 3197424609 L 3207953050 3145076864 L 3211582599 3198947160 L 3206158944 3193093660 L 3211766160 3195067552 L 3208964469 1025324325 L 3211767925 1041957820 L 3212566783 1038521144 L 3212543584 1048285038 L 3208343501 1053620493 L 3210974668 1042750783 L 3210119306 1056200802 L 3212335552 1057001373 L 3208419542 1049210306 L 3208404619 1059813220 L 3207660363 1052828122 L 3206333680 1057434899 L 3210666897 1060206486 L 3211278947 1059046876 L 3208145597 1058954970 L 3206370607 1064776588 L 3203408296 1064517428 L 3199312341 1060896654 L 3197970504 1063996544 L 3201207323 1060214419 L 3194923721 1059693492 L 3189357054 1065334314 L 3201387014 1058896990 L 1023813688 1060068074 L 3169229620 1060472248 L 3150703824 1064973512 L 3187860385 1062723184 L 1044811380 1062990289 L 1051260522 1063467010 L 1052399777 1059113510 L 1042565216 1060674096 L 1054527736 1060153976 L 1046508286 1064413312 L 1057476264 1061258663 L 1051071517 1063319833 L 1054124583 1061225697 L 1057615873 1060012244 L 1056637839 1064461048 L 1058933689 1061403332 L 1058134794 1063519753 L 1060690549 1064348388 L 1058174891 1064665818 L 1058910643 1062250736 L 1059114858 1059632370 L 1060180151 1064785008 L 1063749473 1062453126 L 1062807612 1061602883 L 1063295510 1060150663 L 1060426625 1057117948 L 1065118844 1057449628 L 1060140066 1055513702 L 1060749730 1059947143 L 1061960406 1052763590 L 1063495717 1058746543 L 1063088156 1057500436 L 1059510712 1050771579 L 1061148434 1050579718 L 1061363523 1043611202 L 1059700043 1024818824 L 1062627968 1045454415 L 1060639302 1039118777 L 1059755852 1016207539 L 1065090200 3191026734 L 1060963317 3179833404 L 1064203666 3190856913 L 1061410318 3191717651 L 1060793346 3184588270 L 1058972456 3196861741 L 1064435087 3202545672 L 1065323625 3199793770 L 1059549362 3207209456 L 1063029369 3204897180 L 1061376541 3206261275 L 1064961030 3209775762 L 1061404170 3207889551 L 1061113212 3206929354 L 1059479076 3208345608 L 1062675056 3209629135 L 1061057520 3208483364 L 1061237015 3208839269 L 1061224808 3206658110 L 1059897160 3212314816 L 1058360033 3207506654 L 1049281500 3211515830 L 1052834669 3210286353 L 1045650552 3209095348 L 1051304594 3212602483 L 1050634066 3206972866 L 1044541954 3207388014 L 1043135940 3208680529 L 3177205026 3209259816 L 3195788358 3207681104 L 3118351872 3208782535 L 3200852214 3209746882 L 3199345601 3207337550 L 3190169192 3208975169 L 3198963615 3212485620 L 3198288886 3212191485 L 3199132270 3210635032 L 3202303793 3207948274 L 3205255540 3207267857 L 3203367861 3207643929 L 3204959295 3210089611 L 3208481737 3208889112 L 3209829850 3210637324 Z M 3206299366 3202926239 L 3202344743 3200321646 L 3205644730 3204169484 L 3197812308 3201922649 L 3204494775 3202792321 L 3203916990 3200017824 L 3189428704 3206958118 L 3199267528 3199755736 L 3198240178 3204973263 L 3191854350 3206782574 L 1034599108 3202173162 L 1023510082 3198911527 L 1023401964 3207352110 L 3175483352 3200659270 L 3179553729 3206098111 L 1046770015 3204049971 L 1024608284 3203966091 L 1052416382 3202344650 L 1049525715 3204862344 L 1055636005 3205889053 L 1053874123 3198799490 L 1050855555 3206417181 L 1053486968 3201455758 L 1059850255 3205555757 L 1050557649 3196996874 L 1053986790 3199920471 L 1056640615 3196827138 L 1050539114 3196973253 L 1054910901 3195737974 L 1051626940 3182998370 L 1050735364 3184276816 L 1056288301 3179666521 L 1056021666 1050702866 L 1059005332 1016907168 L 1050381198 1045368236 L 1056446463 1057384940 L 1055744933 1050957277 L 1057305552 1057617927 L 1059172694 1058088472 L 1055594354 1054562764 L 1051475710 1055316367 L 1033887506 1057941497 L 1049359519 1050567098 L 1049693810 1053336415 L 1043933764 1057472270 L 3191044901 1059254130 L 3193353283 1059492960 L 3171893429 1058149770 L 3189136175 1058124413 L 3185670732 1056442652 L 3192849050 1058789412 L 3197409693 1050501736 L 3205634281 1058360963 L 3205551798 1059384066 L 3199999000 1049489184 L 3205774646 1056320404 L 3200520314 1041991758 L 3199872146 1053595788 L 3200152014 1049293601 L 3204429904 1050402156 L 3198272223 3164921028 L 3207633313 1034690242 L 3203924707 1020802852 L 3202147079 3197689630 L 3203781583 3197949727 L 3202860861 3191501117 L 3201851287 3197071932 L 3199257800 3204256330 L 3205834650 3204279723 L 3206480658 3202097278 L 3206299366 3202926239 Z M 3195207751 1026788966 L 3197951699 1040895920 L 3190275174 3162293891 L 3203399380 1037943012 L 3199924696 1044244928 L 3201481482 1019113600 L 3193878806 1051667900 L 1023791992 1048601983 L 3190455357 1049548546 L 3191359438 1043773728 L 3183251440 1052805447 L 3159176268 1040936860 L 3188785394 1046805142 L 1041941637 1051525945 L 3183112272 1054579108 L 1041486238 1050032925 L 1034282648 1026781042 L 1050468220 1049656287 L 3174584314 1048849098 L 1034877684 1029204689 L 1046726337 1047589270 L 1051982626 1035150238 L 1055401820 1049035360 L 1048116051 961038800 L 1037041580 1029497278 L 1051210194 3191583429 L 1050210828 3169519480 L 1047798372 3181084993 L 3181804556 3198666824 L 3162935172 3199267235 L 3183593398 3197372091 L 3175853114 3197969186 L 3196408008 3199865661 L 1036741368 3194870974 L 1016123960 3190992080 L 3201798635 3184285864 L 3194313748 1027432152 L 3194258984 1028332056 L 3196934352 3179452044 L 3195207751 1026788966 Z" ``` Also, importantly: we use `lyon::tessellation::FillOptions::non_zero()`. I probably should have mentioned this :thinking: If this doesn't help reproducing, I'll try and debug the issue on my end. > If you have some code somewhere online I can look at it might help. Afraid I can't share the code that generated this path, but the rough idea is that we rebuild (via `walk_along_path`) an existing simpler path, and randomly offset points both along the tangent and the normal, while also randomly prolonging or shortening the interval between points. Damn. When I ran with `FillOptions::default()`, I didn't trigger the assertion either, only `FillOptions::non_zero()` triggers it. I should have noticed this sooner. Aha! Silly me, I should have tried this. With the non-zero fill rule I can reproduce the issue with all of the test cases you provided. I have to confess the non-zero fill rule is not as well tested as even-odd which needs to change. The upside is that I've been pushing the fuzzing parameters far enough that I managed to find another bug. > Afraid I can't share the code that generated this path, but the rough idea is that we rebuild (via walk_along_path) an existing simpler path, and randomly offset points both along the tangent and the normal, while also randomly prolonging or shortening the interval between points. Sound like fun!
[ "562" ]
0.15
nical/lyon
2020-04-23T21:45:52Z
diff --git a/tessellation/src/fill_tests.rs b/tessellation/src/fill_tests.rs --- a/tessellation/src/fill_tests.rs +++ b/tessellation/src/fill_tests.rs @@ -135,7 +135,7 @@ fn test_path_with_rotations(path: Path, step: f32, expected_triangle_count: Opti let mut angle = Angle::radians(0.0); while angle.radians < PI * 2.0 { - println!("\n\n ==================== angle = {:?}", angle); + //println!("\n\n ==================== angle = {:?}", angle); let tranformed_path = path.transformed(&Rotation::new(angle)); diff --git a/tessellation/src/fill_tests.rs b/tessellation/src/fill_tests.rs --- a/tessellation/src/fill_tests.rs +++ b/tessellation/src/fill_tests.rs @@ -2188,3 +2188,201 @@ fn issue_529() { // SVG path syntax: // "M 203.01 174.67 L 203.04 174.72 L 203 174.68 ZM 203 174.66 L 203.01 174.68 L 202.99 174.68 Z" } + +#[test] +fn issue_562_1() { + let mut builder = Path::builder(); + + builder.begin(point(757.26587, 494.72363)); + builder.line_to(point(833.3479, 885.81494)); + builder.line_to(point(342.08817, 855.6907)); + builder.close(); + + builder.begin(point(580.21893, 759.2482)); + builder.line_to(point(545.2758, 920.6801)); + builder.line_to(point(739.3726, 23.550331)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M 757.26587 494.72363 L 833.3479 885.81494 L 342.08817 855.6907 ZM 580.21893 759.2482 L 545.2758 920.6801 L 739.3726 23.550331 Z" +} + +#[test] +fn issue_562_2() { + let mut builder = Path::builder(); + + builder.begin(point(3071.0, 737.0)); + builder.line_to(point(3071.0, 738.0)); + builder.line_to(point(3071.0, 738.0)); + builder.close(); + + builder.begin(point(3071.0, 3071.0)); + builder.line_to(point(3071.0, 703.0)); + builder.line_to(point(3071.0, 703.0)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M 3071 737 L 3071 738 L 3071 738 ZM 3071 3071 L 3071 703 L 3071 703 Z" +} + +#[test] +fn issue_562_3() { + let mut builder = Path::builder(); + + builder.begin(point(4224.0, -128.0)); + builder.line_to(point(3903.0, 3615.0)); + builder.line_to(point(3903.0, 3590.0)); + builder.line_to(point(3893.0, 3583.0)); + builder.close(); + + builder.begin(point(3898.0, 3898.0)); + builder.line_to(point(3898.0, 3585.0)); + builder.line_to(point(3897.0, 3585.0)); + builder.close(); + + builder.begin(point(3899.0, 3899.0)); + builder.line_to(point(3899.0, 1252.0)); + builder.line_to(point(3899.0, 1252.0)); + builder.close(); + + builder.begin(point(3897.0, 3897.0)); + builder.line_to(point(3897.0, 3536.0)); + builder.line_to(point(3897.0, 3536.0)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M 4224 -128 L 3903 3615 L 3903 3590 L 3893 3583 ZM 3898 3898 L 3898 3585 L 3897 3585 ZM 3899 3899 L 3899 1252 L 3899 1252 ZM 3897 3897 L 3897 3536 L 3897 3536 Z" +} + +#[test] +fn issue_562_4() { + let mut builder = Path::builder(); + + builder.begin(point(160.39546, 11.226683)); + builder.line_to(point(160.36594, 11.247373)); + builder.line_to(point(160.32234, 11.28461)); + builder.line_to(point(160.36172, 11.299779)); + builder.line_to(point(160.39265, 11.361827)); + builder.close(); + + builder.begin(point(160.36313, 160.36313)); + builder.line_to(point(160.36313, 11.14253)); + builder.line_to(point(160.36313, 11.14253)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M 160.39546 11.226683 L 160.36594 11.247373 L 160.32234 11.28461 L 160.36172 11.299779 L 160.39265 11.361827 ZM 160.36313 160.36313 L 160.36313 11.14253 L 160.36313 11.14253 Z" +} + +#[test] +fn issue_562_5() { + let mut builder = Path::builder(); + + builder.begin(point(0.88427734, 0.2277832)); + builder.line_to(point(0.88671875, 0.22143555)); + builder.line_to(point(0.91259766, 0.23803711)); + builder.line_to(point(0.8869629, 0.22607422)); + builder.line_to(point(0.88793945, 0.22827148)); + builder.line_to(point(0.8869629, 0.22607422)); + builder.line_to(point(0.89453125, 0.2265625)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M 0.88427734 0.2277832 L 0.88671875 0.22143555 L 0.91259766 0.23803711 L 0.8869629 0.22607422 L 0.88793945 0.22827148 L 0.8869629 0.22607422 L 0.89453125 0.2265625 Z" +} + +#[test] +fn issue_562_6() { + let mut builder = Path::builder(); + + builder.begin(point(-499.51904, 864.00793)); + builder.line_to(point(510.1705, -862.41235)); + builder.line_to(point(1005.31006, 6.4012146)); + builder.line_to(point(-994.65857, -4.8055725)); + builder.line_to(point(-489.81372, -868.01575)); + builder.line_to(point(500.4652, 869.6113)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M -499.51904 864.00793 L 510.1705 -862.41235 L 1005.31006 6.4012146 L -994.65857 -4.8055725 L -489.81372 -868.01575 L 500.4652 869.6113 Z" +} + +#[test] +fn issue_562_7() { + let mut builder = Path::builder(); + + builder.begin(point(-880.59766, -480.86603)); + builder.line_to(point(878.77014, 470.2519)); + builder.line_to(point(709.1563, 698.824)); + builder.line_to(point(-710.9838, -709.4381)); + builder.line_to(point(-483.84427, -880.9657)); + builder.line_to(point(482.01672, 870.35156)); + builder.line_to(point(215.75311, 970.9385)); + builder.line_to(point(-217.58063, -981.5527)); + builder.line_to(point(66.236084, -1003.05)); + builder.line_to(point(-68.063614, 992.4358)); + builder.line_to(point(-346.44025, 933.1019)); + builder.line_to(point(344.61273, -943.71606)); + builder.line_to(point(594.9969, -808.35785)); + builder.line_to(point(-596.8244, 797.7438)); + builder.line_to(point(934.5602, -358.7028)); + builder.line_to(point(-936.3877, 348.08868)); + builder.line_to(point(-998.05756, 70.22009)); + builder.line_to(point(996.23004, -80.83423)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M -880.59766 -480.86603 L 878.77014 470.2519 L 709.1563 698.824 L -710.9838 -709.4381 L -483.84427 -880.9657 L 482.01672 870.35156 L 215.75311 970.9385 L -217.58063 -981.5527 L 66.236084 -1003.05 L -68.063614 992.4358 L -346.44025 933.1019 L 344.61273 -943.71606 L 594.9969 -808.35785 L -596.8244 797.7438 L 934.5602 -358.7028 L -936.3877 348.08868 L -998.05756 70.22009 L 996.23004 -80.83423 Z" +} + +#[test] +fn issue_562_8() { + let mut builder = Path::builder(); + + builder.begin(point(997.84753, -18.145767)); + builder.line_to(point(-1001.9789, 8.1993265)); + builder.line_to(point(690.0551, 716.8084)); + builder.line_to(point(-694.1865, -726.7548)); + builder.line_to(point(-589.4575, -814.2759)); + builder.line_to(point(585.3262, 804.3294)); + builder.line_to(point(469.6551, 876.7747)); + builder.line_to(point(-473.78647, -886.7211)); + builder.line_to(point(-349.32822, -942.74115)); + builder.line_to(point(345.1968, 932.7947)); + builder.line_to(point(-218.4011, -981.2923)); + builder.line_to(point(-83.44396, -1001.6565)); + builder.line_to(point(-57.160374, 993.50793)); + builder.line_to(point(53.02899, -1003.4543)); + builder.line_to(point(188.47563, -986.65234)); + builder.line_to(point(-192.60701, 976.7059)); + builder.line_to(point(-324.50436, 941.61707)); + builder.line_to(point(320.37296, -951.56354)); + builder.line_to(point(446.26376, -898.84155)); + builder.line_to(point(-450.39514, 888.89514)); + builder.line_to(point(-567.9344, 819.52203)); + builder.line_to(point(563.80304, -829.4685)); + builder.line_to(point(670.8013, -744.73676)); + builder.line_to(point(-769.3966, 636.2781)); + builder.line_to(point(909.81805, -415.4218)); + builder.close(); + + test_path(builder.build().as_slice()); + + // SVG path syntax: + // "M 997.84753 -18.145767 L -1001.9789 8.1993265 L 690.0551 716.8084 L -694.1865 -726.7548 L -589.4575 -814.2759 L 585.3262 804.3294 L 469.6551 876.7747 L -473.78647 -886.7211 L -349.32822 -942.74115 L 345.1968 932.7947 L -218.4011 -981.2923 L -83.44396 -1001.6565 L -57.160374 993.50793 L 53.02899 -1003.4543 L 188.47563 -986.65234 L -192.60701 976.7059 L -324.50436 941.61707 L 320.37296 -951.56354 L 446.26376 -898.84155 L -450.39514 888.89514 L -567.9344 819.52203 L 563.80304 -829.4685 L 670.8013 -744.73676 L -769.3966 636.2781 L 909.81805 -415.4218 Z" +} +
FillTessellator with non-zero fill rule panics with 'assertion failed: self.fill.spans.is_empty()' Hello, First of all, really sorry that the bug reproduction is not as minimal as it could be (see attached `Path`). I can spend some more time on this later, if it helps. Version: `0.15.6` The panic is a `debug_assert!` in `FillTessellator::tessellate_impl` happening in the intersection handling mode: ```rust if !self.assume_no_intersection { debug_assert!(self.active.edges.is_empty()); debug_assert!(self.fill.spans.is_empty()); } // There shouldn't be any span left after the tessellation ends. // If for whatever reason (bug) there are, flush them so that we don't // miss the triangles they contain. for span in &mut self.fill.spans { if !span.remove { span.tess.flush(builder); } } ``` With debug assertions disabled, the panic doesn't happen, but the resulting geometry has missing sections. The path that produced the result: ``` [renderer\src\renderer.rs:1138] b.build() = Path { points: [ (-0.60259604,-0.58157045), (-0.59677887,-0.5092269), (-0.6174213,-0.5267591), (-0.61093175,-0.46566024), (-0.5861228,-0.41503733), (-0.61833483,-0.40764514), (-0.61942095,-0.3795996), (-0.57637125,-0.36358547), (-0.60975134,-0.3158738), (-0.5886128,-0.26188445), (-0.615655,-0.29995453), (-0.5752456,-0.27125803), (-0.61702263,-0.24840377), (-0.59614843,-0.18031535), (-0.6170358,-0.16135482), (-0.62298775,-0.1401929), (-0.6228149,-0.10120473), (-0.59152186,-0.050876297), (-0.6111256,-0.04873301), (-0.60475266,-0.0018536113), (-0.62126493,0.010817773), (-0.5920884,0.0062524937), (-0.59197724,0.06690842), (-0.5864321,0.052761808), (-0.5765475,0.105109796), (-0.6088325,0.15463106), (-0.61339265,0.17660378), (-0.5773294,0.23629637), (-0.6207038,0.28113014), (-0.6187729,0.32698315), (-0.59179604,0.35906404), (-0.614892,0.38619053), (-0.586713,0.38986617), (-0.5828318,0.42302912), (-0.6248592,0.46195307), (-0.5768974,0.45683885), (-0.58562267,0.54633164), (-0.58863395,0.55197126), (-0.622171,0.5798707), (-0.6041322,0.60540473), (-0.5428574,0.6073949), (-0.49670452,0.6109467), (-0.46826607,0.5785106), (-0.4918129,0.59013784), (-0.42939848,0.58626264), (-0.4484358,0.61799717), (-0.3978513,0.5944932), (-0.39727977,0.60985017), (-0.37688425,0.59424764), (-0.3527931,0.5852067), (-0.3457066,0.61835283), (-0.32513332,0.5955711), (-0.32902676,0.6113396), (-0.30619046,0.6175135), (-0.29688856,0.61987853), (-0.2844228,0.6018847), (-0.25545648,0.5823764), (-0.22642548,0.6207665), (-0.20151892,0.61305124), (-0.17513536,0.6060338), (-0.14052011,0.6096689), (-0.1033149,0.588294), (-0.10065438,0.6232538), (-0.07159888,0.58615905), (-0.09497244,0.5907014), (-0.033542663,0.5997216), (-0.03461238,0.6111606), (-0.016603516,0.608124), (0.03890508,0.58146995), (0.052306406,0.593672), (0.0832663,0.5952745), (0.122955725,0.5828806), (0.11377947,0.6046953), (0.15270458,0.5898786), (0.19612166,0.5832964), (0.24701829,0.6230404), (0.23935774,0.5922927), (0.27105954,0.6164352), (0.2878405,0.59562314), (0.31238535,0.59102637), (0.35035154,0.57745963), (0.39165956,0.6181594), (0.3967888,0.6247795), (0.4631457,0.58175796), (0.47948575,0.60768604), (0.5105501,0.5953715), (0.571468,0.622078), (0.56343484,0.59557736), (0.5667347,0.59340954), (0.58849484,0.5812343), (0.60110056,0.5824008), (0.5925639,0.554705), (0.5952156,0.52566063), (0.5789647,0.50823784), (0.62111044,0.48361027), (0.58528686,0.44653568), (0.61515754,0.4052647), (0.6059972,0.41006753), (0.59712356,0.35409263), (0.62325376,0.3479237), (0.58130985,0.3200769), (0.5844029,0.2710338), (0.5940329,0.24385622), (0.5983489,0.20151895), (0.5865866,0.14628445), (0.5947929,0.15216458), (0.6019779,0.068069965), (0.58402693,0.047285147), (0.5962282,0.06835826), (0.62238306,0.042473916), (0.6201916,0.032901905), (0.6085951,-0.0039572464), (0.5885772,-0.033157233), (0.58350766,-0.07931078), (0.5863097,-0.099550486), (0.6045314,-0.12336385), (0.59558696,-0.16949475), (0.5775068,-0.2037091), (0.6233757,-0.20333086), (0.6023864,-0.24556363), (0.6208509,-0.24487463), (0.6140979,-0.28466457), (0.5961493,-0.28554806), (0.59294146,-0.32766032), (0.6149322,-0.32879248), (0.5885359,-0.36302572), (0.60423875,-0.38484472), (0.60595775,-0.37690973), (0.61442167,-0.40872684), (0.59914464,-0.48643023), (0.57834053,-0.48027998), (0.6177974,-0.5173237), (0.6002402,-0.51034313), (0.59600747,-0.54360604), (0.60293674,-0.54362786), (0.6234776,-0.5925645), (0.57233346,-0.58652276), (0.5645269,-0.59446895), (0.50188154,-0.58349663), (0.5216614,-0.5906242), (0.4563698,-0.6070479), (0.49255794,-0.618665), (0.4400403,-0.592449), (0.40736714,-0.58600867), (0.40539715,-0.58021474), (0.3745325,-0.58631366), (0.37698188,-0.5758431), (0.3635959,-0.61922157), (0.32900646,-0.5905947), (0.3197619,-0.5760027), (0.2586821,-0.59875774), (0.2950288,-0.5802172), (0.25808737,-0.5807295), (0.2195605,-0.60770506), (0.19836077,-0.5873924), (0.16206777,-0.5862778), (0.17651996,-0.5773876), (0.16164728,-0.5796963), (0.1320911,-0.6059241), (0.12242479,-0.60222197), (0.09847601,-0.5968505), (0.07492885,-0.5978607), (0.049932566,-0.5947989), (0.0030497573,-0.608694), (-0.03205134,-0.5933147), (-0.05033874,-0.61138254), (-0.067493446,-0.579865), (-0.09693898,-0.57661176), (-0.07316814,-0.59106356), (-0.12402288,-0.5804932), (-0.16019267,-0.58088017), (-0.14007387,-0.58318055), (-0.2034651,-0.57595354), (-0.18248624,-0.60295117), (-0.21558326,-0.6036031), (-0.21937431,-0.6246258), (-0.2518451,-0.6065916), (-0.2374334,-0.5759969), (-0.31872496,-0.5990379), (-0.31005886,-0.5843345), (-0.3181398,-0.57603425), (-0.36501303,-0.6116566), (-0.39997482,-0.5873107), (-0.4124322,-0.6185696), (-0.42816016,-0.5950977), (-0.50068486,-0.57650554), (-0.5380531,-0.6035571), (-0.525106,-0.59686184), (-0.594949,-0.58061665), (-0.57879514,-0.5798233), (-0.29675782,-0.28452057), (-0.24763039,-0.3228382), (-0.20794387,-0.29842067), (-0.21426141,-0.29775405), (-0.14372064,-0.32083926), (-0.12067782,-0.2809099), (-0.08520027,-0.31095064), (-0.08751391,-0.3042702), (-0.036226794,-0.27863735), (-0.018205184,-0.31108704), (-0.025932608,-0.29662612), (-0.0027539898,-0.27848557), (0.020221405,-0.27980366), (0.07470769,-0.28136113), (0.076729596,-0.27798364), (0.1507279,-0.31309813), (0.16384159,-0.32452077), (0.15821922,-0.2813635), (0.17702198,-0.30820543), (0.1931788,-0.28837848), (0.22456959,-0.31963113), (0.26741686,-0.31262013), (0.24365339,-0.31195414), (0.28450483,-0.32311893), (0.2899769,-0.28927734), (0.3054002,-0.31149706), (0.32003966,-0.2669488), (0.3180658,-0.22617309), (0.2820771,-0.19516827), (0.31043264,-0.18790394), (0.31692246,-0.11270481), (0.31096938,-0.1102328), (0.28008324,-0.13458017), (0.28404975,-0.05718037), (0.28717384,-0.01619012), (0.2886603,0.0069112536), (0.3141475,0.025300987), (0.2969753,0.083431676), (0.3058953,0.07754997), (0.29735526,0.10121589), (0.30658162,0.18440203), (0.3178312,0.1805799), (0.3080364,0.20908354), (0.32325375,0.19740905), (0.3023612,0.2065191), (0.28636914,0.20976755), (0.28632414,0.25062406), (0.29063004,0.27398133), (0.30441955,0.2790809), (0.23388645,0.2829509), (0.24248835,0.3074875), (0.2093001,0.32283372), (0.18040219,0.3174637), (0.17111823,0.3044186), (0.12868175,0.3066763), (0.12107556,0.28109536), (0.08493749,0.31363815), (0.06621642,0.31911612), (0.014729233,0.29004174), (0.026758876,0.30046654), (-0.02744952,0.31654358), (-0.0680121,0.29293913), (-0.08377724,0.28104413), (-0.084302515,0.29465106), (-0.1326194,0.31418052), (-0.13527404,0.31053945), (-0.19256584,0.2789343), (-0.1866086,0.28764045), (-0.21125369,0.2797091), (-0.2446407,0.31787658), (-0.26799384,0.3168881), (-0.25821373,0.3002406), (-0.30369022,0.27710253), (-0.308262,0.30638203), (-0.304127,0.24392901), (-0.2844539,0.21547566), (-0.3179056,0.23636363), (-0.3031408,0.1879893), (-0.29248494,0.17064708), (-0.30521703,0.15191133), (-0.30163595,0.09261818), (-0.30107588,0.11501736), (-0.3237576,0.05002614), (-0.3193523,0.04355081), (-0.2817773,0.018528512), (-0.29315352,-0.015802464), (-0.2841787,-0.047852114), (-0.3200281,-0.08511352), (-0.27511322,-0.10760765), (-0.31292272,-0.17306928), (-0.32358846,-0.16101113), (-0.30491018,-0.21262279), (-0.29324737,-0.24626745), (-0.31967318,-0.25357124), (-0.1313625,-0.051560905), (-0.16452262,-0.045776214), (-0.14756282,0.008725138), (-0.15558232,0.031920042), (-0.15406884,0.07536536), (-0.11803106,0.061181977), (-0.13425447,0.09863065), (-0.07760243,0.09327083), (-0.10481052,0.10784877), (-0.12055813,0.108920015), (-0.066495314,0.12169065), (-0.07656256,0.14880407), (-0.07220844,0.15967748), (-0.057043646,0.12403247), (-0.07464621,0.14983201), (-0.057791688,0.16106145), (-0.0024733413,0.14846951), (0.044990394,0.13312174), (0.059183106,0.14213166), (0.06636514,0.14784311), (0.065392286,0.117277846), (0.07669962,0.100540005), (0.08542977,0.12089226), (0.10523389,0.12256271), (0.092723146,0.08747706), (0.110089995,0.061987936), (0.14387512,0.05746229), (0.14404552,0.034098938), (0.1374408,0.013244936), (0.14449653,-0.039051503), (0.15886287,-0.061389275), (0.14222021,-0.065283954), (0.14696278,-0.0639164), (0.11313941,-0.09705555), (0.10661489,-0.07139524), (0.09435058,-0.12477098), (0.04344476,-0.14646487), (0.023379706,-0.12777074), (0.01841465,-0.17299202), (-0.031268314,-0.12649246), (-0.06154371,-0.16749237), (-0.039286736,-0.14578591), (-0.08729143,-0.13973206), (-0.059731632,-0.107418336), (-0.057891134,-0.13353941), (-0.08053762,-0.10146829), (-0.07866131,-0.11454674), (-0.11223841,-0.10906139), ], verbs: [ Begin, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, Close, Begin, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, Close, Begin, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, LineTo, Close, ], num_attributes: 0, } ```
08cd4c3d8c1ef53fbbb1b702f655e26c6bd5cc03
[ "earcut_tests::self_touching", "fill_tests::issue_562_1", "fill_tests::issue_562_5", "earcut_tests::eberly_6", "fill_tests::issue_562_6", "fill_tests::issue_481_reduced", "fill_tests::issue_481_original", "fill_tests::issue_562_7", "fuzz_tests::fuzzing_test_case_16", "fuzz_tests::fuzzing_test_case_01", "earcut_tests::water_huge", "fill_tests::n_segments_intersecting" ]
[ "earcut_tests::bad_diagonal", "earcut_tests::building", "earcut_tests::degenerate", "earcut_tests::bad_hole", "earcut_tests::empty_square", "earcut_tests::eberly_3", "earcut_tests::dude", "earcut_tests::issue_16", "earcut_tests::hole_touching_outer", "earcut_tests::issue_17", "earcut_tests::issue_29", "earcut_tests::issue_45", "earcut_tests::outside_ring", "earcut_tests::issue_52", "earcut_tests::issue_34", "earcut_tests::shared_points", "earcut_tests::steiner", "earcut_tests::touching_holes", "earcut_tests::simplified_us_border", "earcut_tests::water_3", "earcut_tests::water_3b", "event_queue::test_event_queue_push_sorted", "event_queue::test_event_queue_sort_2", "event_queue::test_event_queue_sort_1", "event_queue::test_event_queue_sort_4", "fill::fill_vertex_source_02", "fill::fill_vertex_source_03", "fill_tests::back_along_previous_edge", "fill::fill_builder_vertex_source", "earcut_tests::hilbert", "event_queue::test_event_queue_sort_3", "fill_tests::issue_476_original", "fill_tests::issue_529", "event_queue::test_event_queue_sort_5", "fill_tests::issue_562_2", "fill::fill_vertex_source_01", "fill_tests::angle_precision", "fill_tests::issue_518_1", "fill_tests::issue_518_2", "fill_tests::issue_562_3", "fill_tests::issue_476_reduced", "fill_tests::issue_500", "fill_tests::new_tess_2", "fill_tests::issue_562_4", "fill_tests::new_tess_1", "fill_tests::new_tess_coincident_simple", "earcut_tests::water_2", "fill_tests::new_tess_overlapping_1", "fill_tests::new_tess_merge", "fill_tests::reduced_test_case_01", "fill_tests::new_tess_points_too_close", "fill_tests::reduced_test_case_06", "earcut_tests::issue_35", "fill_tests::overlapping_horizontal", "fill_tests::reduced_test_case_08", "fill_tests::reduced_test_case_07", "fill_tests::reduced_test_case_14", "fill_tests::test_auto_intersection_type1", "fill_tests::test_auto_intersection_type2", "fill_tests::reduced_test_case_03", "fill_tests::reduced_test_case_09", "fill_tests::reduced_test_case_11", "fill_tests::reduced_test_case_10", "fill_tests::reduced_test_case_12", "fill_tests::reduced_test_case_02", "fill_tests::reduced_test_case_13", "fill_tests::reduced_test_case_05", "fill_tests::issue_562_8", "fill_tests::reduced_test_case_04", "event_queue::test_logo", "fill_tests::test_chained_merge_end", "fill_tests::test_chained_merge_left", "fill_tests::test_chained_merge_merge", "fill_tests::test_coincident_simple_1", "fill_tests::test_close_at_first_position", "fill_tests::test_coincident_simple_2", "fill_tests::test_chained_merge_split", "fill_tests::test_colinear_3", "fill_tests::test_colinear_4", "earcut_tests::water_4", "fill_tests::test_colinear_touching_squares2", "fill_tests::test_colinear_touching_squares3", "fill_tests::test_colinear_touching_squares", "fill_tests::test_double_merge_with_intersection", "fill_tests::test_exp_no_intersection_01", "fill_tests::test_fixed_to_f32_precision", "fill_tests::test_intersecting_bow_tie", "fill_tests::test_identical_squares", "fill_tests::test_empty_path", "fill_tests::test_no_close", "fill_tests::test_point_on_edge2", "fill_tests::test_intersection_horizontal_precision", "fill_tests::test_point_on_edge_right", "fill_tests::test_intersection_1", "fill_tests::test_point_on_edge_left", "fill_tests::test_overlapping_with_intersection", "fill_tests::test_simple_double_merge", "fill_tests::test_simple_monotone", "fill_tests::test_unknown_issue_1", "fill_tests::three_edges_below", "fill_tests::triangle", "fill_tests::test_split_with_intersections", "fill_tests::test_colinear_2", "fuzz_tests::fuzzing_test_case_15", "fuzz_tests::fuzzing_test_case_12", "fuzz_tests::fuzzing_test_case_11", "fill_tests::test_colinear_1", "fuzz_tests::fuzzing_test_case_14", "fuzz_tests::fuzzing_test_case_18", "fuzz_tests::fuzzing_test_case_20", "fuzz_tests::fuzzing_test_case_10", "fuzz_tests::fuzzing_test_case_19", "fuzz_tests::fuzzing_test_case_17", "fuzz_tests::fuzzing_test_case_21", "fuzz_tests::fuzzing_test_case_13", "fuzz_tests::fuzzing_test_case_24", "fuzz_tests::fuzzing_test_case_22", "fuzz_tests::fuzzing_test_case_4", "fuzz_tests::fuzzing_test_case_6", "fill_tests::test_too_many_vertices", "fuzz_tests::fuzzing_test_case_23", "fuzz_tests::fuzzing_test_case_25", "fill_tests::test_rust_logo_scale_down2", "fill_tests::test_simple_triangle", "stroke::stroke_vertex_source_01", "fuzz_tests::fuzzing_test_case_8", "monotone::test_monotone_tess", "math_utils::test_compute_normal", "fuzz_tests::fuzzing_test_case_7", "fuzz_tests::fuzzing_test_case_9", "stroke::test_empty_caps", "stroke::test_square", "stroke::test_too_many_vertices", "fill_tests::test_coincident_simple_rotated", "stroke::test_empty_path", "fill_tests::test_rust_logo_scale_down", "test_without_miter_limit", "fuzz_tests::fuzzing_test_case_26", "test_with_invalid_miter_limit - should panic", "test_with_miter_limit", "fuzz_tests::fuzzing_test_case_5", "earcut_tests::water", "fill_tests::test_colinear_touching_squares_rotated", "fuzz_tests::fuzzing_test_case_3", "fuzz_tests::fuzzing_test_case_2", "fill_tests::test_degenerate_same_position", "fill_tests::test_intersecting_star_shape", "fill_tests::test_auto_intersection_multi", "fill_tests::test_rust_logo_scale_up", "fill_tests::test_simple_split", "fill_tests::test_simple_1", "fill_tests::test_simple_merge_split", "fill_tests::test_hole_1", "fill_tests::test_simple_aligned", "earcut_tests::water_huge_2", "fill_tests::test_simple_2", "fill_tests::very_large_path", "fill_tests::test_rust_logo_no_intersection", "fill_tests::test_rust_logo_with_intersection", "tessellation/src/geometry_builder.rs - geometry_builder (line 205)", "tessellation/src/geometry_builder.rs - geometry_builder (line 131)", "tessellation/src/stroke.rs - stroke::StrokeTessellator::builder (line 171)", "tessellation/src/fill.rs - fill::FillTessellator::builder (line 623)", "tessellation/src/stroke.rs - stroke::StrokeTessellator (line 47)", "tessellation/src/geometry_builder.rs - geometry_builder (line 72)", "tessellation/src/fill.rs - fill::FillTessellator (line 377)", "tessellation/src/fill.rs - fill::FillTessellator (line 335)" ]
[]
[]
2020-04-23T21:46:13Z
122ee5f0077fcf363745cb6ab1c4641545029efc
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -432,7 +432,7 @@ name = "geom_bench" version = "0.0.1" dependencies = [ "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.3", + "lyon 0.15.5", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -781,13 +781,13 @@ dependencies = [ [[package]] name = "lyon" -version = "0.15.3" +version = "0.15.5" dependencies = [ "lyon_algorithms 0.15.0", "lyon_extra 0.15.0", "lyon_svg 0.15.0", "lyon_tess2 0.15.0", - "lyon_tessellation 0.15.4", + "lyon_tessellation 0.15.5", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -809,7 +809,7 @@ dependencies = [ "gfx_window_glutin 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.3", + "lyon 0.15.5", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -862,14 +862,14 @@ dependencies = [ name = "lyon_tess2" version = "0.15.0" dependencies = [ - "lyon_tessellation 0.15.4", + "lyon_tessellation 0.15.5", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "tess2-sys 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lyon_tessellation" -version = "0.15.4" +version = "0.15.5" dependencies = [ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "lyon_extra 0.15.0", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,7 +1117,7 @@ dependencies = [ "gfx_device_gl 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_window_glutin 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.3", + "lyon 0.15.5", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1125,7 +1125,7 @@ name = "path_bench" version = "0.0.1" dependencies = [ "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.3", + "lyon 0.15.5", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1584,7 +1584,7 @@ name = "svg-rendering-example" version = "0.1.0" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.3", + "lyon 0.15.5", "usvg 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wgpu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wgpu-native 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1683,7 +1683,7 @@ name = "tess_bench" version = "0.0.1" dependencies = [ "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.3", + "lyon 0.15.5", "tess2-sys 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1930,7 +1930,7 @@ dependencies = [ name = "wgpu-example" version = "0.1.0" dependencies = [ - "lyon 0.15.3", + "lyon 0.15.5", "wgpu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wgpu-native 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winit 0.20.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lyon" -version = "0.15.3" +version = "0.15.5" description = "2D Graphics rendering on the GPU using tessellation." authors = [ "Nicolas Silva <nical@fastmail.com>" ] repository = "https://github.com/nical/lyon" diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ libtess2 = ["lyon_tess2"] [dependencies] -lyon_tessellation = { version = "0.15.3", path = "tessellation/" } +lyon_tessellation = { version = "0.15.5", path = "tessellation/" } lyon_algorithms = { version = "0.15.0", path = "algorithms/" } lyon_extra = { version = "0.15.0", optional = true, path = "extra/" } lyon_svg = { version = "0.15.0", optional = true, path = "svg/" } diff --git a/tessellation/Cargo.toml b/tessellation/Cargo.toml --- a/tessellation/Cargo.toml +++ b/tessellation/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lyon_tessellation" -version = "0.15.4" +version = "0.15.5" description = "A low level path tessellation library." authors = [ "Nicolas Silva <nical@fastmail.com>" ] repository = "https://github.com/nical/lyon" diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1545,10 +1545,20 @@ impl FillTessellator { } else { debug_assert!(!is_after(self.current_position, edge.to)); - let x = if edge.to.y == y { - edge.to.x - } else if edge.from.y == y { + let eq_to = edge.to.y == y; + let eq_from = edge.from.y == y; + + let x = if eq_to && eq_from { + let current_x = self.current_position.x; + if edge.max_x >= current_x && edge.min_x <= current_x { + self.current_position.x + } else { + edge.min_x + } + } else if eq_from { edge.from.x + } else if eq_to { + edge.to.x } else { edge.solve_x_for_y(y) };
nical__lyon-530
530
Thanks for the report, unless the input data contains broken floats like NaNs or inifinity, and has fewer than u32::MAX vertices, it should definitely be considered as a bug in the tessellator which is the case here. I was able to reproduce this and reduce it to a small testcase. I'll look into it soon.
[ "529" ]
0.15
nical/lyon
2020-01-12T20:48:35Z
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -882,7 +882,7 @@ dependencies = [ name = "lyon_wasm_test" version = "0.11.0" dependencies = [ - "lyon 0.15.3", + "lyon 0.15.5", ] [[package]] diff --git a/tessellation/src/fill_tests.rs b/tessellation/src/fill_tests.rs --- a/tessellation/src/fill_tests.rs +++ b/tessellation/src/fill_tests.rs @@ -2146,3 +2146,29 @@ fn very_large_path() { &mut NoOutput::new(), ).unwrap(); } + +#[test] +fn issue_529() { + let mut builder = Path::builder(); + + builder.move_to(point(203.01, 174.67)); + builder.line_to(point(203.04, 174.72)); + builder.line_to(point(203.0, 174.68)); + builder.close(); + + builder.move_to(point(203.0, 174.66)); + builder.line_to(point(203.01, 174.68)); + builder.line_to(point(202.99, 174.68)); + builder.close(); + + let mut tess = FillTessellator::new(); + + tess.tessellate( + &builder.build(), + &FillOptions::default(), + &mut NoOutput::new(), + ).unwrap(); + + // SVG path syntax: + // "M 203.01 174.67 L 203.04 174.72 L 203 174.68 ZM 203 174.66 L 203.01 174.68 L 202.99 174.68 Z" +}
Fill tessellation failure in 0.15.3 I'm tesselating a svg file that I simply pass from usvg to lyon fill tesselator. The svg file can be found at [0], I used `CNTR_RG_03M_2016_4326.svg` which used to work with 0.14, (but `CNTR_RG_01M_2016_4326.svg` did not). The error is simply `Internal(IncorrectActiveEdgeOrder(3))`, the node id seems to be "MX" (Mexico). I'm unable to discern if this is bad data or numerical issue or simply a bug in the tessellator. [0] https://ec.europa.eu/eurostat/cache/GISCO/distribution/v1/countries-2016.html
08cd4c3d8c1ef53fbbb1b702f655e26c6bd5cc03
[ "fill_tests::issue_529" ]
[ "basic_shapes::issue_366", "earcut_tests::bad_diagonal", "earcut_tests::bad_hole", "earcut_tests::building", "earcut_tests::degenerate", "earcut_tests::dude", "earcut_tests::eberly_3", "earcut_tests::empty_square", "earcut_tests::hole_touching_outer", "earcut_tests::issue_16", "earcut_tests::issue_29", "earcut_tests::issue_17", "earcut_tests::issue_45", "earcut_tests::outside_ring", "earcut_tests::issue_34", "earcut_tests::shared_points", "earcut_tests::simplified_us_border", "earcut_tests::issue_52", "earcut_tests::steiner", "earcut_tests::self_touching", "earcut_tests::touching_holes", "earcut_tests::water_3b", "earcut_tests::hilbert", "event_queue::test_event_queue_sort_1", "fill::fill_vertex_source_01", "event_queue::test_event_queue_push_sorted", "fill::fill_vertex_source_03", "fill::fill_vertex_source_02", "earcut_tests::water_3", "fill_tests::back_along_previous_edge", "event_queue::test_event_queue_sort_3", "fill_tests::angle_precision", "event_queue::test_event_queue_sort_5", "fill_tests::issue_476_reduced", "fill_tests::issue_481_reduced", "fill_tests::new_tess_1", "fill_tests::new_tess_2", "event_queue::test_event_queue_sort_2", "fill_tests::issue_476_original", "event_queue::test_event_queue_sort_4", "fill_tests::issue_518_2", "earcut_tests::issue_35", "fill_tests::reduced_test_case_04", "fill_tests::issue_518_1", "fill_tests::overlapping_horizontal", "earcut_tests::eberly_6", "fill_tests::new_tess_coincident_simple", "fill_tests::issue_500", "fill_tests::reduced_test_case_14", "fill_tests::new_tess_overlapping_1", "fill_tests::issue_481_original", "fill_tests::reduced_test_case_08", "fill_tests::reduced_test_case_11", "fill_tests::reduced_test_case_12", "fill_tests::reduced_test_case_07", "fill_tests::reduced_test_case_06", "fill_tests::reduced_test_case_01", "fill_tests::reduced_test_case_09", "fill_tests::reduced_test_case_05", "fill_tests::reduced_test_case_02", "fill_tests::test_chained_merge_left", "fill_tests::new_tess_merge", "fill_tests::new_tess_points_too_close", "fill_tests::reduced_test_case_10", "fill_tests::test_chained_merge_end", "fill_tests::test_auto_intersection_type1", "fill_tests::test_coincident_simple_2", "fill_tests::test_colinear_3", "fill_tests::test_colinear_touching_squares3", "fill_tests::test_chained_merge_split", "fill_tests::test_close_at_first_position", "fill_tests::test_coincident_simple_1", "fill_tests::test_chained_merge_merge", "fill_tests::reduced_test_case_03", "fill_tests::test_auto_intersection_type2", "fill_tests::test_colinear_4", "fill_tests::test_colinear_touching_squares", "fill_tests::test_colinear_touching_squares2", "fill_tests::test_double_merge_with_intersection", "fill_tests::test_exp_no_intersection_01", "fill_tests::test_empty_path", "fill_tests::test_fixed_to_f32_precision", "fill_tests::test_identical_squares", "fill_tests::reduced_test_case_13", "fill_tests::test_no_close", "fill_tests::test_intersection_horizontal_precision", "fill_tests::test_intersection_1", "fill_tests::test_overlapping_with_intersection", "fill_tests::test_point_on_edge_left", "fill_tests::test_intersecting_bow_tie", "earcut_tests::water_2", "fill_tests::test_rust_logo_scale_down2", "fill_tests::test_point_on_edge2", "fill_tests::test_simple_double_merge", "fill_tests::test_point_on_edge_right", "earcut_tests::water_4", "fill_tests::test_coincident_simple_rotated", "fill_tests::test_colinear_touching_squares_rotated", "fill_tests::test_intersecting_star_shape", "fill_tests::test_simple_monotone", "event_queue::test_logo", "fill_tests::test_colinear_2", "fill_tests::test_too_many_vertices", "fill_tests::test_split_with_intersections", "fuzz_tests::fuzzing_test_case_10", "fill_tests::three_edges_below", "fill_tests::triangle", "fill_tests::test_unknown_issue_1", "fill_tests::test_colinear_1", "fuzz_tests::fuzzing_test_case_11", "fill_tests::test_simple_triangle", "fuzz_tests::fuzzing_test_case_12", "fill_tests::test_rust_logo_scale_down", "fuzz_tests::fuzzing_test_case_15", "fuzz_tests::fuzzing_test_case_17", "fuzz_tests::fuzzing_test_case_18", "fuzz_tests::fuzzing_test_case_14", "fuzz_tests::fuzzing_test_case_20", "fuzz_tests::fuzzing_test_case_21", "fuzz_tests::fuzzing_test_case_13", "fuzz_tests::fuzzing_test_case_16", "earcut_tests::water", "fuzz_tests::fuzzing_test_case_19", "fuzz_tests::fuzzing_test_case_22", "fuzz_tests::fuzzing_test_case_23", "fuzz_tests::fuzzing_test_case_25", "fuzz_tests::fuzzing_test_case_4", "fuzz_tests::fuzzing_test_case_6", "fuzz_tests::fuzzing_test_case_7", "fuzz_tests::fuzzing_test_case_8", "fuzz_tests::fuzzing_test_case_5", "fill_tests::test_auto_intersection_multi", "fuzz_tests::fuzzing_test_case_3", "math_utils::test_compute_normal", "fuzz_tests::fuzzing_test_case_9", "monotone::test_monotone_tess", "stroke::test_empty_caps", "fuzz_tests::fuzzing_test_case_24", "stroke::stroke_vertex_source_01", "fuzz_tests::fuzzing_test_case_26", "stroke::test_square", "stroke::test_too_many_vertices", "stroke::test_empty_path", "test_with_miter_limit", "fill_tests::test_rust_logo_scale_up", "test_with_invalid_miter_limit - should panic", "test_without_miter_limit", "fuzz_tests::fuzzing_test_case_01", "fuzz_tests::fuzzing_test_case_2", "fill_tests::test_degenerate_same_position", "fill_tests::test_simple_1", "fill_tests::test_simple_split", "fill_tests::test_simple_merge_split", "fill_tests::test_simple_aligned", "fill_tests::test_hole_1", "fill_tests::test_simple_2", "earcut_tests::water_huge", "earcut_tests::water_huge_2", "fill_tests::n_segments_intersecting", "fill_tests::test_rust_logo_no_intersection", "fill_tests::test_rust_logo_with_intersection", "fill_tests::very_large_path", "tessellation/src/geometry_builder.rs - geometry_builder (line 202)", "tessellation/src/geometry_builder.rs - geometry_builder (line 131)", "tessellation/src/fill.rs - fill::FillTessellator (line 336)", "tessellation/src/fill.rs - fill::FillTessellator (line 378)", "tessellation/src/geometry_builder.rs - geometry_builder (line 72)", "tessellation/src/stroke.rs - stroke::StrokeTessellator (line 44)" ]
[]
[]
2020-01-12T20:54:59Z
4429c2aad3f900fd33a8a64e62e8e9da97ffaf1e
diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -7,7 +7,7 @@ use crate::path::builder::{Build, PathBuilder}; use crate::path::private::DebugValidator; use crate::path::{AttributeStore, EndpointId, IdEvent, PathEvent, PathSlice, PositionStore, Winding}; use crate::path::polygon::Polygon; -use crate::{GeometryBuilderError, StrokeGeometryBuilder, VertexId}; +use crate::{StrokeGeometryBuilder, VertexId}; use crate::{ LineCap, LineJoin, Order, Side, StrokeOptions, TessellationError, TessellationResult, VertexSource, diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -270,17 +270,10 @@ macro_rules! add_vertex { position += $builder.attributes.normal * $builder.options.line_width / 2.0; } - let res = $builder - .output - .add_stroke_vertex(position, StrokeAttributes(&mut $builder.attributes)); - - match res { - Ok(v) => v, - Err(e) => { - $builder.builder_error(e); - VertexId(0) - } - } + $builder.output.add_stroke_vertex( + position, + StrokeAttributes(&mut $builder.attributes) + ) }}; } diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -334,10 +327,14 @@ impl<'l> PathBuilder for StrokeBuilder<'l> { fn end(&mut self, close: bool) { self.validator.end(); + if self.error.is_some() { + return; + } + if close { self.close(); } else { - self.end_subpath(); + self.end(); } } diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -501,7 +498,7 @@ impl<'l> StrokeBuilder<'l> { } #[cold] - fn builder_error(&mut self, e: GeometryBuilderError) { + fn error<E: Into<TessellationError>>(&mut self, e: E) { if self.error.is_none() { self.error = Some(e.into()); } diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -570,10 +567,14 @@ impl<'l> StrokeBuilder<'l> { if close { self.close(); } else { - self.end_subpath(); + self.end(); } } } + + if self.error.is_some() { + return; + } } } diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -596,11 +597,17 @@ impl<'l> StrokeBuilder<'l> { if (self.first - self.current).square_length() > threshold { let first = self.first; self.edge_to(first, self.first_endpoint, 1.0, true); + if self.error.is_some() { + return; + } } if self.nth > 1 { let second = self.second; self.edge_to(second, self.second_endpoint, self.second_t, true); + if self.error.is_some() { + return; + } self.attributes.normal = self.previous_normal; self.attributes.side = Side::Left; diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -610,12 +617,24 @@ impl<'l> StrokeBuilder<'l> { self.attributes.advancement = self.sub_path_start_length; self.attributes.buffer_is_valid = false; - let first_left_id = add_vertex!(self, position: self.previous); + let first_left_id = match add_vertex!(self, position: self.previous) { + Ok(id) => id, + Err(e) => { + self.error(e); + return; + } + }; self.attributes.normal = -self.previous_normal; self.attributes.side = Side::Right; - let first_right_id = add_vertex!(self, position: self.previous); + let first_right_id = match add_vertex!(self, position: self.previous) { + Ok(id) => id, + Err(e) => { + self.error(e); + return; + } + }; self.output .add_triangle(first_right_id, first_left_id, self.second_right_id); diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -626,49 +645,57 @@ impl<'l> StrokeBuilder<'l> { self.sub_path_start_length = self.length; } - fn tessellate_empty_square_cap(&mut self) { + fn tessellate_empty_square_cap(&mut self) -> Result<(), TessellationError> { self.attributes.normal = vector(1.0, 1.0); self.attributes.side = Side::Right; - let a = add_vertex!(self, position: self.current); + let a = add_vertex!(self, position: self.current)?; self.attributes.normal = vector(1.0, -1.0); self.attributes.side = Side::Left; - let b = add_vertex!(self, position: self.current); + let b = add_vertex!(self, position: self.current)?; self.attributes.normal = vector(-1.0, -1.0); self.attributes.side = Side::Left; - let c = add_vertex!(self, position: self.current); + let c = add_vertex!(self, position: self.current)?; self.attributes.normal = vector(-1.0, 1.0); self.attributes.side = Side::Right; - let d = add_vertex!(self, position: self.current); + let d = add_vertex!(self, position: self.current)?; self.output.add_triangle(a, b, c); self.output.add_triangle(a, c, d); + + Ok(()) } - fn tessellate_empty_round_cap(&mut self) { + fn tessellate_empty_round_cap(&mut self) -> Result<(), TessellationError> { let center = self.current; self.attributes.normal = vector(-1.0, 0.0); self.attributes.side = Side::Left; - let left_id = add_vertex!(self, position: center); + let left_id = add_vertex!(self, position: center)?; self.attributes.normal = vector(1.0, 0.0); self.attributes.side = Side::Right; - let right_id = add_vertex!(self, position: center); + let right_id = add_vertex!(self, position: center)?; + + self.tessellate_round_cap(center, vector(0.0, -1.0), left_id, right_id, true)?; + self.tessellate_round_cap(center, vector(0.0, 1.0), left_id, right_id, false) + } - self.tessellate_round_cap(center, vector(0.0, -1.0), left_id, right_id, true); - self.tessellate_round_cap(center, vector(0.0, 1.0), left_id, right_id, false); + fn end(&mut self) { + if let Err(e) = self.end_subpath() { + self.error(e); + } } - fn end_subpath(&mut self) { + fn end_subpath(&mut self) -> Result<(), TessellationError> { self.attributes.src = VertexSource::Endpoint { id: self.current_endpoint, }; diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -681,11 +708,11 @@ impl<'l> StrokeBuilder<'l> { LineCap::Square => { // Even if there is no edge, if we are using square caps we have to place a square // at the current position. - self.tessellate_empty_square_cap(); + self.tessellate_empty_square_cap()?; } LineCap::Round => { // Same thing for round caps. - self.tessellate_empty_round_cap(); + self.tessellate_empty_round_cap()?; } _ => {} } diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -702,13 +729,17 @@ impl<'l> StrokeBuilder<'l> { } let p = self.current + d; self.edge_to(p, self.previous_endpoint, 1.0, true); + if let Some(e) = &self.error { + return Err(e.clone()); + } + // Restore the real current position. self.current = current; if self.options.end_cap == LineCap::Round { let left_id = self.previous_left_id; let right_id = self.previous_right_id; - self.tessellate_round_cap(current, d, left_id, right_id, false); + self.tessellate_round_cap(current, d, left_id, right_id, false)?; } } // first edge diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -728,15 +759,15 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = n1; self.attributes.side = Side::Left; - let first_left_id = add_vertex!(self, position: first); + let first_left_id = add_vertex!(self, position: first)?; self.attributes.normal = n2; self.attributes.side = Side::Right; - let first_right_id = add_vertex!(self, position: first); + let first_right_id = add_vertex!(self, position: first)?; if self.options.start_cap == LineCap::Round { - self.tessellate_round_cap(first, d, first_left_id, first_right_id, true); + self.tessellate_round_cap(first, d, first_left_id, first_right_id, true)?; } self.output diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -744,6 +775,8 @@ impl<'l> StrokeBuilder<'l> { self.output .add_triangle(first_left_id, self.second_left_id, self.second_right_id); } + + Ok(()) } fn edge_to(&mut self, to: Point, endpoint: EndpointId, t: f32, with_join: bool) { diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -751,6 +784,10 @@ impl<'l> StrokeBuilder<'l> { return; } + if self.error.is_some() { + return; + } + if self.nth == 0 { // We don't have enough information to compute the previous // vertices (and thus the current join) yet. diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -770,8 +807,19 @@ impl<'l> StrokeBuilder<'l> { LineJoin::Miter }; - let (start_left_id, start_right_id, end_left_id, end_right_id, front_side) = - self.tessellate_join(previous_edge, next_edge, join_type); + let ( + start_left_id, + start_right_id, + end_left_id, + end_right_id, + front_side + ) = match self.tessellate_join(previous_edge, next_edge, join_type) { + Ok(value) => value, + Err(e) => { + self.error(e); + return; + } + }; // Tessellate the edge if self.nth > 1 { diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -824,10 +872,10 @@ impl<'l> StrokeBuilder<'l> { left: VertexId, right: VertexId, is_start: bool, - ) { + ) -> Result<(), TessellationError> { let radius = self.options.line_width.abs(); if radius < 1e-4 { - return; + return Ok(()); } let arc_len = 0.5 * PI * radius; diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -845,7 +893,7 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = dir; self.attributes.side = Side::Left; - let mid_vertex = add_vertex!(self, position: center); + let mid_vertex = add_vertex!(self, position: center)?; let (v1, v2, v3) = if is_start { (left, right, mid_vertex) diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -860,7 +908,7 @@ impl<'l> StrokeBuilder<'l> { 0.0 }; - if let Err(e) = tess_round_cap( + tess_round_cap( center, (left_angle, mid_angle), radius, diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -872,10 +920,9 @@ impl<'l> StrokeBuilder<'l> { !is_start, &mut self.attributes, self.output, - ) { - self.builder_error(e); - } - if let Err(e) = tess_round_cap( + )?; + + tess_round_cap( center, (mid_angle, right_angle), radius, diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -887,9 +934,7 @@ impl<'l> StrokeBuilder<'l> { !is_start, &mut self.attributes, self.output, - ) { - self.builder_error(e); - } + ) } fn tessellate_back_join( diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -900,7 +945,7 @@ impl<'l> StrokeBuilder<'l> { next_length: f32, front_side: Side, front_normal: Vector, - ) -> (VertexId, VertexId, Option<Order>) { + ) -> Result<(VertexId, VertexId, Option<Order>), TessellationError> { // We must watch out for special cases where the previous or next edge is small relative // to the line width inducing an overlap of the stroke of both edges. diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -931,27 +976,28 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = back_start_vertex_normal; self.attributes.side = front_side.opposite(); - let back_start_vertex = add_vertex!(self, position: self.current); + let back_start_vertex = add_vertex!(self, position: self.current)?; self.attributes.normal = back_end_vertex_normal; self.attributes.side = front_side.opposite(); - let back_end_vertex = add_vertex!(self, position: self.current); - // return - return match order { + let back_end_vertex = add_vertex!(self, position: self.current)?; + + return Ok(match order { Order::Before => (back_start_vertex, back_end_vertex, Some(order)), Order::After => (back_end_vertex, back_start_vertex, Some(order)), - }; + }); } self.attributes.normal = -front_normal; self.attributes.side = front_side.opposite(); // Standard Case - let back_start_vertex = add_vertex!(self, position: self.current); + let back_start_vertex = add_vertex!(self, position: self.current)?; let back_end_vertex = back_start_vertex; - (back_start_vertex, back_end_vertex, None) + + Ok((back_start_vertex, back_end_vertex, None)) } fn tessellate_join( diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -959,7 +1005,7 @@ impl<'l> StrokeBuilder<'l> { previous_edge: Vector, next_edge: Vector, mut join_type: LineJoin, - ) -> (VertexId, VertexId, VertexId, VertexId, Side) { + ) -> Result<(VertexId, VertexId, VertexId, VertexId, Side), TessellationError> { // This function needs to differentiate the "front" of the join (aka. the pointy side) // from the back. The front is where subdivision or adjustments may be needed. let prev_tangent = previous_edge.normalize(); diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -999,7 +1045,7 @@ impl<'l> StrokeBuilder<'l> { next_edge_length, front_side, front_normal, - ); + )?; let threshold = 0.95; if prev_tangent.dot(next_tangent) >= threshold { diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1026,10 +1072,10 @@ impl<'l> StrokeBuilder<'l> { let (start_vertex, end_vertex) = match join_type { LineJoin::Round => { - self.tessellate_round_join(prev_tangent, next_tangent, front_side, back_join_vertex) + self.tessellate_round_join(prev_tangent, next_tangent, front_side, back_join_vertex)? } LineJoin::Bevel => { - self.tessellate_bevel_join(prev_tangent, next_tangent, front_side, back_join_vertex) + self.tessellate_bevel_join(prev_tangent, next_tangent, front_side, back_join_vertex)? } LineJoin::MiterClip => self.tessellate_miter_clip_join( prev_tangent, diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1037,12 +1083,12 @@ impl<'l> StrokeBuilder<'l> { front_side, back_join_vertex, normal, - ), + )?, // Fallback to Miter for unimplemented line joins _ => { self.attributes.normal = front_normal; self.attributes.side = front_side; - let end_vertex = add_vertex!(self, position: self.current); + let end_vertex = add_vertex!(self, position: self.current)?; self.previous_normal = normal; if let Some(_order) = order { diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1058,7 +1104,7 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = n1; self.attributes.side = front_side; - let start_vertex = add_vertex!(self, position: self.current); + let start_vertex = add_vertex!(self, position: self.current)?; self.output .add_triangle(start_vertex, end_vertex, back_join_vertex); diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1088,7 +1134,7 @@ impl<'l> StrokeBuilder<'l> { } } - match front_side { + Ok(match front_side { Side::Left => ( start_vertex, back_start_vertex, diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1103,7 +1149,7 @@ impl<'l> StrokeBuilder<'l> { end_vertex, front_side, ), - } + }) } fn tessellate_bevel_join( diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1112,7 +1158,7 @@ impl<'l> StrokeBuilder<'l> { next_tangent: Vector, front_side: Side, back_vertex: VertexId, - ) -> (VertexId, VertexId) { + ) -> Result<(VertexId, VertexId), TessellationError> { let neg_if_right = if front_side.is_left() { 1.0 } else { -1.0 }; let previous_normal = vector(-prev_tangent.y, prev_tangent.x); let next_normal = vector(-next_tangent.y, next_tangent.x); diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1120,12 +1166,12 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = previous_normal * neg_if_right; self.attributes.side = front_side; - let start_vertex = add_vertex!(self, position: self.current); + let start_vertex = add_vertex!(self, position: self.current)?; self.attributes.normal = next_normal * neg_if_right; self.attributes.side = front_side; - let last_vertex = add_vertex!(self, position: self.current); + let last_vertex = add_vertex!(self, position: self.current)?; self.previous_normal = next_normal; diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1136,7 +1182,7 @@ impl<'l> StrokeBuilder<'l> { }; self.output.add_triangle(v1, v2, v3); - (start_vertex, last_vertex) + Ok((start_vertex, last_vertex)) } fn tessellate_round_join( diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1145,7 +1191,7 @@ impl<'l> StrokeBuilder<'l> { next_tangent: Vector, front_side: Side, back_vertex: VertexId, - ) -> (VertexId, VertexId) { + ) -> Result<(VertexId, VertexId), TessellationError> { let join_angle = get_join_angle(prev_tangent, next_tangent); let max_radius_segment_angle = diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1163,7 +1209,7 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = initial_normal; self.attributes.side = front_side; - let mut last_vertex = add_vertex!(self, position: self.current); + let mut last_vertex = add_vertex!(self, position: self.current)?; let start_vertex = last_vertex; // Plot each point along the radius by using a matrix to diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1182,7 +1228,7 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = n; self.attributes.side = front_side; - let current_vertex = add_vertex!(self, position: self.current); + let current_vertex = add_vertex!(self, position: self.current)?; let (v1, v2, v3) = if front_side.is_left() { (back_vertex, last_vertex, current_vertex) diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1196,7 +1242,7 @@ impl<'l> StrokeBuilder<'l> { self.previous_normal = n * neg_if_right; - (start_vertex, last_vertex) + Ok((start_vertex, last_vertex)) } fn tessellate_miter_clip_join( diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1206,7 +1252,7 @@ impl<'l> StrokeBuilder<'l> { front_side: Side, back_vertex: VertexId, normal: Vector, - ) -> (VertexId, VertexId) { + ) -> Result<(VertexId, VertexId), TessellationError> { let neg_if_right = if front_side.is_left() { 1.0 } else { -1.0 }; let previous_normal: Vector = vector(-prev_tangent.y, prev_tangent.x); let next_normal: Vector = vector(-next_tangent.y, next_tangent.x); diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1216,12 +1262,12 @@ impl<'l> StrokeBuilder<'l> { self.attributes.normal = v1 * neg_if_right; self.attributes.side = front_side; - let start_vertex = add_vertex!(self, position: self.current); + let start_vertex = add_vertex!(self, position: self.current)?; self.attributes.normal = v2 * neg_if_right; self.attributes.side = front_side; - let last_vertex = add_vertex!(self, position: self.current); + let last_vertex = add_vertex!(self, position: self.current)?; self.previous_normal = normal; diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1232,7 +1278,7 @@ impl<'l> StrokeBuilder<'l> { }; self.output.add_triangle(v1, v2, v3); - (start_vertex, last_vertex) + Ok((start_vertex, last_vertex)) } fn miter_limit_is_exceeded(&self, normal: Vector) -> bool { diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1305,7 +1351,7 @@ fn tess_round_cap( invert_winding: bool, attributes: &mut StrokeAttributesData, output: &mut dyn StrokeGeometryBuilder, -) -> Result<(), GeometryBuilderError> { +) -> Result<(), TessellationError> { if num_recursions == 0 { return Ok(()); }
nical__lyon-579
579
I certainly am! Was it the stroke or fill tessellator? Pretty sure it was the stroke tesselator. It may be useful to know that there were only bezier curves imitating lines (i.e. the control points were identical to the corners) in the builder. There may however have been duplicate points in it. Some more info. I think this might be happening when the index type overflows. The reason is that the add_vertex! macro hides the actual overflow error and just returns a vertex with index 0. This will usually cause some other asserts to trip. ```rust macro_rules! add_vertex { ($builder: expr, position: $position: expr) => {{ let mut position = $position; if $builder.options.apply_line_width { position += $builder.attributes.normal * $builder.options.line_width / 2.0; } let res = $builder.output.add_stroke_vertex( position, StrokeAttributes(&mut $builder.attributes), ); match res { Ok(v) => v, Err(e) => { $builder.builder_error(e); VertexId(0) } } }} } ``` Ouch! The initial intention was to propagate the error but that apparently never materialize. nice catch!
[ "545" ]
0.15
nical/lyon
2020-04-27T22:00:28Z
diff --git a/tessellation/src/stroke.rs b/tessellation/src/stroke.rs --- a/tessellation/src/stroke.rs +++ b/tessellation/src/stroke.rs @@ -1665,12 +1711,14 @@ fn test_too_many_vertices() { } impl GeometryBuilder for Builder { fn begin_geometry(&mut self) {} - fn add_triangle(&mut self, _a: VertexId, _b: VertexId, _c: VertexId) {} + fn add_triangle(&mut self, a: VertexId, b: VertexId, c: VertexId) { + assert!(a != b); + assert!(a != c); + assert!(b != c); + } fn end_geometry(&mut self) -> Count { - Count { - vertices: 0, - indices: 0, - } + // Expected to abort the geometry. + panic!(); } fn abort_geometry(&mut self) {} }
The stroke tessellator does not propagate errors I cannot replicate this, but you might be interested in a panic that i found ``` thread 'main' panicked at 'assertion failed: b != c', tessellation/src/geometry_builder.rs:510:9 ```
08cd4c3d8c1ef53fbbb1b702f655e26c6bd5cc03
[ "stroke::test_too_many_vertices" ]
[ "earcut_tests::bad_diagonal", "earcut_tests::building", "earcut_tests::degenerate", "earcut_tests::bad_hole", "earcut_tests::empty_square", "earcut_tests::eberly_3", "earcut_tests::dude", "earcut_tests::issue_17", "earcut_tests::issue_16", "earcut_tests::hole_touching_outer", "earcut_tests::issue_29", "earcut_tests::issue_45", "earcut_tests::outside_ring", "earcut_tests::issue_34", "earcut_tests::issue_52", "earcut_tests::shared_points", "earcut_tests::self_touching", "earcut_tests::steiner", "earcut_tests::simplified_us_border", "earcut_tests::water_3b", "earcut_tests::touching_holes", "earcut_tests::water_3", "event_queue::test_event_queue_push_sorted", "event_queue::test_event_queue_sort_2", "event_queue::test_event_queue_sort_1", "event_queue::test_event_queue_sort_3", "event_queue::test_event_queue_sort_4", "fill::active_edge_size", "fill::fill_builder_vertex_source", "event_queue::test_event_queue_sort_5", "fill::fill_vertex_source_01", "earcut_tests::hilbert", "fill_tests::issue_529", "fill_tests::issue_562_2", "fill::fill_vertex_source_03", "fill::fill_vertex_source_02", "fill_tests::issue_562_1", "fill_tests::back_along_previous_edge", "fill_tests::new_tess_coincident_simple", "fill_tests::issue_481_reduced", "earcut_tests::eberly_6", "fill_tests::issue_476_reduced", "fill_tests::angle_precision", "fill_tests::issue_500", "fill_tests::new_tess_merge", "fill_tests::overlapping_horizontal", "fill_tests::issue_476_original", "fill_tests::new_tess_1", "fill_tests::issue_562_4", "fill_tests::issue_562_6", "fill_tests::issue_562_7", "fill_tests::new_tess_overlapping_1", "earcut_tests::water_4", "fill_tests::reduced_test_case_01", "fill_tests::reduced_test_case_03", "fill_tests::reduced_test_case_04", "fill_tests::issue_562_5", "fill_tests::new_tess_points_too_close", "fill_tests::reduced_test_case_11", "fill_tests::reduced_test_case_12", "fill_tests::reduced_test_case_06", "fill_tests::reduced_test_case_07", "fill_tests::reduced_test_case_08", "fill_tests::reduced_test_case_13", "fill_tests::reduced_test_case_14", "fill_tests::test_auto_intersection_type1", "fill_tests::new_tess_2", "fill_tests::issue_562_3", "fill_tests::reduced_test_case_02", "fill_tests::reduced_test_case_10", "fill_tests::reduced_test_case_09", "event_queue::test_logo", "fill_tests::issue_518_1", "earcut_tests::issue_35", "fill_tests::issue_481_original", "fill_tests::test_auto_intersection_type2", "fill_tests::test_chained_merge_end", "fill_tests::issue_518_2", "fill_tests::test_coincident_simple_1", "fill_tests::test_coincident_simple_2", "fill_tests::test_empty_path", "fill_tests::test_chained_merge_merge", "fill_tests::test_double_merge_with_intersection", "fill_tests::test_chained_merge_split", "fill_tests::test_exp_no_intersection_01", "fill_tests::test_chained_merge_left", "fill_tests::test_colinear_3", "fill_tests::test_colinear_4", "fill_tests::test_colinear_touching_squares", "fill_tests::test_colinear_touching_squares2", "fill_tests::test_colinear_touching_squares3", "fill_tests::reduced_test_case_05", "fill_tests::test_close_at_first_position", "earcut_tests::water_2", "fill_tests::test_identical_squares", "fill_tests::test_intersecting_bow_tie", "fill_tests::test_fixed_to_f32_precision", "fill_tests::test_intersection_1", "fill_tests::test_intersection_horizontal_precision", "fill_tests::test_point_on_edge_right", "fill_tests::test_overlapping_with_intersection", "fill_tests::test_point_on_edge2", "fill_tests::test_no_close", "fill_tests::test_point_on_edge_left", "fill_tests::test_colinear_1", "fill_tests::test_colinear_2", "fill_tests::issue_562_8", "fill_tests::test_simple_double_merge", "fill_tests::test_simple_monotone", "fill_tests::test_unknown_issue_1", "fuzz_tests::fuzzing_test_case_10", "fill_tests::triangle", "fill_tests::test_split_with_intersections", "fuzz_tests::fuzzing_test_case_11", "fuzz_tests::fuzzing_test_case_12", "fill_tests::test_too_many_vertices", "fill_tests::three_edges_below", "fuzz_tests::fuzzing_test_case_13", "fuzz_tests::fuzzing_test_case_17", "fuzz_tests::fuzzing_test_case_15", "fuzz_tests::fuzzing_test_case_18", "fuzz_tests::fuzzing_test_case_20", "fuzz_tests::fuzzing_test_case_19", "fuzz_tests::fuzzing_test_case_14", "fuzz_tests::fuzzing_test_case_22", "fuzz_tests::fuzzing_test_case_21", "fuzz_tests::fuzzing_test_case_24", "fuzz_tests::fuzzing_test_case_6", "fuzz_tests::fuzzing_test_case_4", "fuzz_tests::fuzzing_test_case_26", "fuzz_tests::fuzzing_test_case_25", "fuzz_tests::fuzzing_test_case_16", "fuzz_tests::fuzzing_test_case_7", "earcut_tests::water", "math_utils::test_compute_normal", "stroke::stroke_vertex_source_01", "fill_tests::test_coincident_simple_rotated", "monotone::test_monotone_tess", "fuzz_tests::fuzzing_test_case_9", "fuzz_tests::fuzzing_test_case_8", "stroke::test_empty_caps", "fuzz_tests::fuzzing_test_case_23", "stroke::test_empty_path", "fill_tests::test_simple_triangle", "test_with_miter_limit", "fuzz_tests::fuzzing_test_case_5", "stroke::test_square", "test_without_miter_limit", "test_with_invalid_miter_limit - should panic", "fill_tests::test_colinear_touching_squares_rotated", "fill_tests::test_rust_logo_scale_down", "fill_tests::test_rust_logo_scale_down2", "fuzz_tests::fuzzing_test_case_3", "fuzz_tests::fuzzing_test_case_2", "fill_tests::test_degenerate_same_position", "fuzz_tests::fuzzing_test_case_01", "fill_tests::test_auto_intersection_multi", "fill_tests::test_intersecting_star_shape", "fill_tests::test_rust_logo_scale_up", "fill_tests::test_simple_split", "earcut_tests::water_huge", "fill_tests::test_simple_merge_split", "fill_tests::test_hole_1", "fill_tests::test_simple_aligned", "fill_tests::test_simple_1", "earcut_tests::water_huge_2", "fill_tests::test_simple_2", "fill_tests::very_large_path", "fill_tests::n_segments_intersecting", "fill_tests::test_rust_logo_no_intersection", "fill_tests::test_rust_logo_with_intersection", "tessellation/src/geometry_builder.rs - geometry_builder (line 205)", "tessellation/src/stroke.rs - stroke::StrokeTessellator::builder (line 172)", "tessellation/src/geometry_builder.rs - geometry_builder (line 131)", "tessellation/src/fill.rs - fill::FillTessellator::builder (line 630)", "tessellation/src/stroke.rs - stroke::StrokeTessellator (line 48)", "tessellation/src/geometry_builder.rs - geometry_builder (line 72)", "tessellation/src/fill.rs - fill::FillTessellator (line 390)", "tessellation/src/fill.rs - fill::FillTessellator (line 348)" ]
[]
[]
2020-04-28T19:52:35Z
4651f1b20b508aeb3cd79e0d9252803e7325afa8
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -432,7 +432,7 @@ name = "geom_bench" version = "0.0.1" dependencies = [ "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.1", + "lyon 0.15.3", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -781,13 +781,13 @@ dependencies = [ [[package]] name = "lyon" -version = "0.15.1" +version = "0.15.3" dependencies = [ "lyon_algorithms 0.15.0", "lyon_extra 0.15.0", "lyon_svg 0.15.0", "lyon_tess2 0.15.0", - "lyon_tessellation 0.15.2", + "lyon_tessellation 0.15.3", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -809,7 +809,7 @@ dependencies = [ "gfx_window_glutin 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.1", + "lyon 0.15.3", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -862,14 +862,14 @@ dependencies = [ name = "lyon_tess2" version = "0.15.0" dependencies = [ - "lyon_tessellation 0.15.2", + "lyon_tessellation 0.15.3", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "tess2-sys 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lyon_tessellation" -version = "0.15.2" +version = "0.15.3" dependencies = [ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "lyon_extra 0.15.0", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1117,7 +1117,7 @@ dependencies = [ "gfx_device_gl 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_window_glutin 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.1", + "lyon 0.15.3", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1125,7 +1125,7 @@ name = "path_bench" version = "0.0.1" dependencies = [ "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.1", + "lyon 0.15.3", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1584,7 +1584,7 @@ name = "svg-rendering-example" version = "0.1.0" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.1", + "lyon 0.15.3", "usvg 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wgpu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wgpu-native 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1683,7 +1683,7 @@ name = "tess_bench" version = "0.0.1" dependencies = [ "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon 0.15.1", + "lyon 0.15.3", "tess2-sys 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1930,7 +1930,7 @@ dependencies = [ name = "wgpu-example" version = "0.1.0" dependencies = [ - "lyon 0.15.1", + "lyon 0.15.3", "wgpu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wgpu-native 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winit 0.20.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lyon" -version = "0.15.1" +version = "0.15.3" description = "2D Graphics rendering on the GPU using tessellation." authors = [ "Nicolas Silva <nical@fastmail.com>" ] repository = "https://github.com/nical/lyon" diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ libtess2 = ["lyon_tess2"] [dependencies] -lyon_tessellation = { version = "0.15.0", path = "tessellation/" } +lyon_tessellation = { version = "0.15.3", path = "tessellation/" } lyon_algorithms = { version = "0.15.0", path = "algorithms/" } lyon_extra = { version = "0.15.0", optional = true, path = "extra/" } lyon_svg = { version = "0.15.0", optional = true, path = "svg/" } diff --git a/tessellation/Cargo.toml b/tessellation/Cargo.toml --- a/tessellation/Cargo.toml +++ b/tessellation/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lyon_tessellation" -version = "0.15.2" +version = "0.15.3" description = "A low level path tessellation library." authors = [ "Nicolas Silva <nical@fastmail.com>" ] repository = "https://github.com/nical/lyon" diff --git a/tessellation/Cargo.toml b/tessellation/Cargo.toml --- a/tessellation/Cargo.toml +++ b/tessellation/Cargo.toml @@ -22,7 +22,7 @@ experimental = [] [dependencies] -lyon_path = { version = "0.15.0", path = "../path" } +lyon_path = { version = "0.15.1", path = "../path" } sid = "0.6" serde = { version = "1.0", optional = true, features = ["serde_derive"] } arrayvec = "0.5" diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1723,6 +1723,7 @@ impl<'l> FillAttributes<'l> { VertexSourceIterator { events: self.events, id: self.current_event, + prev: None, } } diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1761,53 +1762,73 @@ impl<'l> FillAttributes<'l> { let store = self.attrib_store.unwrap(); - let second = self.events.next_sibling_id(self.current_event); - if !self.events.valid_id(second) { - let edge = &self.events.edge_data[self.current_event as usize]; - let t = edge.range.start; - if t == 0.0 { - return store.get(edge.from_id); - } - if t == 1.0 { - return store.get(edge.to_id); - } - } + let mut sources = VertexSourceIterator { + events: self.events, + id: self.current_event, + prev: None, + }; let num_attributes = store.num_attributes(); - assert!(self.attrib_buffer.len() == num_attributes); - // First source taken out of the loop to avoid initializing the buffer. - { - let edge = &self.events.edge_data[self.current_event as usize]; - let t = edge.range.start; + let first = sources.next().unwrap(); + let mut next = sources.next(); - let a = store.get(edge.from_id); - let b = store.get(edge.to_id); + // Fast path for the single-source-single-endpoint common case. + if next.is_none() { + if let VertexSource::Endpoint { id } = first { + return store.get(id); + } + } - assert!(a.len() == num_attributes); - assert!(b.len() == num_attributes); - for i in 0..num_attributes { - self.attrib_buffer[i] = a[i] * (1.0 - t) + b[i] * t; + // First source taken out of the loop to avoid initializing the buffer. + match first { + VertexSource::Endpoint { id } => { + let a = store.get(id); + assert!(a.len() == num_attributes); + assert!(self.attrib_buffer.len() == num_attributes); + for i in 0..num_attributes { + self.attrib_buffer[i] = a[i]; + } + } + VertexSource::Edge { from, to, t } => { + let a = store.get(from); + let b = store.get(to); + assert!(a.len() == num_attributes); + assert!(b.len() == num_attributes); + assert!(self.attrib_buffer.len() == num_attributes); + for i in 0..num_attributes { + self.attrib_buffer[i] = a[i] * (1.0 - t) + b[i] * t; + } } } let mut div = 1.0; - let mut current_sibling = second; - while self.events.valid_id(current_sibling) { - let edge = &self.events.edge_data[current_sibling as usize]; - let t = edge.range.start; - - let a = store.get(edge.from_id); - let b = store.get(edge.to_id); - - assert!(a.len() == num_attributes); - assert!(b.len() == num_attributes); - for i in 0..num_attributes { - self.attrib_buffer[i] += a[i] * (1.0 - t) + b[i] * t; + loop { + match next { + Some(VertexSource::Endpoint { id }) => { + let a = store.get(id); + assert!(a.len() == num_attributes); + assert!(self.attrib_buffer.len() == num_attributes); + for i in 0..num_attributes { + self.attrib_buffer[i] += a[i]; + } + } + Some(VertexSource::Edge { from, to, t }) => { + let a = store.get(from); + let b = store.get(to); + assert!(a.len() == num_attributes); + assert!(b.len() == num_attributes); + assert!(self.attrib_buffer.len() == num_attributes); + for i in 0..num_attributes { + self.attrib_buffer[i] += a[i] * (1.0 - t) + b[i] * t; + } + } + None => { + break; + } } - div += 1.0; - current_sibling = self.events.next_sibling_id(current_sibling); + next = sources.next(); } if div > 1.0 { diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -1825,32 +1846,44 @@ impl<'l> FillAttributes<'l> { pub struct VertexSourceIterator<'l> { events: &'l EventQueue, id: TessEventId, + prev: Option<VertexSource>, } impl<'l> Iterator for VertexSourceIterator<'l> { type Item = VertexSource; + #[inline] fn next(&mut self) -> Option<VertexSource> { - if self.id == INVALID_EVENT_ID { - return None; - } + let mut src; + loop { + if self.id == INVALID_EVENT_ID { + return None; + } - let edge = &self.events.edge_data[self.id as usize]; + let edge = &self.events.edge_data[self.id as usize]; - self.id = self.events.next_sibling_id(self.id); + self.id = self.events.next_sibling_id(self.id); - let t = edge.range.start; + let t = edge.range.start; - if t == 0.0 { - Some(VertexSource::Endpoint { id: edge.from_id }) - } else if t == 1.0 { - Some(VertexSource::Endpoint { id: edge.to_id }) - } else { - Some(VertexSource::Edge { - from: edge.from_id, - to: edge.to_id, - t, - }) + src = if t == 0.0 { + Some(VertexSource::Endpoint { id: edge.from_id }) + } else if t == 1.0 { + Some(VertexSource::Endpoint { id: edge.to_id }) + } else { + Some(VertexSource::Edge { + from: edge.from_id, + to: edge.to_id, + t, + }) + }; + + if src != self.prev { + break; + } } + + self.prev = src; + src } }
nical__lyon-520
520
[ "517" ]
0.15
nical/lyon
2019-12-28T12:17:48Z
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -882,7 +882,7 @@ dependencies = [ name = "lyon_wasm_test" version = "0.11.0" dependencies = [ - "lyon 0.15.1", + "lyon 0.15.3", ] [[package]] diff --git a/tessellation/src/fill.rs b/tessellation/src/fill.rs --- a/tessellation/src/fill.rs +++ b/tessellation/src/fill.rs @@ -2122,3 +2155,86 @@ fn fill_vertex_source_02() { } } } + +#[test] +fn fill_vertex_source_03() { + use crate::path::commands::PathCommands; + use crate::path::AttributeSlice; + + // x---x + // \ / + // x <--- + // / \ + // x---x + // + // check that the attribute interpolation is weighted correctly at + // start events. + + let endpoints: &[Point] = &[ + point(0.0, 0.0), + point(2.0, 0.0), + point(1.0, 1.0), + point(0.0, 2.0), + point(2.0, 2.0), + point(1.0, 1.0), + ]; + + let attributes = &[0.0, 0.0, 1.0, 0.0, 0.0, 2.0]; + + let mut cmds = PathCommands::builder(); + cmds.move_to(EndpointId(0)); + cmds.line_to(EndpointId(1)); + cmds.line_to(EndpointId(2)); + cmds.close(); + cmds.move_to(EndpointId(3)); + cmds.line_to(EndpointId(4)); + cmds.line_to(EndpointId(5)); + cmds.close(); + + let cmds = cmds.build(); + + let mut queue = EventQueue::from_path_with_ids( + 0.1, + FillOptions::DEFAULT_SWEEP_ORIENTATION, + cmds.id_events(), + &(endpoints, endpoints), + ); + + let mut tess = FillTessellator::new(); + tess.tessellate_events( + &mut queue, + Some(&AttributeSlice::new(attributes, 1)), + &FillOptions::default(), + &mut CheckVertexSources { next_vertex: 0 }, + ).unwrap(); + + struct CheckVertexSources { + next_vertex: u32, + } + + impl GeometryBuilder for CheckVertexSources { + fn begin_geometry(&mut self) {} + fn end_geometry(&mut self) -> Count { Count { vertices: self.next_vertex, indices: 0 } } + fn abort_geometry(&mut self) {} + fn add_triangle(&mut self, _: VertexId, _: VertexId, _: VertexId) {} + } + + impl FillGeometryBuilder for CheckVertexSources { + fn add_fill_vertex(&mut self, v: Point, mut attr: FillAttributes) -> Result<VertexId, GeometryBuilderError> { + if eq(v, point(1.0, 1.0)) { + assert_eq!(attr.interpolated_attributes(), &[1.5]); + assert_eq!(attr.sources().count(), 2); + } + else { + assert_eq!(attr.interpolated_attributes(), &[0.0]); + assert_eq!(attr.sources().count(), 1); + } + + let id = self.next_vertex; + self.next_vertex += 1; + + Ok(VertexId(id)) + } + } +} +
The vertex source iterator can visit the same endpoint twice in some cases. For start events for example, it can happen for the endpoint to be visited once for each of its edges.
08cd4c3d8c1ef53fbbb1b702f655e26c6bd5cc03
[ "fill::fill_vertex_source_03" ]
[ "basic_shapes::issue_366", "earcut_tests::bad_diagonal", "earcut_tests::building", "earcut_tests::degenerate", "earcut_tests::bad_hole", "earcut_tests::eberly_3", "earcut_tests::dude", "earcut_tests::empty_square", "earcut_tests::hole_touching_outer", "earcut_tests::issue_16", "earcut_tests::issue_17", "earcut_tests::issue_29", "earcut_tests::issue_45", "earcut_tests::issue_52", "earcut_tests::issue_34", "earcut_tests::shared_points", "earcut_tests::outside_ring", "earcut_tests::hilbert", "earcut_tests::steiner", "earcut_tests::self_touching", "earcut_tests::touching_holes", "earcut_tests::simplified_us_border", "earcut_tests::water_3b", "earcut_tests::water_3", "earcut_tests::issue_35", "event_queue::test_event_queue_push_sorted", "earcut_tests::eberly_6", "event_queue::test_event_queue_sort_3", "event_queue::test_event_queue_sort_2", "event_queue::test_event_queue_sort_5", "event_queue::test_event_queue_sort_4", "fill::fill_vertex_source_01", "fill::fill_vertex_source_02", "event_queue::test_event_queue_sort_1", "fill_tests::issue_481_reduced", "event_queue::test_logo", "fill_tests::issue_500", "fill_tests::issue_518_1", "fill_tests::issue_518_2", "fill_tests::new_tess_1", "fill_tests::new_tess_points_too_close", "fill_tests::new_tess_2", "fill_tests::new_tess_coincident_simple", "fill_tests::angle_precision", "earcut_tests::water_2", "fill_tests::back_along_previous_edge", "fill_tests::issue_476_original", "earcut_tests::water_4", "fill_tests::issue_476_reduced", "fill_tests::new_tess_merge", "fill_tests::reduced_test_case_02", "fill_tests::reduced_test_case_01", "fill_tests::reduced_test_case_07", "fill_tests::reduced_test_case_06", "fill_tests::reduced_test_case_05", "fill_tests::issue_481_original", "fill_tests::reduced_test_case_03", "fill_tests::overlapping_horizontal", "fill_tests::reduced_test_case_08", "fill_tests::reduced_test_case_04", "fill_tests::new_tess_overlapping_1", "fill_tests::reduced_test_case_09", "fill_tests::reduced_test_case_11", "fill_tests::reduced_test_case_12", "fill_tests::test_auto_intersection_type1", "fill_tests::test_auto_intersection_type2", "fill_tests::test_chained_merge_end", "fill_tests::test_chained_merge_left", "fill_tests::test_chained_merge_merge", "fill_tests::reduced_test_case_13", "fill_tests::test_chained_merge_split", "fill_tests::reduced_test_case_14", "fill_tests::reduced_test_case_10", "fill_tests::test_close_at_first_position", "fill_tests::test_colinear_4", "fill_tests::test_colinear_touching_squares", "fill_tests::test_colinear_touching_squares2", "fill_tests::test_colinear_touching_squares3", "fill_tests::test_coincident_simple_1", "fill_tests::test_coincident_simple_2", "fill_tests::test_double_merge_with_intersection", "fill_tests::test_exp_no_intersection_01", "fill_tests::test_fixed_to_f32_precision", "fill_tests::test_colinear_3", "fill_tests::test_empty_path", "fill_tests::test_identical_squares", "fill_tests::test_intersection_1", "fill_tests::test_intersecting_bow_tie", "fill_tests::test_intersection_horizontal_precision", "fill_tests::test_overlapping_with_intersection", "fill_tests::test_point_on_edge_right", "fill_tests::test_point_on_edge2", "fill_tests::test_no_close", "fill_tests::test_simple_double_merge", "fill_tests::test_point_on_edge_left", "fill_tests::test_rust_logo_scale_down", "earcut_tests::water", "fuzz_tests::fuzzing_test_case_10", "fill_tests::test_simple_monotone", "fuzz_tests::fuzzing_test_case_11", "fill_tests::three_edges_below", "fill_tests::test_unknown_issue_1", "fill_tests::test_split_with_intersections", "fill_tests::test_colinear_1", "fill_tests::triangle", "fill_tests::test_colinear_2", "fuzz_tests::fuzzing_test_case_17", "fuzz_tests::fuzzing_test_case_18", "fuzz_tests::fuzzing_test_case_13", "fuzz_tests::fuzzing_test_case_12", "fuzz_tests::fuzzing_test_case_15", "fill_tests::test_too_many_vertices", "fuzz_tests::fuzzing_test_case_14", "fuzz_tests::fuzzing_test_case_16", "fill_tests::test_coincident_simple_rotated", "fill_tests::test_colinear_touching_squares_rotated", "fill_tests::test_rust_logo_scale_down2", "fuzz_tests::fuzzing_test_case_19", "fill_tests::test_simple_triangle", "fuzz_tests::fuzzing_test_case_20", "fuzz_tests::fuzzing_test_case_21", "fuzz_tests::fuzzing_test_case_4", "fuzz_tests::fuzzing_test_case_22", "fuzz_tests::fuzzing_test_case_23", "fuzz_tests::fuzzing_test_case_24", "fuzz_tests::fuzzing_test_case_26", "fill_tests::test_auto_intersection_multi", "fuzz_tests::fuzzing_test_case_25", "fuzz_tests::fuzzing_test_case_5", "fuzz_tests::fuzzing_test_case_7", "fuzz_tests::fuzzing_test_case_8", "fuzz_tests::fuzzing_test_case_6", "math_utils::test_compute_normal", "fill_tests::test_intersecting_star_shape", "stroke::stroke_vertex_source_01", "stroke::test_too_many_vertices", "fuzz_tests::fuzzing_test_case_9", "stroke::test_empty_path", "stroke::test_square", "monotone::test_monotone_tess", "stroke::test_empty_caps", "test_with_invalid_miter_limit - should panic", "test_with_miter_limit", "test_without_miter_limit", "fuzz_tests::fuzzing_test_case_01", "fuzz_tests::fuzzing_test_case_3", "fuzz_tests::fuzzing_test_case_2", "fill_tests::test_rust_logo_scale_up", "fill_tests::test_degenerate_same_position", "fill_tests::test_simple_split", "fill_tests::test_simple_1", "fill_tests::test_simple_merge_split", "fill_tests::test_hole_1", "fill_tests::test_simple_aligned", "earcut_tests::water_huge", "fill_tests::test_simple_2", "earcut_tests::water_huge_2", "fill_tests::n_segments_intersecting", "fill_tests::test_rust_logo_no_intersection", "fill_tests::test_rust_logo_with_intersection", "fill_tests::very_large_path", "tessellation/src/geometry_builder.rs - geometry_builder (line 202)", "tessellation/src/geometry_builder.rs - geometry_builder (line 131)", "tessellation/src/geometry_builder.rs - geometry_builder (line 72)", "tessellation/src/stroke.rs - stroke::StrokeTessellator (line 44)", "tessellation/src/fill.rs - fill::FillTessellator (line 378)", "tessellation/src/fill.rs - fill::FillTessellator (line 336)" ]
[]
[]
2021-09-29T20:59:52Z
17b0ce8c74a2bb917de85f99428886ca8445ac3b
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -787,7 +787,7 @@ dependencies = [ "lyon_extra 0.15.0", "lyon_svg 0.15.0", "lyon_tess2 0.15.0", - "lyon_tessellation 0.15.1", + "lyon_tessellation 0.15.2", ] [[package]] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -862,14 +862,14 @@ dependencies = [ name = "lyon_tess2" version = "0.15.0" dependencies = [ - "lyon_tessellation 0.15.1", + "lyon_tessellation 0.15.2", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "tess2-sys 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lyon_tessellation" -version = "0.15.1" +version = "0.15.2" dependencies = [ "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "lyon_extra 0.15.0", diff --git a/tessellation/Cargo.toml b/tessellation/Cargo.toml --- a/tessellation/Cargo.toml +++ b/tessellation/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lyon_tessellation" -version = "0.15.1" +version = "0.15.2" description = "A low level path tessellation library." authors = [ "Nicolas Silva <nical@fastmail.com>" ] repository = "https://github.com/nical/lyon" diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -213,6 +213,7 @@ impl EventQueue { } pub(crate) fn insert_sibling(&mut self, sibling: TessEventId, position: Point, data: EdgeData) { + debug_assert!(is_after(data.to, position)); let idx = self.events.len() as TessEventId; let next_sibling = self.events[sibling as usize].next_sibling; diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -656,6 +657,10 @@ impl EventQueueBuilder { mut t0: f32, mut t1: f32, ) { + if from == to { + return; + } + let mut evt_pos = from; let mut evt_to = to; if is_after(evt_pos, to) { diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -748,6 +753,10 @@ impl EventQueueBuilder { let mut first = None; let is_first_edge = self.nth == 0; segment.for_each_flattened_with_t(self.tolerance, &mut|to, t1| { + if from == to { + return; + } + if first == None { first = Some(to) // We can't call vertex(prev, from, to) in the first iteration diff --git a/tessellation/src/event_queue.rs b/tessellation/src/event_queue.rs --- a/tessellation/src/event_queue.rs +++ b/tessellation/src/event_queue.rs @@ -829,6 +838,10 @@ impl EventQueueBuilder { let mut first = None; let is_first_edge = self.nth == 0; segment.for_each_flattened_with_t(self.tolerance, &mut|to, t1| { + if from == to { + return; + } + if first == None { first = Some(to) // We can't call vertex(prev, from, to) in the first iteration
nical__lyon-519
519
The above example will work successfully if I omit the last `line_to` and let it close via `close`, but here's another example where omitting it has no effect: ``` let mut builder = Path::builder(); builder.move_to(Point::new(-69.1f32, -465.5f32)); builder.line_to(Point::new(-69.1f32, -461.65f32)); builder.quadratic_bezier_to( Point::new(-70.95f32, -462.8f32), Point::new(-72.95f32, -462.9f32), ); builder.quadratic_bezier_to( Point::new(-75.65f32, -463.1f32), Point::new(-77.35f32, -461.45f32), ); builder.quadratic_bezier_to( Point::new(-78.65f32, -460.2f32), Point::new(-79.05f32, -458.1f32), ); builder.line_to(Point::new(-80.55f32, -465.5f32)); builder.line_to(Point::new(-69.1f32, -465.5f32)); builder.close(); builder.build() ```
[ "518" ]
0.15
nical/lyon
2019-12-27T22:28:12Z
diff --git a/tessellation/src/fill_tests.rs b/tessellation/src/fill_tests.rs --- a/tessellation/src/fill_tests.rs +++ b/tessellation/src/fill_tests.rs @@ -2055,6 +2055,70 @@ fn issue_500() { ).unwrap(); } +#[test] +fn issue_518_1() { + let mut builder = Path::builder(); + builder.move_to(point(-76.95, -461.8)); + builder.quadratic_bezier_to( + point(-75.95, -462.6), + point(-74.65, -462.8), + ); + builder.line_to(point(-79.1, -456.4)); + builder.line_to(point(-83.4, -464.75)); + builder.line_to(point(-80.75, -464.75)); + builder.line_to(point(-79.05, -458.1)); + builder.quadratic_bezier_to( + point(-78.65, -460.2), + point(-77.35, -461.45), + ); + builder.line_to(point(-77.1, -461.65)); + builder.line_to(point(-76.95, -461.8)); + builder.close(); + + let mut tess = FillTessellator::new(); + + let mut buffers: VertexBuffers<Point, u16> = VertexBuffers::new(); + + tess.tessellate( + &builder.build(), + &FillOptions::default(), + &mut simple_builder(&mut buffers), + ).unwrap(); +} + +#[test] +fn issue_518_2() { + let mut builder = Path::builder(); + builder.move_to(point(-69.1, -465.5)); + builder.line_to(point(-69.1, -461.65)); + builder.quadratic_bezier_to( + point(-70.95, -462.8), + point(-72.95, -462.9), + ); + builder.quadratic_bezier_to( + point(-75.65, -463.1), + point(-77.35, -461.45), + ); + builder.quadratic_bezier_to( + point(-78.65, -460.2), + point(-79.05, -458.1), + ); + builder.line_to(point(-80.55, -465.5)); + builder.line_to(point(-69.1, -465.5)); + builder.close(); + + let mut tess = FillTessellator::new(); + + let mut buffers: VertexBuffers<Point, u16> = VertexBuffers::new(); + + tess.tessellate( + &builder.build(), + &FillOptions::default(), + &mut simple_builder(&mut buffers), + ).unwrap(); +} + + #[test] fn very_large_path() { /// Try tessellating a path with a large number of endpoints.
Path hits `is_after(to, self.current_position)` assert The following path hit an assert in the fill tessellator in both debug and release: ``` let mut builder = Path::builder(); builder.move_to(Point::new(-76.95f32, -461.8f32)); builder.quadratic_bezier_to( Point::new(-75.95f32, -462.6f32), Point::new(-74.65f32, -462.8f32), ); builder.line_to(Point::new(-79.1f32, -456.4f32)); builder.line_to(Point::new(-83.4f32, -464.75f32)); builder.line_to(Point::new(-80.75f32, -464.75f32)); builder.line_to(Point::new(-79.05f32, -458.1f32)); builder.quadratic_bezier_to( Point::new(-78.65f32, -460.2f32), Point::new(-77.35f32, -461.45f32), ); builder.line_to(Point::new(-77.1f32, -461.65f32)); builder.line_to(Point::new(-76.95f32, -461.8f32)); builder.close(); builder.build() ``` Debug: ``` thread 'main' panicked at 'assertion failed: is_after(to, self.current_position)', ...\github.com-1ecc6299db9ec823\lyon_tessellation-0.15.1\src\fill.rs:715:17 ``` Release: ``` thread 'main' panicked at 'assertion failed: from != edge.to', ...\lyon_tessellation-0.15.1\src\fill.rs:1252:13 ``` SVG of above broken minimal example and full art (although the SVGs may or may not expose the problem, as Flash can sometimes export paths in awkward ways): [bad-art.zip](https://github.com/nical/lyon/files/4006264/bad-art.zip) lyon and lyon-tessellation 0.15.1
08cd4c3d8c1ef53fbbb1b702f655e26c6bd5cc03
[ "fill_tests::issue_518_2", "fill_tests::issue_518_1" ]
[ "basic_shapes::issue_366", "earcut_tests::bad_diagonal", "earcut_tests::bad_hole", "earcut_tests::eberly_3", "earcut_tests::empty_square", "earcut_tests::dude", "earcut_tests::building", "earcut_tests::degenerate", "earcut_tests::issue_16", "earcut_tests::issue_17", "earcut_tests::hole_touching_outer", "earcut_tests::issue_29", "earcut_tests::outside_ring", "earcut_tests::issue_45", "earcut_tests::issue_34", "earcut_tests::issue_52", "earcut_tests::shared_points", "earcut_tests::steiner", "earcut_tests::self_touching", "earcut_tests::simplified_us_border", "earcut_tests::touching_holes", "earcut_tests::hilbert", "earcut_tests::water_3", "earcut_tests::water_3b", "event_queue::test_event_queue_sort_1", "event_queue::test_event_queue_sort_3", "event_queue::test_event_queue_sort_4", "event_queue::test_event_queue_push_sorted", "fill::fill_vertex_source_01", "event_queue::test_event_queue_sort_5", "fill::fill_vertex_source_02", "earcut_tests::issue_35", "fill_tests::angle_precision", "event_queue::test_event_queue_sort_2", "fill_tests::back_along_previous_edge", "fill_tests::issue_476_original", "fill_tests::issue_481_reduced", "earcut_tests::water_4", "fill_tests::new_tess_2", "fill_tests::new_tess_merge", "fill_tests::new_tess_1", "fill_tests::new_tess_points_too_close", "fill_tests::issue_476_reduced", "fill_tests::issue_500", "fill_tests::overlapping_horizontal", "earcut_tests::water_2", "fill_tests::reduced_test_case_01", "earcut_tests::eberly_6", "fill_tests::new_tess_coincident_simple", "fill_tests::new_tess_overlapping_1", "fill_tests::issue_481_original", "fill_tests::reduced_test_case_04", "fill_tests::reduced_test_case_08", "fill_tests::reduced_test_case_07", "fill_tests::reduced_test_case_05", "fill_tests::reduced_test_case_06", "fill_tests::reduced_test_case_09", "fill_tests::reduced_test_case_03", "fill_tests::reduced_test_case_14", "fill_tests::reduced_test_case_02", "fill_tests::test_close_at_first_position", "fill_tests::test_chained_merge_split", "fill_tests::test_auto_intersection_type1", "fill_tests::test_auto_intersection_type2", "fill_tests::test_chained_merge_left", "fill_tests::test_chained_merge_merge", "fill_tests::reduced_test_case_12", "fill_tests::reduced_test_case_10", "fill_tests::reduced_test_case_11", "fill_tests::test_chained_merge_end", "fill_tests::test_coincident_simple_1", "fill_tests::test_coincident_simple_2", "fill_tests::reduced_test_case_13", "fill_tests::test_colinear_3", "fill_tests::test_colinear_touching_squares3", "fill_tests::test_colinear_touching_squares", "fill_tests::test_empty_path", "fill_tests::test_double_merge_with_intersection", "fill_tests::test_colinear_4", "fill_tests::test_colinear_touching_squares2", "event_queue::test_logo", "fill_tests::test_exp_no_intersection_01", "fill_tests::test_fixed_to_f32_precision", "fill_tests::test_intersecting_bow_tie", "fill_tests::test_overlapping_with_intersection", "fill_tests::test_point_on_edge_right", "fill_tests::test_intersection_horizontal_precision", "fill_tests::test_no_close", "fill_tests::test_identical_squares", "fill_tests::test_point_on_edge2", "fill_tests::test_intersection_1", "fill_tests::test_point_on_edge_left", "fill_tests::test_unknown_issue_1", "fill_tests::test_simple_double_merge", "fill_tests::triangle", "fill_tests::test_simple_monotone", "fill_tests::test_split_with_intersections", "fill_tests::test_colinear_2", "fill_tests::three_edges_below", "fuzz_tests::fuzzing_test_case_10", "fuzz_tests::fuzzing_test_case_13", "fuzz_tests::fuzzing_test_case_12", "fill_tests::test_colinear_1", "earcut_tests::water", "fuzz_tests::fuzzing_test_case_11", "fuzz_tests::fuzzing_test_case_14", "fuzz_tests::fuzzing_test_case_17", "fuzz_tests::fuzzing_test_case_18", "fuzz_tests::fuzzing_test_case_19", "fill_tests::test_rust_logo_scale_down2", "fill_tests::test_rust_logo_scale_down", "fill_tests::test_too_many_vertices", "fuzz_tests::fuzzing_test_case_16", "fuzz_tests::fuzzing_test_case_15", "fuzz_tests::fuzzing_test_case_20", "fuzz_tests::fuzzing_test_case_22", "fuzz_tests::fuzzing_test_case_21", "fuzz_tests::fuzzing_test_case_4", "fuzz_tests::fuzzing_test_case_24", "fuzz_tests::fuzzing_test_case_6", "fuzz_tests::fuzzing_test_case_9", "math_utils::test_compute_normal", "fuzz_tests::fuzzing_test_case_7", "fuzz_tests::fuzzing_test_case_8", "fill_tests::test_coincident_simple_rotated", "monotone::test_monotone_tess", "stroke::stroke_vertex_source_01", "stroke::test_empty_caps", "stroke::test_empty_path", "fuzz_tests::fuzzing_test_case_23", "stroke::test_square", "stroke::test_too_many_vertices", "fuzz_tests::fuzzing_test_case_5", "fill_tests::test_colinear_touching_squares_rotated", "fill_tests::test_simple_triangle", "fill_tests::test_intersecting_star_shape", "fuzz_tests::fuzzing_test_case_26", "fuzz_tests::fuzzing_test_case_25", "fuzz_tests::fuzzing_test_case_3", "test_with_miter_limit", "test_with_invalid_miter_limit - should panic", "test_without_miter_limit", "fuzz_tests::fuzzing_test_case_2", "fill_tests::test_auto_intersection_multi", "fuzz_tests::fuzzing_test_case_01", "fill_tests::test_rust_logo_scale_up", "fill_tests::test_degenerate_same_position", "fill_tests::test_simple_split", "fill_tests::test_simple_merge_split", "fill_tests::test_simple_1", "fill_tests::test_hole_1", "fill_tests::test_simple_aligned", "fill_tests::test_simple_2", "earcut_tests::water_huge", "earcut_tests::water_huge_2", "fill_tests::n_segments_intersecting", "fill_tests::test_rust_logo_no_intersection", "fill_tests::test_rust_logo_with_intersection", "fill_tests::very_large_path", "tessellation/src/geometry_builder.rs - geometry_builder (line 202)", "tessellation/src/geometry_builder.rs - geometry_builder (line 131)", "tessellation/src/stroke.rs - stroke::StrokeTessellator (line 44)", "tessellation/src/fill.rs - fill::FillTessellator (line 336)", "tessellation/src/geometry_builder.rs - geometry_builder (line 72)", "tessellation/src/fill.rs - fill::FillTessellator (line 378)" ]
[]
[]
2019-12-28T00:17:29Z
fcb9841a744543b993eb1645db35dbda541e9a30
diff --git a/strum_macros/src/helpers/type_props.rs b/strum_macros/src/helpers/type_props.rs --- a/strum_macros/src/helpers/type_props.rs +++ b/strum_macros/src/helpers/type_props.rs @@ -21,6 +21,7 @@ pub struct StrumTypeProperties { pub discriminant_others: Vec<TokenStream>, pub discriminant_vis: Option<Visibility>, pub use_phf: bool, + pub enum_repr: Option<TokenStream>, } impl HasTypeProperties for DeriveInput { diff --git a/strum_macros/src/helpers/type_props.rs b/strum_macros/src/helpers/type_props.rs --- a/strum_macros/src/helpers/type_props.rs +++ b/strum_macros/src/helpers/type_props.rs @@ -103,6 +104,17 @@ impl HasTypeProperties for DeriveInput { } } + let attrs = &self.attrs; + for attr in attrs { + if let Ok(list) = attr.meta.require_list() { + if let Some(ident) = list.path.get_ident() { + if ident == "repr" { + output.enum_repr = Some(list.tokens.clone()) + } + } + } + } + Ok(output) } } diff --git a/strum_macros/src/macros/enum_discriminants.rs b/strum_macros/src/macros/enum_discriminants.rs --- a/strum_macros/src/macros/enum_discriminants.rs +++ b/strum_macros/src/macros/enum_discriminants.rs @@ -40,10 +40,16 @@ pub fn enum_discriminants_inner(ast: &DeriveInput) -> syn::Result<TokenStream> { // Pass through all other attributes let pass_though_attributes = type_properties.discriminant_others; + let repr = type_properties.enum_repr.map(|repr| quote!(#[repr(#repr)])); + // Add the variants without fields, but exclude the `strum` meta item let mut discriminants = Vec::new(); for variant in variants { let ident = &variant.ident; + let discriminant = variant + .discriminant + .as_ref() + .map(|(_, expr)| quote!( = #expr)); // Don't copy across the "strum" meta attribute. Only passthrough the whitelisted // attributes and proxy `#[strum_discriminants(...)]` attributes diff --git a/strum_macros/src/macros/enum_discriminants.rs b/strum_macros/src/macros/enum_discriminants.rs --- a/strum_macros/src/macros/enum_discriminants.rs +++ b/strum_macros/src/macros/enum_discriminants.rs @@ -81,7 +87,7 @@ pub fn enum_discriminants_inner(ast: &DeriveInput) -> syn::Result<TokenStream> { }) .collect::<Result<Vec<_>, _>>()?; - discriminants.push(quote! { #(#attrs)* #ident }); + discriminants.push(quote! { #(#attrs)* #ident #discriminant}); } // Ideally: diff --git a/strum_macros/src/macros/enum_discriminants.rs b/strum_macros/src/macros/enum_discriminants.rs --- a/strum_macros/src/macros/enum_discriminants.rs +++ b/strum_macros/src/macros/enum_discriminants.rs @@ -153,6 +159,7 @@ pub fn enum_discriminants_inner(ast: &DeriveInput) -> syn::Result<TokenStream> { Ok(quote! { /// Auto-generated discriminant enum variants #derives + #repr #(#[ #pass_though_attributes ])* #discriminants_vis enum #discriminants_name { #(#discriminants),* diff --git a/strum_macros/src/macros/from_repr.rs b/strum_macros/src/macros/from_repr.rs --- a/strum_macros/src/macros/from_repr.rs +++ b/strum_macros/src/macros/from_repr.rs @@ -1,62 +1,32 @@ use heck::ToShoutySnakeCase; use proc_macro2::{Span, TokenStream}; -use quote::{format_ident, quote, ToTokens}; -use syn::{Data, DeriveInput, Fields, PathArguments, Type, TypeParen}; +use quote::{format_ident, quote}; +use syn::{Data, DeriveInput, Fields, Type}; -use crate::helpers::{non_enum_error, HasStrumVariantProperties}; +use crate::helpers::{non_enum_error, HasStrumVariantProperties, HasTypeProperties}; pub fn from_repr_inner(ast: &DeriveInput) -> syn::Result<TokenStream> { let name = &ast.ident; let gen = &ast.generics; let (impl_generics, ty_generics, where_clause) = gen.split_for_impl(); let vis = &ast.vis; - let attrs = &ast.attrs; let mut discriminant_type: Type = syn::parse("usize".parse().unwrap()).unwrap(); - for attr in attrs { - let path = attr.path(); - - let mut ts = if let Ok(ts) = attr - .meta - .require_list() - .map(|metas| metas.to_token_stream().into_iter()) - { - ts - } else { - continue; - }; - // Discard the path - let _ = ts.next(); - let tokens: TokenStream = ts.collect(); - - if path.leading_colon.is_some() { - continue; - } - if path.segments.len() != 1 { - continue; - } - let segment = path.segments.first().unwrap(); - if segment.ident != "repr" { - continue; - } - if segment.arguments != PathArguments::None { - continue; - } - let typ_paren = match syn::parse2::<Type>(tokens.clone()) { - Ok(Type::Paren(TypeParen { elem, .. })) => *elem, - _ => continue, - }; - let inner_path = match &typ_paren { - Type::Path(t) => t, - _ => continue, - }; - if let Some(seg) = inner_path.path.segments.last() { - for t in &[ - "u8", "u16", "u32", "u64", "usize", "i8", "i16", "i32", "i64", "isize", - ] { - if seg.ident == t { - discriminant_type = typ_paren; - break; + if let Some(type_path) = ast + .get_type_properties() + .ok() + .and_then(|tp| tp.enum_repr) + .and_then(|repr_ts| syn::parse2::<Type>(repr_ts).ok()) + { + if let Type::Path(path) = type_path.clone() { + if let Some(seg) = path.path.segments.last() { + for t in &[ + "u8", "u16", "u32", "u64", "usize", "i8", "i16", "i32", "i64", "isize", + ] { + if seg.ident == t { + discriminant_type = type_path; + break; + } } } }
Peternator7__strum-288
288
It's a breaking change, but I agree it's certainly more inline with what would be expected. Happy to take a PR if you're interested.
[ "283" ]
0.25
Peternator7/strum
2023-08-01T22:43:37Z
diff --git a/strum_tests/tests/enum_discriminants.rs b/strum_tests/tests/enum_discriminants.rs --- a/strum_tests/tests/enum_discriminants.rs +++ b/strum_tests/tests/enum_discriminants.rs @@ -1,6 +1,9 @@ -use enum_variant_type::EnumVariantType; -use strum::{Display, EnumDiscriminants, EnumIter, EnumMessage, EnumString, IntoEnumIterator}; +use std::mem::{align_of, size_of}; +use enum_variant_type::EnumVariantType; +use strum::{ + Display, EnumDiscriminants, EnumIter, EnumMessage, EnumString, FromRepr, IntoEnumIterator, +}; mod core {} // ensure macros call `::core` diff --git a/strum_tests/tests/enum_discriminants.rs b/strum_tests/tests/enum_discriminants.rs --- a/strum_tests/tests/enum_discriminants.rs +++ b/strum_tests/tests/enum_discriminants.rs @@ -305,3 +308,58 @@ fn crate_module_path_test() { assert_eq!(expected, discriminants); } + +#[allow(dead_code)] +#[derive(EnumDiscriminants)] +#[repr(u16)] +enum WithReprUInt { + Variant0, + Variant1, +} + +#[test] +fn with_repr_uint() { + // These tests would not be proof of proper functioning on a 16 bit system + assert_eq!(size_of::<u16>(), size_of::<WithReprUIntDiscriminants>()); + assert_eq!( + size_of::<WithReprUInt>(), + size_of::<WithReprUIntDiscriminants>() + ) +} + +#[allow(dead_code)] +#[derive(EnumDiscriminants)] +#[repr(align(16), u8)] +enum WithReprAlign { + Variant0, + Variant1, +} + +#[test] +fn with_repr_align() { + assert_eq!( + align_of::<WithReprAlign>(), + align_of::<WithReprAlignDiscriminants>() + ); + assert_eq!(16, align_of::<WithReprAlignDiscriminants>()); +} + +#[allow(dead_code)] +#[derive(EnumDiscriminants)] +#[strum_discriminants(derive(FromRepr))] +enum WithExplicitDicriminantValue { + Variant0 = 42 + 100, + Variant1 = 11, +} + +#[test] +fn with_explicit_discriminant_value() { + assert_eq!( + WithExplicitDicriminantValueDiscriminants::from_repr(11), + Some(WithExplicitDicriminantValueDiscriminants::Variant1) + ); + assert_eq!( + 142, + WithExplicitDicriminantValueDiscriminants::Variant0 as u8 + ); +}
EnumDiscriminants should inherit the repr of the enum they are derived from The below example code will generate `VehicleDiscriminants` enum with `Car` and `Truck` variants but it will be `repr(usize)` instead of inheriting the `u8` repr of `Vehicle` additionally they will have the default enum representations (`Car = 0` and `Vehicle = 1` in this case) ``` // Custom discriminant tests #[derive(EnumDiscriminants, Debug, PartialEq)] #[strum_discriminants(derive(FromRepr))] #[repr(u8)] enum Vehicle { Car(CarModel) = 1, Truck(TruckModel) = 3, } ``` I would have expected the above code to produce the following: ``` #[repr(u8)] #[derive(FromRepr)] enum VehicleDiscriminants { Car = 1, Truck = 3, } ```
597f8e941fb9dec5603f6892df4109b50f615160
[ "with_explicit_discriminant_value", "with_repr_uint", "with_repr_align" ]
[ "arbitrary_attributes_pass_through", "complicated_test", "crate_module_path_test", "from_ref_test", "fields_test", "filter_variant_attributes_pass_through", "from_ref_test_complex", "from_test", "from_test_complex", "override_visibility", "split_attributes_test", "renamed_test", "with_default_test", "simple_test", "with_passthrough_attributes_test" ]
[]
[]
2024-01-28T01:13:46Z
025b1b5687d061bc4116f77578fa9fc2b3fc1f26
diff --git a/strum_macros/src/macros/enum_count.rs b/strum_macros/src/macros/enum_count.rs --- a/strum_macros/src/macros/enum_count.rs +++ b/strum_macros/src/macros/enum_count.rs @@ -2,11 +2,18 @@ use proc_macro2::TokenStream; use quote::quote; use syn::{Data, DeriveInput}; +use crate::helpers::variant_props::HasStrumVariantProperties; use crate::helpers::{non_enum_error, HasTypeProperties}; pub(crate) fn enum_count_inner(ast: &DeriveInput) -> syn::Result<TokenStream> { let n = match &ast.data { - Data::Enum(v) => v.variants.len(), + Data::Enum(v) => v.variants.iter().try_fold(0usize, |acc, v| { + if v.get_variant_properties()?.disabled.is_none() { + Ok::<usize, syn::Error>(acc + 1usize) + } else { + Ok::<usize, syn::Error>(acc) + } + })?, _ => return Err(non_enum_error()), }; let type_properties = ast.get_type_properties()?;
Peternator7__strum-268
268
[ "267" ]
0.24
Peternator7/strum
2023-04-26T18:46:25Z
diff --git a/strum_tests/tests/enum_count.rs b/strum_tests/tests/enum_count.rs --- a/strum_tests/tests/enum_count.rs +++ b/strum_tests/tests/enum_count.rs @@ -11,12 +11,29 @@ enum Week { Saturday, } +#[allow(dead_code)] +#[derive(Debug, EnumCount, EnumIter)] +enum Pets { + Dog, + Cat, + Fish, + Bird, + #[strum(disabled)] + Hamster, +} + #[test] fn simple_test() { assert_eq!(7, Week::COUNT); assert_eq!(Week::iter().count(), Week::COUNT); } +#[test] +fn disabled_test() { + assert_eq!(4, Pets::COUNT); + assert_eq!(Pets::iter().count(), Pets::COUNT); +} + #[test] fn crate_module_path_test() { pub mod nested {
Disabled variant still included in Count The [additional attributes docs](https://docs.rs/strum/latest/strum/additional_attributes/index.html#attributes-on-variants) define the `disabled` attribute as: > `disabled`: removes variant from generated code. However, when deriving the `EnumCount` trait, the disabled variant is still counted in the final count. Here is some example code: ```rust use strum::EnumCount; #[derive(strum::EnumCount)] enum Fields { Field0, Field1, Field2, #[strum(disabled)] Unknown, } fn main() { println!("Count: {}", Fields::COUNT); } ```` Expected output: `Count: 3` Actual output: `Count: 4` This issue seems similar to #244
025b1b5687d061bc4116f77578fa9fc2b3fc1f26
[ "disabled_test" ]
[ "crate_module_path_test", "simple_test" ]
[]
[]
2023-06-18T22:54:11Z
c6c78a16c59af13a6bf6d35ed859618033a61768
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -277,6 +277,15 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "content_inspector" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" +dependencies = [ + "memchr", +] + [[package]] name = "core-foundation" version = "0.9.3" diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -442,6 +451,7 @@ dependencies = [ "chrono", "clap", "clap_complete", + "content_inspector", "diqwest", "form_urlencoded", "futures", diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -40,6 +40,7 @@ async-stream = "0.3" walkdir = "2.3" form_urlencoded = "1.0" alphanumeric-sort = "1.4" +content_inspector = "0.2.4" [features] default = ["tls"] diff --git a/assets/index.css b/assets/index.css --- a/assets/index.css +++ b/assets/index.css @@ -108,11 +108,10 @@ body { } .main { - padding: 3em 1em 0; + padding: 3.3em 1em 0; } .empty-folder { - padding-top: 1rem; font-style: italic; } diff --git a/assets/index.css b/assets/index.css --- a/assets/index.css +++ b/assets/index.css @@ -202,6 +201,25 @@ body { padding-right: 1em; } +.editor { + width: 100%; + height: calc(100vh - 5rem); + border: 1px solid #ced4da; + outline: none; +} + +.save-btn { + margin-left: auto; + margin-right: 2em; + cursor: pointer; + user-select: none; +} + +.not-editable { + font-style: italic; +} + + @media (min-width: 768px) { .path a { min-width: 400px; diff --git a/assets/index.html b/assets/index.html --- a/assets/index.html +++ b/assets/index.html @@ -7,59 +7,97 @@ <link rel="icon" type="image/x-icon" href="__ASSERTS_PREFIX__favicon.ico"> <link rel="stylesheet" href="__ASSERTS_PREFIX__index.css"> <script> - DATA = __INDEX_DATA__ + DATA = __INDEX_DATA__ </script> <script src="__ASSERTS_PREFIX__index.js"></script> </head> + <body> <div class="head"> <div class="breadcrumb"></div> <div class="toolbox"> <div> <a href="?zip" class="zip-root hidden" title="Download folder as a .zip file"> - <svg width="16" height="16" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z"/></svg> + <svg width="16" height="16" viewBox="0 0 16 16"> + <path + d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" /> + <path + d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z" /> + </svg> + </a> + <a href="" class="download hidden" title="Download file" download=""> + <svg width="16" height="16" viewBox="0 0 16 16"> + <path + d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" /> + <path + d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z" /> + </svg> </a> </div> <div class="control upload-file hidden" title="Upload files"> <label for="file"> - <svg width="16" height="16" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z"/><path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z"/></svg> + <svg width="16" height="16" viewBox="0 0 16 16"> + <path + d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" /> + <path + d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z" /> + </svg> </label> <input type="file" id="file" name="file" multiple> </div> <div class="control new-folder hidden" title="New folder"> <svg width="16" height="16" viewBox="0 0 16 16"> - <path d="m.5 3 .04.87a1.99 1.99 0 0 0-.342 1.311l.637 7A2 2 0 0 0 2.826 14H9v-1H2.826a1 1 0 0 1-.995-.91l-.637-7A1 1 0 0 1 2.19 4h11.62a1 1 0 0 1 .996 1.09L14.54 8h1.005l.256-2.819A2 2 0 0 0 13.81 3H9.828a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 6.172 1H2.5a2 2 0 0 0-2 2zm5.672-1a1 1 0 0 1 .707.293L7.586 3H2.19c-.24 0-.47.042-.683.12L1.5 2.98a1 1 0 0 1 1-.98h3.672z"/> - <path d="M13.5 10a.5.5 0 0 1 .5.5V12h1.5a.5.5 0 1 1 0 1H14v1.5a.5.5 0 1 1-1 0V13h-1.5a.5.5 0 0 1 0-1H13v-1.5a.5.5 0 0 1 .5-.5z"/> + <path + d="m.5 3 .04.87a1.99 1.99 0 0 0-.342 1.311l.637 7A2 2 0 0 0 2.826 14H9v-1H2.826a1 1 0 0 1-.995-.91l-.637-7A1 1 0 0 1 2.19 4h11.62a1 1 0 0 1 .996 1.09L14.54 8h1.005l.256-2.819A2 2 0 0 0 13.81 3H9.828a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 6.172 1H2.5a2 2 0 0 0-2 2zm5.672-1a1 1 0 0 1 .707.293L7.586 3H2.19c-.24 0-.47.042-.683.12L1.5 2.98a1 1 0 0 1 1-.98h3.672z" /> + <path + d="M13.5 10a.5.5 0 0 1 .5.5V12h1.5a.5.5 0 1 1 0 1H14v1.5a.5.5 0 1 1-1 0V13h-1.5a.5.5 0 0 1 0-1H13v-1.5a.5.5 0 0 1 .5-.5z" /> </svg> </div> </div> <form class="searchbar hidden"> <div class="icon"> - <svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg> + <svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> + <path + d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" /> + </svg> </div> <input id="search" name="q" type="text" maxlength="128" autocomplete="off" tabindex="1"> <input type="submit" hidden /> </form> + <div class="save-btn hidden" title="Save file"> + <svg viewBox="0 0 1024 1024" width="24" height="24"> + <path + d="M426.666667 682.666667v42.666666h170.666666v-42.666666h-170.666666z m-42.666667-85.333334h298.666667v128h42.666666V418.133333L605.866667 298.666667H298.666667v426.666666h42.666666v-128h42.666667z m260.266667-384L810.666667 379.733333V810.666667H213.333333V213.333333h430.933334zM341.333333 341.333333h85.333334v170.666667H341.333333V341.333333z" + fill="#444444" p-id="8311"></path> + </svg> + </div> </div> <div class="main"> - <div class="empty-folder hidden"></div> - <table class="uploaders-table hidden"> - <thead> - <tr> - <th class="cell-name" colspan="2">Name</th> - <th class="cell-status">Progress</th> - </tr> - </thead> - </table> - <table class="paths-table hidden"> - <thead> - </thead> - <tbody> - </tbody> - </table> + <div class="index-page hidden"> + <div class="empty-folder hidden"></div> + <table class="uploaders-table hidden"> + <thead> + <tr> + <th class="cell-name" colspan="2">Name</th> + <th class="cell-status">Progress</th> + </tr> + </thead> + </table> + <table class="paths-table hidden"> + <thead> + </thead> + <tbody> + </tbody> + </table> + </div> + <div class="editor-page hidden"> + <div class="not-editable hidden"></div> + <textarea class="editor hidden" cols="10"></textarea> + </div> </div> <script> window.addEventListener("DOMContentLoaded", ready); </script> </body> + </html> \ No newline at end of file diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -7,9 +7,14 @@ */ /** - * @typedef {object} DATA + * @typedef {IndexDATA|EditDATA} DATA + */ + +/** + * @typedef {object} IndexDATA * @property {string} href * @property {string} uri_prefix + * @property {"Index"} kind * @property {PathItem[]} paths * @property {boolean} allow_upload * @property {boolean} allow_delete diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -18,6 +23,14 @@ * @property {boolean} dir_exists */ +/** + * @typedef {object} EditDATA + * @property {string} href + * @property {string} uri_prefix + * @property {"Edit"} kind + * @property {string} editable + */ + /** * @type {DATA} DATA */ diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -57,11 +70,43 @@ let $emptyFolder; /** * @type Element */ -let $newFolder; -/** - * @type Element - */ -let $searchbar; +let $editor; + +function ready() { + document.title = `Index of ${DATA.href} - Dufs`; + $pathsTable = document.querySelector(".paths-table") + $pathsTableHead = document.querySelector(".paths-table thead"); + $pathsTableBody = document.querySelector(".paths-table tbody"); + $uploadersTable = document.querySelector(".uploaders-table"); + $emptyFolder = document.querySelector(".empty-folder"); + $editor = document.querySelector(".editor"); + + addBreadcrumb(DATA.href, DATA.uri_prefix); + + if (DATA.kind == "Index") { + + document.querySelector(".index-page").classList.remove("hidden"); + + if (DATA.allow_search) { + setupSearch() + } + + if (DATA.allow_archive) { + document.querySelector(".zip-root").classList.remove("hidden"); + } + + renderPathsTableHead(); + renderPathsTableBody(); + + if (DATA.allow_upload) { + dropzone(); + setupUpload(); + } + } else if (DATA.kind == "Edit") { + setupEditor(); + } +} + class Uploader { /** diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -83,12 +128,12 @@ class Uploader { upload() { const { idx, name } = this; - const url = getUrl(name); + const url = newUrl(name); const encodedName = encodedStr(name); $uploadersTable.insertAdjacentHTML("beforeend", ` <tr id="upload${idx}" class="uploader"> <td class="path cell-icon"> - ${getSvg()} + ${getPathSvg()} </td> <td class="path cell-name"> <a href="${url}">${encodedName}</a> diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -105,7 +150,7 @@ class Uploader { ajax() { Uploader.runnings += 1; - const url = getUrl(this.name); + const url = newUrl(this.name); this.lastUptime = Date.now(); const ajax = new XMLHttpRequest(); ajax.upload.addEventListener("progress", e => this.progress(e), false); diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -272,7 +317,7 @@ function renderPathsTableBody() { */ function addPath(file, index) { const encodedName = encodedStr(file.name); - let url = getUrl(file.name) + let url = newUrl(file.name) let actionDelete = ""; let actionDownload = ""; let actionMove = ""; diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -316,10 +361,10 @@ function addPath(file, index) { $pathsTableBody.insertAdjacentHTML("beforeend", ` <tr id="addPath${index}"> <td class="path cell-icon"> - ${getSvg(file.path_type)} + ${getPathSvg(file.path_type)} </td> <td class="path cell-name"> - <a href="${url}">${encodedName}</a> + <a href="${url}?edit" target="_blank">${encodedName}</a> </td> <td class="cell-mtime">${formatMtime(file.mtime)}</td> <td class="cell-size">${formatSize(file.size).join(" ")}</td> diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -339,19 +384,16 @@ async function deletePath(index) { if (!confirm(`Delete \`${file.name}\`?`)) return; try { - const res = await fetch(getUrl(file.name), { + const res = await fetch(newUrl(file.name), { method: "DELETE", }); - if (res.status >= 200 && res.status < 300) { - document.getElementById(`addPath${index}`).remove(); - DATA.paths[index] = null; - if (!DATA.paths.find(v => !!v)) { - $pathsTable.classList.add("hidden"); - $emptyFolder.textContent = dirEmptyNote; - $emptyFolder.classList.remove("hidden"); - } - } else { - throw new Error(await res.text()) + await assertFetch(res); + document.getElementById(`addPath${index}`).remove(); + DATA.paths[index] = null; + if (!DATA.paths.find(v => !!v)) { + $pathsTable.classList.add("hidden"); + $emptyFolder.textContent = dirEmptyNote; + $emptyFolder.classList.remove("hidden"); } } catch (err) { alert(`Cannot delete \`${file.name}\`, ${err.message}`); diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -368,7 +410,7 @@ async function movePath(index) { const file = DATA.paths[index]; if (!file) return; - const fileUrl = getUrl(file.name); + const fileUrl = newUrl(file.name); const fileUrlObj = new URL(fileUrl) const prefix = DATA.uri_prefix.slice(0, -1); diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -388,11 +430,8 @@ async function movePath(index) { "Destination": newFileUrl, } }); - if (res.status >= 200 && res.status < 300) { - location.href = newFileUrl.split("/").slice(0, -1).join("/") - } else { - throw new Error(await res.text()) - } + await assertFetch(res); + location.href = newFileUrl.split("/").slice(0, -1).join("/") } catch (err) { alert(`Cannot move \`${filePath}\` to \`${newPath}\`, ${err.message}`); } diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -426,12 +465,13 @@ function dropzone() { * Setup searchbar */ function setupSearch() { + const $searchbar = document.querySelector(".searchbar"); $searchbar.classList.remove("hidden"); $searchbar.addEventListener("submit", event => { event.preventDefault(); const formData = new FormData($searchbar); const q = formData.get("q"); - let href = getUrl(); + let href = baseUrl(); if (q) { href += "?q=" + q; } diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -442,10 +482,8 @@ function setupSearch() { } } -/** - * Setup upload - */ function setupUpload() { + const $newFolder = document.querySelector(".new-folder"); $newFolder.classList.remove("hidden"); $newFolder.addEventListener("click", () => { const name = prompt("Enter folder name"); diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -460,19 +498,61 @@ function setupUpload() { }); } +async function setupEditor() { + document.querySelector(".editor-page").classList.remove("hidden");; + + const $download = document.querySelector(".download") + $download.classList.remove("hidden"); + $download.href = baseUrl() + + if (!DATA.editable) { + const $notEditable = document.querySelector(".not-editable"); + $notEditable.classList.remove("hidden"); + $notEditable.textContent = "File is binary or too large."; + return; + } + + const $saveBtn = document.querySelector(".save-btn"); + $saveBtn.classList.remove("hidden"); + $saveBtn.addEventListener("click", saveChange); + + $editor.classList.remove("hidden"); + try { + const res = await fetch(baseUrl()); + await assertFetch(res); + const text = await res.text(); + $editor.value = text; + } catch (err) { + alert(`Failed get file, ${err.message}`); + } +} + +/** + * Save editor change + */ +async function saveChange() { + try { + await fetch(baseUrl(), { + method: "PUT", + body: $editor.value, + }); + } catch (err) { + alert(`Failed to save file, ${err.message}`); + } +} + /** * Create a folder * @param {string} name */ async function createFolder(name) { - const url = getUrl(name); + const url = newUrl(name); try { const res = await fetch(url, { method: "MKCOL", }); - if (res.status >= 200 && res.status < 300) { - location.href = url; - } + await assertFetch(res); + location.href = url; } catch (err) { alert(`Cannot create folder \`${name}\`, ${err.message}`); } diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -492,15 +572,18 @@ async function addFileEntries(entries, dirs) { } -function getUrl(name) { - let url = location.href.split('?')[0]; +function newUrl(name) { + let url = baseUrl(); if (!url.endsWith("/")) url += "/"; - if (!name) return url; url += name.split("/").map(encodeURIComponent).join("/"); return url; } -function getSvg(path_type) { +function baseUrl() { + return location.href.split('?')[0]; +} + +function getPathSvg(path_type) { switch (path_type) { case "Dir": return `<svg height="16" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M13 4H7V3c0-.66-.31-1-1-1H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zM6 4H1V3h5v1z"></path></svg>`; diff --git a/assets/index.js b/assets/index.js --- a/assets/index.js +++ b/assets/index.js @@ -558,30 +641,8 @@ function encodedStr(rawStr) { }); } -function ready() { - document.title = `Index of ${DATA.href} - Dufs`; - $pathsTable = document.querySelector(".paths-table") - $pathsTableHead = document.querySelector(".paths-table thead"); - $pathsTableBody = document.querySelector(".paths-table tbody"); - $uploadersTable = document.querySelector(".uploaders-table"); - $emptyFolder = document.querySelector(".empty-folder"); - $newFolder = document.querySelector(".new-folder"); - $searchbar = document.querySelector(".searchbar"); - - if (DATA.allow_search) { - setupSearch() - } - - if (DATA.allow_archive) { - document.querySelector(".zip-root").classList.remove("hidden"); - } - - addBreadcrumb(DATA.href, DATA.uri_prefix); - renderPathsTableHead(); - renderPathsTableBody(); - - if (DATA.allow_upload) { - dropzone(); - setupUpload(); +async function assertFetch(res) { + if (!(res.status >= 200 && res.status < 300)) { + throw new Error(await res.text()) } } diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -29,7 +29,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::time::SystemTime; use tokio::fs::File; -use tokio::io::{AsyncSeekExt, AsyncWrite}; +use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWrite}; use tokio::{fs, io}; use tokio_util::io::StreamReader; use uuid::Uuid; diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -43,6 +43,7 @@ const INDEX_JS: &str = include_str!("../assets/index.js"); const FAVICON_ICO: &[u8] = include_bytes!("../assets/favicon.ico"); const INDEX_NAME: &str = "index.html"; const BUF_SIZE: usize = 65536; +const TEXT_MAX_SIZE: u64 = 4194304; // 4M pub struct Server { args: Arc<Args>, diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -232,8 +233,12 @@ impl Server { .await?; } } else if is_file { - self.handle_send_file(path, headers, head_only, &mut res) - .await?; + if query_params.contains_key("edit") { + self.handle_edit_file(path, head_only, &mut res).await?; + } else { + self.handle_send_file(path, headers, head_only, &mut res) + .await?; + } } else if render_spa { self.handle_render_spa(path, headers, head_only, &mut res) .await?; diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -673,6 +678,41 @@ impl Server { Ok(()) } + async fn handle_edit_file( + &self, + path: &Path, + head_only: bool, + res: &mut Response, + ) -> BoxResult<()> { + let (file, meta) = tokio::join!(fs::File::open(path), fs::metadata(path),); + let (file, meta) = (file?, meta?); + let href = format!("/{}", normalize_path(path.strip_prefix(&self.args.path)?)); + let mut buffer: Vec<u8> = vec![]; + file.take(1024).read_to_end(&mut buffer).await?; + let editable = meta.len() <= TEXT_MAX_SIZE && content_inspector::inspect(&buffer).is_text(); + let data = EditData { + href, + kind: DataKind::Edit, + uri_prefix: self.args.uri_prefix.clone(), + allow_upload: self.args.allow_upload, + allow_delete: self.args.allow_delete, + editable, + }; + res.headers_mut() + .typed_insert(ContentType::from(mime_guess::mime::TEXT_HTML_UTF_8)); + let output = self + .html + .replace("__ASSERTS_PREFIX__", &self.assets_prefix) + .replace("__INDEX_DATA__", &serde_json::to_string(&data).unwrap()); + res.headers_mut() + .typed_insert(ContentLength(output.as_bytes().len() as u64)); + if head_only { + return Ok(()); + } + *res.body_mut() = output.into(); + Ok(()) + } + async fn handle_propfind_dir( &self, path: &Path, diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -855,6 +895,7 @@ impl Server { } let href = format!("/{}", normalize_path(path.strip_prefix(&self.args.path)?)); let data = IndexData { + kind: DataKind::Index, href, uri_prefix: self.args.uri_prefix.clone(), allow_upload: self.args.allow_upload, diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -1018,9 +1059,16 @@ impl Server { } } +#[derive(Debug, Serialize)] +enum DataKind { + Index, + Edit, +} + #[derive(Debug, Serialize)] struct IndexData { href: String, + kind: DataKind, uri_prefix: String, allow_upload: bool, allow_delete: bool, diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -1030,6 +1078,16 @@ struct IndexData { paths: Vec<PathItem>, } +#[derive(Debug, Serialize)] +struct EditData { + href: String, + kind: DataKind, + uri_prefix: String, + allow_upload: bool, + allow_delete: bool, + editable: bool, +} + #[derive(Debug, Serialize, Eq, PartialEq, Ord, PartialOrd)] struct PathItem { path_type: PathType,
sigoden__dufs-179
179
[ "172" ]
0.31
sigoden/dufs
2023-02-20T14:35:53Z
diff --git a/tests/fixtures.rs b/tests/fixtures.rs --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -11,9 +11,12 @@ use std::time::{Duration, Instant}; #[allow(dead_code)] pub type Error = Box<dyn std::error::Error>; +#[allow(dead_code)] +pub const BIN_FILE: &str = "😀.bin"; + /// File names for testing purpose #[allow(dead_code)] -pub static FILES: &[&str] = &["test.txt", "test.html", "index.html", "😀.bin"]; +pub static FILES: &[&str] = &["test.txt", "test.html", "index.html", BIN_FILE]; /// Directory names for testing directory don't exist #[allow(dead_code)] diff --git a/tests/fixtures.rs b/tests/fixtures.rs --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -42,10 +45,17 @@ pub static DIRECTORIES: &[&str] = &["dir1/", "dir2/", "dir3/", DIR_NO_INDEX, DIR pub fn tmpdir() -> TempDir { let tmpdir = assert_fs::TempDir::new().expect("Couldn't create a temp dir for tests"); for file in FILES { - tmpdir - .child(file) - .write_str(&format!("This is {file}")) - .expect("Couldn't write to file"); + if *file == BIN_FILE { + tmpdir + .child(file) + .write_binary(b"bin\0\0123") + .expect("Couldn't write to file"); + } else { + tmpdir + .child(file) + .write_str(&format!("This is {file}")) + .expect("Couldn't write to file"); + } } for directory in DIRECTORIES { if *directory == DIR_ASSETS { diff --git a/tests/fixtures.rs b/tests/fixtures.rs --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -58,10 +68,17 @@ pub fn tmpdir() -> TempDir { if *directory == DIR_NO_INDEX && *file == "index.html" { continue; } - tmpdir - .child(format!("{directory}{file}")) - .write_str(&format!("This is {directory}{file}")) - .expect("Couldn't write to file"); + if *file == BIN_FILE { + tmpdir + .child(format!("{directory}{file}")) + .write_binary(b"bin\0\0123") + .expect("Couldn't write to file"); + } else { + tmpdir + .child(format!("{directory}{file}")) + .write_str(&format!("This is {directory}{file}")) + .expect("Couldn't write to file"); + } } } } diff --git a/tests/http.rs b/tests/http.rs --- a/tests/http.rs +++ b/tests/http.rs @@ -1,9 +1,10 @@ mod fixtures; mod utils; -use fixtures::{server, Error, TestServer}; +use fixtures::{server, Error, TestServer, BIN_FILE}; use rstest::rstest; use serde_json::Value; +use utils::retrive_edit_file; #[rstest] fn get_dir(server: TestServer) -> Result<(), Error> { diff --git a/tests/http.rs b/tests/http.rs --- a/tests/http.rs +++ b/tests/http.rs @@ -103,12 +104,12 @@ fn get_dir_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { #[rstest] fn get_dir_search2(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { - let resp = reqwest::blocking::get(format!("{}?q={}", server.url(), "😀.bin"))?; + let resp = reqwest::blocking::get(format!("{}?q={BIN_FILE}", server.url()))?; assert_eq!(resp.status(), 200); let paths = utils::retrieve_index_paths(&resp.text()?); assert!(!paths.is_empty()); for p in paths { - assert!(p.contains("😀.bin")); + assert!(p.contains(BIN_FILE)); } Ok(()) } diff --git a/tests/http.rs b/tests/http.rs --- a/tests/http.rs +++ b/tests/http.rs @@ -177,6 +178,24 @@ fn get_file_404(server: TestServer) -> Result<(), Error> { Ok(()) } +#[rstest] +fn get_file_edit(server: TestServer) -> Result<(), Error> { + let resp = fetch!(b"GET", format!("{}index.html?edit", server.url())).send()?; + assert_eq!(resp.status(), 200); + let editable = retrive_edit_file(&resp.text().unwrap()).unwrap(); + assert!(editable); + Ok(()) +} + +#[rstest] +fn get_file_edit_bin(server: TestServer) -> Result<(), Error> { + let resp = fetch!(b"GET", format!("{}{BIN_FILE}?edit", server.url())).send()?; + assert_eq!(resp.status(), 200); + let editable = retrive_edit_file(&resp.text().unwrap()).unwrap(); + assert!(!editable); + Ok(()) +} + #[rstest] fn head_file_404(server: TestServer) -> Result<(), Error> { let resp = fetch!(b"HEAD", format!("{}404", server.url())).send()?; diff --git a/tests/render.rs b/tests/render.rs --- a/tests/render.rs +++ b/tests/render.rs @@ -1,7 +1,7 @@ mod fixtures; mod utils; -use fixtures::{server, Error, TestServer, DIR_NO_FOUND, DIR_NO_INDEX, FILES}; +use fixtures::{server, Error, TestServer, BIN_FILE, DIR_NO_FOUND, DIR_NO_INDEX, FILES}; use rstest::rstest; #[rstest] diff --git a/tests/render.rs b/tests/render.rs --- a/tests/render.rs +++ b/tests/render.rs @@ -56,11 +56,10 @@ fn render_try_index3( #[case(server(&["--render-try-index"] as &[&str]), false)] #[case(server(&["--render-try-index", "--allow-search"] as &[&str]), true)] fn render_try_index4(#[case] server: TestServer, #[case] searched: bool) -> Result<(), Error> { - let resp = reqwest::blocking::get(format!("{}{}?q={}", server.url(), DIR_NO_INDEX, "😀.bin"))?; + let resp = reqwest::blocking::get(format!("{}{}?q={}", server.url(), DIR_NO_INDEX, BIN_FILE))?; assert_eq!(resp.status(), 200); let paths = utils::retrieve_index_paths(&resp.text()?); - assert!(!paths.is_empty()); - assert_eq!(paths.iter().all(|v| v.contains("😀.bin")), searched); + assert_eq!(paths.iter().all(|v| v.contains(BIN_FILE)), searched); Ok(()) } diff --git a/tests/utils.rs b/tests/utils.rs --- a/tests/utils.rs +++ b/tests/utils.rs @@ -25,24 +25,13 @@ macro_rules! fetch { } #[allow(dead_code)] -pub fn retrieve_index_paths(index: &str) -> IndexSet<String> { - retrieve_index_paths_impl(index).unwrap_or_default() -} - -#[allow(dead_code)] -pub fn encode_uri(v: &str) -> String { - let parts: Vec<_> = v.split('/').map(urlencoding::encode).collect(); - parts.join("/") -} - -fn retrieve_index_paths_impl(index: &str) -> Option<IndexSet<String>> { - let lines: Vec<&str> = index.lines().collect(); - let line = lines.iter().find(|v| v.contains("DATA ="))?; - let line_col = line.find("DATA =").unwrap() + 6; - let value: Value = line[line_col..].parse().ok()?; +pub fn retrieve_index_paths(content: &str) -> IndexSet<String> { + let value = retrive_json(content).unwrap(); let paths = value - .get("paths")? - .as_array()? + .get("paths") + .unwrap() + .as_array() + .unwrap() .iter() .flat_map(|v| { let name = v.get("name")?.as_str()?; diff --git a/tests/utils.rs b/tests/utils.rs --- a/tests/utils.rs +++ b/tests/utils.rs @@ -54,5 +43,26 @@ fn retrieve_index_paths_impl(index: &str) -> Option<IndexSet<String>> { } }) .collect(); - Some(paths) + paths +} + +#[allow(dead_code)] +pub fn retrive_edit_file(content: &str) -> Option<bool> { + let value = retrive_json(content)?; + let value = value.get("editable").unwrap(); + Some(value.as_bool().unwrap()) +} + +#[allow(dead_code)] +pub fn encode_uri(v: &str) -> String { + let parts: Vec<_> = v.split('/').map(urlencoding::encode).collect(); + parts.join("/") +} + +fn retrive_json(content: &str) -> Option<Value> { + let lines: Vec<&str> = content.lines().collect(); + let line = lines.iter().find(|v| v.contains("DATA ="))?; + let line_col = line.find("DATA =").unwrap() + 6; + let value: Value = line[line_col..].parse().unwrap(); + Some(value) }
[Feature Request] Edit files The ability to edit and save files on the server. txt, yaml, php etc.
a61fda6e80d70e5cd7ded9a9b33a9ca373c2b239
[ "get_file_edit_bin", "get_file_edit" ]
[ "utils::test_glob_key", "default_not_exist_dir", "allow_delete_no_override", "allow_upload_no_override", "allow_archive", "default_not_allow_upload", "default_not_allow_archive", "default_not_allow_delete", "allow_search", "allow_upload_not_exist_dir", "allow_upload_delete_can_override", "path_prefix_file", "path_prefix_propfind", "path_prefix_index", "asset_js", "assets", "asset_css", "asset_ico", "asset_js_with_prefix", "assets_with_prefix", "assets_override", "auth_skip", "auth_webdav_copy", "auth_skip_on_options_method", "auth_nest_share", "auth_webdav_move", "auth", "no_auth", "auth_basic", "auth_readonly", "auth_path_prefix", "auth_nest", "bind_fails::case_1", "bind_ipv4_ipv6::case_1", "bind_ipv4_ipv6::case_3", "help_shows", "print_completions", "cors", "hidden_get_dir::case_2", "hidden_dir_noly::case_1", "hidden_propfind_dir::case_1", "hidden_get_dir::case_1", "hidden_get_dir2::case_2", "hidden_propfind_dir::case_2", "hidden_search_dir::case_1", "hidden_search_dir::case_2", "hidden_get_dir2::case_1", "hidden_dir_noly::case_2", "head_file_404", "get_dir_404", "head_dir", "get_dir", "get_dir_json", "empty_search", "delete_file_404", "head_dir_zip", "get_dir_search", "get_dir_search2", "head_dir_404", "get_dir_search3", "get_file", "options_dir", "get_file_404", "head_file", "put_file_conflict_dir", "get_dir_zip", "head_dir_search", "get_dir_simple", "delete_file", "put_file", "put_file_create_dir", "log_remote_user::case_2", "log_remote_user::case_1", "no_log::case_1", "get_file_range", "get_file_range_beyond", "get_file_range_invalid", "render_index", "render_try_index2", "render_spa2", "render_try_index", "render_index2", "render_spa", "render_try_index3", "render_try_index4::case_1", "render_try_index4::case_2", "single_file::case_1", "path_prefix_single_file::case_1", "search_dir_sort_by_name", "ls_dir_sort_by_name", "default_not_allow_symlink", "allow_symlink", "wrong_path_cert", "wrong_path_key", "tls_works::case_3", "tls_works::case_1", "tls_works::case_2", "unlock_file", "lock_file", "mkcol_already_exists", "move_not_allow_delete", "proppatch_404", "lock_file_404", "move_not_allow_upload", "copy_file_404", "propfind_double_slash", "move_file_404", "mkcol_not_allow_upload", "mkcol_dir", "propfind_dir", "copy_not_allow_upload", "unlock_file_404", "propfind_dir_depth0", "proppatch_file", "propfind_file", "propfind_404", "copy_file", "move_file" ]
[ "bind_ipv4_ipv6::case_2", "validate_printed_urls::case_2", "validate_printed_urls::case_1" ]
[]
2023-03-05T03:12:08Z
c6dcaf95d4ccdcfe2af81d7dff43a5c440eca7da
diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -171,6 +171,16 @@ Delete a file/folder curl -X DELETE http://127.0.0.1:5000/path-to-file-or-folder ``` +List/search directory contents + +``` +curl http://127.0.0.1:5000?simple # output pathname only, just like `ls -1` + +curl http://127.0.0.1:5000?json # output name/mtime/type/size and other information in json format + +curl http://127.0.0.1:5000?q=Dockerfile&simple # search for files, just like `find -name Dockerfile` +``` + <details> <summary><h2>Advanced topics</h2></summary> diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -831,24 +831,50 @@ impl Server { } else { paths.sort_unstable(); } + if query_params.contains_key("simple") { + let output = paths + .into_iter() + .map(|v| { + if v.is_dir() { + format!("{}/\n", v.name) + } else { + format!("{}\n", v.name) + } + }) + .collect::<Vec<String>>() + .join(""); + res.headers_mut() + .typed_insert(ContentType::from(mime_guess::mime::TEXT_HTML_UTF_8)); + res.headers_mut() + .typed_insert(ContentLength(output.as_bytes().len() as u64)); + *res.body_mut() = output.into(); + if head_only { + return Ok(()); + } + return Ok(()); + } let href = format!("/{}", normalize_path(path.strip_prefix(&self.args.path)?)); let data = IndexData { href, uri_prefix: self.args.uri_prefix.clone(), - paths, allow_upload: self.args.allow_upload, allow_delete: self.args.allow_delete, allow_search: self.args.allow_search, allow_archive: self.args.allow_archive, dir_exists: exist, + paths, + }; + let output = if query_params.contains_key("json") { + res.headers_mut() + .typed_insert(ContentType::from(mime_guess::mime::APPLICATION_JSON)); + serde_json::to_string_pretty(&data).unwrap() + } else { + res.headers_mut() + .typed_insert(ContentType::from(mime_guess::mime::TEXT_HTML_UTF_8)); + self.html + .replace("__ASSERTS_PREFIX__", &self.assets_prefix) + .replace("__INDEX_DATA__", &serde_json::to_string(&data).unwrap()) }; - let data = serde_json::to_string(&data).unwrap(); - let output = self - .html - .replace("__ASSERTS_PREFIX__", &self.assets_prefix) - .replace("__INDEX_DATA__", &data); - res.headers_mut() - .typed_insert(ContentType::from(mime_guess::mime::TEXT_HTML_UTF_8)); res.headers_mut() .typed_insert(ContentLength(output.as_bytes().len() as u64)); if head_only { diff --git a/src/server.rs b/src/server.rs --- a/src/server.rs +++ b/src/server.rs @@ -996,12 +1022,12 @@ impl Server { struct IndexData { href: String, uri_prefix: String, - paths: Vec<PathItem>, allow_upload: bool, allow_delete: bool, allow_search: bool, allow_archive: bool, dir_exists: bool, + paths: Vec<PathItem>, } #[derive(Debug, Serialize, Eq, PartialEq, Ord, PartialOrd)]
sigoden__dufs-177
177
What scenarios need this kind of API ? Abstractly, a list directory API would allow end users to build file system abstractions around a given dufs server. For my use case, I'm building a GUI that when provided a URL to a `dufs` server, a file tree would be displayed. imagine something like https://doc.qt.io/qt-6/qtwidgets-itemviews-dirview-example.html. the displayed files would be available on the `dufs` server Maybe add an `output` query string to control the output format - html: output web page, default - json: output file list, including file name, size, type and other information - simple: output only a list of filenames Sounds good to me, I'll look to prototype this weekend
[ "166" ]
0.31
sigoden/dufs
2023-02-20T02:46:30Z
diff --git a/tests/assets.rs b/tests/assets.rs --- a/tests/assets.rs +++ b/tests/assets.rs @@ -11,13 +11,13 @@ use std::process::{Command, Stdio}; fn assets(server: TestServer) -> Result<(), Error> { let ver = env!("CARGO_PKG_VERSION"); let resp = reqwest::blocking::get(server.url())?; - let index_js = format!("/__dufs_v{}_index.js", ver); - let index_css = format!("/__dufs_v{}_index.css", ver); - let favicon_ico = format!("/__dufs_v{}_favicon.ico", ver); + let index_js = format!("/__dufs_v{ver}_index.js"); + let index_css = format!("/__dufs_v{ver}_index.css"); + let favicon_ico = format!("/__dufs_v{ver}_favicon.ico"); let text = resp.text()?; - assert!(text.contains(&format!(r#"href="{}""#, index_css))); - assert!(text.contains(&format!(r#"href="{}""#, favicon_ico))); - assert!(text.contains(&format!(r#"src="{}""#, index_js))); + assert!(text.contains(&format!(r#"href="{index_css}""#))); + assert!(text.contains(&format!(r#"href="{favicon_ico}""#))); + assert!(text.contains(&format!(r#"src="{index_js}""#))); Ok(()) } diff --git a/tests/assets.rs b/tests/assets.rs --- a/tests/assets.rs +++ b/tests/assets.rs @@ -67,13 +67,13 @@ fn asset_ico(server: TestServer) -> Result<(), Error> { fn assets_with_prefix(#[with(&["--path-prefix", "xyz"])] server: TestServer) -> Result<(), Error> { let ver = env!("CARGO_PKG_VERSION"); let resp = reqwest::blocking::get(format!("{}xyz/", server.url()))?; - let index_js = format!("/xyz/__dufs_v{}_index.js", ver); - let index_css = format!("/xyz/__dufs_v{}_index.css", ver); - let favicon_ico = format!("/xyz/__dufs_v{}_favicon.ico", ver); + let index_js = format!("/xyz/__dufs_v{ver}_index.js"); + let index_css = format!("/xyz/__dufs_v{ver}_index.css"); + let favicon_ico = format!("/xyz/__dufs_v{ver}_favicon.ico"); let text = resp.text()?; - assert!(text.contains(&format!(r#"href="{}""#, index_css))); - assert!(text.contains(&format!(r#"href="{}""#, favicon_ico))); - assert!(text.contains(&format!(r#"src="{}""#, index_js))); + assert!(text.contains(&format!(r#"href="{index_css}""#))); + assert!(text.contains(&format!(r#"href="{favicon_ico}""#))); + assert!(text.contains(&format!(r#"src="{index_js}""#))); Ok(()) } diff --git a/tests/assets.rs b/tests/assets.rs --- a/tests/assets.rs +++ b/tests/assets.rs @@ -108,7 +108,7 @@ fn assets_override(tmpdir: TempDir, port: u16) -> Result<(), Error> { wait_for_port(port); - let url = format!("http://localhost:{}", port); + let url = format!("http://localhost:{port}"); let resp = reqwest::blocking::get(&url)?; assert!(resp.text()?.starts_with(&format!( "/__dufs_v{}_index.js;DATA", diff --git a/tests/fixtures.rs b/tests/fixtures.rs --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -44,7 +44,7 @@ pub fn tmpdir() -> TempDir { for file in FILES { tmpdir .child(file) - .write_str(&format!("This is {}", file)) + .write_str(&format!("This is {file}")) .expect("Couldn't write to file"); } for directory in DIRECTORIES { diff --git a/tests/fixtures.rs b/tests/fixtures.rs --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -59,8 +59,8 @@ pub fn tmpdir() -> TempDir { continue; } tmpdir - .child(format!("{}{}", directory, file)) - .write_str(&format!("This is {}{}", directory, file)) + .child(format!("{directory}{file}")) + .write_str(&format!("This is {directory}{file}")) .expect("Couldn't write to file"); } } diff --git a/tests/fixtures.rs b/tests/fixtures.rs --- a/tests/fixtures.rs +++ b/tests/fixtures.rs @@ -109,11 +109,11 @@ where pub fn wait_for_port(port: u16) { let start_wait = Instant::now(); - while !port_check::is_port_reachable(format!("localhost:{}", port)) { + while !port_check::is_port_reachable(format!("localhost:{port}")) { sleep(Duration::from_millis(100)); if start_wait.elapsed().as_secs() > 1 { - panic!("timeout waiting for port {}", port); + panic!("timeout waiting for port {port}"); } } } diff --git a/tests/http.rs b/tests/http.rs --- a/tests/http.rs +++ b/tests/http.rs @@ -3,6 +3,7 @@ mod utils; use fixtures::{server, Error, TestServer}; use rstest::rstest; +use serde_json::Value; #[rstest] fn get_dir(server: TestServer) -> Result<(), Error> { diff --git a/tests/http.rs b/tests/http.rs --- a/tests/http.rs +++ b/tests/http.rs @@ -49,6 +50,32 @@ fn get_dir_zip(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { Ok(()) } +#[rstest] +fn get_dir_json(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { + let resp = reqwest::blocking::get(format!("{}?json", server.url()))?; + assert_eq!(resp.status(), 200); + assert_eq!( + resp.headers().get("content-type").unwrap(), + "application/json" + ); + let json: Value = serde_json::from_str(&resp.text().unwrap()).unwrap(); + assert!(json["paths"].as_array().is_some()); + Ok(()) +} + +#[rstest] +fn get_dir_simple(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { + let resp = reqwest::blocking::get(format!("{}?simple", server.url()))?; + assert_eq!(resp.status(), 200); + assert_eq!( + resp.headers().get("content-type").unwrap(), + "text/html; charset=utf-8" + ); + let text = resp.text().unwrap(); + assert!(text.split('\n').any(|v| v == "index.html")); + Ok(()) +} + #[rstest] fn head_dir_zip(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { let resp = fetch!(b"HEAD", format!("{}?zip", server.url())).send()?; diff --git a/tests/http.rs b/tests/http.rs --- a/tests/http.rs +++ b/tests/http.rs @@ -86,6 +113,15 @@ fn get_dir_search2(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { Ok(()) } +#[rstest] +fn get_dir_search3(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { + let resp = reqwest::blocking::get(format!("{}?q={}&simple", server.url(), "test.html"))?; + assert_eq!(resp.status(), 200); + let text = resp.text().unwrap(); + assert!(text.split('\n').any(|v| v == "test.html")); + Ok(()) +} + #[rstest] fn head_dir_search(#[with(&["-A"])] server: TestServer) -> Result<(), Error> { let resp = fetch!(b"HEAD", format!("{}?q={}", server.url(), "test.html")).send()?; diff --git a/tests/log_http.rs b/tests/log_http.rs --- a/tests/log_http.rs +++ b/tests/log_http.rs @@ -31,7 +31,7 @@ fn log_remote_user( let stdout = child.stdout.as_mut().expect("Failed to get stdout"); - let req = fetch!(b"GET", &format!("http://localhost:{}", port)); + let req = fetch!(b"GET", &format!("http://localhost:{port}")); let resp = if is_basic { req.basic_auth("user", Some("pass")).send()? diff --git a/tests/log_http.rs b/tests/log_http.rs --- a/tests/log_http.rs +++ b/tests/log_http.rs @@ -66,7 +66,7 @@ fn no_log(tmpdir: TempDir, port: u16, #[case] args: &[&str]) -> Result<(), Error let stdout = child.stdout.as_mut().expect("Failed to get stdout"); - let resp = fetch!(b"GET", &format!("http://localhost:{}", port)).send()?; + let resp = fetch!(b"GET", &format!("http://localhost:{port}")).send()?; assert_eq!(resp.status(), 200); let mut buf = [0; 1000]; diff --git a/tests/single_file.rs b/tests/single_file.rs --- a/tests/single_file.rs +++ b/tests/single_file.rs @@ -21,11 +21,11 @@ fn single_file(tmpdir: TempDir, port: u16, #[case] file: &str) -> Result<(), Err wait_for_port(port); - let resp = reqwest::blocking::get(format!("http://localhost:{}", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}"))?; assert_eq!(resp.text()?, "This is index.html"); - let resp = reqwest::blocking::get(format!("http://localhost:{}/", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}/"))?; assert_eq!(resp.text()?, "This is index.html"); - let resp = reqwest::blocking::get(format!("http://localhost:{}/index.html", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}/index.html"))?; assert_eq!(resp.text()?, "This is index.html"); child.kill()?; diff --git a/tests/single_file.rs b/tests/single_file.rs --- a/tests/single_file.rs +++ b/tests/single_file.rs @@ -46,13 +46,13 @@ fn path_prefix_single_file(tmpdir: TempDir, port: u16, #[case] file: &str) -> Re wait_for_port(port); - let resp = reqwest::blocking::get(format!("http://localhost:{}/xyz", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}/xyz"))?; assert_eq!(resp.text()?, "This is index.html"); - let resp = reqwest::blocking::get(format!("http://localhost:{}/xyz/", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}/xyz/"))?; assert_eq!(resp.text()?, "This is index.html"); - let resp = reqwest::blocking::get(format!("http://localhost:{}/xyz/index.html", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}/xyz/index.html"))?; assert_eq!(resp.text()?, "This is index.html"); - let resp = reqwest::blocking::get(format!("http://localhost:{}", port))?; + let resp = reqwest::blocking::get(format!("http://localhost:{port}"))?; assert_eq!(resp.status(), 404); child.kill()?; diff --git a/tests/sort.rs b/tests/sort.rs --- a/tests/sort.rs +++ b/tests/sort.rs @@ -7,9 +7,9 @@ use rstest::rstest; #[rstest] fn ls_dir_sort_by_name(server: TestServer) -> Result<(), Error> { let url = server.url(); - let resp = reqwest::blocking::get(format!("{}?sort=name&order=asc", url))?; + let resp = reqwest::blocking::get(format!("{url}?sort=name&order=asc"))?; let paths1 = self::utils::retrieve_index_paths(&resp.text()?); - let resp = reqwest::blocking::get(format!("{}?sort=name&order=desc", url))?; + let resp = reqwest::blocking::get(format!("{url}?sort=name&order=desc"))?; let mut paths2 = self::utils::retrieve_index_paths(&resp.text()?); paths2.reverse(); assert_eq!(paths1, paths2); diff --git a/tests/sort.rs b/tests/sort.rs --- a/tests/sort.rs +++ b/tests/sort.rs @@ -19,9 +19,9 @@ fn ls_dir_sort_by_name(server: TestServer) -> Result<(), Error> { #[rstest] fn search_dir_sort_by_name(server: TestServer) -> Result<(), Error> { let url = server.url(); - let resp = reqwest::blocking::get(format!("{}?q={}&sort=name&order=asc", url, "test.html"))?; + let resp = reqwest::blocking::get(format!("{url}?q=test.html&sort=name&order=asc"))?; let paths1 = self::utils::retrieve_index_paths(&resp.text()?); - let resp = reqwest::blocking::get(format!("{}?q={}&sort=name&order=desc", url, "test.html"))?; + let resp = reqwest::blocking::get(format!("{url}?q=test.html&sort=name&order=desc"))?; let mut paths2 = self::utils::retrieve_index_paths(&resp.text()?); paths2.reverse(); assert_eq!(paths1, paths2); diff --git a/tests/symlink.rs b/tests/symlink.rs --- a/tests/symlink.rs +++ b/tests/symlink.rs @@ -22,7 +22,7 @@ fn default_not_allow_symlink(server: TestServer, tmpdir: TempDir) -> Result<(), let resp = reqwest::blocking::get(server.url())?; let paths = utils::retrieve_index_paths(&resp.text()?); assert!(!paths.is_empty()); - assert!(!paths.contains(&format!("{}/", dir))); + assert!(!paths.contains(&format!("{dir}/"))); Ok(()) } diff --git a/tests/symlink.rs b/tests/symlink.rs --- a/tests/symlink.rs +++ b/tests/symlink.rs @@ -41,6 +41,6 @@ fn allow_symlink( let resp = reqwest::blocking::get(server.url())?; let paths = utils::retrieve_index_paths(&resp.text()?); assert!(!paths.is_empty()); - assert!(paths.contains(&format!("{}/", dir))); + assert!(paths.contains(&format!("{dir}/"))); Ok(()) } diff --git a/tests/utils.rs b/tests/utils.rs --- a/tests/utils.rs +++ b/tests/utils.rs @@ -48,7 +48,7 @@ fn retrieve_index_paths_impl(index: &str) -> Option<IndexSet<String>> { let name = v.get("name")?.as_str()?; let path_type = v.get("path_type")?.as_str()?; if path_type.ends_with("Dir") { - Some(format!("{}/", name)) + Some(format!("{name}/")) } else { Some(name.to_owned()) }
[Feature request] API to search and list directories ## Specific Demand An API to search for a file and show contents of a directory. ### list directory API curl http://127.0.0.1:5000/path-to-directory?list_contents=true to return a list of this files contents, analogous to running the linux command `ls /path-to-directory` on the server locally ### search API curl http://127.0.0.1:5000/path-to-directory?search_for=${NAME_STR} would be analogous to running the linux command `find -L /path-to-directory -name "${NAME_STR}"` on the server locally; ## Implement Suggestion Haven't thought about this seriously yet; I figure its best to agree on an API
a61fda6e80d70e5cd7ded9a9b33a9ca373c2b239
[ "get_dir_json", "get_dir_simple", "get_dir_search3" ]
[ "utils::test_glob_key", "default_not_exist_dir", "allow_upload_not_exist_dir", "allow_upload_no_override", "default_not_allow_upload", "allow_search", "allow_archive", "allow_delete_no_override", "default_not_allow_delete", "default_not_allow_archive", "allow_upload_delete_can_override", "path_prefix_propfind", "path_prefix_index", "path_prefix_file", "assets", "assets_with_prefix", "asset_css", "asset_js", "asset_ico", "asset_js_with_prefix", "assets_override", "auth_webdav_move", "auth_webdav_copy", "auth_nest_share", "auth_skip_on_options_method", "auth_skip", "auth_basic", "no_auth", "auth", "auth_path_prefix", "auth_readonly", "auth_nest", "bind_fails::case_1", "bind_ipv4_ipv6::case_1", "bind_ipv4_ipv6::case_3", "help_shows", "print_completions", "cors", "hidden_get_dir2::case_1", "hidden_get_dir2::case_2", "hidden_search_dir::case_1", "hidden_get_dir::case_1", "hidden_search_dir::case_2", "hidden_dir_noly::case_1", "hidden_dir_noly::case_2", "hidden_propfind_dir::case_1", "hidden_propfind_dir::case_2", "hidden_get_dir::case_2", "head_dir_zip", "get_dir_search", "head_file", "get_dir", "get_dir_404", "get_file", "options_dir", "delete_file", "put_file_conflict_dir", "empty_search", "delete_file_404", "get_dir_zip", "get_file_404", "head_dir_404", "head_dir", "head_dir_search", "get_dir_search2", "head_file_404", "put_file", "put_file_create_dir", "log_remote_user::case_2", "log_remote_user::case_1", "no_log::case_1", "get_file_range_beyond", "get_file_range_invalid", "get_file_range", "render_try_index", "render_index2", "render_spa2", "render_spa", "render_try_index3", "render_index", "render_try_index4::case_2", "render_try_index4::case_1", "render_try_index2", "single_file::case_1", "path_prefix_single_file::case_1", "ls_dir_sort_by_name", "search_dir_sort_by_name", "allow_symlink", "default_not_allow_symlink", "wrong_path_key", "wrong_path_cert", "tls_works::case_3", "tls_works::case_1", "tls_works::case_2", "lock_file_404", "lock_file", "mkcol_already_exists", "proppatch_404", "propfind_404", "proppatch_file", "propfind_double_slash", "mkcol_not_allow_upload", "mkcol_dir", "move_not_allow_delete", "propfind_dir_depth0", "copy_not_allow_upload", "copy_file_404", "unlock_file_404", "move_file_404", "unlock_file", "propfind_dir", "propfind_file", "move_not_allow_upload", "copy_file", "move_file" ]
[ "bind_ipv4_ipv6::case_2", "validate_printed_urls::case_2", "validate_printed_urls::case_1" ]
[]
2023-02-20T03:05:57Z
8f5aba5cfcf4d845035aab7cb4255dbea0e2573d
diff --git /dev/null b/changelog.d/2576.added.md new file mode 100644 --- /dev/null +++ b/changelog.d/2576.added.md @@ -0,0 +1,1 @@ +Added experimental.trust_any_certificate to enable making app trust any certificate on macOS \ No newline at end of file diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -617,7 +617,7 @@ "type": "object", "properties": { "readlink": { - "title": "_experimental_ readlink {#fexperimental-readlink}", + "title": "_experimental_ readlink {#experimental-readlink}", "description": "Enables the `readlink` hook.", "type": [ "boolean", diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -625,12 +625,20 @@ ] }, "tcp_ping4_mock": { - "title": "_experimental_ tcp_ping4_mock {#fexperimental-tcp_ping4_mock}", + "title": "_experimental_ tcp_ping4_mock {#experimental-tcp_ping4_mock}", "description": "<https://github.com/metalbear-co/mirrord/issues/2421#issuecomment-2093200904>", "type": [ "boolean", "null" ] + }, + "trust_any_certificate": { + "title": "_experimental_ trust_any_certificate {#experimental-trust_any_certificate}", + "description": "Enables trusting any certificate on macOS, useful for <https://github.com/golang/go/issues/51991#issuecomment-2059588252>", + "type": [ + "boolean", + "null" + ] } }, "additionalProperties": false diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -112,6 +112,8 @@ mod macros; mod proxy_connection; mod setup; mod socket; +#[cfg(target_os = "macos")] +mod tls; #[cfg(all( any(target_arch = "x86_64", target_arch = "aarch64"), diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -341,11 +343,7 @@ fn layer_start(mut config: LayerConfig) { SETUP.set(state).unwrap(); let state = setup(); - enable_hooks( - state.fs_config().is_active(), - state.remote_dns_enabled(), - state.sip_binaries(), - ); + enable_hooks(state); let _detour_guard = DetourGuard::new(); tracing::info!("Initializing mirrord-layer!"); diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -475,7 +473,12 @@ fn sip_only_layer_start(mut config: LayerConfig, patch_binaries: Vec<String>) { /// `true`, see [`NetworkConfig`](mirrord_config::feature::network::NetworkConfig), and /// [`hooks::enable_socket_hooks`](socket::hooks::enable_socket_hooks). #[mirrord_layer_macro::instrument(level = "trace")] -fn enable_hooks(enabled_file_ops: bool, enabled_remote_dns: bool, patch_binaries: Vec<String>) { +fn enable_hooks(state: &LayerSetup) { + let enabled_file_ops = state.fs_config().is_active(); + let enabled_remote_dns = state.remote_dns_enabled(); + #[cfg(target_os = "macos")] + let patch_binaries = state.sip_binaries(); + let mut hook_manager = HookManager::default(); unsafe { diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -526,6 +529,11 @@ fn enable_hooks(enabled_file_ops: bool, enabled_remote_dns: bool, patch_binaries exec_utils::enable_execve_hook(&mut hook_manager, patch_binaries) }; + #[cfg(target_os = "macos")] + if state.experimental().trust_any_certificate { + unsafe { tls::enable_tls_hooks(&mut hook_manager) }; + } + if enabled_file_ops { unsafe { file::hooks::enable_file_hooks(&mut hook_manager) }; } diff --git a/mirrord/layer/src/setup.rs b/mirrord/layer/src/setup.rs --- a/mirrord/layer/src/setup.rs +++ b/mirrord/layer/src/setup.rs @@ -119,6 +119,7 @@ impl LayerSetup { .unwrap_or(true) } + #[cfg(target_os = "macos")] pub fn sip_binaries(&self) -> Vec<String> { self.config .sip_binaries diff --git /dev/null b/mirrord/layer/src/tls.rs new file mode 100644 --- /dev/null +++ b/mirrord/layer/src/tls.rs @@ -0,0 +1,24 @@ +use libc::c_void; +use mirrord_layer_macro::hook_guard_fn; + +use crate::{hooks::HookManager, replace}; + +// https://developer.apple.com/documentation/security/2980705-sectrustevaluatewitherror +#[hook_guard_fn] +pub(crate) unsafe extern "C" fn sec_trust_evaluate_with_error_detour( + trust: *const c_void, + error: *const c_void, +) -> bool { + tracing::trace!("sec_trust_evaluate_with_error_detour called"); + true +} + +pub(crate) unsafe fn enable_tls_hooks(hook_manager: &mut HookManager) { + replace!( + hook_manager, + "SecTrustEvaluateWithError", + sec_trust_evaluate_with_error_detour, + FnSec_trust_evaluate_with_error, + FN_SEC_TRUST_EVALUATE_WITH_ERROR + ); +}
metalbear-co__mirrord-2589
2,589
[ "2576" ]
3.109
metalbear-co/mirrord
2024-07-11T11:32:23Z
diff --git a/mirrord/config/src/experimental.rs b/mirrord/config/src/experimental.rs --- a/mirrord/config/src/experimental.rs +++ b/mirrord/config/src/experimental.rs @@ -10,22 +10,29 @@ use crate::config::source::MirrordConfigSource; #[config(map_to = "ExperimentalFileConfig", derive = "JsonSchema")] #[cfg_attr(test, config(derive = "PartialEq, Eq"))] pub struct ExperimentalConfig { - /// ## _experimental_ tcp_ping4_mock {#fexperimental-tcp_ping4_mock} + /// ## _experimental_ tcp_ping4_mock {#experimental-tcp_ping4_mock} /// /// <https://github.com/metalbear-co/mirrord/issues/2421#issuecomment-2093200904> #[config(default = true)] pub tcp_ping4_mock: bool, - /// ## _experimental_ readlink {#fexperimental-readlink} + /// ## _experimental_ readlink {#experimental-readlink} /// /// Enables the `readlink` hook. #[config(default = false)] pub readlink: bool, + + /// # _experimental_ trust_any_certificate {#experimental-trust_any_certificate} + /// + /// Enables trusting any certificate on macOS, useful for <https://github.com/golang/go/issues/51991#issuecomment-2059588252> + #[config(default = false)] + pub trust_any_certificate: bool, } impl CollectAnalytics for &ExperimentalConfig { fn collect_analytics(&self, analytics: &mut mirrord_analytics::Analytics) { analytics.add("tcp_ping4_mock", self.tcp_ping4_mock); analytics.add("readlink", self.readlink); + analytics.add("trust_any_certificate", self.trust_any_certificate); } }
Add function detour for FN__SEC_TRUST_EVALUATE_WITH_ERROR Closes #2569
8f5aba5cfcf4d845035aab7cb4255dbea0e2573d
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "config::from_env::tests::basic", "config::source::tests::basic::case_1", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::mode::tests::default::case_1", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::fs::mode::tests::default::case_2", "feature::fs::mode::tests::default::case_3", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::fs::tests::fs_config_default", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::disabled::case_2", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::network::outgoing::tests::valid_filters::case_03", "feature::network::outgoing::tests::valid_filters::case_04", "feature::network::outgoing::tests::valid_filters::case_07", "feature::network::outgoing::tests::invalid_filters::case_2 - should panic", "feature::network::outgoing::tests::valid_filters::case_01", "feature::network::outgoing::tests::valid_filters::case_02", "feature::network::outgoing::tests::valid_filters::case_06", "feature::network::outgoing::tests::valid_filters::case_08", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::invalid_filters::case_3 - should panic", "feature::network::outgoing::tests::valid_filters::case_05", "feature::network::outgoing::tests::invalid_filters::case_1 - should panic", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "feature::network::outgoing::tests::valid_filters::case_09", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::fs::mode::tests::disabled::case_1", "feature::fs::mode::tests::disabled::case_3", "target::tests::default::case_3", "target::tests::default::case_4", "feature::fs::mode::tests::disabled::case_4", "target::tests::default::case_1", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "target::tests::default::case_2", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "target::tests::parse_target_config_from_json::case_2", "target::tests::parse_target_config_from_json::case_3", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "target::tests::default::case_5", "target::tests::parse_target_config_from_json::case_1", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "target::tests::parse_target_config_from_json::case_4", "target::tests::default::case_6", "config::source::tests::basic::case_2", "feature::network::outgoing::tests::valid_filters::case_10", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "tests::full::config_type_2_ConfigType__Toml", "tests::empty::config_type_2_ConfigType__Toml", "tests::empty::config_type_3_ConfigType__Yaml", "tests::full::config_type_1_ConfigType__Json", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "tests::empty::config_type_1_ConfigType__Json", "tests::full::config_type_3_ConfigType__Yaml", "tests::schema_file_exists" ]
[]
[]
2024-07-12T07:08:58Z
2f78dd8e7c5746e0c4b6edcb9fbf59c1bc9f0067
diff --git /dev/null b/changelog.d/2164.internal.md new file mode 100644 --- /dev/null +++ b/changelog.d/2164.internal.md @@ -0,0 +1,1 @@ +Moved the docs from `CopyTargetFileConfig` to `CopyTargetConfig` so that medschool reads them. diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -397,7 +397,6 @@ ] }, "CopyTargetFileConfig": { - "description": "Allows the user to target a pod created dynamically from the orignal [`target`](#target). The new pod inherits most of the original target's specification, e.g. labels.\n\n```json { \"feature\": { \"copy_target\": { \"scale_down\": true } } } ```\n\n```json { \"feature\": { \"copy_target\": true } } ```", "anyOf": [ { "type": "boolean" diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -406,8 +405,6 @@ "type": "object", "properties": { "scale_down": { - "title": "feature.copy_target.scale_down {#feature-copy_target-scale_down}", - "description": "If this option is set, mirrord will scale down the target deployment to 0 for the time the copied pod is alive.\n\nThis option is compatible only with deployment targets.", "type": [ "boolean", "null" diff --git a/mirrord/config/configuration.md b/mirrord/config/configuration.md --- a/mirrord/config/configuration.md +++ b/mirrord/config/configuration.md @@ -968,6 +968,39 @@ Creates a new copy of the target. mirrord will use this copy instead of the orig This feature is not compatible with rollout targets and running without a target (`targetless` mode). +Allows the user to target a pod created dynamically from the orignal [`target`](#target). +The new pod inherits most of the original target's specification, e.g. labels. + +```json +{ + "feature": { + "copy_target": { + "scale_down": true + } + } +} +``` + +```json +{ + "feature": { + "copy_target": true + } +} +``` + + +### feature.copy_target.scale_down {#feature-copy_target-scale_down} + +If this option is set, mirrord will scale down the target deployment to 0 for the time +the copied pod is alive. + +This option is compatible only with deployment targets. +```json + { + "scale_down": true + } +``` # internal_proxy {#root-internal_proxy} Configuration for the internal proxy mirrord spawns for each local mirrord session diff --git a/mirrord/config/src/feature/copy_target.rs b/mirrord/config/src/feature/copy_target.rs --- a/mirrord/config/src/feature/copy_target.rs +++ b/mirrord/config/src/feature/copy_target.rs @@ -75,9 +47,41 @@ impl FromMirrordConfig for CopyTargetConfig { type Generator = CopyTargetFileConfig; } +/// Allows the user to target a pod created dynamically from the orignal [`target`](#target). +/// The new pod inherits most of the original target's specification, e.g. labels. +/// +/// ```json +/// { +/// "feature": { +/// "copy_target": { +/// "scale_down": true +/// } +/// } +/// } +/// ``` +/// +/// ```json +/// { +/// "feature": { +/// "copy_target": true +/// } +/// } +/// ``` #[derive(Clone, Debug)] pub struct CopyTargetConfig { pub enabled: bool, + + /// ### feature.copy_target.scale_down {#feature-copy_target-scale_down} + /// + /// If this option is set, mirrord will scale down the target deployment to 0 for the time + /// the copied pod is alive. + /// + /// This option is compatible only with deployment targets. + /// ```json + /// { + /// "scale_down": true + /// } + /// ``` pub scale_down: bool, }
metalbear-co__mirrord-2165
2,165
[ "2164" ]
3.82
metalbear-co/mirrord
2024-01-10T10:40:35Z
diff --git a/mirrord/config/src/feature/copy_target.rs b/mirrord/config/src/feature/copy_target.rs --- a/mirrord/config/src/feature/copy_target.rs +++ b/mirrord/config/src/feature/copy_target.rs @@ -10,40 +10,12 @@ use serde::Deserialize; use crate::config::{ConfigContext, FromMirrordConfig, MirrordConfig, Result}; -/// Allows the user to target a pod created dynamically from the orignal [`target`](#target). -/// The new pod inherits most of the original target's specification, e.g. labels. -/// -/// ```json -/// { -/// "feature": { -/// "copy_target": { -/// "scale_down": true -/// } -/// } -/// } -/// ``` -/// -/// ```json -/// { -/// "feature": { -/// "copy_target": true -/// } -/// } -/// ``` #[derive(Clone, Debug, Deserialize, JsonSchema)] #[cfg_attr(test, derive(PartialEq, Eq))] #[serde(untagged)] pub enum CopyTargetFileConfig { Simple(bool), - Advanced { - /// ### feature.copy_target.scale_down {#feature-copy_target-scale_down} - /// - /// If this option is set, mirrord will scale down the target deployment to 0 for the time - /// the copied pod is alive. - /// - /// This option is compatible only with deployment targets. - scale_down: Option<bool>, - }, + Advanced { scale_down: Option<bool> }, } impl Default for CopyTargetFileConfig {
Fix copy_target config docs The docs from the code do not appear in the generated docs.
2f78dd8e7c5746e0c4b6edcb9fbf59c1bc9f0067
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "config::from_env::tests::basic", "config::source::tests::basic::case_1", "config::source::tests::basic::case_2", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::disabled::case_1", "feature::fs::mode::tests::disabled::case_2", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::mode::tests::disabled::case_3", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "feature::fs::mode::tests::disabled::case_4", "feature::fs::tests::fs_config_default", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::mode::tests::default::case_3", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_2", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::invalid_filters::case_1 - should panic", "feature::network::outgoing::tests::invalid_filters::case_2 - should panic", "feature::network::outgoing::tests::valid_filters::case_01", "feature::network::outgoing::tests::valid_filters::case_02", "feature::network::outgoing::tests::invalid_filters::case_3 - should panic", "feature::network::outgoing::tests::valid_filters::case_04", "feature::network::outgoing::tests::valid_filters::case_05", "feature::network::outgoing::tests::valid_filters::case_03", "feature::network::outgoing::tests::valid_filters::case_08", "feature::network::outgoing::tests::valid_filters::case_07", "feature::network::outgoing::tests::valid_filters::case_06", "feature::network::outgoing::tests::valid_filters::case_09", "feature::network::outgoing::tests::valid_filters::case_10", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "target::tests::default::case_2", "target::tests::default::case_5", "target::tests::default::case_6", "target::tests::default::case_4", "target::tests::default::case_3", "target::tests::default::case_1", "target::tests::parse_target_config_from_json::case_3", "target::tests::parse_target_config_from_json::case_1", "target::tests::parse_target_config_from_json::case_4", "tests::schema_file_exists", "target::tests::parse_target_config_from_json::case_2", "tests::empty::config_type_2_ConfigType__Toml", "tests::empty::config_type_1_ConfigType__Json", "tests::empty::config_type_3_ConfigType__Yaml", "tests::full::config_type_1_ConfigType__Json", "tests::full::config_type_2_ConfigType__Toml", "tests::full::config_type_3_ConfigType__Yaml" ]
[]
[]
2024-01-10T11:25:40Z
879fd097bd5949bf694f8f6610900139323e1f33
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2698,8 +2698,7 @@ dependencies = [ [[package]] name = "iptables" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39f0d72d0feb83c9b7f4e1fbde2b4a629886f30841127b3f86383831dba2629" +source = "git+https://github.com/metalbear-co/rust-iptables.git?rev=e66c7332e361df3c61a194f08eefe3f40763d624#e66c7332e361df3c61a194f08eefe3f40763d624" dependencies = [ "lazy_static", "nix 0.27.1", diff --git /dev/null b/changelog.d/2272.added.md new file mode 100644 --- /dev/null +++ b/changelog.d/2272.added.md @@ -0,0 +1,1 @@ +Add agent configuration to use nftables instead of iptables-legacy to make it work in mesh that uses nftables. \ No newline at end of file diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -316,6 +316,14 @@ "null" ] }, + "nftables": { + "title": "agent.nftables {#agent-nftables}", + "description": "Use iptables-nft instead of iptables-legacy. Defaults to `false`.\n\nNeeded if your mesh uses nftables instead of iptables-legacy,", + "type": [ + "boolean", + "null" + ] + }, "privileged": { "title": "agent.privileged {#agent-privileged}", "description": "Run the mirror agent as privileged container. Defaults to `false`.\n\nMight be needed in strict environments such as Bottlerocket.", diff --git a/mirrord/agent/Cargo.toml b/mirrord/agent/Cargo.toml --- a/mirrord/agent/Cargo.toml +++ b/mirrord/agent/Cargo.toml @@ -60,7 +60,7 @@ semver.workspace = true drain.workspace = true [target.'cfg(target_os = "linux")'.dependencies] -iptables = "0.5" +iptables = {git = "https://github.com/metalbear-co/rust-iptables.git", rev = "e66c7332e361df3c61a194f08eefe3f40763d624"} rawsocket = {git = "https://github.com/metalbear-co/rawsocket.git"} diff --git a/mirrord/agent/src/main.rs b/mirrord/agent/src/main.rs --- a/mirrord/agent/src/main.rs +++ b/mirrord/agent/src/main.rs @@ -45,8 +45,8 @@ use crate::{ api::TcpStealerApi, connection::TcpConnectionStealer, ip_tables::{ - IPTablesWrapper, SafeIpTables, IPTABLE_MESH, IPTABLE_MESH_ENV, IPTABLE_PREROUTING, - IPTABLE_PREROUTING_ENV, IPTABLE_STANDARD, IPTABLE_STANDARD_ENV, + new_iptables, IPTablesWrapper, SafeIpTables, IPTABLE_MESH, IPTABLE_MESH_ENV, + IPTABLE_PREROUTING, IPTABLE_PREROUTING_ENV, IPTABLE_STANDARD, IPTABLE_STANDARD_ENV, }, StealerCommand, }, diff --git a/mirrord/agent/src/main.rs b/mirrord/agent/src/main.rs --- a/mirrord/agent/src/main.rs +++ b/mirrord/agent/src/main.rs @@ -762,7 +762,7 @@ async fn start_agent(args: Args, watch: drain::Watch) -> Result<()> { } async fn clear_iptable_chain() -> Result<()> { - let ipt = iptables::new(false).unwrap(); + let ipt = new_iptables(); SafeIpTables::load(IPTablesWrapper::from(ipt), false) .await? diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -117,6 +117,18 @@ pub struct IPTablesWrapper { tables: Arc<iptables::IPTables>, } +/// wrapper around iptables::new that uses nft or legacy based on env +pub fn new_iptables() -> iptables::IPTables { + if let Ok(val) = std::env::var("MIRRORD_AGENT_NFTABLES") + && val.to_lowercase() == "true" + { + iptables::new_with_cmd("/usr/sbin/iptables-nft") + } else { + iptables::new_with_cmd("/usr/sbin/iptables-legacy") + } + .expect("IPTables initialization may not fail!") +} + impl Debug for IPTablesWrapper { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("IPTablesWrapper") diff --git a/mirrord/agent/src/steal/subscriptions.rs b/mirrord/agent/src/steal/subscriptions.rs --- a/mirrord/agent/src/steal/subscriptions.rs +++ b/mirrord/agent/src/steal/subscriptions.rs @@ -10,7 +10,7 @@ use tokio::net::{TcpListener, TcpStream}; use super::{ http::HttpFilter, - ip_tables::{IPTablesWrapper, SafeIpTables}, + ip_tables::{new_iptables, IPTablesWrapper, SafeIpTables}, }; use crate::{error::AgentError, util::ClientId}; diff --git a/mirrord/agent/src/steal/subscriptions.rs b/mirrord/agent/src/steal/subscriptions.rs --- a/mirrord/agent/src/steal/subscriptions.rs +++ b/mirrord/agent/src/steal/subscriptions.rs @@ -94,7 +94,7 @@ impl PortRedirector for IpTablesRedirector { let iptables = match self.iptables.as_ref() { Some(iptables) => iptables, None => { - let iptables = iptables::new(false).unwrap(); + let iptables = new_iptables(); let safe = SafeIpTables::create(iptables.into(), self.flush_connections).await?; self.iptables.insert(safe) } diff --git a/mirrord/kube/src/api/container/ephemeral.rs b/mirrord/kube/src/api/container/ephemeral.rs --- a/mirrord/kube/src/api/container/ephemeral.rs +++ b/mirrord/kube/src/api/container/ephemeral.rs @@ -215,7 +215,8 @@ impl ContainerVariant for EphemeralTargetedVariant<'_> { "targetContainerName": runtime_data.container_name, "env": [ {"name": "RUST_LOG", "value": agent.log_level}, - { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() } + { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() }, + { "name": "MIRRORD_AGENT_NFTABLES", "value": agent.nftables.to_string() } ], "command": command_line, })).map_err(KubeApiError::from) diff --git a/mirrord/kube/src/api/container/job.rs b/mirrord/kube/src/api/container/job.rs --- a/mirrord/kube/src/api/container/job.rs +++ b/mirrord/kube/src/api/container/job.rs @@ -208,7 +208,8 @@ impl ContainerVariant for JobVariant<'_> { "command": command_line, "env": [ { "name": "RUST_LOG", "value": agent.log_level }, - { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() } + { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() }, + { "name": "MIRRORD_AGENT_NFTABLES", "value": agent.nftables.to_string() } ], // Add requests to avoid getting defaulted https://github.com/metalbear-co/mirrord/issues/579 "resources": resources
metalbear-co__mirrord-2273
2,273
[ "2272" ]
3.89
metalbear-co/mirrord
2024-02-26T15:50:26Z
diff --git a/mirrord/config/src/agent.rs b/mirrord/config/src/agent.rs --- a/mirrord/config/src/agent.rs +++ b/mirrord/config/src/agent.rs @@ -253,6 +253,15 @@ pub struct AgentConfig { #[config(default = false)] pub privileged: bool, + /// ### agent.nftables {#agent-nftables} + /// + /// Use iptables-nft instead of iptables-legacy. + /// Defaults to `false`. + /// + /// Needed if your mesh uses nftables instead of iptables-legacy, + #[config(default = false)] + pub nftables: bool, + /// <!--${internal}--> /// Create an agent that returns an error after accepting the first client. For testing /// purposes. Only supported with job agents (not with ephemeral agents). diff --git a/mirrord/config/src/lib.rs b/mirrord/config/src/lib.rs --- a/mirrord/config/src/lib.rs +++ b/mirrord/config/src/lib.rs @@ -690,6 +690,7 @@ mod tests { tolerations: None, check_out_of_pods: None, resources: None, + nftables: None, }), feature: Some(FeatureFileConfig { env: ToggleableConfig::Enabled(true).into(), diff --git a/mirrord/kube/src/api/container/job.rs b/mirrord/kube/src/api/container/job.rs --- a/mirrord/kube/src/api/container/job.rs +++ b/mirrord/kube/src/api/container/job.rs @@ -388,7 +389,8 @@ mod test { "command": ["./mirrord-agent", "-l", "3000", "targetless"], "env": [ { "name": "RUST_LOG", "value": agent.log_level }, - { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() } + { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() }, + { "name": "MIRRORD_AGENT_NFTABLES", "value": agent.nftables.to_string() } ], "resources": // Add requests to avoid getting defaulted https://github.com/metalbear-co/mirrord/issues/579 { diff --git a/mirrord/kube/src/api/container/job.rs b/mirrord/kube/src/api/container/job.rs --- a/mirrord/kube/src/api/container/job.rs +++ b/mirrord/kube/src/api/container/job.rs @@ -510,7 +512,8 @@ mod test { "command": ["./mirrord-agent", "-l", "3000", "targeted", "--container-id", "container", "--container-runtime", "docker"], "env": [ { "name": "RUST_LOG", "value": agent.log_level }, - { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() } + { "name": "MIRRORD_AGENT_STEALER_FLUSH_CONNECTIONS", "value": agent.flush_connections.to_string() }, + { "name": "MIRRORD_AGENT_NFTABLES", "value": agent.nftables.to_string() } ], "resources": // Add requests to avoid getting defaulted https://github.com/metalbear-co/mirrord/issues/579 {
Support for Istio Mesh + nft When users use Istio Mesh + nftables (not iptables legacy) our rules run before mesh, leading to undefined behavior. We probably should have a flag - iptables_mode which can be either legacy or nft then we use the appropriate and all should work the same (in theory). Need to manually test it to know better though. Linkerd has similar modes. `iptablesMode`
879fd097bd5949bf694f8f6610900139323e1f33
[ "tests::schema_file_is_up_to_date", "api::container::job::test::targetless", "api::container::job::test::targeted" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "config::from_env::tests::basic", "config::source::tests::basic::case_1", "config::source::tests::basic::case_2", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_3", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::default::case_2", "feature::fs::mode::tests::disabled::case_2", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::fs::mode::tests::disabled::case_1", "feature::fs::tests::fs_config_default", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::fs::mode::tests::disabled::case_4", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::fs::mode::tests::disabled::case_3", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::invalid_filters::case_1 - should panic", "feature::network::outgoing::tests::valid_filters::case_03", "feature::network::outgoing::tests::valid_filters::case_02", "feature::network::outgoing::tests::invalid_filters::case_2 - should panic", "feature::network::outgoing::tests::invalid_filters::case_3 - should panic", "feature::network::outgoing::tests::valid_filters::case_08", "feature::network::outgoing::tests::valid_filters::case_09", "feature::network::outgoing::tests::valid_filters::case_05", "feature::network::outgoing::tests::valid_filters::case_10", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "feature::network::outgoing::tests::valid_filters::case_06", "target::tests::default::case_2", "feature::network::outgoing::tests::valid_filters::case_01", "target::tests::default::case_1", "target::tests::default::case_6", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "feature::network::outgoing::tests::valid_filters::case_04", "feature::network::outgoing::tests::valid_filters::case_07", "tests::empty::config_type_1_ConfigType__Json", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "target::tests::parse_target_config_from_json::case_1", "target::tests::parse_target_config_from_json::case_3", "target::tests::default::case_5", "tests::full::config_type_1_ConfigType__Json", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "tests::schema_file_exists", "target::tests::parse_target_config_from_json::case_2", "target::tests::default::case_4", "target::tests::parse_target_config_from_json::case_4", "target::tests::default::case_3", "tests::empty::config_type_3_ConfigType__Yaml", "tests::empty::config_type_2_ConfigType__Toml", "tests::full::config_type_3_ConfigType__Yaml", "tests::full::config_type_2_ConfigType__Toml", "api::runtime::tests::target_parses::case_2", "api::runtime::tests::target_parses::case_1", "api::runtime::tests::target_parse_fails::case_2_panic - should panic", "api::runtime::tests::target_parses::case_3", "api::runtime::tests::target_parses::case_4", "api::runtime::tests::target_parse_fails::case_1_panic - should panic", "api::runtime::tests::target_parses::case_5", "api::container::util::test::agent_version_regex::case_1", "api::container::util::test::agent_version_regex::case_2" ]
[]
[]
2024-02-26T21:53:12Z
8d19bf67acb88006f0f42744c4537bcc7b77039d
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -1221,6 +1221,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.4" diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -3315,6 +3324,7 @@ dependencies = [ "tokio", "tokio-util", "tracing", + "tracing-appender", "tracing-subscriber", "which", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -6253,6 +6263,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" +dependencies = [ + "crossbeam-channel", + "time", + "tracing-subscriber", +] + [[package]] name = "tracing-attributes" version = "0.1.23" diff --git /dev/null b/changelog.d/2246.added.md new file mode 100644 --- /dev/null +++ b/changelog.d/2246.added.md @@ -0,0 +1,1 @@ +Add log level and log destination for int proxy \ No newline at end of file diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -796,7 +796,7 @@ "type": "object", "properties": { "idle_timeout": { - "title": "internal_proxy.idle_timeout {#agent-idle_timeout}", + "title": "internal_proxy.idle_timeout {#internal_proxy-idle_timeout}", "description": "How much time to wait while we don't have any active connections before exiting.\n\nCommon cases would be running a chain of processes that skip using the layer and don't connect to the proxy.\n\n```json { \"internal_proxy\": { \"idle_timeout\": 30 } } ```", "type": [ "integer", diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -805,8 +805,24 @@ "format": "uint64", "minimum": 0.0 }, + "log_destination": { + "title": "internal_proxy.log_destination {#internal_proxy-log_destination}", + "description": "Set the log file destination for the internal proxy.", + "type": [ + "string", + "null" + ] + }, + "log_level": { + "title": "internal_proxy.log_level {#internal_proxy-log_level}", + "description": "Set the log level for the internal proxy. RUST_LOG convention (i.e `mirrord=trace`) will only beu sed if log_destination is set", + "type": [ + "string", + "null" + ] + }, "start_idle_timeout": { - "title": "internal_proxy.start_idle_timeout {#agent-start_idle_timeout}", + "title": "internal_proxy.start_idle_timeout {#internal_proxy-start_idle_timeout}", "description": "How much time to wait for the first connection to the proxy in seconds.\n\nCommon cases would be running with dlv or any other debugger, which sets a breakpoint on process execution, delaying the layer startup and connection to proxy.\n\n```json { \"internal_proxy\": { \"start_idle_timeout\": 60 } } ```", "type": [ "integer", diff --git a/mirrord/cli/Cargo.toml b/mirrord/cli/Cargo.toml --- a/mirrord/cli/Cargo.toml +++ b/mirrord/cli/Cargo.toml @@ -53,6 +53,7 @@ tokio-util.workspace = true socket2.workspace = true drain.workspace = true clap_complete = "4.4.1" +tracing-appender = "0.2" [target.'cfg(target_os = "macos")'.dependencies] mirrord-sip = { path = "../sip" } diff --git a/mirrord/cli/src/error.rs b/mirrord/cli/src/error.rs --- a/mirrord/cli/src/error.rs +++ b/mirrord/cli/src/error.rs @@ -254,6 +254,9 @@ pub(crate) enum CliError { r#"This is a bug. Please report it in our Discord or GitHub repository. {GENERAL_HELP}"# ))] ConnectRequestBuildError(HttpError), + #[error("Failed to open log file for writing: {0:#?}")] + #[diagnostic(help(r#"Check that int proxy log file is in valid writable path"#))] + OpenIntProxyLogFile(std::io::Error), } impl From<OperatorApiError> for CliError { diff --git a/mirrord/cli/src/internal_proxy.rs b/mirrord/cli/src/internal_proxy.rs --- a/mirrord/cli/src/internal_proxy.rs +++ b/mirrord/cli/src/internal_proxy.rs @@ -28,6 +28,7 @@ use nix::libc; use tokio::{net::TcpListener, sync::mpsc, task::JoinHandle}; use tokio_util::sync::CancellationToken; use tracing::{error, info, log::trace}; +use tracing_subscriber::EnvFilter; use crate::{ connection::AGENT_CONNECT_INFO_ENV_KEY, diff --git a/mirrord/cli/src/internal_proxy.rs b/mirrord/cli/src/internal_proxy.rs --- a/mirrord/cli/src/internal_proxy.rs +++ b/mirrord/cli/src/internal_proxy.rs @@ -144,6 +145,22 @@ fn get_agent_connect_info() -> Result<Option<AgentConnectInfo>> { /// It listens for inbound layer connect and forwards to agent. pub(crate) async fn proxy(watch: drain::Watch) -> Result<()> { let config = LayerConfig::from_env()?; + + if let Some(ref log_destination) = config.internal_proxy.log_destination { + let output_file = std::fs::OpenOptions::new() + .write(true) + .create(true) + .open(log_destination) + .map_err(CliError::OpenIntProxyLogFile)?; + let tracing_registry = tracing_subscriber::fmt().with_writer(output_file); + if let Some(ref log_level) = config.internal_proxy.log_level { + tracing_registry + .with_env_filter(EnvFilter::builder().parse_lossy(log_level)) + .init(); + } else { + tracing_registry.init(); + } + } let agent_connect_info = get_agent_connect_info()?; let mut analytics = AnalyticsReporter::new(config.telemetry, watch); diff --git a/mirrord/cli/src/main.rs b/mirrord/cli/src/main.rs --- a/mirrord/cli/src/main.rs +++ b/mirrord/cli/src/main.rs @@ -451,6 +451,7 @@ fn init_ext_error_handler(commands: &Commands) -> bool { let _ = miette::set_hook(Box::new(|_| Box::new(JSONReportHandler::new()))); true } + Commands::InternalProxy => true, _ => false, } } diff --git a/mirrord/config/src/internal_proxy.rs b/mirrord/config/src/internal_proxy.rs --- a/mirrord/config/src/internal_proxy.rs +++ b/mirrord/config/src/internal_proxy.rs @@ -38,7 +38,7 @@ pub struct InternalProxyConfig { #[config(default = 60)] pub start_idle_timeout: u64, - /// ### internal_proxy.idle_timeout {#agent-idle_timeout} + /// ### internal_proxy.idle_timeout {#internal_proxy-idle_timeout} /// /// How much time to wait while we don't have any active connections before exiting. /// diff --git a/mirrord/config/src/internal_proxy.rs b/mirrord/config/src/internal_proxy.rs --- a/mirrord/config/src/internal_proxy.rs +++ b/mirrord/config/src/internal_proxy.rs @@ -54,4 +54,14 @@ pub struct InternalProxyConfig { /// ``` #[config(default = 5)] pub idle_timeout: u64, + + /// ### internal_proxy.log_level {#internal_proxy-log_level} + /// Set the log level for the internal proxy. + /// RUST_LOG convention (i.e `mirrord=trace`) + /// will only beu sed if log_destination is set + pub log_level: Option<String>, + + /// ### internal_proxy.log_destination {#internal_proxy-log_destination} + /// Set the log file destination for the internal proxy. + pub log_destination: Option<String>, }
metalbear-co__mirrord-2247
2,247
[ "2246" ]
3.87
metalbear-co/mirrord
2024-02-18T14:20:27Z
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -3502,7 +3512,7 @@ dependencies = [ "mirrord-protocol", "rand", "regex", - "rstest 0.17.0", + "rstest 0.18.2", "serde", "serde_json", "shellexpand", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -3551,7 +3561,7 @@ dependencies = [ "os_info", "rand", "regex", - "rstest 0.17.0", + "rstest 0.18.2", "serde", "serde_json", "socket2 0.5.5", diff --git a/mirrord/config/src/internal_proxy.rs b/mirrord/config/src/internal_proxy.rs --- a/mirrord/config/src/internal_proxy.rs +++ b/mirrord/config/src/internal_proxy.rs @@ -21,7 +21,7 @@ use crate::config::source::MirrordConfigSource; #[config(map_to = "InternalProxyFileConfig", derive = "JsonSchema")] #[cfg_attr(test, config(derive = "PartialEq"))] pub struct InternalProxyConfig { - /// ### internal_proxy.start_idle_timeout {#agent-start_idle_timeout} + /// ### internal_proxy.start_idle_timeout {#internal_proxy-start_idle_timeout} /// /// How much time to wait for the first connection to the proxy in seconds. ///
Allow for dumping intproxy logs to files Currently, whenever the internal proxy dies, the user is left only with some communication error. Having logs from the proxy would allow us to find the root of the problem
8d19bf67acb88006f0f42744c4537bcc7b77039d
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "config::from_env::tests::basic", "config::source::tests::basic::case_1", "config::source::tests::basic::case_2", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_2", "feature::fs::mode::tests::default::case_3", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::disabled::case_1", "feature::fs::mode::tests::disabled::case_2", "feature::fs::mode::tests::disabled::case_3", "feature::fs::mode::tests::disabled::case_4", "feature::fs::tests::fs_config_default", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::invalid_filters::case_2 - should panic", "feature::network::outgoing::tests::invalid_filters::case_1 - should panic", "feature::network::outgoing::tests::invalid_filters::case_3 - should panic", "feature::network::outgoing::tests::valid_filters::case_01", "feature::network::outgoing::tests::valid_filters::case_02", "feature::network::outgoing::tests::valid_filters::case_03", "feature::network::outgoing::tests::valid_filters::case_04", "feature::network::outgoing::tests::valid_filters::case_05", "feature::network::outgoing::tests::valid_filters::case_06", "feature::network::outgoing::tests::valid_filters::case_07", "feature::network::outgoing::tests::valid_filters::case_08", "feature::network::outgoing::tests::valid_filters::case_09", "feature::network::outgoing::tests::valid_filters::case_10", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "target::tests::default::case_1", "target::tests::default::case_2", "target::tests::default::case_3", "target::tests::default::case_4", "target::tests::default::case_5", "target::tests::default::case_6", "target::tests::parse_target_config_from_json::case_1", "target::tests::parse_target_config_from_json::case_2", "target::tests::parse_target_config_from_json::case_3", "target::tests::parse_target_config_from_json::case_4", "tests::empty::config_type_1_ConfigType__Json", "tests::empty::config_type_2_ConfigType__Toml", "tests::empty::config_type_3_ConfigType__Yaml", "tests::full::config_type_1_ConfigType__Json", "tests::schema_file_exists", "tests::full::config_type_3_ConfigType__Yaml", "tests::full::config_type_2_ConfigType__Toml" ]
[]
[]
2024-02-18T15:25:09Z
2df1a30c473926ead9ab883b61b1878cd69d63e8
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -4060,7 +4060,7 @@ dependencies = [ [[package]] name = "mirrord-protocol" -version = "1.10.0" +version = "1.11.0" dependencies = [ "actix-codec", "bincode", diff --git /dev/null b/changelog.d/2699.added.md new file mode 100644 --- /dev/null +++ b/changelog.d/2699.added.md @@ -0,0 +1,1 @@ +Add support for all_of, any_of composite http filters in config. \ No newline at end of file diff --git a/mirrord/agent/src/steal/http/filter.rs b/mirrord/agent/src/steal/http/filter.rs --- a/mirrord/agent/src/steal/http/filter.rs +++ b/mirrord/agent/src/steal/http/filter.rs @@ -9,6 +9,13 @@ pub enum HttpFilter { Header(Regex), /// Path based filter. Path(Regex), + /// Filter composed of multiple filters. + Composite { + /// If true, all filters must match, otherwise any filter can match. + all: bool, + /// Filters to use. + filters: Vec<HttpFilter>, + }, } impl TryFrom<&mirrord_protocol::tcp::HttpFilter> for HttpFilter { diff --git a/mirrord/agent/src/steal/http/filter.rs b/mirrord/agent/src/steal/http/filter.rs --- a/mirrord/agent/src/steal/http/filter.rs +++ b/mirrord/agent/src/steal/http/filter.rs @@ -22,6 +29,14 @@ impl TryFrom<&mirrord_protocol::tcp::HttpFilter> for HttpFilter { mirrord_protocol::tcp::HttpFilter::Path(path) => { Ok(Self::Path(Regex::new(&format!("(?i){path}"))?)) } + mirrord_protocol::tcp::HttpFilter::Composite { all, filters } => { + let all = *all; + let filters = filters + .iter() + .map(HttpFilter::try_from) + .collect::<Result<Vec<_>, _>>()?; + Ok(Self::Composite { all, filters }) + } } } } diff --git a/mirrord/agent/src/steal/http/filter.rs b/mirrord/agent/src/steal/http/filter.rs --- a/mirrord/agent/src/steal/http/filter.rs +++ b/mirrord/agent/src/steal/http/filter.rs @@ -87,6 +102,12 @@ impl HttpFilter { .unwrap_or(false) }) .unwrap_or(false), + + Self::Composite { all: true, filters } => filters.iter().all(|f| f.matches(request)), + Self::Composite { + all: false, + filters, + } => filters.iter().any(|f| f.matches(request)), } } } diff --git a/mirrord/cli/src/error.rs b/mirrord/cli/src/error.rs --- a/mirrord/cli/src/error.rs +++ b/mirrord/cli/src/error.rs @@ -182,9 +182,9 @@ pub(crate) enum CliError { ))] AgentConnectionFailed(KubeApiError), - #[error("Failed to fetch remote environment variables from the agent: {0}")] + #[error("Failed to communicate with the agent: {0}")] #[diagnostic(help("Please check agent status and logs.{GENERAL_HELP}"))] - RemoteEnvFetchFailed(String), + InitialAgentCommFailed(String), #[error("Failed to execute binary `{0}` with args {1:?}")] #[diagnostic(help( diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -9,10 +9,15 @@ use mirrord_config::{ config::ConfigError, internal_proxy::MIRRORD_INTPROXY_CONNECT_TCP_ENV, LayerConfig, }; use mirrord_intproxy::agent_conn::AgentConnectInfo; +use mirrord_operator::client::OperatorSession; use mirrord_progress::Progress; -use mirrord_protocol::{ClientMessage, DaemonMessage, EnvVars, GetEnvVarsRequest, LogLevel}; +use mirrord_protocol::{ + tcp::HTTP_COMPOSITE_FILTER_VERSION, ClientMessage, DaemonMessage, EnvVars, GetEnvVarsRequest, + LogLevel, +}; #[cfg(target_os = "macos")] use mirrord_sip::sip_patch; +use semver::Version; use serde::Serialize; use tokio::{ io::{AsyncBufReadExt, BufReader}, diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -164,6 +169,28 @@ impl MirrordExecution { .await .inspect_err(|_| analytics.set_error(AnalyticsError::AgentConnection))?; + if config.feature.network.incoming.http_filter.is_composite() { + let version = match &connect_info { + AgentConnectInfo::Operator(OperatorSession { + operator_protocol_version: Some(version), + .. + }) => Some(version.clone()), + AgentConnectInfo::DirectKubernetes(_) => { + Some(MirrordExecution::get_agent_version(&mut connection).await?) + } + _ => None, + }; + if !version + .map(|version| HTTP_COMPOSITE_FILTER_VERSION.matches(&version)) + .unwrap_or(false) + { + Err(ConfigError::Conflict(format!( + "Cannot use 'any_of' or 'all_of' HTTP filter types, protocol version used by mirrord-agent must match {}. Consider using a newer version of mirrord-agent", + *HTTP_COMPOSITE_FILTER_VERSION + )))? + } + } + let mut env_vars = if config.feature.env.load_from_process.unwrap_or(false) { Default::default() } else { diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -275,6 +302,29 @@ impl MirrordExecution { }) } + async fn get_agent_version(connection: &mut AgentConnection) -> Result<Version> { + let Ok(_) = connection + .sender + .send(ClientMessage::SwitchProtocolVersion( + mirrord_protocol::VERSION.clone(), + )) + .await + else { + return Err(CliError::InitialAgentCommFailed( + "failed to send protocol version request".to_string(), + )); + }; + match connection.receiver.recv().await { + Some(DaemonMessage::SwitchProtocolVersionResponse(version)) => Ok(version), + Some(msg) => Err(CliError::InitialAgentCommFailed(format!( + "received unexpected message during agent version check: {msg:?}" + ))), + None => Err(CliError::InitialAgentCommFailed( + "no response received from agent connection during agent version check".to_string(), + )), + } + } + /// Starts the external proxy (`extproxy`) so sidecar intproxy can connect via this to agent #[tracing::instrument(level = Level::TRACE, skip_all)] pub(crate) async fn start_external<P>( diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -411,7 +461,7 @@ impl MirrordExecution { Self::get_remote_env(connection, env_vars_exclude, env_vars_include), ) .await - .map_err(|_| CliError::RemoteEnvFetchFailed("timeout".to_string()))??; + .map_err(|_| CliError::InitialAgentCommFailed("timeout".to_string()))??; env_vars.extend(remote_env); if let Some(overrides) = &config.feature.env.r#override { env_vars.extend(overrides.iter().map(|(k, v)| (k.clone(), v.clone()))); diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -436,7 +486,7 @@ impl MirrordExecution { })) .await .map_err(|_| { - CliError::RemoteEnvFetchFailed("agent unexpectedly closed connection".to_string()) + CliError::InitialAgentCommFailed("agent unexpectedly closed connection".to_string()) })?; loop { diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -447,7 +497,7 @@ impl MirrordExecution { } Some(DaemonMessage::GetEnvVarsResponse(Err(error))) => { tracing::error!(?error, "Agent responded with an error"); - Err(CliError::RemoteEnvFetchFailed(format!( + Err(CliError::InitialAgentCommFailed(format!( "agent responded with an error: {error}" ))) } diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -459,13 +509,13 @@ impl MirrordExecution { continue; } - Some(DaemonMessage::Close(msg)) => Err(CliError::RemoteEnvFetchFailed(format!( + Some(DaemonMessage::Close(msg)) => Err(CliError::InitialAgentCommFailed(format!( "agent closed connection with message: {msg}" ))), - Some(msg) => Err(CliError::RemoteEnvFetchFailed(format!( + Some(msg) => Err(CliError::InitialAgentCommFailed(format!( "agent responded with an unexpected message: {msg:?}" ))), - None => Err(CliError::RemoteEnvFetchFailed( + None => Err(CliError::InitialAgentCommFailed( "agent unexpectedly closed connection".to_string(), )), }; diff --git a/mirrord/config/configuration.md b/mirrord/config/configuration.md --- a/mirrord/config/configuration.md +++ b/mirrord/config/configuration.md @@ -997,6 +997,14 @@ Similarly, you can exclude certain paths using a negative look-ahead: Setting this filter will make mirrord only steal requests to URIs that do not start with "/health/". +#### feature.network.incoming.http_filter.all_of {#feature-network-incoming-http_filter-all_of} + +Messages must match all of the specified filters. + +#### feature.network.incoming.http_filter.any_of {#feature-network-incoming-http_filter-any_of} + +Messages must match any of the specified filters. + ##### feature.network.incoming.http_filter.header_filter {#feature-network-incoming-http-header-filter} diff --git a/mirrord/config/configuration.md b/mirrord/config/configuration.md --- a/mirrord/config/configuration.md +++ b/mirrord/config/configuration.md @@ -1259,12 +1267,14 @@ and don't connect to the proxy. ``` ### internal_proxy.log_destination {#internal_proxy-log_destination} + Set the log file destination for the internal proxy. ### internal_proxy.log_level {#internal_proxy-log_level} + Set the log level for the internal proxy. -RUST_LOG convention (i.e `mirrord=trace`) -will only be used if log_destination is set +RUST_LOG convention (i.e `mirrord=trace`) will only be used if `log_destination` +is set. ### internal_proxy.start_idle_timeout {#internal_proxy-start_idle_timeout} diff --git a/mirrord/config/src/feature/network/incoming/http_filter.rs b/mirrord/config/src/feature/network/incoming/http_filter.rs --- a/mirrord/config/src/feature/network/incoming/http_filter.rs +++ b/mirrord/config/src/feature/network/incoming/http_filter.rs @@ -81,6 +81,16 @@ pub struct HttpFilterConfig { #[config(env = "MIRRORD_HTTP_PATH_FILTER")] pub path_filter: Option<String>, + /// #### feature.network.incoming.http_filter.all_of {#feature-network-incoming-http_filter-all_of} + /// + /// Messages must match all of the specified filters. + pub all_of: Option<Vec<InnerFilter>>, + + /// #### feature.network.incoming.http_filter.any_of {#feature-network-incoming-http_filter-any_of} + /// + /// Messages must match any of the specified filters. + pub any_of: Option<Vec<InnerFilter>>, + /// ##### feature.network.incoming.http_filter.ports {#feature-network-incoming-http_filter-ports} /// /// Activate the HTTP traffic filter only for these ports. diff --git a/mirrord/config/src/feature/network/incoming/http_filter.rs b/mirrord/config/src/feature/network/incoming/http_filter.rs --- a/mirrord/config/src/feature/network/incoming/http_filter.rs +++ b/mirrord/config/src/feature/network/incoming/http_filter.rs @@ -95,7 +105,14 @@ pub struct HttpFilterConfig { impl HttpFilterConfig { pub fn is_filter_set(&self) -> bool { - self.header_filter.is_some() || self.path_filter.is_some() + self.header_filter.is_some() + || self.path_filter.is_some() + || self.all_of.is_some() + || self.any_of.is_some() + } + + pub fn is_composite(&self) -> bool { + self.all_of.is_some() || self.any_of.is_some() } pub fn get_filtered_ports(&self) -> Option<&[u16]> { diff --git a/mirrord/config/src/feature/network/incoming/http_filter.rs b/mirrord/config/src/feature/network/incoming/http_filter.rs --- a/mirrord/config/src/feature/network/incoming/http_filter.rs +++ b/mirrord/config/src/feature/network/incoming/http_filter.rs @@ -124,6 +165,9 @@ impl MirrordToggleableConfig for HttpFilterFileConfig { .source_value(context) .transpose()?; + let all_of = None; + let any_of = None; + let ports = FromEnv::new("MIRRORD_HTTP_FILTER_PORTS") .source_value(context) .transpose()? diff --git a/mirrord/config/src/feature/network/incoming/http_filter.rs b/mirrord/config/src/feature/network/incoming/http_filter.rs --- a/mirrord/config/src/feature/network/incoming/http_filter.rs +++ b/mirrord/config/src/feature/network/incoming/http_filter.rs @@ -132,6 +176,8 @@ impl MirrordToggleableConfig for HttpFilterFileConfig { Ok(Self::Generated { header_filter, path_filter, + all_of, + any_of, ports, }) } diff --git a/mirrord/config/src/lib.rs b/mirrord/config/src/lib.rs --- a/mirrord/config/src/lib.rs +++ b/mirrord/config/src/lib.rs @@ -367,23 +367,19 @@ impl LayerConfig { ); } - if self - .feature - .network - .incoming - .http_filter - .path_filter - .is_some() - && self - .feature - .network - .incoming - .http_filter - .header_filter - .is_some() - { + let http_filter = &self.feature.network.incoming.http_filter; + let used_filters = [ + http_filter.path_filter.is_some(), + http_filter.header_filter.is_some(), + http_filter.all_of.is_some(), + http_filter.any_of.is_some(), + ] + .into_iter() + .filter(|used| *used) + .count(); + if used_filters > 1 { Err(ConfigError::Conflict( - "Cannot use both HTTP header filter and path filter at the same time".to_string(), + "Cannot use multiple types of HTTP filter at the same time, use 'any_of' or 'all_of' to combine filters".to_string(), ))? } diff --git a/mirrord/operator/src/client.rs b/mirrord/operator/src/client.rs --- a/mirrord/operator/src/client.rs +++ b/mirrord/operator/src/client.rs @@ -112,7 +112,7 @@ pub struct OperatorSession { operator_license_fingerprint: Option<String>, /// Version of [`mirrord_protocol`] used by the operator. /// Used to create [`ConnectionWrapper`]. - operator_protocol_version: Option<Version>, + pub operator_protocol_version: Option<Version>, } impl fmt::Debug for OperatorSession { diff --git a/mirrord/protocol/Cargo.toml b/mirrord/protocol/Cargo.toml --- a/mirrord/protocol/Cargo.toml +++ b/mirrord/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mirrord-protocol" -version = "1.10.0" +version = "1.11.0" authors.workspace = true description.workspace = true documentation.workspace = true diff --git a/mirrord/protocol/src/tcp.rs b/mirrord/protocol/src/tcp.rs --- a/mirrord/protocol/src/tcp.rs +++ b/mirrord/protocol/src/tcp.rs @@ -150,6 +150,13 @@ pub enum HttpFilter { Header(Filter), /// Filter by path ("/api/v1") Path(Filter), + /// Filter by multiple filters + Composite { + /// If true, all filters must match, otherwise any filter can match + all: bool, + /// Filters to use + filters: Vec<HttpFilter>, + }, } impl Display for HttpFilter { diff --git a/mirrord/protocol/src/tcp.rs b/mirrord/protocol/src/tcp.rs --- a/mirrord/protocol/src/tcp.rs +++ b/mirrord/protocol/src/tcp.rs @@ -157,6 +164,34 @@ impl Display for HttpFilter { match self { HttpFilter::Header(filter) => write!(f, "header={filter}"), HttpFilter::Path(filter) => write!(f, "path={filter}"), + HttpFilter::Composite { all, filters } => match all { + true => { + write!(f, "all of ")?; + let mut first = true; + for filter in filters { + if first { + write!(f, "({filter})")?; + first = false; + } else { + write!(f, ", ({filter})")?; + } + } + Ok(()) + } + false => { + write!(f, "any of ")?; + let mut first = true; + for filter in filters { + if first { + write!(f, "({filter})")?; + first = false; + } else { + write!(f, ", ({filter})")?; + } + } + Ok(()) + } + }, } } } diff --git a/mirrord/protocol/src/tcp.rs b/mirrord/protocol/src/tcp.rs --- a/mirrord/protocol/src/tcp.rs +++ b/mirrord/protocol/src/tcp.rs @@ -416,6 +451,10 @@ pub static HTTP_CHUNKED_RESPONSE_VERSION: LazyLock<VersionReq> = pub static HTTP_FILTERED_UPGRADE_VERSION: LazyLock<VersionReq> = LazyLock::new(|| ">=1.5.0".parse().expect("Bad Identifier")); +/// Minimal mirrord-protocol version that allows [`HttpFilter::Composite`] +pub static HTTP_COMPOSITE_FILTER_VERSION: LazyLock<VersionReq> = + LazyLock::new(|| ">=1.11.0".parse().expect("Bad Identifier")); + /// Protocol break - on version 2, please add source port, dest/src IP to the message /// so we can avoid losing this information. #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone)]
metalbear-co__mirrord-2699
2,699
I agree technically, but from UX side we wouldn't want too complex configuration Currently the config looks like: ```json { "http_filter": { "header_filter": "user: me" } } ``` or ```json { "http_filter": { "path_filter": "/api/v1/my-route.*" } } ``` I'd allow for third variant like this: ```json { "http_filter": [ {"header": "user: me"}, {"path": "/api/v1/my-route.*"}, ... ] } ``` Another, more extensible option: ```json { "http_filter": { "all": [ {"header": "user: me"}, {"path": "/api/v1/my-route.*"} ] } } ``` (allow for `"all"` | `"any"`) How about allowing both to be set and take it as an AND? ```json { "http_filter": { "path_filter": "/api/v1/my-route.*", "header_filter": "user: me" } } Sounds ok, but it would be the same amount of work on our end with less flexibility :c > Another, more extensible option: > > ```json > { > "http_filter": { > "all": [ > {"header": "user: me"}, > {"path": "/api/v1/my-route.*"} > ] > } > } > ``` > > (allow for `"all"` | `"any"`) I like how explicit this is tbh I'm okay with it, as long as the basic config options remain (so users can just specify under http_filter one condition..)
[ "2683" ]
3.115
metalbear-co/mirrord
2024-08-23T16:44:18Z
diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -987,6 +987,28 @@ "description": "Filter configuration for the HTTP traffic stealer feature.\n\nAllows the user to set a filter (regex) for the HTTP headers, so that the stealer traffic feature only captures HTTP requests that match the specified filter, forwarding unmatched requests to their original destinations.\n\nOnly does something when [`feature.network.incoming.mode`](#feature-network-incoming-mode) is set as `\"steal\"`, ignored otherwise.\n\nFor example, to filter based on header: ```json { \"header_filter\": \"host: api\\\\..+\" } ``` Setting that filter will make mirrord only steal requests with the `host` header set to hosts that start with \"api\", followed by a dot, and then at least one more character.\n\nFor example, to filter based on path: ```json { \"path_filter\": \"^/api/\" } ``` Setting this filter will make mirrord only steal requests to URIs starting with \"/api/\".\n\nThis can be useful for filtering out Kubernetes liveness, readiness and startup probes. For example, for avoiding stealing any probe sent by kubernetes, you can set this filter: ```json { \"header_filter\": \"^User-Agent: (?!kube-probe)\" } ``` Setting this filter will make mirrord only steal requests that **do** have a user agent that **does not** begin with \"kube-probe\".\n\nSimilarly, you can exclude certain paths using a negative look-ahead: ```json { \"path_filter\": \"^(?!/health/)\" } ``` Setting this filter will make mirrord only steal requests to URIs that do not start with \"/health/\".", "type": "object", "properties": { + "all_of": { + "title": "feature.network.incoming.http_filter.all_of {#feature-network-incoming-http_filter-all_of}", + "description": "Messages must match all of the specified filters.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/InnerFilter" + } + }, + "any_of": { + "title": "feature.network.incoming.http_filter.any_of {#feature-network-incoming-http_filter-any_of}", + "description": "Messages must match any of the specified filters.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/InnerFilter" + } + }, "header_filter": { "title": "feature.network.incoming.http_filter.header_filter {#feature-network-incoming-http-header-filter}", "description": "Supports regexes validated by the [`fancy-regex`](https://docs.rs/fancy-regex/latest/fancy_regex/) crate.\n\nThe HTTP traffic feature converts the HTTP headers to `HeaderKey: HeaderValue`, case-insensitive.", diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -1191,6 +1213,36 @@ } ] }, + "InnerFilter": { + "anyOf": [ + { + "title": "feature.network.incoming.inner_filter.header_filter {#feature-network-incoming-inner-header-filter}", + "description": "Supports regexes validated by the [`fancy-regex`](https://docs.rs/fancy-regex/latest/fancy_regex/) crate.\n\nThe HTTP traffic feature converts the HTTP headers to `HeaderKey: HeaderValue`, case-insensitive.", + "type": "object", + "required": [ + "header" + ], + "properties": { + "header": { + "type": "string" + } + } + }, + { + "title": "feature.network.incoming.inner_filter.path_filter {#feature-network-incoming-inner-path-filter}", + "description": "Supports regexes validated by the [`fancy-regex`](https://docs.rs/fancy-regex/latest/fancy_regex/) crate.\n\nCase-insensitive. Tries to find match in the path (without query) and path+query. If any of the two matches, the request is stolen.", + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "type": "string" + } + } + } + ] + }, "InternalProxyFileConfig": { "description": "Configuration for the internal proxy mirrord spawns for each local mirrord session that local layers use to connect to the remote agent\n\nThis is seldom used, but if you get `ConnectionRefused` errors, you might want to increase the timeouts a bit.\n\n```json { \"internal_proxy\": { \"start_idle_timeout\": 30, \"idle_timeout\": 5 } } ```", "type": "object", diff --git a/mirrord/agent/src/steal/http/filter.rs b/mirrord/agent/src/steal/http/filter.rs --- a/mirrord/agent/src/steal/http/filter.rs +++ b/mirrord/agent/src/steal/http/filter.rs @@ -110,3 +131,70 @@ impl NormalizedHeaders { }) } } + +#[cfg(test)] +mod test { + use hyper::Request; + use mirrord_protocol::tcp::{self, Filter}; + + use crate::steal::http::HttpFilter; + + #[test] + fn matching_all_filter() { + let tcp_filter = tcp::HttpFilter::Composite { + all: true, + filters: vec![ + tcp::HttpFilter::Header(Filter::new("brass-key: a-bazillion".to_string()).unwrap()), + tcp::HttpFilter::Path(Filter::new("path/to/v1".to_string()).unwrap()), + ], + }; + + // should match + let mut input = Request::builder() + .uri("https://www.balconia.gov/api/path/to/v1") + .header("brass-key", "a-bazillion") + .body(()) + .unwrap(); + let filter: HttpFilter = TryFrom::try_from(&tcp_filter).unwrap(); + assert!(filter.matches(&mut input)); + + // should fail + let mut input = Request::builder() + .uri("https://www.balconia.gov/api/path/to/v1") + .header("brass-key", "nothin") + .body(()) + .unwrap(); + assert!(!filter.matches(&mut input)); + } + + #[test] + fn matching_any_filter() { + let tcp_filter = tcp::HttpFilter::Composite { + all: false, + filters: vec![ + tcp::HttpFilter::Header(Filter::new("brass-key: a-bazillion".to_string()).unwrap()), + tcp::HttpFilter::Header(Filter::new("dungeon-key: heavy".to_string()).unwrap()), + tcp::HttpFilter::Path(Filter::new("path/to/v1".to_string()).unwrap()), + tcp::HttpFilter::Path(Filter::new("path/for/v8".to_string()).unwrap()), + ], + }; + + // should match + let mut input = Request::builder() + .uri("https://www.balconia.gov/api/path/to/v1") + .header("brass-key", "nothin") + .body(()) + .unwrap(); + let filter: HttpFilter = TryFrom::try_from(&tcp_filter).unwrap(); + assert!(filter.matches(&mut input)); + + // should fail + let mut input = Request::builder() + .uri("https://www.balconia.gov/api/path/to/v3") + .header("brass-key", "nothin") + .body(()) + .unwrap(); + let filter: HttpFilter = TryFrom::try_from(&tcp_filter).unwrap(); + assert!(!filter.matches(&mut input)); + } +} diff --git a/mirrord/config/src/feature/network/incoming/http_filter.rs b/mirrord/config/src/feature/network/incoming/http_filter.rs --- a/mirrord/config/src/feature/network/incoming/http_filter.rs +++ b/mirrord/config/src/feature/network/incoming/http_filter.rs @@ -103,6 +120,30 @@ impl HttpFilterConfig { } } +#[derive(PartialEq, Eq, Clone, Debug, JsonSchema, Serialize, Deserialize)] +#[serde(untagged)] +pub enum InnerFilter { + /// ##### feature.network.incoming.inner_filter.header_filter {#feature-network-incoming-inner-header-filter} + /// + /// + /// Supports regexes validated by the + /// [`fancy-regex`](https://docs.rs/fancy-regex/latest/fancy_regex/) crate. + /// + /// The HTTP traffic feature converts the HTTP headers to `HeaderKey: HeaderValue`, + /// case-insensitive. + Header { header: String }, + + /// ##### feature.network.incoming.inner_filter.path_filter {#feature-network-incoming-inner-path-filter} + /// + /// + /// Supports regexes validated by the + /// [`fancy-regex`](https://docs.rs/fancy-regex/latest/fancy_regex/) crate. + /// + /// Case-insensitive. Tries to find match in the path (without query) and path+query. + /// If any of the two matches, the request is stolen. + Path { path: String }, +} + /// <!--${internal}--> /// Helper struct for setting up ports configuration (part of the HTTP traffic stealer feature). ///
Support specifying both header and path filter for stealing HTTP IMO we should probably just allow for any set/combination of filters. Remember to verify config after fetching `mirrord-protocol` version used by agent/operator
866664165f21460504794672bb680257e090cfaa
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "config::from_env::tests::basic", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "config::source::tests::basic::case_1", "config::source::tests::basic::case_2", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::fs::mode::tests::default::case_3", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::fs::mode::tests::disabled::case_1", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::mode::tests::disabled::case_3", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_2", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::fs::mode::tests::disabled::case_4", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::fs::mode::tests::disabled::case_2", "feature::fs::mode::tests::default::case_4", "feature::fs::tests::fs_config_default", "feature::network::filter::tests::invalid_filters::case_3 - should panic", "feature::network::filter::tests::invalid_filters::case_2 - should panic", "feature::network::filter::tests::invalid_filters::case_1 - should panic", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::network::filter::tests::valid_filters::case_04", "feature::network::filter::tests::valid_filters::case_02", "feature::network::filter::tests::valid_filters::case_01", "feature::network::filter::tests::valid_filters::case_03", "feature::network::filter::tests::valid_filters::case_07", "feature::network::filter::tests::valid_filters::case_08", "feature::network::filter::tests::valid_filters::case_09", "feature::network::filter::tests::valid_filters::case_06", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::filter::tests::valid_filters::case_10", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::filter::tests::valid_filters::case_05", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "target::tests::default::case_1", "target::tests::default::case_2", "target::tests::default::case_3", "target::tests::default::case_4", "target::tests::default::case_5", "target::tests::default::case_6", "target::tests::parse_target_config_from_json::case_1", "tests::empty::config_type_1_ConfigType__Json", "target::tests::parse_target_config_from_json::case_3", "target::tests::parse_target_config_from_json::case_4", "target::tests::parse_target_config_from_json::case_2", "tests::schema_file_exists", "tests::empty::config_type_3_ConfigType__Yaml", "tests::empty::config_type_2_ConfigType__Toml", "tests::issue_2647::config_type_1_ConfigType__Json", "tests::full::config_type_1_ConfigType__Json", "tests::issue_2647::config_type_3_ConfigType__Yaml", "tests::issue_2647::config_type_2_ConfigType__Toml", "tests::full::config_type_3_ConfigType__Yaml", "tests::full::config_type_2_ConfigType__Toml" ]
[]
[]
2024-08-28T17:12:23Z
7a2dd1b8b246dfc700a38b8ddb7ba244babf1272
diff --git /dev/null b/changelog.d/2641.fixed.md new file mode 100644 --- /dev/null +++ b/changelog.d/2641.fixed.md @@ -0,0 +1,1 @@ +Specify that `mirrord container` is an unstable feature. diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -527,7 +527,7 @@ ] }, "ContainerFileConfig": { - "description": "`mirrord container` command specific config.", + "description": "Unstable: `mirrord container` command specific config.", "type": "object", "properties": { "cli_image": { diff --git a/mirrord/cli/src/config.rs b/mirrord/cli/src/config.rs --- a/mirrord/cli/src/config.rs +++ b/mirrord/cli/src/config.rs @@ -25,7 +25,7 @@ pub(super) struct Cli { #[derive(Debug, Subcommand)] pub(super) enum Commands { - /// Create and run a new container from an image with mirrord loaded + /// Unstable: Create and run a new container from an image with mirrord loaded Container(Box<ContainerArgs>), /// Execute a binary using mirrord, mirror remote traffic to it, provide it access to remote diff --git a/mirrord/cli/src/container.rs b/mirrord/cli/src/container.rs --- a/mirrord/cli/src/container.rs +++ b/mirrord/cli/src/container.rs @@ -162,6 +162,8 @@ pub(crate) async fn container_command( ) -> Result<()> { let progress = ProgressTracker::from_env("mirrord container"); + progress.warning("mirrord container is currently an unstable feature"); + for (name, value) in exec_params.as_env_vars()? { std::env::set_var(name, value); } diff --git a/mirrord/config/src/lib.rs b/mirrord/config/src/lib.rs --- a/mirrord/config/src/lib.rs +++ b/mirrord/config/src/lib.rs @@ -266,7 +266,7 @@ pub struct LayerConfig { pub agent: AgentConfig, /// ## container {#root-container} - #[config(nested)] + #[config(nested, unstable)] pub container: ContainerConfig, /// ## feature {#root-feature}
metalbear-co__mirrord-2668
2,668
[ "2641" ]
3.113
metalbear-co/mirrord
2024-08-15T15:12:18Z
diff --git a/mirrord/config/configuration.md b/mirrord/config/configuration.md --- a/mirrord/config/configuration.md +++ b/mirrord/config/configuration.md @@ -384,7 +384,7 @@ IP:PORT to connect to instead of using k8s api, for testing purposes. ## container {#root-container} -`mirrord container` command specific config. +Unstable: `mirrord container` command specific config. ### container.cli_image {#container-cli_image} diff --git a/mirrord/config/src/container.rs b/mirrord/config/src/container.rs --- a/mirrord/config/src/container.rs +++ b/mirrord/config/src/container.rs @@ -11,7 +11,7 @@ static DEFAULT_CLI_IMAGE: &str = concat!( env!("CARGO_PKG_VERSION") ); -/// `mirrord container` command specific config. +/// Unstable: `mirrord container` command specific config. #[derive(MirrordConfig, Clone, Debug, Serialize)] #[config(map_to = "ContainerFileConfig", derive = "JsonSchema")] #[cfg_attr(test, config(derive = "PartialEq"))]
Mark `mirrord container ...` as unstable 1. Mark `mirrord container ...` subcommand as unstable. 2. Maybe push this info to CLI progress as well? 3. ~~Add new session type field to analytics reports. Should allow for differentiating regular runs from container runs~~ done in #2643
7a2dd1b8b246dfc700a38b8ddb7ba244babf1272
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "config::from_env::tests::basic", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "config::source::tests::basic::case_1", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "config::source::tests::basic::case_2", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_2", "feature::fs::mode::tests::default::case_3", "feature::fs::mode::tests::disabled::case_1", "feature::fs::mode::tests::disabled::case_2", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::disabled::case_4", "feature::fs::mode::tests::disabled::case_3", "feature::network::filter::tests::invalid_filters::case_2 - should panic", "feature::network::filter::tests::invalid_filters::case_3 - should panic", "feature::network::filter::tests::valid_filters::case_01", "feature::fs::tests::fs_config_default", "feature::network::filter::tests::valid_filters::case_03", "feature::network::filter::tests::invalid_filters::case_1 - should panic", "feature::network::filter::tests::valid_filters::case_05", "feature::network::filter::tests::valid_filters::case_06", "feature::network::filter::tests::valid_filters::case_04", "feature::network::filter::tests::valid_filters::case_02", "feature::network::filter::tests::valid_filters::case_07", "feature::network::filter::tests::valid_filters::case_08", "feature::network::filter::tests::valid_filters::case_09", "feature::network::filter::tests::valid_filters::case_10", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "target::tests::default::case_1", "target::tests::default::case_2", "target::tests::default::case_3", "target::tests::default::case_4", "target::tests::default::case_5", "target::tests::default::case_6", "tests::empty::config_type_1_ConfigType__Json", "target::tests::parse_target_config_from_json::case_3", "tests::empty::config_type_2_ConfigType__Toml", "tests::empty::config_type_3_ConfigType__Yaml", "target::tests::parse_target_config_from_json::case_4", "target::tests::parse_target_config_from_json::case_2", "target::tests::parse_target_config_from_json::case_1", "tests::schema_file_exists", "tests::issue_2647::config_type_1_ConfigType__Json", "tests::full::config_type_1_ConfigType__Json", "tests::full::config_type_2_ConfigType__Toml", "tests::issue_2647::config_type_3_ConfigType__Yaml", "tests::full::config_type_3_ConfigType__Yaml", "tests::issue_2647::config_type_2_ConfigType__Toml" ]
[]
[]
2024-08-15T16:54:02Z
bf3c0297895b85d87993ff54b62806e90b59f318
diff --git /dev/null b/changelog.d/2662.fixed.md new file mode 100644 --- /dev/null +++ b/changelog.d/2662.fixed.md @@ -0,0 +1,1 @@ +Fix IncomingConfig json schema regression. diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -1137,37 +1137,19 @@ "IncomingFileConfig": { "title": "incoming (network)", "description": "Controls the incoming TCP traffic feature.\n\nSee the incoming [reference](https://mirrord.dev/docs/reference/traffic/#incoming) for more details.\n\nIncoming traffic supports 2 modes of operation:\n\n1. Mirror (**default**): Sniffs the TCP data from a port, and forwards a copy to the interested listeners;\n\n2. Steal: Captures the TCP data from a port, and forwards it to the local process, see [`steal`](##steal);\n\n### Minimal `incoming` config\n\n```json { \"feature\": { \"network\": { \"incoming\": \"steal\" } } } ```\n\n### Advanced `incoming` config\n\n```json { \"feature\": { \"network\": { \"incoming\": { \"mode\": \"steal\", \"http_filter\": { \"header_filter\": \"host: api\\\\..+\" }, \"port_mapping\": [[ 7777, 8888 ]], \"ignore_localhost\": false, \"ignore_ports\": [9999, 10000] \"listen_ports\": [[80, 8111]] } } } } ```", - "oneOf": [ + "anyOf": [ { - "type": "object", - "required": [ - "Simple" - ], - "properties": { - "Simple": { - "anyOf": [ - { - "$ref": "#/definitions/IncomingMode" - }, - { - "type": "null" - } - ] + "anyOf": [ + { + "$ref": "#/definitions/IncomingMode" + }, + { + "type": "null" } - }, - "additionalProperties": false + ] }, { - "type": "object", - "required": [ - "Advanced" - ], - "properties": { - "Advanced": { - "$ref": "#/definitions/IncomingAdvancedFileConfig" - } - }, - "additionalProperties": false + "$ref": "#/definitions/IncomingAdvancedFileConfig" } ] }, diff --git a/mirrord/config/src/util.rs b/mirrord/config/src/util.rs --- a/mirrord/config/src/util.rs +++ b/mirrord/config/src/util.rs @@ -14,7 +14,7 @@ pub trait MirrordToggleableConfig: MirrordConfig + Default { } #[derive(PartialEq, Eq, Clone, Debug, JsonSchema)] -#[serde(untagged, deny_unknown_fields)] +#[schemars(untagged, deny_unknown_fields)] pub enum ToggleableConfig<T> { Enabled(bool), Config(T),
metalbear-co__mirrord-2665
2,665
I need to take a closer look but I think it should be contained to incoming because of how schemars parses serde macro and I added manual parsing logic to it
[ "2662" ]
3.113
metalbear-co/mirrord
2024-08-15T09:24:18Z
diff --git a/mirrord/config/src/feature/network/incoming.rs b/mirrord/config/src/feature/network/incoming.rs --- a/mirrord/config/src/feature/network/incoming.rs +++ b/mirrord/config/src/feature/network/incoming.rs @@ -67,6 +67,7 @@ use http_filter::*; /// ``` #[derive(Clone, Debug, JsonSchema)] #[cfg_attr(test, derive(PartialEq, Eq))] +#[schemars(untagged, rename_all = "lowercase")] pub enum IncomingFileConfig { Simple(Option<IncomingMode>), Advanced(Box<IncomingAdvancedFileConfig>),
schema issue on "incoming" (and probably others) <img width="570" alt="image" src="https://github.com/user-attachments/assets/b2232ec4-66e2-4670-85a2-c7d1b97c00f9"> I assume it's part of the refactor that @DmitryDodzin did
7a2dd1b8b246dfc700a38b8ddb7ba244babf1272
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "config::source::tests::basic::case_1", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::fs::advanced::tests::advanced_fs_config_default", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::fs::mode::tests::disabled::case_2", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::fs::mode::tests::disabled::case_3", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::fs::tests::fs_config_default", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::network::filter::tests::valid_filters::case_03", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::network::filter::tests::valid_filters::case_01", "feature::network::filter::tests::valid_filters::case_04", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "feature::network::filter::tests::valid_filters::case_05", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::network::filter::tests::valid_filters::case_02", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::network::filter::tests::valid_filters::case_06", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "config::from_env::tests::basic", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "feature::network::filter::tests::invalid_filters::case_2 - should panic", "feature::network::filter::tests::invalid_filters::case_1 - should panic", "feature::network::filter::tests::invalid_filters::case_3 - should panic", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::network::filter::tests::valid_filters::case_07", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "feature::network::filter::tests::valid_filters::case_08", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "config::source::tests::basic::case_2", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "feature::network::filter::tests::valid_filters::case_09", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::network::filter::tests::valid_filters::case_10", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some_AgentImageConfig___test___to_string_____Some_AgentImageCon::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_2", "feature::fs::mode::tests::disabled::case_1", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::disabled::case_4", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "feature::fs::mode::tests::default::case_3", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "target::tests::default::case_1", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "target::tests::default::case_2", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "target::tests::parse_target_config_from_json::case_4", "tests::empty::config_type_1_ConfigType__Json", "tests::issue_2647::config_type_1_ConfigType__Json", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "target::tests::default::case_3", "target::tests::default::case_4", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Off___Default::dns_1__None_true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "target::tests::default::case_5", "target::tests::parse_target_config_from_json::case_1", "tests::schema_file_exists", "tests::full::config_type_1_ConfigType__Json", "target::tests::parse_target_config_from_json::case_3", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "target::tests::parse_target_config_from_json::case_2", "target::tests::default::case_6", "tests::empty::config_type_3_ConfigType__Yaml", "tests::empty::config_type_2_ConfigType__Toml", "tests::issue_2647::config_type_3_ConfigType__Yaml", "tests::issue_2647::config_type_2_ConfigType__Toml", "tests::full::config_type_3_ConfigType__Yaml", "tests::full::config_type_2_ConfigType__Toml" ]
[]
[]
2024-08-15T10:05:15Z
53c9db608c12f50fe5de647f7acfbc822d425d4c
diff --git /dev/null b/changelog.d/1479.fixed.md new file mode 100644 --- /dev/null +++ b/changelog.d/1479.fixed.md @@ -0,0 +1,1 @@ +Add new rule to the OUTPUT chain of iptables in agent to support kubectl port-forward diff --git a/mirrord/agent/src/main.rs b/mirrord/agent/src/main.rs --- a/mirrord/agent/src/main.rs +++ b/mirrord/agent/src/main.rs @@ -50,7 +50,7 @@ use crate::{ connection::TcpConnectionStealer, ip_tables::{ SafeIpTables, IPTABLE_MESH, IPTABLE_MESH_ENV, IPTABLE_PREROUTING, - IPTABLE_PREROUTING_ENV, + IPTABLE_PREROUTING_ENV, IPTABLE_STANDARD, IPTABLE_STANDARD_ENV, }, StealerCommand, }, diff --git a/mirrord/agent/src/main.rs b/mirrord/agent/src/main.rs --- a/mirrord/agent/src/main.rs +++ b/mirrord/agent/src/main.rs @@ -657,6 +657,7 @@ async fn start_iptable_guard() -> Result<()> { std::env::set_var(IPTABLE_PREROUTING_ENV, IPTABLE_PREROUTING.as_str()); std::env::set_var(IPTABLE_MESH_ENV, IPTABLE_MESH.as_str()); + std::env::set_var(IPTABLE_STANDARD_ENV, IPTABLE_STANDARD.as_str()); let result = spawn_child_agent(); diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -9,7 +9,8 @@ use crate::{ steal::ip_tables::{ flush_connections::FlushConnections, mesh::{MeshRedirect, MeshVendor}, - redirect::{PreroutingRedirect, Redirect}, + redirect::Redirect, + standard::StandardRedirect, }, }; diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -17,6 +18,7 @@ pub(crate) mod chain; pub(crate) mod flush_connections; pub(crate) mod mesh; pub(crate) mod redirect; +pub(crate) mod standard; pub static IPTABLE_PREROUTING_ENV: &str = "MIRRORD_IPTABLE_PREROUTING_NAME"; pub static IPTABLE_PREROUTING: LazyLock<String> = LazyLock::new(|| { diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -99,7 +111,7 @@ impl IPTables for iptables::IPTables { #[enum_dispatch(Redirect)] pub enum Redirects<IPT: IPTables + Send + Sync> { - Standard(PreroutingRedirect<IPT>), + Standard(StandardRedirect<IPT>), Mesh(MeshRedirect<IPT>), FlushConnections(FlushConnections<Redirects<IPT>>), } diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -122,7 +134,7 @@ where let mut redirect = if let Some(vendor) = MeshVendor::detect(&ipt)? { Redirects::Mesh(MeshRedirect::create(Arc::new(ipt), vendor)?) } else { - Redirects::Standard(PreroutingRedirect::create(Arc::new(ipt))?) + Redirects::Standard(StandardRedirect::create(Arc::new(ipt))?) }; if flush_connections { diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -138,7 +150,7 @@ where let mut redirect = if let Some(vendor) = MeshVendor::detect(&ipt)? { Redirects::Mesh(MeshRedirect::load(Arc::new(ipt), vendor)?) } else { - Redirects::Standard(PreroutingRedirect::load(Arc::new(ipt))?) + Redirects::Standard(StandardRedirect::load(Arc::new(ipt))?) }; if flush_connections { diff --git /dev/null b/mirrord/agent/src/steal/ip_tables/standard.rs new file mode 100644 --- /dev/null +++ b/mirrord/agent/src/steal/ip_tables/standard.rs @@ -0,0 +1,111 @@ +use std::sync::Arc; + +use async_trait::async_trait; +use mirrord_protocol::Port; +use nix::unistd::getgid; + +use crate::{ + error::Result, + steal::ip_tables::{ + chain::IPTableChain, redirect::PreroutingRedirect, IPTables, Redirect, IPTABLE_STANDARD, + }, +}; + +pub struct StandardRedirect<IPT: IPTables> { + preroute: PreroutingRedirect<IPT>, + managed: IPTableChain<IPT>, + own_packet_filter: String, +} + +impl<IPT> StandardRedirect<IPT> +where + IPT: IPTables, +{ + const ENTRYPOINT: &'static str = "OUTPUT"; + + pub fn create(ipt: Arc<IPT>) -> Result<Self> { + let preroute = PreroutingRedirect::create(ipt.clone())?; + let managed = IPTableChain::create(ipt, IPTABLE_STANDARD.to_string())?; + let own_packet_filter = "-o lo".to_owned(); + + let gid = getgid(); + managed.add_rule(&format!("-m owner --gid-owner {gid} -p tcp -j RETURN"))?; + + Ok(StandardRedirect { + preroute, + managed, + own_packet_filter, + }) + } + + pub fn load(ipt: Arc<IPT>) -> Result<Self> { + let preroute = PreroutingRedirect::load(ipt.clone())?; + let managed = IPTableChain::create(ipt, IPTABLE_STANDARD.to_string())?; + let own_packet_filter = "-o lo".to_owned(); + + Ok(StandardRedirect { + preroute, + managed, + own_packet_filter, + }) + } +} + +/// This wrapper adds a new rule to the NAT OUTPUT chain to redirect "localhost" traffic as well +/// Note: OUTPUT chain is only traversed for packets produced by local applications +#[async_trait] +impl<IPT> Redirect for StandardRedirect<IPT> +where + IPT: IPTables + Send + Sync, +{ + async fn mount_entrypoint(&self) -> Result<()> { + self.preroute.mount_entrypoint().await?; + + self.managed.inner().add_rule( + Self::ENTRYPOINT, + &format!("-j {}", self.managed.chain_name()), + )?; + + Ok(()) + } + + async fn unmount_entrypoint(&self) -> Result<()> { + self.preroute.unmount_entrypoint().await?; + + self.managed.inner().remove_rule( + Self::ENTRYPOINT, + &format!("-j {}", self.managed.chain_name()), + )?; + + Ok(()) + } + + async fn add_redirect(&self, redirected_port: Port, target_port: Port) -> Result<()> { + self.preroute + .add_redirect(redirected_port, target_port) + .await?; + let redirect_rule = format!( + "{} -m tcp -p tcp --dport {redirected_port} -j REDIRECT --to-ports {target_port}", + self.own_packet_filter + ); + + self.managed.add_rule(&redirect_rule)?; + + Ok(()) + } + + async fn remove_redirect(&self, redirected_port: Port, target_port: Port) -> Result<()> { + self.preroute + .remove_redirect(redirected_port, target_port) + .await?; + + let redirect_rule = format!( + "{} -m tcp -p tcp --dport {redirected_port} -j REDIRECT --to-ports {target_port}", + self.own_packet_filter + ); + + self.managed.remove_rule(&redirect_rule)?; + + Ok(()) + } +}
metalbear-co__mirrord-1527
1,527
managed to reproduce it ill run wireshark/tcpdump in the pod to see where the forwarded traffic is actually going with steal on and sending request to the nodeport: ``` 15:38:32.077374 IP 192-168-65-4.kubernetes.default.svc.cluster.local.60460 > py-serv-deployment-ff89b5974-dhl2q.http: Flags [S], seq 439708412, win 64240, options [mss 1460,sackOK,TS val 3218045251 ecr 0,nop,wscale 7], length 0 15:38:32.077437 IP py-serv-deployment-ff89b5974-dhl2q.http > 192-168-65-4.kubernetes.default.svc.cluster.local.60460: Flags [S.], seq 2983302851, ack 439708413, win 65160, options [mss 1460,sackOK,TS val 3669149584 ecr 3218045251,nop,wscale 7], length 0 15:38:32.077507 IP 192-168-65-4.kubernetes.default.svc.cluster.local.60460 > py-serv-deployment-ff89b5974-dhl2q.http: Flags [.], ack 1, win 502, options [nop,nop,TS val 3218045251 ecr 3669149584], length 0 15:38:32.078247 IP 192-168-65-4.kubernetes.default.svc.cluster.local.60460 > py-serv-deployment-ff89b5974-dhl2q.http: Flags [P.], seq 1:80, ack 1, win 502, options [nop,nop,TS val 3218045251 ecr 3669149584], length 79: HTTP: GET / HTTP/1.1 15:38:32.078281 IP py-serv-deployment-ff89b5974-dhl2q.http > 192-168-65-4.kubernetes.default.svc.cluster.local.60460: Flags [.], ack 80, win 509, options [nop,nop,TS val 3669149584 ecr 3218045251], length 0 15:38:32.084998 IP py-serv-deployment-ff89b5974-dhl2q.http > 192-168-65-4.kubernetes.default.svc.cluster.local.60460: Flags [P.], seq 1:175, ack 80, win 509, options [nop,nop,TS val 3669149591 ecr 3218045251], length 174: HTTP: HTTP/1.1 200 OK 15:38:32.085091 IP 192-168-65-4.kubernetes.default.svc.cluster.local.60460 > py-serv-deployment-ff89b5974-dhl2q.http: Flags [.], ack 175, win 501, options [nop,nop,TS val 3218045258 ecr 3669149591], length 0 15:38:32.085144 IP py-serv-deployment-ff89b5974-dhl2q.http > 192-168-65-4.kubernetes.default.svc.cluster.local.60460: Flags [F.], seq 175, ack 80, win 509, options [nop,nop,TS val 3669149591 ecr 3218045258], length 0 15:38:32.087129 IP 192-168-65-4.kubernetes.default.svc.cluster.local.60460 > py-serv-deployment-ff89b5974-dhl2q.http: Flags [F.], seq 80, ack 176, win 501, options [nop,nop,TS val 3218045260 ecr 3669149591], length 0 15:38:32.087182 IP py-serv-deployment-ff89b5974-dhl2q.http > 192-168-65-4.kubernetes.default.svc.cluster.local.60460: Flags [.], ack 81, win 509, options [nop,nop,TS val 3669149593 ecr 3218045260], length 0 15:38:37.194501 ARP, Request who-has 10.1.0.1 tell py-serv-deployment-ff89b5974-dhl2q, length 28 15:38:37.194600 ARP, Request who-has py-serv-deployment-ff89b5974-dhl2q tell 10.1.0.1, length 28 15:38:37.194610 ARP, Reply py-serv-deployment-ff89b5974-dhl2q is-at 2a:35:01:cf:2e:a2 (oui Unknown), length 28 15:38:37.194613 ARP, Reply 10.1.0.1 is-at d2:1a:da:1e:7f:70 (oui Unknown), length 28 ``` clearly, there is a TCP exchange, however when sending a request with kubectl port-forward, there is no such exchange, I believe it is because of how kubectl port-forward works? https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#port-forward ``` Creates a proxy server or application-level gateway between localhost and the Kubernetes API server. It also allows serving static content over specified HTTP path. All incoming data enters through one port and gets forwarded to the remote Kubernetes API server port, except for the path matching the static content path. ``` wondering what is the use case here? It might be on loopback, and I fear we don't steal that traffic (we can though)
[ "1479" ]
3.47
metalbear-co/mirrord
2023-06-09T03:29:59Z
diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -38,6 +40,16 @@ pub static IPTABLE_MESH: LazyLock<String> = LazyLock::new(|| { }) }); +pub static IPTABLE_STANDARD_ENV: &str = "MIRRORD_IPTABLE_STANDARD_NAME"; +pub static IPTABLE_STANDARD: LazyLock<String> = LazyLock::new(|| { + std::env::var(IPTABLE_STANDARD_ENV).unwrap_or_else(|_| { + format!( + "MIRRORD_STANDARD_{}", + Alphanumeric.sample_string(&mut rand::thread_rng(), 5) + ) + }) +}); + const IPTABLES_TABLE_NAME: &str = "nat"; #[cfg_attr(test, mockall::automock)] diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -210,11 +222,39 @@ mod tests { .times(1) .returning(|_, _, _| Ok(())); + mock.expect_create_chain() + .with(str::starts_with("MIRRORD_STANDARD_")) + .times(1) + .returning(|_| Ok(())); + + mock.expect_insert_rule() + .with( + str::starts_with("MIRRORD_STANDARD_"), + str::starts_with("-m owner --gid-owner"), + eq(1), + ) + .times(1) + .returning(|_, _, _| Ok(())); + + mock.expect_insert_rule() + .with( + str::starts_with("MIRRORD_STANDARD_"), + eq("-o lo -m tcp -p tcp --dport 69 -j REDIRECT --to-ports 420"), + eq(2), + ) + .times(1) + .returning(|_, _, _| Ok(())); + mock.expect_add_rule() .with(eq("PREROUTING"), str::starts_with("-j MIRRORD_INPUT_")) .times(1) .returning(|_, _| Ok(())); + mock.expect_add_rule() + .with(eq("OUTPUT"), str::starts_with("-j MIRRORD_STANDARD_")) + .times(1) + .returning(|_, _| Ok(())); + mock.expect_remove_rule() .with( str::starts_with("MIRRORD_INPUT_"), diff --git a/mirrord/agent/src/steal/ip_tables.rs b/mirrord/agent/src/steal/ip_tables.rs --- a/mirrord/agent/src/steal/ip_tables.rs +++ b/mirrord/agent/src/steal/ip_tables.rs @@ -223,16 +263,34 @@ mod tests { .times(1) .returning(|_, _| Ok(())); + mock.expect_remove_rule() + .with( + str::starts_with("MIRRORD_STANDARD_"), + eq("-o lo -m tcp -p tcp --dport 69 -j REDIRECT --to-ports 420"), + ) + .times(1) + .returning(|_, _| Ok(())); + mock.expect_remove_rule() .with(eq("PREROUTING"), str::starts_with("-j MIRRORD_INPUT_")) .times(1) .returning(|_, _| Ok(())); + mock.expect_remove_rule() + .with(eq("OUTPUT"), str::starts_with("-j MIRRORD_STANDARD_")) + .times(1) + .returning(|_, _| Ok(())); + mock.expect_remove_chain() .with(str::starts_with("MIRRORD_INPUT_")) .times(1) .returning(|_| Ok(())); + mock.expect_remove_chain() + .with(str::starts_with("MIRRORD_STANDARD_")) + .times(1) + .returning(|_| Ok(())); + let ipt = SafeIpTables::create(mock, false) .await .expect("Create Failed"); diff --git a/tests/src/traffic.rs b/tests/src/traffic.rs --- a/tests/src/traffic.rs +++ b/tests/src/traffic.rs @@ -312,6 +312,7 @@ mod traffic { #[rstest] #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + #[timeout(Duration::from_secs(120))] pub async fn gethostname_remote_result(#[future] hostname_service: KubeService) { let service = hostname_service.await; let node_command = vec!["python3", "-u", "python-e2e/hostname.py"];
request through `kubectl port forward` doesn't get stolen When stealing pod requests, if one uses `kubectl port forward deploy/deploymentname 8080` those requests still get answered by the remote.
dfab96e405bf4b195117700926bc15352d57f069
[ "steal::ip_tables::tests::default" ]
[ "env::tests::default", "env::tests::default_exclude", "env::tests::include", "util::indexallocator_tests::check_max", "steal::ip_tables::redirect::tests::add_redirect_twice", "steal::ip_tables::redirect::tests::add_redirect", "util::indexallocator_tests::sanity", "steal::ip_tables::redirect::tests::remove_redirect", "util::indexallocator_tests::sanity_buffer", "util::subscription_tests::sanity", "watched_task::test::simple_failing", "watched_task::test::simple_successful", "steal::ip_tables::mesh::tests::add_redirect", "steal::ip_tables::tests::linkerd" ]
[]
[ "tests::sanity" ]
2023-06-20T17:20:21Z
e9dd388116c77eba1cee287db2ba27a0d63487d7
diff --git /dev/null b/changelog.d/+remove-capture-error-trace.removed.md new file mode 100644 --- /dev/null +++ b/changelog.d/+remove-capture-error-trace.removed.md @@ -0,0 +1,1 @@ +Removed error capture error trace feature \ No newline at end of file diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -377,17 +377,9 @@ "additionalProperties": false }, "FeatureFileConfig": { - "description": "Controls mirrord features.\n\nSee the [technical reference, Technical Reference](https://mirrord.dev/docs/reference/) to learn more about what each feature does.\n\nThe [`env`](#feature-env), [`fs`](#feature-fs) and [`network`](#feature-network) options have support for a shortened version, that you can see [here](#root-shortened).\n\n```json { \"feature\": { \"env\": { \"include\": \"DATABASE_USER;PUBLIC_ENV\", \"exclude\": \"DATABASE_PASSWORD;SECRET_ENV\", \"overrides\": { \"DATABASE_CONNECTION\": \"db://localhost:7777/my-db\", \"LOCAL_BEAR\": \"panda\" } }, \"fs\": { \"mode\": \"write\", \"read_write\": \".+\\.json\" , \"read_only\": [ \".+\\.yaml\", \".+important-file\\.txt\" ], \"local\": [ \".+\\.js\", \".+\\.mjs\" ] }, \"network\": { \"incoming\": { \"mode\": \"steal\", \"http_header_filter\": { \"filter\": \"host: api\\..+\", \"ports\": [80, 8080] }, \"port_mapping\": [[ 7777, 8888 ]], \"ignore_localhost\": false, \"ignore_ports\": [9999, 10000] }, \"outgoing\": { \"tcp\": true, \"udp\": true, \"ignore_localhost\": false, \"unix_streams\": \"bear.+\" }, \"dns\": false }, \"capture_error_trace\": false } } ```", + "description": "Controls mirrord features.\n\nSee the [technical reference, Technical Reference](https://mirrord.dev/docs/reference/) to learn more about what each feature does.\n\nThe [`env`](#feature-env), [`fs`](#feature-fs) and [`network`](#feature-network) options have support for a shortened version, that you can see [here](#root-shortened).\n\n```json { \"feature\": { \"env\": { \"include\": \"DATABASE_USER;PUBLIC_ENV\", \"exclude\": \"DATABASE_PASSWORD;SECRET_ENV\", \"overrides\": { \"DATABASE_CONNECTION\": \"db://localhost:7777/my-db\", \"LOCAL_BEAR\": \"panda\" } }, \"fs\": { \"mode\": \"write\", \"read_write\": \".+\\.json\" , \"read_only\": [ \".+\\.yaml\", \".+important-file\\.txt\" ], \"local\": [ \".+\\.js\", \".+\\.mjs\" ] }, \"network\": { \"incoming\": { \"mode\": \"steal\", \"http_header_filter\": { \"filter\": \"host: api\\..+\", \"ports\": [80, 8080] }, \"port_mapping\": [[ 7777, 8888 ]], \"ignore_localhost\": false, \"ignore_ports\": [9999, 10000] }, \"outgoing\": { \"tcp\": true, \"udp\": true, \"ignore_localhost\": false, \"unix_streams\": \"bear.+\" }, \"dns\": false }, } } ```", "type": "object", "properties": { - "capture_error_trace": { - "title": "feature.capture_error_trace {#feature-capture_error_trace}", - "description": "Controls the crash reporting feature.\n\nWith this feature enabled, mirrord generates a nice crash report log.\n\nDefaults to `false`.", - "type": [ - "boolean", - "null" - ] - }, "env": { "title": "feature.env {#feature-env}", "anyOf": [ diff --git a/mirrord/cli/src/config.rs b/mirrord/cli/src/config.rs --- a/mirrord/cli/src/config.rs +++ b/mirrord/cli/src/config.rs @@ -180,10 +180,6 @@ pub(super) struct ExecArgs { /// Load config from config file #[arg(short = 'f', long)] pub config_file: Option<PathBuf>, - - /// Create a trace file of errors for debugging. - #[arg(long)] - pub capture_error_trace: bool, } #[derive(Args, Debug)] diff --git a/mirrord/cli/src/main.rs b/mirrord/cli/src/main.rs --- a/mirrord/cli/src/main.rs +++ b/mirrord/cli/src/main.rs @@ -145,10 +145,6 @@ async fn exec(args: &ExecArgs, progress: &TaskProgress) -> Result<()> { std::env::set_var("MIRRORD_CONFIG_FILE", full_path); } - if args.capture_error_trace { - std::env::set_var("MIRRORD_CAPTURE_ERROR_TRACE", "true"); - } - let sub_progress = progress.subtask("preparing to launch process"); let config = LayerConfig::from_env()?; diff --git a/mirrord/config/src/feature.rs b/mirrord/config/src/feature.rs --- a/mirrord/config/src/feature.rs +++ b/mirrord/config/src/feature.rs @@ -3,7 +3,6 @@ use mirrord_config_derive::MirrordConfig; use schemars::JsonSchema; use self::{env::EnvConfig, fs::FsConfig, network::NetworkConfig}; -use crate::config::source::MirrordConfigSource; pub mod env; pub mod fs; diff --git a/mirrord/config/src/feature.rs b/mirrord/config/src/feature.rs --- a/mirrord/config/src/feature.rs +++ b/mirrord/config/src/feature.rs @@ -54,7 +53,6 @@ pub mod network; /// }, /// "dns": false /// }, -/// "capture_error_trace": false /// } /// } /// ``` diff --git a/mirrord/config/src/lib.rs b/mirrord/config/src/lib.rs --- a/mirrord/config/src/lib.rs +++ b/mirrord/config/src/lib.rs @@ -121,7 +121,6 @@ const PAUSE_WITHOUT_STEAL_WARNING: &str = /// }, /// "dns": false /// }, -/// "capture_error_trace": false /// }, /// "operator": true, /// "kubeconfig": "~/.kube/config", diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -144,7 +144,6 @@ mod socket; mod tcp; mod tcp_mirror; mod tcp_steal; -mod tracing_util; #[cfg(target_os = "linux")] #[cfg(target_arch = "x86_64")] diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -368,19 +367,8 @@ fn mirrord_layer_entry_point() { /// Initialize logger. Set the logs to go according to the layer's config either to a trace file, to /// mirrord-console or to stderr. -fn init_tracing(config: &LayerConfig) { - if config.feature.capture_error_trace { - tracing_subscriber::registry() - .with( - tracing_subscriber::fmt::layer() - .with_writer(tracing_util::file_tracing_writer()) - .with_ansi(false) - .with_thread_ids(true) - .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE), - ) - .with(tracing_subscriber::EnvFilter::new("mirrord=trace")) - .init(); - } else if let Ok(console_addr) = std::env::var("MIRRORD_CONSOLE_ADDR") { +fn init_tracing() { + if let Ok(console_addr) = std::env::var("MIRRORD_CONSOLE_ADDR") { mirrord_console::init_logger(&console_addr).expect("logger initialization failed"); } else { tracing_subscriber::registry() diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -483,7 +471,7 @@ fn layer_start(config: LayerConfig) { if LAYER_INITIALIZED.get().is_none() { // If we're here it's not a fork, we're in the ctor. let _ = LAYER_INITIALIZED.set(()); - init_tracing(&config); + init_tracing(); set_globals(&config); enable_hooks( config.feature.fs.is_active(), diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -813,8 +801,6 @@ impl Layer { /// /// - Handle the heartbeat mechanism (Ping/Pong feature), sending a [`ClientMessage::Ping`] if all /// the other channels received nothing for a while (60 seconds); -/// -/// - Write log file if `FeatureConfig::capture_error_trace` is set. async fn thread_loop( mut receiver: Receiver<HookMessage>, tx: Sender<ClientMessage>, diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -825,7 +811,6 @@ async fn thread_loop( feature: FeatureConfig { network: NetworkConfig { incoming, .. }, - capture_error_trace, .. }, .. diff --git a/mirrord/layer/src/lib.rs b/mirrord/layer/src/lib.rs --- a/mirrord/layer/src/lib.rs +++ b/mirrord/layer/src/lib.rs @@ -891,10 +876,6 @@ async fn thread_loop( } } } - - if capture_error_trace { - tracing_util::print_support_message(); - } graceful_exit!("mirrord has encountered an error and is now exiting."); } diff --git a/mirrord/layer/src/tracing_util.rs /dev/null --- a/mirrord/layer/src/tracing_util.rs +++ /dev/null @@ -1,92 +0,0 @@ -use std::{ - fs, - path::{Path, PathBuf}, - sync::{Mutex, OnceLock}, -}; - -use itertools::Itertools; -use rand::distributions::{Alphanumeric, DistString}; -use tracing_appender::{ - non_blocking::{NonBlocking, NonBlockingBuilder, WorkerGuard}, - WorkerOptions, -}; - -use crate::detour::{detour_bypass_off, detour_bypass_on}; - -pub(crate) static TRACING_GUARDS: Mutex<Vec<WorkerGuard>> = Mutex::new(vec![]); -pub(crate) static LOG_FILE_PATH: OnceLock<PathBuf> = OnceLock::new(); - -pub fn file_tracing_writer() -> NonBlocking { - let run_id = std::env::var("MIRRORD_RUN_ID").unwrap_or_else(|_| { - let run_id = Alphanumeric - .sample_string(&mut rand::thread_rng(), 10) - .to_lowercase(); - - std::env::set_var("MIRRORD_RUN_ID", run_id.clone()); - - run_id - }); - - let log_file_name = format!("{run_id}-mirrord-layer.log"); - - LOG_FILE_PATH - .set(PathBuf::from("/tmp/mirrord").join(&log_file_name)) - .expect("Could not set LOG_FILE_PATH singleton"); - - let file_appender = tracing_appender::rolling::never("/tmp/mirrord", log_file_name); - - let (non_blocking, guard) = NonBlockingBuilder::default() - .worker_options( - WorkerOptions::default() - .on_thread_start(detour_bypass_on) - .on_thread_stop(detour_bypass_off), - ) - .finish(file_appender); - - if let Ok(mut guards) = TRACING_GUARDS.lock() { - guards.push(guard) - } - - non_blocking -} - -pub fn print_support_message() { - if let Some(log_file) = LOG_FILE_PATH.get() { - println!( - r#" -mirrord full log file at: {}"#, - log_file.display() - ); - - let issue_link = create_github_link(log_file); - - println!( - r#" -mirrord encountered an error. We'd appreciate it if you could create an issue on our GitHub repository so we could address it as soon as possible.``` - -NOTE: Please redact sensitive information from the logs. - -{issue_link} - "# - ); - } -} - -fn create_github_link<P: AsRef<Path>>(log_file: P) -> String { - let binary_type = std::env::args().join(" "); - let os_version = format!("{}", os_info::get()); - let base_url = format!("https://github.com/metalbear-co/mirrord/issues/new?assignees=&labels=bug&template=bug_report.yml&binary_type={}&os_version={}", urlencoding::encode(&binary_type), urlencoding::encode(&os_version)); - - if let Ok(logs) = fs::read(log_file) { - let encoded_logs = urlencoding::encode_binary(&logs); - let last_logs = encoded_logs - .len() - .checked_sub(6000) - .and_then(|offset| encoded_logs.get(offset..)) - .unwrap_or(&encoded_logs); - - format!("{base_url}&logs={last_logs}") - } else { - base_url - } -}
metalbear-co__mirrord-1623
1,623
[ "744" ]
3.49
metalbear-co/mirrord
2023-07-06T06:58:19Z
diff --git a/mirrord-schema.json b/mirrord-schema.json --- a/mirrord-schema.json +++ b/mirrord-schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "LayerFileConfig", - "description": "mirrord allows for a high degree of customization when it comes to which features you want to enable, and how they should function.\n\nAll of the configuration fields have a default value, so a minimal configuration would be no configuration at all.\n\nTo help you get started, here are examples of a basic configuration file, and a complete configuration file containing all fields.\n\n### Basic `config.json` {#root-basic}\n\n```json { \"target\": \"pod/bear-pod\", \"feature\": { \"env\": true, \"fs\": \"read\", \"network\": true } } ```\n\n### Complete `config.json` {#root-complete}\n\n```json { \"accept_invalid_certificates\": false, \"skip_processes\": \"ide-debugger\", \"pause\": false, \"target\": { \"path\": \"pod/bear-pod\", \"namespace\": \"default\" }, \"connect_tcp\": null, \"agent\": { \"log_level\": \"info\", \"namespace\": \"default\", \"image\": \"ghcr.io/metalbear-co/mirrord:latest\", \"image_pull_policy\": \"IfNotPresent\", \"image_pull_secrets\": [ { \"secret-key\": \"secret\" } ], \"ttl\": 30, \"ephemeral\": false, \"communication_timeout\": 30, \"startup_timeout\": 360, \"network_interface\": \"eth0\", \"flush_connections\": true }, \"feature\": { \"env\": { \"include\": \"DATABASE_USER;PUBLIC_ENV\", \"exclude\": \"DATABASE_PASSWORD;SECRET_ENV\", \"overrides\": { \"DATABASE_CONNECTION\": \"db://localhost:7777/my-db\", \"LOCAL_BEAR\": \"panda\" } }, \"fs\": { \"mode\": \"write\", \"read_write\": \".+\\.json\" , \"read_only\": [ \".+\\.yaml\", \".+important-file\\.txt\" ], \"local\": [ \".+\\.js\", \".+\\.mjs\" ] }, \"network\": { \"incoming\": { \"mode\": \"steal\", \"http_header_filter\": { \"filter\": \"host: api\\..+\", \"ports\": [80, 8080] }, \"port_mapping\": [[ 7777, 8888 ]], \"ignore_localhost\": false, \"ignore_ports\": [9999, 10000] }, \"outgoing\": { \"tcp\": true, \"udp\": true, \"ignore_localhost\": false, \"unix_streams\": \"bear.+\" }, \"dns\": false }, \"capture_error_trace\": false }, \"operator\": true, \"kubeconfig\": \"~/.kube/config\", \"sip_binaries\": \"bash\" \"telemetry\": true, } ```\n\n# Options {#root-options}", + "description": "mirrord allows for a high degree of customization when it comes to which features you want to enable, and how they should function.\n\nAll of the configuration fields have a default value, so a minimal configuration would be no configuration at all.\n\nTo help you get started, here are examples of a basic configuration file, and a complete configuration file containing all fields.\n\n### Basic `config.json` {#root-basic}\n\n```json { \"target\": \"pod/bear-pod\", \"feature\": { \"env\": true, \"fs\": \"read\", \"network\": true } } ```\n\n### Complete `config.json` {#root-complete}\n\n```json { \"accept_invalid_certificates\": false, \"skip_processes\": \"ide-debugger\", \"pause\": false, \"target\": { \"path\": \"pod/bear-pod\", \"namespace\": \"default\" }, \"connect_tcp\": null, \"agent\": { \"log_level\": \"info\", \"namespace\": \"default\", \"image\": \"ghcr.io/metalbear-co/mirrord:latest\", \"image_pull_policy\": \"IfNotPresent\", \"image_pull_secrets\": [ { \"secret-key\": \"secret\" } ], \"ttl\": 30, \"ephemeral\": false, \"communication_timeout\": 30, \"startup_timeout\": 360, \"network_interface\": \"eth0\", \"flush_connections\": true }, \"feature\": { \"env\": { \"include\": \"DATABASE_USER;PUBLIC_ENV\", \"exclude\": \"DATABASE_PASSWORD;SECRET_ENV\", \"overrides\": { \"DATABASE_CONNECTION\": \"db://localhost:7777/my-db\", \"LOCAL_BEAR\": \"panda\" } }, \"fs\": { \"mode\": \"write\", \"read_write\": \".+\\.json\" , \"read_only\": [ \".+\\.yaml\", \".+important-file\\.txt\" ], \"local\": [ \".+\\.js\", \".+\\.mjs\" ] }, \"network\": { \"incoming\": { \"mode\": \"steal\", \"http_header_filter\": { \"filter\": \"host: api\\..+\", \"ports\": [80, 8080] }, \"port_mapping\": [[ 7777, 8888 ]], \"ignore_localhost\": false, \"ignore_ports\": [9999, 10000] }, \"outgoing\": { \"tcp\": true, \"udp\": true, \"ignore_localhost\": false, \"unix_streams\": \"bear.+\" }, \"dns\": false }, }, \"operator\": true, \"kubeconfig\": \"~/.kube/config\", \"sip_binaries\": \"bash\" \"telemetry\": true, } ```\n\n# Options {#root-options}", "type": "object", "properties": { "accept_invalid_certificates": { diff --git a/mirrord/config/src/feature.rs b/mirrord/config/src/feature.rs --- a/mirrord/config/src/feature.rs +++ b/mirrord/config/src/feature.rs @@ -62,16 +60,6 @@ pub mod network; #[config(map_to = "FeatureFileConfig", derive = "JsonSchema")] #[cfg_attr(test, config(derive = "PartialEq, Eq"))] pub struct FeatureConfig { - /// ## feature.capture_error_trace {#feature-capture_error_trace} - /// - /// Controls the crash reporting feature. - /// - /// With this feature enabled, mirrord generates a nice crash report log. - /// - /// Defaults to `false`. - #[config(env = "MIRRORD_CAPTURE_ERROR_TRACE", default = false)] - pub capture_error_trace: bool, - /// ## feature.env {#feature-env} #[config(nested, toggleable)] pub env: EnvConfig, diff --git a/mirrord/config/src/lib.rs b/mirrord/config/src/lib.rs --- a/mirrord/config/src/lib.rs +++ b/mirrord/config/src/lib.rs @@ -627,7 +626,6 @@ mod tests { ..Default::default() })), })), - capture_error_trace: None, }), connect_tcp: None, operator: None, diff --git a/mirrord/layer/tests/apps/fork/fork.c b/mirrord/layer/tests/apps/fork/fork.c --- a/mirrord/layer/tests/apps/fork/fork.c +++ b/mirrord/layer/tests/apps/fork/fork.c @@ -1,12 +1,14 @@ #include <unistd.h> #include <fcntl.h> - +#include <sys/wait.h> /// This program forks, and the child process calls `socket`. /// It is used to verify that hooks are handled in a child socket after a fork. int main() { - if (!fork()) { + pid_t pid = fork(); + if (!pid) { const char path[] = "/path/to/some/file"; open(path, 0); } + waitpid(pid, NULL, 0); }
Capture log clashes with install script ### Bug Description The capture log feature creates a folder called /tmp/mirrord. The install.sh tries to create a file called /tmp/mirrord, and if the folder exists it crashes. Need to add a GUID to the filename. ### Steps to Reproduce Run mirrord with capture log, then run the CLI install script. ### Backtrace _No response_ ### Relevant Logs _No response_ ### Your operating system and version N/A ### Local process N/A ### Local process version _No response_ ### Additional Info _No response_
e9dd388116c77eba1cee287db2ba27a0d63487d7
[ "tests::schema_file_is_up_to_date" ]
[ "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_1__None___info___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_1__None_None_::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_1__None_None_::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_1__None___IfNotPresent___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_1__None_1_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_1__None_false_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_1__None_60_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_2__Some___30____Some_30__::startup_timeout_2__Some___30____30_", "agent::tests::default::log_level_2__Some___trace______trace___::namespace_2__Some___app____Some___app____::image_2__Some___test____Some___test____::image_pull_policy_2__Some___Always______Always___::ttl_2__Some___30____30_::ephemeral_2__Some___true____true_::communication_timeout_1__None_None_::startup_timeout_2__Some___30____30_", "config::from_env::tests::basic", "config::source::tests::basic::case_1", "config::source::tests::basic::case_2", "feature::env::tests::default::include_1__None_None_::exclude_1__None_None_", "feature::env::tests::default::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_None_", "feature::env::tests::default::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_1__None_None_", "feature::env::tests::default::include_3__Some___IVAR1IVAR2____Some___IVAR1IVAR2____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_1__None_None_::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_1__None_None_::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_1__None_Some________", "feature::env::tests::disabled_config::include_2__Some___IVAR1____Some___IVAR1____::exclude_2__Some___EVAR1____Some___EVAR1____", "feature::fs::advanced::tests::advanced_fs_config_default", "feature::fs::mode::tests::default::case_1", "feature::fs::mode::tests::default::case_2", "feature::fs::mode::tests::default::case_3", "feature::fs::mode::tests::disabled::case_1", "feature::fs::mode::tests::default::case_4", "feature::fs::mode::tests::disabled::case_2", "feature::fs::mode::tests::disabled::case_3", "feature::fs::mode::tests::disabled::case_4", "feature::fs::tests::fs_config_default", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_1__None_true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_1__None_true_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::default::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_1__None_false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_2__Some___false____false_::udp_3__Some___true____true_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_1__None_false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_2__Some___false____false_", "feature::network::outgoing::tests::disabled::tcp_3__Some___true____true_::udp_3__Some___true____true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_1__None_true_", "feature::network::tests::default::incoming_1__None_IncomingConfig_mode_IncomingMode__Mirror___Default__defaul::dns_2__Some___false____false_", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Mirror___Defa::dns_1__None_true_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_1__None_true_", "target::tests::default::case_1", "feature::network::tests::default::incoming_2__Some___false____IncomingConfig_mode_IncomingMode__Mirror___Defa::dns_2__Some___false____false_", "feature::network::tests::default::incoming_3__Some___true____IncomingConfig_mode_IncomingMode__Steal___Defaul::dns_2__Some___false____false_", "target::tests::default::case_2", "target::tests::default::case_3", "target::tests::default::case_4", "target::tests::default::case_5", "target::tests::parse_target_config_from_json::case_1", "target::tests::parse_target_config_from_json::case_3", "tests::empty::config_type_1_ConfigType__Json", "target::tests::parse_target_config_from_json::case_4", "target::tests::parse_target_config_from_json::case_2", "tests::empty::config_type_3_ConfigType__Yaml", "tests::empty::config_type_2_ConfigType__Toml", "tests::schema_file_exists", "tests::full::config_type_1_ConfigType__Json", "tests::full::config_type_3_ConfigType__Yaml", "tests::full::config_type_2_ConfigType__Toml" ]
[]
[]
2023-07-06T09:40:33Z
da95b6d28bfe6cf94586a5e916c97c81ab6bdac0
diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6593,6 +6593,8 @@ fn to_incorrect_module_name_report<'a>( expected, } = problem; + let severity = Severity::RuntimeError; + // SAFETY: if the module was not UTF-8, that would be reported as a parsing problem, rather // than an incorrect module name problem (the latter can happen only after parsing). let src = unsafe { from_utf8_unchecked(src) }; diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6607,7 +6609,7 @@ fn to_incorrect_module_name_report<'a>( let doc = alloc.stack([ alloc.reflow("This module has a different name than I expected:"), - alloc.region(lines.convert_region(found.region)), + alloc.region(lines.convert_region(found.region), severity), alloc.reflow("Based on the nesting and use of this module, I expect it to have name"), alloc.pq_module_name(expected).indent(4), ]); diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6616,7 +6618,7 @@ fn to_incorrect_module_name_report<'a>( filename, doc, title: "INCORRECT MODULE NAME".to_string(), - severity: Severity::RuntimeError, + severity, }; let mut buf = String::new(); diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6636,6 +6638,7 @@ fn to_no_platform_package_report( ) -> String { use roc_reporting::report::{Report, RocDocAllocator, DEFAULT_PALETTE}; use ven_pretty::DocAllocator; + let severity = Severity::RuntimeError; // SAFETY: if the module was not UTF-8, that would be reported as a parsing problem, rather // than an incorrect module name problem (the latter can happen only after parsing). diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6651,7 +6654,7 @@ fn to_no_platform_package_report( let doc = alloc.stack([ alloc.reflow("This app does not specify a platform:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region),severity), alloc.reflow("Make sure you have exactly one package specified as `platform`:"), alloc .parser_suggestion(" app [main] {\n pf: platform \"…path or URL to platform…\"\n ^^^^^^^^\n }"), diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6663,7 +6666,7 @@ fn to_no_platform_package_report( filename, doc, title: "UNSPECIFIED PLATFORM".to_string(), - severity: Severity::RuntimeError, + severity, }; let mut buf = String::new(); diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6683,6 +6686,7 @@ fn to_multiple_platform_packages_report( ) -> String { use roc_reporting::report::{Report, RocDocAllocator, DEFAULT_PALETTE}; use ven_pretty::DocAllocator; + let severity = Severity::RuntimeError; // SAFETY: if the module was not UTF-8, that would be reported as a parsing problem, rather // than an incorrect module name problem (the latter can happen only after parsing). diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6698,7 +6702,7 @@ fn to_multiple_platform_packages_report( let doc = alloc.stack([ alloc.reflow("This app specifies multiple packages as `platform`:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Roc apps must specify exactly one platform."), ]); diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6706,7 +6710,7 @@ fn to_multiple_platform_packages_report( filename, doc, title: "MULTIPLE PLATFORMS".to_string(), - severity: Severity::RuntimeError, + severity, }; let mut buf = String::new(); diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6797,13 +6801,15 @@ fn to_unrecognized_package_shorthand_report( } }; + let severity = Severity::RuntimeError; + let doc = alloc.stack([ alloc.concat([ alloc.reflow("This module is trying to import from `"), alloc.shorthand(shorthand), alloc.reflow("`:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), help, ]); diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -6811,7 +6817,7 @@ fn to_unrecognized_package_shorthand_report( filename, doc, title: "UNRECOGNIZED PACKAGE".to_string(), - severity: Severity::RuntimeError, + severity, }; let mut buf = String::new(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -84,7 +84,7 @@ pub fn can_problem<'b>( alloc .symbol_unqualified(symbol) .append(alloc.reflow(" is not used anywhere in your code.")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc .reflow("If you didn't intend on using ") .append(alloc.symbol_unqualified(symbol)) diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -99,7 +99,7 @@ pub fn can_problem<'b>( alloc.symbol_qualified(symbol), alloc.reflow(" is not used in this module."), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Since "), alloc.symbol_qualified(symbol), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -115,7 +115,7 @@ pub fn can_problem<'b>( alloc.module(module_id), alloc.reflow(" is imported but not used."), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Since "), alloc.module(module_id), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -145,17 +145,17 @@ pub fn can_problem<'b>( alloc.reflow(" was imported here: ") }, ]), - alloc.region(lines.convert_region(new_import_region)), + alloc.region(lines.convert_region(new_import_region), severity), match existing_import { - ScopeModuleSource::Import(exsting_import_region) => { + ScopeModuleSource::Import(existing_import_region) => { alloc.stack([ alloc.concat([ alloc.reflow("but "), alloc.module_name(name.clone()), alloc.reflow(" is already used by a previous import:"), ]), - alloc.region(lines.convert_region(exsting_import_region)), + alloc.region(lines.convert_region(existing_import_region), severity), ]) } ScopeModuleSource::Builtin => { diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -193,7 +193,7 @@ pub fn can_problem<'b>( alloc.module(module_id), alloc.reflow(" was imported here:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Builtins are imported automatically, so you can remove this import."), alloc.reflow("Tip: Learn more about builtins in the tutorial:\n\n<https://www.roc-lang.org/tutorial#builtin-modules>"), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -207,7 +207,7 @@ pub fn can_problem<'b>( alloc.symbol_qualified(symbol), alloc.reflow(" was imported here:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("All types from builtins are automatically exposed, so you can remove "), alloc.symbol_unqualified(symbol), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -230,13 +230,13 @@ pub fn can_problem<'b>( alloc.symbol_qualified(new_symbol), alloc.reflow(":"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("However, the name "), alloc.symbol_unqualified(new_symbol), alloc.reflow(" was already used here:"), ]), - alloc.region(lines.convert_region(existing_symbol_region)), + alloc.region(lines.convert_region(existing_symbol_region), severity), alloc.concat([ alloc.reflow("You can rename it, or use the qualified name: "), alloc.symbol_qualified(new_symbol), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -249,7 +249,7 @@ pub fn can_problem<'b>( Problem::DefsOnlyUsedInRecursion(1, region) => { doc = alloc.stack([ alloc.reflow("This definition is only used in recursion with itself:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow( "If you don't intend to use or export this definition, it should be removed!", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -264,7 +264,7 @@ pub fn can_problem<'b>( alloc.string(n.to_string()), alloc.reflow(" definitions are only used in mutual recursion with themselves:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow( "If you don't intend to use or export any of them, they should all be removed!", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -293,7 +293,7 @@ pub fn can_problem<'b>( .reflow("I don't know how to generate the ") .append(alloc.ident(loc_ident.value)) .append(alloc.reflow(" function.")), - alloc.region(lines.convert_region(loc_ident.region)), + alloc.region(lines.convert_region(loc_ident.region), severity), alloc .reflow("Only specific functions like `after` and `map` can be generated.") .append(alloc.reflow("Learn more about hosted modules at TODO.")), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -315,7 +315,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(argument_symbol), alloc.text("."), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("If you don't need "), alloc.symbol_unqualified(argument_symbol), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -343,7 +343,7 @@ pub fn can_problem<'b>( alloc.keyword("when"), alloc.reflow(" branch."), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("If you don't need to use "), alloc.symbol_unqualified(symbol), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -378,7 +378,7 @@ pub fn can_problem<'b>( )), ]) }, - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), ]); title = SYNTAX_PROBLEM.to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -407,7 +407,7 @@ pub fn can_problem<'b>( alloc .reflow("This pattern is not allowed in ") .append(alloc.reflow(this_thing)), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat(suggestion), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -419,14 +419,14 @@ pub fn can_problem<'b>( kind, } => { let (res_title, res_doc) = - report_shadowing(alloc, lines, original_region, shadow, kind); + report_shadowing(alloc, lines, original_region, shadow, kind, severity); doc = res_doc; title = res_title.to_string(); } Problem::CyclicAlias(symbol, region, others, alias_kind) => { let answer = crate::error::r#type::cyclic_alias( - alloc, lines, symbol, region, others, alias_kind, + alloc, lines, symbol, region, others, alias_kind, severity, ); doc = answer.0; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -448,7 +448,7 @@ pub fn can_problem<'b>( alloc.reflow(alias_kind.as_str()), alloc.reflow(" definition:"), ]), - alloc.region(lines.convert_region(variable_region)), + alloc.region(lines.convert_region(variable_region), severity), alloc.reflow("Roc does not allow unused type parameters!"), // TODO add link to this guide section alloc.tip().append(alloc.reflow( diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -485,7 +485,7 @@ pub fn can_problem<'b>( alloc.reflow(") type variables. Here is one of them:"), ])); } - stack.push(alloc.region(lines.convert_region(one_occurrence))); + stack.push(alloc.region(lines.convert_region(one_occurrence), severity)); stack.push(alloc.concat([ alloc.reflow(match kind { AliasKind::Structural => "Type alias", diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -526,7 +526,7 @@ pub fn can_problem<'b>( ])); stack.push(alloc.reflow("Here is one of them:")); } - stack.push(alloc.region(lines.convert_region(one_occurrence))); + stack.push(alloc.region(lines.convert_region(one_occurrence), severity)); stack.push(alloc.concat([ alloc.reflow(match kind { AliasKind::Structural => "Type alias", diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -568,7 +568,7 @@ pub fn can_problem<'b>( ])); stack.push(alloc.reflow("Here is one of them:")); } - stack.push(alloc.region(lines.convert_region(one_occurrence))); + stack.push(alloc.region(lines.convert_region(one_occurrence), severity)); stack.push(alloc.concat([ alloc.reflow("All type variables in "), alloc.reflow(match kind { diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -587,7 +587,7 @@ pub fn can_problem<'b>( title = UNDECLARED_TYPE_VARIABLE.to_string(); } Problem::BadRecursion(entries) => { - doc = to_circular_def_doc(alloc, lines, &entries); + doc = to_circular_def_doc(alloc, lines, &entries, severity); title = CIRCULAR_DEF.to_string(); } Problem::DuplicateRecordFieldValue { diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -716,6 +716,7 @@ pub fn can_problem<'b>( ), alloc.region( lines.convert_region(Region::span_across(annotation_pattern, def_pattern)), + severity, ), alloc.reflow("Is it a typo? If not, put either a newline or comment between them."), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -732,7 +733,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(type_name), alloc.reflow(" has an unexpected pattern:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Only type variables like "), alloc.type_variable("a".into()), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -747,7 +748,7 @@ pub fn can_problem<'b>( Problem::InvalidHexadecimal(region) => { doc = alloc.stack([ alloc.reflow("This unicode code point is invalid:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow(r"I was expecting a hexadecimal number, like "), alloc.parser_suggestion("\\u(1100)"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -763,7 +764,7 @@ pub fn can_problem<'b>( Problem::InvalidUnicodeCodePt(region) => { doc = alloc.stack([ alloc.reflow("This unicode code point is invalid:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Learn more about working with unicode in roc at TODO"), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -772,7 +773,7 @@ pub fn can_problem<'b>( Problem::InvalidInterpolation(region) => { doc = alloc.stack([ alloc.reflow("This string interpolation is invalid:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow(r"String interpolations cannot contain newlines or other interpolations."), alloc.reflow(r"You can learn more about string interpolation at <https://www.roc-lang.org/tutorial#string-interpolation>"), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -795,13 +796,13 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(alias), alloc.reflow(" is a nested datatype. Here is one recursive usage of it:"), ]), - alloc.region(lines.convert_region(differing_recursion_region)), + alloc.region(lines.convert_region(differing_recursion_region), severity), alloc.concat([ alloc.reflow("But recursive usages of "), alloc.symbol_unqualified(alias), alloc.reflow(" must match its definition:"), ]), - alloc.region(lines.convert_region(def_region)), + alloc.region(lines.convert_region(def_region), severity), alloc.reflow("Nested datatypes are not supported in Roc."), alloc.concat([ alloc.hint("Consider rewriting the definition of "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -827,7 +828,7 @@ pub fn can_problem<'b>( alloc.text(kind_str), alloc.reflow(" extension type is invalid:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.note("A "), alloc.reflow(kind_str), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -850,7 +851,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(name), alloc.reflow(" ability includes type variables:"), ]), - alloc.region(lines.convert_region(variables_region)), + alloc.region(lines.convert_region(variables_region), severity), alloc.reflow( "Abilities cannot depend on type variables, but their member values can!", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -865,7 +866,7 @@ pub fn can_problem<'b>( alloc.reflow( r#"The type referenced in this "implements" clause is not an ability:"#, ), - alloc.region(lines.convert_region(clause_region)), + alloc.region(lines.convert_region(clause_region), severity), ]); title = IMPLEMENTS_CLAUSE_IS_NOT_AN_ABILITY.to_string(); } diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -877,7 +878,7 @@ pub fn can_problem<'b>( alloc.keyword(roc_parse::keyword::IMPLEMENTS), alloc.reflow(" clause is not allowed here:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.keyword(roc_parse::keyword::IMPLEMENTS), alloc.reflow( diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -895,7 +896,7 @@ pub fn can_problem<'b>( alloc.symbol_foreign_qualified(ability), alloc.reflow(" ability once before:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Abilities only need to bound to a type variable once in an "), alloc.keyword(roc_parse::keyword::IMPLEMENTS), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -920,7 +921,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(ability), alloc.reflow(":"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Ability members must include an "), alloc.keyword(roc_parse::keyword::IMPLEMENTS), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -953,7 +954,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(ability), alloc.keyword(" ability:"), ]), - alloc.region(lines.convert_region(span_has_clauses)), + alloc.region(lines.convert_region(span_has_clauses), severity), alloc.reflow("Ability members can only bind one type variable to their parent ability. Otherwise, I wouldn't know what type implements an ability by looking at specializations!"), alloc.concat([ alloc.hint("Did you mean to only bind "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -971,7 +972,7 @@ pub fn can_problem<'b>( alloc .concat([alloc .reflow("This ability definition is not on the top-level of a module:")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Abilities can only be defined on the top-level of a Roc module."), ]); title = ABILITY_NOT_ON_TOPLEVEL.to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -984,7 +985,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(ability), alloc.reflow(" as a type directly:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow( "Abilities can only be used in type annotations to constrain type variables.", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1010,7 +1011,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(member), alloc.reflow(" ability member is in a nested scope:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Specializations can only be defined on the top-level of a module."), ]); title = SPECIALIZATION_NOT_ON_TOPLEVEL.to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1018,7 +1019,7 @@ pub fn can_problem<'b>( Problem::IllegalDerivedAbility(region) => { doc = alloc.stack([ alloc.reflow("This ability cannot be derived:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Only builtin abilities can be derived."), alloc .note("The builtin abilities are ") diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1029,7 +1030,7 @@ pub fn can_problem<'b>( Problem::NotAnAbility(region) => { doc = alloc.stack([ alloc.reflow("This identifier is not an ability in scope:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Only abilities can be implemented."), ]); title = NOT_AN_ABILITY.to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1043,7 +1044,7 @@ pub fn can_problem<'b>( alloc.concat([ alloc.reflow("The "), alloc.symbol_unqualified(ability), alloc.reflow(" ability does not have a member "), alloc.string(name), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Only implementations for members an ability has can be specified in this location.") ]); title = NOT_AN_ABILITY_MEMBER.to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1054,7 +1055,7 @@ pub fn can_problem<'b>( alloc.concat([ alloc.reflow("An implementation of "), alloc.symbol_unqualified(member), alloc.reflow(" could not be found in this scope:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.tip().append(alloc.concat([alloc.reflow("consider adding a value of name "), alloc.symbol_unqualified(member), alloc.reflow(" in this scope, or using another variable that implements this ability member, like "), alloc.type_str(&format!("{{ {member_str}: my{member_str} }}"))])) ]); title = IMPLEMENTATION_NOT_FOUND.to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1071,7 +1072,7 @@ pub fn can_problem<'b>( doc = alloc.stack([ alloc.reflow("Ability implementations cannot be optional:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Custom implementations must be supplied fully."), hint, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1080,7 +1081,7 @@ pub fn can_problem<'b>( Problem::QualifiedAbilityImpl { region } => { doc = alloc.stack([ alloc.reflow("This ability implementation is qualified:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow( "Custom implementations must be defined in the local scope, and unqualified.", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1090,7 +1091,7 @@ pub fn can_problem<'b>( Problem::AbilityImplNotIdent { region } => { doc = alloc.stack([ alloc.reflow("This ability implementation is not an identifier:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow( "Custom ability implementations defined in this position can only be unqualified identifiers, not arbitrary expressions.", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1104,9 +1105,9 @@ pub fn can_problem<'b>( } => { doc = alloc.stack([ alloc.reflow("This ability member implementation is duplicate:"), - alloc.region(lines.convert_region(duplicate)), + alloc.region(lines.convert_region(duplicate), severity), alloc.reflow("The first implementation was defined here:"), - alloc.region(lines.convert_region(original)), + alloc.region(lines.convert_region(original), severity), alloc .reflow("Only one custom implementation can be defined for an ability member."), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1123,7 +1124,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(ability), alloc.reflow(" ability:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("The following implemented members should not be listed:"), alloc.type_block( alloc.intersperse( diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1147,7 +1148,7 @@ pub fn can_problem<'b>( alloc.symbol_unqualified(ability), alloc.reflow(" ability:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("The following necessary members are missing implementations:"), alloc.type_block( alloc.intersperse( diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1171,7 +1172,7 @@ pub fn can_problem<'b>( alloc.keyword("when"), alloc.reflow(" branch"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Identifiers introduced in a "), alloc.keyword("when"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1183,7 +1184,7 @@ pub fn can_problem<'b>( Problem::NoIdentifiersIntroduced(region) => { doc = alloc.stack([ alloc.reflow("This destructure assignment doesn't introduce any new variables:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("If you don't need to use the value on the right-hand-side of this assignment, consider removing the assignment. Since Roc is purely functional, assignments that don't introduce variables cannot affect a program's behavior!"), ]); title = "UNNECESSARY DEFINITION".to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1195,7 +1196,7 @@ pub fn can_problem<'b>( } => { doc = alloc.stack([ alloc.reflow("This ability member specialization is already claimed to specialize another opaque type:"), - alloc.region(lines.convert_region(overload)), + alloc.region(lines.convert_region(overload), severity), alloc.concat([ alloc.reflow("Previously, we found it to specialize "), alloc.symbol_unqualified(ability_member), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1214,7 +1215,7 @@ pub fn can_problem<'b>( alloc.keyword("*"), alloc.reflow(") that isn't needed."), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Annotations for tag unions which are constants, or which are returned from functions, work the same way with or without a "), alloc.keyword("*"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1229,7 +1230,7 @@ pub fn can_problem<'b>( Problem::MultipleListRestPattern { region } => { doc = alloc.stack([ alloc.reflow("This list pattern match has multiple rest patterns:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("I only support compiling list patterns with one "), alloc.parser_suggestion(".."), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1267,7 +1268,7 @@ pub fn can_problem<'b>( found_arguments, alloc.reflow(" instead:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Are there missing parentheses?"), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1282,7 +1283,7 @@ pub fn can_problem<'b>( alloc.concat([ alloc.reflow("This "), alloc.keyword("crash"), alloc.reflow(" doesn't have a message given to it:") ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.keyword("crash"), alloc.reflow(" must be passed a message to crash with at the exact place it's used. "), alloc.keyword("crash"), alloc.reflow(" can't be used as a value that's passed around, like functions can be - it must be applied immediately!"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1297,10 +1298,10 @@ pub fn can_problem<'b>( alloc.keyword("crash"), alloc.reflow(" has too many values given to it:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.keyword("crash"), - alloc.reflow(" must be given exacly one message to crash with."), + alloc.reflow(" must be given exactly one message to crash with."), ]), ]); title = "OVERAPPLIED CRASH".to_string(); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1384,6 +1385,7 @@ fn to_bad_ident_expr_report<'b>( lines: &LineInfo, bad_ident: roc_parse::ident::BadIdent, surroundings: Region, + severity: Severity, ) -> RocDocBuilder<'b> { use roc_parse::ident::BadIdent::*; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1394,7 +1396,7 @@ fn to_bad_ident_expr_report<'b>( alloc.stack([ alloc.reflow(r"I am trying to parse a record field access here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("So I expect to see a lowercase letter next, like "), alloc.parser_suggestion(".name"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1407,7 +1409,7 @@ fn to_bad_ident_expr_report<'b>( WeirdAccessor(_pos) => alloc.stack([ alloc.reflow("I am very confused by this field access"), - alloc.region(lines.convert_region(surroundings)), + alloc.region(lines.convert_region(surroundings), severity), alloc.concat([ alloc.reflow("It looks like a field access on an accessor. I parse"), alloc.parser_suggestion(".client.name"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1425,7 +1427,7 @@ fn to_bad_ident_expr_report<'b>( alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting to see an identifier next, like "), alloc.parser_suggestion("height"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1440,7 +1442,7 @@ fn to_bad_ident_expr_report<'b>( alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("This looks like a tuple accessor on a module or tag name,"), alloc.reflow(r"but neither modules nor tags can have tuple elements! "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1455,7 +1457,7 @@ fn to_bad_ident_expr_report<'b>( alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"This looks like a qualified tag name to me, "), alloc.reflow(r"but tags cannot be qualified! "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1469,7 +1471,7 @@ fn to_bad_ident_expr_report<'b>( UnderscoreAlone(_pos) => { alloc.stack([ alloc.reflow("An underscore is being used as a variable here:"), - alloc.region(lines.convert_region(surroundings)), + alloc.region(lines.convert_region(surroundings), severity), alloc.concat([alloc .reflow(r"An underscore can be used to ignore a value when pattern matching, but it cannot be used as a variable.")]), ]) diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1478,7 +1480,7 @@ fn to_bad_ident_expr_report<'b>( UnderscoreInMiddle(_pos) => { alloc.stack([ alloc.reflow("Underscores are not allowed in identifier names:"), - alloc.region(lines.convert_region(surroundings)), + alloc.region(lines.convert_region(surroundings), severity), alloc.concat([alloc .reflow(r"I recommend using camelCase. It's the standard style in Roc code!")]), ]) diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1494,11 +1496,11 @@ fn to_bad_ident_expr_report<'b>( None => alloc.reflow(line), Some(declaration_region) => alloc.stack([ alloc.reflow(line), - alloc.region(lines.convert_region(declaration_region)), + alloc.region(lines.convert_region(declaration_region), severity), alloc.reflow("But then it is used here:"), ]) }, - alloc.region(lines.convert_region(surroundings)), + alloc.region(lines.convert_region(surroundings), severity), alloc.concat([ alloc.reflow(r"A variable's name can only start with an underscore if the variable is unused. "), match declaration_region { diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1521,6 +1523,7 @@ fn to_bad_ident_expr_report<'b>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity ), alloc.concat([ alloc.reflow(r"It looks like a record field access on "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1536,6 +1539,7 @@ fn to_bad_ident_expr_report<'b>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity ), alloc.concat([ alloc.reflow(r"Looks like "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1559,6 +1563,7 @@ fn to_bad_ident_expr_report<'b>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity, ), alloc.concat([ alloc.reflow(r"But after the "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1584,6 +1589,7 @@ fn to_bad_ident_pattern_report<'b>( lines: &LineInfo, bad_ident: roc_parse::ident::BadIdent, surroundings: Region, + severity: Severity, ) -> RocDocBuilder<'b> { use roc_parse::ident::BadIdent::*; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1594,7 +1600,7 @@ fn to_bad_ident_pattern_report<'b>( alloc.stack([ alloc.reflow(r"I am trying to parse a record field accessor here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("Something like "), alloc.parser_suggestion(".name"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1607,7 +1613,7 @@ fn to_bad_ident_pattern_report<'b>( WeirdAccessor(_pos) => alloc.stack([ alloc.reflow("I am very confused by this field access"), - alloc.region(lines.convert_region(surroundings)), + alloc.region(lines.convert_region(surroundings), severity), alloc.concat([ alloc.reflow("It looks like a field access on an accessor. I parse"), alloc.parser_suggestion(".client.name"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1625,7 +1631,7 @@ fn to_bad_ident_pattern_report<'b>( alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting to see an identifier next, like "), alloc.parser_suggestion("height"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1640,7 +1646,7 @@ fn to_bad_ident_pattern_report<'b>( alloc.stack([ alloc.reflow("I am trying to parse a qualified name here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"This looks like a qualified tag name to me, "), alloc.reflow(r"but tags cannot be qualified! "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1665,6 +1671,7 @@ fn to_bad_ident_pattern_report<'b>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity, ), alloc.concat([alloc.reflow( r"Underscores are not allowed in identifiers. Use camelCase instead!", diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1677,7 +1684,7 @@ fn to_bad_ident_pattern_report<'b>( alloc.stack([ alloc.reflow("This opaque type reference has an invalid name:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Opaque type names must begin with a capital letter, "), alloc.reflow(r"and must contain only letters and numbers."), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1756,6 +1763,7 @@ fn report_shadowing<'b>( original_region: Region, shadow: Loc<Ident>, kind: ShadowKind, + severity: Severity, ) -> (&'static str, RocDocBuilder<'b>) { let (what, what_plural, is_builtin) = match kind { ShadowKind::Variable => ("variable", "variables", false), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1771,7 +1779,7 @@ fn report_shadowing<'b>( alloc.reflow(what), alloc.reflow(" has the same name as a builtin:"), ]), - alloc.region(lines.convert_region(shadow.region)), + alloc.region(lines.convert_region(shadow.region), severity), alloc.concat([ alloc.reflow("All builtin "), alloc.reflow(what_plural), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1786,9 +1794,9 @@ fn report_shadowing<'b>( .text("The ") .append(alloc.ident(shadow.value)) .append(alloc.reflow(" name is first defined here:")), - alloc.region(lines.convert_region(original_region)), + alloc.region(lines.convert_region(original_region), severity), alloc.reflow("But then it's defined a second time here:"), - alloc.region(lines.convert_region(shadow.region)), + alloc.region(lines.convert_region(shadow.region), severity), alloc.concat([ alloc.reflow("Since these "), alloc.reflow(what_plural), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1808,6 +1816,8 @@ fn pretty_runtime_error<'b>( let doc; let title; + let severity = Severity::RuntimeError; + match runtime_error { RuntimeError::VoidValue => { // is used to communicate to the compiler that diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1825,7 +1835,7 @@ fn pretty_runtime_error<'b>( shadow, kind, } => { - (title, doc) = report_shadowing(alloc, lines, original_region, shadow, kind); + (title, doc) = report_shadowing(alloc, lines, original_region, shadow, kind, severity); } RuntimeError::LookupNotInScope { diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1840,11 +1850,12 @@ fn pretty_runtime_error<'b>( &loc_name.value, options, underscored_suggestion_region, + severity, ); title = UNRECOGNIZED_NAME; } RuntimeError::CircularDef(entries) => { - doc = to_circular_def_doc(alloc, lines, &entries); + doc = to_circular_def_doc(alloc, lines, &entries, severity); title = CIRCULAR_DEF; } RuntimeError::MalformedPattern(problem, region) => { diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1860,7 +1871,7 @@ fn pretty_runtime_error<'b>( MalformedBase(Base::Decimal) => " integer ", BadIdent(bad_ident) => { title = NAMING_PROBLEM; - doc = to_bad_ident_pattern_report(alloc, lines, bad_ident, region); + doc = to_bad_ident_pattern_report(alloc, lines, bad_ident, region, severity); return (doc, title); } diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1892,7 +1903,7 @@ fn pretty_runtime_error<'b>( alloc.text(name), alloc.reflow("pattern is malformed:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), tip, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1933,7 +1944,7 @@ fn pretty_runtime_error<'b>( alloc.string(ident.to_string()), alloc.reflow("`:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), did_you_mean, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1953,6 +1964,7 @@ fn pretty_runtime_error<'b>( &module_name, imported_modules, module_exists, + severity, ); title = MODULE_NOT_IMPORTED; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1972,14 +1984,14 @@ fn pretty_runtime_error<'b>( unreachable!(); } RuntimeError::MalformedIdentifier(_box_str, bad_ident, surroundings) => { - doc = to_bad_ident_expr_report(alloc, lines, bad_ident, surroundings); + doc = to_bad_ident_expr_report(alloc, lines, bad_ident, surroundings, severity); title = SYNTAX_PROBLEM; } RuntimeError::MalformedTypeName(_box_str, surroundings) => { doc = alloc.stack([ alloc.reflow(r"I am confused by this type name:"), - alloc.region(lines.convert_region(surroundings)), + alloc.region(lines.convert_region(surroundings), severity), alloc.concat([ alloc.reflow("Type names start with an uppercase letter, "), alloc.reflow("and can optionally be qualified by a module name, like "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2016,7 +2028,7 @@ fn pretty_runtime_error<'b>( alloc.text(big_or_small), alloc.reflow(":"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc .reflow("Roc uses signed 64-bit floating points, allowing values between "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2038,7 +2050,7 @@ fn pretty_runtime_error<'b>( alloc.concat([ alloc.reflow("This float literal contains an invalid digit:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Floating point literals can only contain the digits 0-9, or use scientific notation 10e4, or have a float suffix."), ]), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2052,7 +2064,7 @@ fn pretty_runtime_error<'b>( alloc .concat([alloc .reflow("This number literal is a float, but it has an integer suffix:")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), ]); title = CONFLICTING_NUMBER_SUFFIX; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2106,7 +2118,7 @@ fn pretty_runtime_error<'b>( alloc.text(problem), alloc.text(":"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.text(plurals), contains, diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2154,7 +2166,7 @@ fn pretty_runtime_error<'b>( alloc.text(big_or_small), alloc.reflow(":"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), info, tip, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2166,7 +2178,7 @@ fn pretty_runtime_error<'b>( alloc .concat([alloc .reflow("This number literal is an integer, but it has a float suffix:")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), ]); title = CONFLICTING_NUMBER_SUFFIX; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2183,7 +2195,7 @@ fn pretty_runtime_error<'b>( doc = alloc.stack([ alloc.concat([alloc .reflow("This integer literal overflows the type indicated by its suffix:")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.tip().append(alloc.concat([ alloc.reflow("The suffix indicates this integer is a "), alloc.type_str(suffix_type), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2207,7 +2219,7 @@ fn pretty_runtime_error<'b>( doc = alloc.stack([ alloc.concat([alloc .reflow("This integer literal underflows the type indicated by its suffix:")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.tip().append(alloc.concat([ alloc.reflow("The suffix indicates this integer is a "), alloc.type_str(suffix_type), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2240,7 +2252,7 @@ fn pretty_runtime_error<'b>( alloc.reflow("This expression cannot be updated"), alloc.reflow(":"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Only variables can be updated with record update syntax."), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2286,7 +2298,7 @@ fn pretty_runtime_error<'b>( doc = alloc.stack([ alloc.concat([alloc.reflow("This character literal is empty.")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), tip, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2301,7 +2313,7 @@ fn pretty_runtime_error<'b>( alloc.concat([ alloc.reflow("This character literal contains more than one code point.") ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([alloc.reflow("Character literals can only contain one code point.")]), tip, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2342,13 +2354,13 @@ fn pretty_runtime_error<'b>( alloc.type_str(opaque.as_inline_str().as_str()), alloc.reflow(" referenced here is not defined:"), ]), - alloc.region(lines.convert_region(used_region)), + alloc.region(lines.convert_region(used_region), severity), ]; if let Some(defined_alias_region) = opt_defined_alias { stack.push(alloc.stack([ alloc.note("There is an alias of the same name:"), - alloc.region(lines.convert_region(defined_alias_region)), + alloc.region(lines.convert_region(defined_alias_region), severity), ])); } diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2369,9 +2381,9 @@ fn pretty_runtime_error<'b>( alloc.type_str(opaque.as_inline_str().as_str()), alloc.reflow(" referenced here:"), ]), - alloc.region(lines.convert_region(referenced_region)), + alloc.region(lines.convert_region(referenced_region), severity), alloc.reflow("is imported from another module:"), - alloc.region(lines.convert_region(imported_region)), + alloc.region(lines.convert_region(imported_region), severity), alloc.note( "Opaque types can only be wrapped and unwrapped in the module they are defined in!", ), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2382,7 +2394,7 @@ fn pretty_runtime_error<'b>( RuntimeError::OpaqueNotApplied(loc_ident) => { doc = alloc.stack([ alloc.reflow("This opaque type is not applied to an argument:"), - alloc.region(lines.convert_region(loc_ident.region)), + alloc.region(lines.convert_region(loc_ident.region), severity), alloc.note("Opaque types always wrap exactly one argument!"), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2391,7 +2403,7 @@ fn pretty_runtime_error<'b>( RuntimeError::OpaqueAppliedToMultipleArgs(region) => { doc = alloc.stack([ alloc.reflow("This opaque type is applied to multiple arguments:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.note("Opaque types always wrap exactly one argument!"), ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2400,7 +2412,7 @@ fn pretty_runtime_error<'b>( RuntimeError::DegenerateBranch(region) => { doc = alloc.stack([ alloc.reflow("This branch pattern does not bind all symbols its body needs:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), ]); title = "DEGENERATE BRANCH"; diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2412,7 +2424,7 @@ fn pretty_runtime_error<'b>( doc = alloc.stack([ alloc.reflow("This function is applied to multiple record builders:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.note("Functions can only take at most one record builder!"), tip, ]); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2422,7 +2434,7 @@ fn pretty_runtime_error<'b>( RuntimeError::UnappliedRecordBuilder(region) => { doc = alloc.stack([ alloc.reflow("This record builder was not applied to a function:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("However, we need a function to construct the record."), alloc.note( "Functions must be applied directly. The pipe operator (|>) cannot be used.", diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2440,6 +2452,7 @@ pub fn to_circular_def_doc<'b>( alloc: &'b RocDocAllocator<'b>, lines: &LineInfo, entries: &[roc_problem::can::CycleEntry], + severity: Severity, ) -> RocDocBuilder<'b> { // TODO "are you trying to mutate a variable? // TODO tip? diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2451,7 +2464,7 @@ pub fn to_circular_def_doc<'b>( alloc.symbol_unqualified(*symbol), alloc.reflow(" is defined directly in terms of itself:"), ]), - alloc.region(lines.convert_region(Region::span_across(symbol_region, expr_region))), + alloc.region(lines.convert_region(Region::span_across(symbol_region, expr_region)), severity), alloc.reflow("Roc evaluates values strictly, so running this program would enter an infinite loop!"), alloc.hint("").append(alloc.concat([ alloc.reflow("Did you mean to define "),alloc.symbol_unqualified(*symbol),alloc.reflow(" as a function?"), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2463,7 +2476,7 @@ pub fn to_circular_def_doc<'b>( .reflow("The ") .append(alloc.symbol_unqualified(first.symbol)) .append(alloc.reflow(" definition is causing a very tricky infinite loop:")), - alloc.region(lines.convert_region(first.symbol_region)), + alloc.region(lines.convert_region(first.symbol_region), severity), alloc .reflow("The ") .append(alloc.symbol_unqualified(first.symbol)) diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2492,6 +2505,7 @@ fn not_found<'b>( name: &Ident, options: MutSet<Box<str>>, underscored_suggestion_region: Option<Region>, + severity: Severity, ) -> RocDocBuilder<'b> { let mut suggestions = suggest::sort( name.as_inline_str().as_str(), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2510,7 +2524,7 @@ fn not_found<'b>( let default_yes = match underscored_suggestion_region { Some(underscored_region) => alloc.stack([ alloc.reflow("There is an ignored identifier of a similar name here:"), - alloc.region(lines.convert_region(underscored_region)), + alloc.region(lines.convert_region(underscored_region), severity), alloc.reflow("Did you mean to remove the leading underscore?"), alloc.reflow("If not, did you mean one of these?"), ]), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2536,7 +2550,7 @@ fn not_found<'b>( alloc.string(name.to_string()), alloc.reflow("` in this scope."), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), to_details(default_no, default_yes), ]) } diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2551,13 +2565,14 @@ fn module_not_found<'b>( name: &ModuleName, options: MutSet<Box<str>>, module_exists: bool, + severity: Severity, ) -> RocDocBuilder<'b> { - // If the module exists, sugguest that the user import it + // If the module exists, suggest that the user import it let details = if module_exists { // TODO: Maybe give an example of how to do that alloc.reflow("Did you mean to import it?") } else { - // If the module might not exist, sugguest that it's a typo + // If the module might not exist, suggest that it's a typo let mut suggestions = suggest::sort(name.as_str(), options.iter().map(|v| v.as_ref()).collect()); suggestions.truncate(4); diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -2587,7 +2602,7 @@ fn module_not_found<'b>( alloc.string(name.to_string()), alloc.reflow("` module is not imported:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), details, ]) } diff --git a/crates/reporting/src/error/expect.rs b/crates/reporting/src/error/expect.rs --- a/crates/reporting/src/error/expect.rs +++ b/crates/reporting/src/error/expect.rs @@ -80,6 +80,7 @@ impl<'a> Renderer<'a> { symbols: &[Symbol], variables: &[Variable], expressions: &[Expr<'_>], + severity: Severity, ) -> RocDocBuilder<'a> { use ven_pretty::DocAllocator; diff --git a/crates/reporting/src/error/expect.rs b/crates/reporting/src/error/expect.rs --- a/crates/reporting/src/error/expect.rs +++ b/crates/reporting/src/error/expect.rs @@ -96,7 +97,7 @@ impl<'a> Renderer<'a> { if it.len() > 0 { self.alloc.stack([ self.alloc.text("This expectation failed:"), - self.alloc.region(line_col_region), + self.alloc.region(line_col_region, severity), self.alloc .text("When it failed, these variables had these values:"), self.alloc.stack(it), diff --git a/crates/reporting/src/error/expect.rs b/crates/reporting/src/error/expect.rs --- a/crates/reporting/src/error/expect.rs +++ b/crates/reporting/src/error/expect.rs @@ -105,7 +106,7 @@ impl<'a> Renderer<'a> { } else { self.alloc.stack([ self.alloc.text("This expectation failed:"), - self.alloc.region(line_col_region), + self.alloc.region(line_col_region, severity), self.alloc.text(""), // Blank line at the end ]) } diff --git a/crates/reporting/src/error/expect.rs b/crates/reporting/src/error/expect.rs --- a/crates/reporting/src/error/expect.rs +++ b/crates/reporting/src/error/expect.rs @@ -147,15 +148,23 @@ impl<'a> Renderer<'a> { W: std::io::Write, { use crate::report::Report; + let severity = Severity::RuntimeError; let line_col_region = self.to_line_col_region(expect_region, failure_region); - let doc = self.render_lookups(subs, line_col_region, symbols, variables, expressions); + let doc = self.render_lookups( + subs, + line_col_region, + symbols, + variables, + expressions, + severity, + ); let report = Report { title: "EXPECT FAILED".into(), doc, filename: self.filename.clone(), - severity: Severity::RuntimeError, + severity, }; let mut buf = String::new(); diff --git a/crates/reporting/src/error/expect.rs b/crates/reporting/src/error/expect.rs --- a/crates/reporting/src/error/expect.rs +++ b/crates/reporting/src/error/expect.rs @@ -214,10 +223,11 @@ impl<'a> Renderer<'a> { use ven_pretty::DocAllocator; let line_col_region = self.line_info.convert_region(expect_region); + let severity = Severity::RuntimeError; let doc = self.alloc.stack([ self.alloc.text("This expectation crashed while running:"), - self.alloc.region(line_col_region), + self.alloc.region(line_col_region, severity), self.alloc.text("The crash reported this message:"), self.alloc.text(message), ]); diff --git a/crates/reporting/src/error/expect.rs b/crates/reporting/src/error/expect.rs --- a/crates/reporting/src/error/expect.rs +++ b/crates/reporting/src/error/expect.rs @@ -226,7 +236,7 @@ impl<'a> Renderer<'a> { title: "EXPECT PANICKED".into(), doc, filename: self.filename.clone(), - severity: Severity::RuntimeError, + severity, }; let mut buf = String::new(); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -60,25 +60,26 @@ fn to_syntax_report<'a>( ) -> Report<'a> { use SyntaxError::*; + let severity = Severity::RuntimeError; let report = |doc| Report { filename: filename.clone(), doc, title: "PARSE PROBLEM".to_string(), - severity: Severity::RuntimeError, + severity, }; match parse_problem { SyntaxError::ArgumentsBeforeEquals(region) => { let doc = alloc.stack([ alloc.reflow("Unexpected tokens in front of the `=` symbol:"), - alloc.region(lines.convert_region(*region)), + alloc.region(lines.convert_region(*region), severity), ]); Report { filename, doc, title: "PARSE PROBLEM".to_string(), - severity: Severity::RuntimeError, + severity, } } Unexpected(region) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -93,7 +94,7 @@ fn to_syntax_report<'a>( // context(alloc, &parse_problem.context_stack, "here"), alloc.text(":"), ]), - alloc.region(region), + alloc.region(region, severity), ]); report(doc) diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -103,27 +104,27 @@ fn to_syntax_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I expected to reach the end of the file, but got stuck here:"), - alloc.region(region), + alloc.region(region, severity), ]); Report { filename, doc, title: "NOT END OF FILE".to_string(), - severity: Severity::RuntimeError, + severity, } } SyntaxError::Eof(region) => { let doc = alloc.stack([ alloc.reflow("End of Field"), - alloc.region(lines.convert_region(*region)), + alloc.region(lines.convert_region(*region), severity), ]); Report { filename, doc, title: "PARSE PROBLEM".to_string(), - severity: Severity::RuntimeError, + severity, } } SyntaxError::OutdentedTooFar => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -133,7 +134,7 @@ fn to_syntax_report<'a>( filename, doc, title: "PARSE PROBLEM".to_string(), - severity: Severity::RuntimeError, + severity, } } Type(typ) => to_type_report(alloc, lines, filename, typ, Position::default()), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -182,7 +183,7 @@ fn to_expr_report<'a>( start: Position, ) -> Report<'a> { use roc_parse::parser::EExpr; - + let severity = Severity::RuntimeError; match parse_problem { EExpr::If(if_, pos) => to_if_report(alloc, lines, filename, context, if_, *pos), EExpr::When(when, pos) => to_when_report(alloc, lines, filename, context, when, *pos), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -201,7 +202,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a definition, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("Looks like you are trying to define a function. "), alloc.reflow("In roc, functions are always written as a lambda, like "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -214,7 +215,7 @@ fn to_expr_report<'a>( filename, doc, title: "ARGUMENTS BEFORE EQUALS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -320,6 +321,7 @@ fn to_expr_report<'a>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity, ), alloc.concat(suggestion), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -328,7 +330,7 @@ fn to_expr_report<'a>( filename, doc, title: "UNKNOWN OPERATOR".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -340,9 +342,10 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am very confused by this identifier:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ - alloc.reflow("Are you trying to qualify a name? I am execting something like "), + alloc + .reflow("Are you trying to qualify a name? I am expecting something like "), alloc.parser_suggestion("Json.Decode.string"), alloc.reflow(". Maybe you are trying to qualify a tag? Tags like "), alloc.parser_suggestion("Err"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -354,7 +357,7 @@ fn to_expr_report<'a>( filename, doc, title: "WEIRD IDENTIFIER".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -428,7 +431,7 @@ fn to_expr_report<'a>( a_thing, alloc.reflow(", but I got stuck here:"), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), expecting, ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -436,7 +439,7 @@ fn to_expr_report<'a>( filename, doc, title: title.to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -446,7 +449,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a definition, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("This definition is missing a final expression."), alloc.reflow(" A nested definition must be followed by"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -464,7 +467,7 @@ fn to_expr_report<'a>( filename, doc, title: "MISSING FINAL EXPRESSION".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -483,7 +486,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("Whatever I am running into is confusing me a lot! "), alloc.reflow("Normally I can give fairly specific hints, "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -495,7 +498,7 @@ fn to_expr_report<'a>( filename, doc, title: "SYNTAX PROBLEM".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -505,7 +508,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a definition, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("Looks like you are trying to define a function. "), alloc.reflow("In roc, functions are always written as a lambda, like "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -518,7 +521,7 @@ fn to_expr_report<'a>( filename, doc, title: "ARGUMENTS BEFORE EQUALS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -528,7 +531,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing an expression, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("Looks like you are trying to define a function. ")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -536,7 +539,7 @@ fn to_expr_report<'a>( filename, doc, title: "BAD BACKPASSING ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -552,7 +555,7 @@ fn to_expr_report<'a>( alloc.reflow( r"I am partway through parsing a record builder, and I found an optional field:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow("Optional fields can only appear when you destructure a record."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -560,7 +563,7 @@ fn to_expr_report<'a>( filename, doc, title: "BAD RECORD BUILDER".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -572,7 +575,7 @@ fn to_expr_report<'a>( alloc.reflow( r"I am partway through parsing a record update, and I found a record builder field:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow("Record builders cannot be updated like records."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -580,7 +583,7 @@ fn to_expr_report<'a>( filename, doc, title: "BAD RECORD UPDATE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -596,7 +599,8 @@ fn to_expr_report<'a>( let surroundings = Region::new(start, *pos); let region = LineColumnRegion::from_pos(lines.convert_pos(*pos)); - let snippet = alloc.region_with_subregion(lines.convert_region(surroundings), region); + let snippet = + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity); let doc = match context { Context::InNode(Node::Dbg, _, _) => alloc.stack([ diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -646,7 +650,7 @@ fn to_expr_report<'a>( filename, doc, title: "INDENT ENDS AFTER EXPRESSION".to_string(), - severity: Severity::RuntimeError, + severity, } } EExpr::Expect(e_expect, _position) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -665,7 +669,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing an expression, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("TODO provide more context.")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -673,7 +677,7 @@ fn to_expr_report<'a>( filename, doc, title: "TRAILING OPERATOR".to_string(), - severity: Severity::RuntimeError, + severity, } } EExpr::UnexpectedComma(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -682,7 +686,7 @@ fn to_expr_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am trying to parse an expression, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("This comma in an invalid position.")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -690,7 +694,7 @@ fn to_expr_report<'a>( filename, doc, title: "UNEXPECTED COMMA".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => todo!("unhandled parse error: {:?}", parse_problem), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -708,9 +712,10 @@ fn to_record_report<'a>( let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("TODO provide more context.")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -718,7 +723,7 @@ fn to_record_report<'a>( filename, doc, title: "RECORD PARSE PROBLEM".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -732,6 +737,8 @@ fn to_lambda_report<'a>( ) -> Report<'a> { use roc_parse::parser::EClosure; + let severity = Severity::RuntimeError; + match *parse_problem { EClosure::Arrow(pos) => match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Token("=>") => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -741,7 +748,7 @@ fn to_lambda_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting a "), alloc.parser_suggestion("->"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -753,7 +760,7 @@ fn to_lambda_report<'a>( filename, doc, title: "WEIRD ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -763,7 +770,7 @@ fn to_lambda_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting a "), alloc.parser_suggestion("->"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -775,7 +782,7 @@ fn to_lambda_report<'a>( filename, doc, title: "MISSING ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -788,7 +795,7 @@ fn to_lambda_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting a "), alloc.parser_suggestion("->"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -800,7 +807,7 @@ fn to_lambda_report<'a>( filename, doc, title: "WEIRD ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -810,7 +817,7 @@ fn to_lambda_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting a "), alloc.parser_suggestion("->"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -822,7 +829,7 @@ fn to_lambda_report<'a>( filename, doc, title: "MISSING ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -835,7 +842,7 @@ fn to_lambda_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck at this comma:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting an argument pattern before this, "), alloc.reflow("so try adding an argument before the comma and see if that helps?"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -846,7 +853,7 @@ fn to_lambda_report<'a>( filename, doc, title: "UNFINISHED ARGUMENT LIST".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -856,7 +863,7 @@ fn to_lambda_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a function argument list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting an argument pattern before this, "), alloc.reflow("so try adding an argument and see if that helps?"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -867,7 +874,7 @@ fn to_lambda_report<'a>( filename, doc, title: "MISSING ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -934,13 +941,14 @@ fn to_unfinished_lambda_report<'a>( ) -> Report<'a> { let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.concat([ alloc.reflow(r"I was partway through parsing a "), alloc.reflow(r" function, but I got stuck here:"), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), message, ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -948,7 +956,7 @@ fn to_unfinished_lambda_report<'a>( filename, doc, title: "UNFINISHED FUNCTION".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -961,6 +969,7 @@ fn to_str_report<'a>( start: Position, ) -> Report<'a> { use roc_parse::parser::EString; + let severity = Severity::RuntimeError; match *parse_problem { EString::Open(_pos) => unreachable!("another branch would be taken"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -992,6 +1001,7 @@ fn to_str_report<'a>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity, ), alloc.concat([ alloc.reflow(r"This is not an escape sequence I recognize."), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1014,7 +1024,7 @@ fn to_str_report<'a>( filename, doc, title: "WEIRD ESCAPE".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::CodePtOpen(pos) | EString::CodePtEnd(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1025,7 +1035,7 @@ fn to_str_report<'a>( alloc.reflow( r"I am partway through parsing a unicode code point, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I was expecting a hexadecimal number, like "), alloc.parser_suggestion("\\u(1100)"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1040,7 +1050,7 @@ fn to_str_report<'a>( filename, doc, title: "WEIRD CODE POINT".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::FormatEnd(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1049,7 +1059,7 @@ fn to_str_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this format expression:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("\"The count is $(count)\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1061,7 +1071,7 @@ fn to_str_report<'a>( filename, doc, title: "ENDLESS FORMAT".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::EndlessSingleQuote(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1070,7 +1080,7 @@ fn to_str_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this scalar literal (character literal):"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("'a'"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1084,7 +1094,7 @@ fn to_str_report<'a>( filename, doc, title: "ENDLESS SCALAR".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::InvalidSingleQuote(e, pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1098,7 +1108,7 @@ fn to_str_report<'a>( alloc.reflow(r"I am part way through parsing this scalar literal (character literal), "), alloc.reflow(r"but it appears to be empty - which is not a valid scalar."), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("'a'"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1115,7 +1125,7 @@ fn to_str_report<'a>( alloc.reflow(r"I am part way through parsing this scalar literal (character literal), "), alloc.reflow(r"but it's too long to fit in a U32 so it's not a valid scalar."), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("'a'"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1133,7 +1143,7 @@ fn to_str_report<'a>( alloc.reflow("but I encountered a string interpolation like \"$(this)\","), alloc.reflow("which is not allowed in single-quote literals."), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("'a'"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1150,7 +1160,7 @@ fn to_str_report<'a>( filename, doc, title: "INVALID SCALAR".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::EndlessSingleLine(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1159,7 +1169,7 @@ fn to_str_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this string:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("\"to be or not to be\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1173,7 +1183,7 @@ fn to_str_report<'a>( filename, doc, title: "ENDLESS STRING".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::ExpectedDoubleQuoteGotSingleQuote(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1182,7 +1192,7 @@ fn to_str_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I was expecting to see a string here, but I got a scalar literal."), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("\"to be or not to be\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1197,7 +1207,7 @@ fn to_str_report<'a>( filename, doc, title: "EXPECTED STRING".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::EndlessMultiLine(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1206,7 +1216,7 @@ fn to_str_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I cannot find the end of this block string:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"You could change it to something like "), alloc.parser_suggestion("\"\"\"to be or not to be\"\"\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1220,7 +1230,7 @@ fn to_str_report<'a>( filename, doc, title: "ENDLESS STRING".to_string(), - severity: Severity::RuntimeError, + severity, } } EString::MultilineInsufficientIndent(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1229,7 +1239,7 @@ fn to_str_report<'a>( let doc = alloc.stack([ alloc.reflow(r"This multiline string is not sufficiently indented:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Lines in a multi-line string must be indented at least as "), alloc.reflow("much as the beginning \"\"\". This extra indentation is automatically removed "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1241,7 +1251,7 @@ fn to_str_report<'a>( filename, doc, title: "INSUFFICIENT INDENT IN MULTI-LINE STRING".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1255,6 +1265,7 @@ fn to_expr_in_parens_report<'a>( start: Position, ) -> Report<'a> { use roc_parse::parser::EInParens; + let severity = Severity::RuntimeError; match *parse_problem { EInParens::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1272,7 +1283,7 @@ fn to_expr_in_parens_report<'a>( let doc = alloc.stack([ alloc.reflow("I am partway through parsing a parenthesized expression or tuple:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I was expecting to see an expression next."), alloc.reflow(r"Note, Roc doesn't use '()' as a null type."), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1283,7 +1294,7 @@ fn to_expr_in_parens_report<'a>( filename, doc, title: "EMPTY PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } EInParens::End(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1293,7 +1304,7 @@ fn to_expr_in_parens_report<'a>( let doc = alloc.stack([ alloc .reflow("I am partway through parsing a record pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing parenthesis next, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1307,7 +1318,7 @@ fn to_expr_in_parens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } EInParens::Open(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1318,7 +1329,7 @@ fn to_expr_in_parens_report<'a>( alloc.reflow( r"I just started parsing an expression in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"An expression in parentheses looks like "), alloc.parser_suggestion("(32)"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1332,7 +1343,7 @@ fn to_expr_in_parens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1348,6 +1359,7 @@ fn to_list_report<'a>( ) -> Report<'a> { use roc_parse::parser::EList; + let severity = Severity::RuntimeError; match *parse_problem { EList::Space(error, pos) => to_space_report(alloc, lines, filename, &error, pos), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1370,7 +1382,11 @@ fn to_list_report<'a>( alloc.reflow( r"I am partway through started parsing a list, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([ alloc .reflow(r"I was expecting to see a list entry before this comma, "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1382,7 +1398,7 @@ fn to_list_report<'a>( filename, doc, title: "UNFINISHED LIST".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1393,7 +1409,11 @@ fn to_list_report<'a>( alloc.reflow( r"I am partway through started parsing a list, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([ alloc.reflow( r"I was expecting to see a closing square bracket before this, ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1415,7 +1435,7 @@ fn to_list_report<'a>( filename, doc, title: "UNFINISHED LIST".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1462,6 +1482,7 @@ fn to_import_report<'a>( ) -> Report<'a> { use roc_parse::parser::EImport::*; use roc_parse::parser::EImportParams; + let severity = Severity::RuntimeError; match parse_problem { Import(_pos) => unreachable!("another branch would be taken"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1530,7 +1551,7 @@ fn to_import_report<'a>( let doc = alloc.stack([ alloc.reflow("I was partway through parsing module params, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow("This looks like a record builder field, but those are not allowed in module params."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1538,7 +1559,7 @@ fn to_import_report<'a>( filename, doc, title: "RECORD BUILDER IN MODULE PARAMS".to_string(), - severity: Severity::RuntimeError, + severity, } } Params(EImportParams::RecordUpdateFound(region), _) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1547,7 +1568,7 @@ fn to_import_report<'a>( let doc = alloc.stack([ alloc.reflow("I was partway through parsing module params, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow("It looks like you're trying to update a record, but module params require a standalone record literal."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1555,7 +1576,7 @@ fn to_import_report<'a>( filename, doc, title: "RECORD UPDATE IN MODULE PARAMS".to_string(), - severity: Severity::RuntimeError, + severity, } } IndentAlias(pos) | Alias(pos) => to_unfinished_import_report( diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1576,7 +1597,7 @@ fn to_import_report<'a>( let doc = alloc.stack([ alloc.reflow(r"This import is using a lowercase alias:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow(r"Module names and aliases must start with an uppercase letter."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1584,7 +1605,7 @@ fn to_import_report<'a>( filename, doc, title: "LOWERCASE ALIAS".to_string(), - severity: Severity::RuntimeError, + severity, } } ExposingListStart(pos) => to_unfinished_import_report( diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1608,7 +1629,7 @@ fn to_import_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I'm partway through parsing an exposing list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow(r"I was expecting a type, value, or function name next, like:"), alloc .parser_suggestion("import Svg exposing [Path, arc, rx]") diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1619,7 +1640,7 @@ fn to_import_report<'a>( filename, doc, title: "WEIRD EXPOSING".to_string(), - severity: Severity::RuntimeError, + severity, } } IndentIngestedName(pos) | IngestedName(pos) => to_unfinished_import_report( diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1665,6 +1686,7 @@ fn to_unfinished_import_report<'a>( ) -> Report<'a> { let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.concat([ diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1672,7 +1694,7 @@ fn to_unfinished_import_report<'a>( alloc.keyword("import"), alloc.reflow(r", but I got stuck here:"), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), message, ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1680,7 +1702,7 @@ fn to_unfinished_import_report<'a>( filename, doc, title: "UNFINISHED IMPORT".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1778,6 +1800,7 @@ fn to_unfinished_if_report<'a>( ) -> Report<'a> { let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.concat([ diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1785,7 +1808,7 @@ fn to_unfinished_if_report<'a>( alloc.keyword("if"), alloc.reflow(r" expression, but I got stuck here:"), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), message, ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1793,7 +1816,7 @@ fn to_unfinished_if_report<'a>( filename, doc, title: "UNFINISHED IF".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1806,6 +1829,7 @@ fn to_when_report<'a>( start: Position, ) -> Report<'a> { use roc_parse::parser::EWhen; + let severity = Severity::RuntimeError; match *parse_problem { EWhen::IfGuard(nested, pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1818,7 +1842,11 @@ fn to_when_report<'a>( alloc.reflow( r"I just started parsing an if guard, but there is no guard condition:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([alloc.reflow("Try adding an expression before the arrow!")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1826,7 +1854,7 @@ fn to_when_report<'a>( filename, doc, title: "IF GUARD NO CONDITION".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => to_expr_report( diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1849,7 +1877,7 @@ fn to_when_report<'a>( alloc.keyword("when"), alloc.reflow(r" expression, but got stuck here:"), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("I was expecting to see an arrow next.")]), note_for_when_indent_error(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1858,7 +1886,7 @@ fn to_when_report<'a>( filename, doc, title: "MISSING ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -1993,8 +2021,8 @@ fn to_unfinished_when_report<'a>( ) -> Report<'a> { match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Token("->") => to_unexpected_arrow_report(alloc, lines, filename, pos, start), - _ => { + let severity = Severity::RuntimeError; let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2004,7 +2032,7 @@ fn to_unfinished_when_report<'a>( alloc.keyword("when"), alloc.reflow(r" expression, but I got stuck here:"), ]), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), message, note_for_when_error(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2013,7 +2041,7 @@ fn to_unfinished_when_report<'a>( filename, doc, title: "UNFINISHED WHEN".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2028,6 +2056,7 @@ fn to_unexpected_arrow_report<'a>( ) -> Report<'a> { let surroundings = Region::new(start, pos); let region = Region::new(pos, pos.bump_column(2)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.concat([ diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2038,6 +2067,7 @@ fn to_unexpected_arrow_report<'a>( alloc.region_with_subregion( lines.convert_region(surroundings), lines.convert_region(region), + severity, ), alloc.concat([ alloc.reflow(r"It makes sense to see arrows around here, "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2053,7 +2083,7 @@ fn to_unexpected_arrow_report<'a>( filename, doc, title: "UNEXPECTED ARROW".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2113,6 +2143,7 @@ fn to_pattern_report<'a>( start: Position, ) -> Report<'a> { use roc_parse::parser::EPattern; + let severity = Severity::RuntimeError; match parse_problem { EPattern::Start(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2121,7 +2152,7 @@ fn to_pattern_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.note("I may be confused by indentation"), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2129,7 +2160,7 @@ fn to_pattern_report<'a>( filename, doc, title: "UNFINISHED PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } EPattern::Record(record, pos) => to_precord_report(alloc, lines, filename, record, *pos), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2153,6 +2184,8 @@ fn to_precord_report<'a>( ) -> Report<'a> { use roc_parse::parser::PRecord; + let severity = Severity::RuntimeError; + match *parse_problem { PRecord::Open(pos) => match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Keyword(keyword) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2161,7 +2194,7 @@ fn to_precord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck on this field name:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Looks like you are trying to use "), alloc.keyword(keyword), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2173,7 +2206,7 @@ fn to_precord_report<'a>( filename, doc, title: "UNFINISHED RECORD PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2182,7 +2215,11 @@ fn to_precord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), record_patterns_look_like(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2190,7 +2227,7 @@ fn to_precord_report<'a>( filename, doc, title: "UNFINISHED RECORD PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2203,7 +2240,7 @@ fn to_precord_report<'a>( Next::Other(Some(c)) if c.is_alphabetic() => { let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a colon, question mark, comma or closing curly brace.", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2215,13 +2252,13 @@ fn to_precord_report<'a>( filename, doc, title: "UNFINISHED RECORD PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { let doc = alloc.stack([ alloc.reflow("I am partway through parsing a record pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing curly brace before this, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2235,7 +2272,7 @@ fn to_precord_report<'a>( filename, doc, title: "UNFINISHED RECORD PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2248,7 +2285,7 @@ fn to_precord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record pattern, but I got stuck on this field name:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Looks like you are trying to use "), alloc.keyword(keyword), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2260,7 +2297,7 @@ fn to_precord_report<'a>( filename, doc, title: "UNFINISHED RECORD PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } Next::Other(Some(',')) => todo!(), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2271,7 +2308,7 @@ fn to_precord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I was expecting to see another record field defined next, so I am looking for a name like "), alloc.parser_suggestion("userName"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2285,7 +2322,7 @@ fn to_precord_report<'a>( filename, doc, title: "PROBLEM IN RECORD PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2323,6 +2360,7 @@ fn to_plist_report<'a>( parse_problem: &PList<'a>, start: Position, ) -> Report<'a> { + let severity = Severity::RuntimeError; match *parse_problem { PList::Open(pos) => { let surroundings = Region::new(start, pos); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2330,7 +2368,7 @@ fn to_plist_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a list pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), list_patterns_look_like(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2338,7 +2376,7 @@ fn to_plist_report<'a>( filename, doc, title: "UNFINISHED LIST PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2347,7 +2385,7 @@ fn to_plist_report<'a>( let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); let doc = alloc.stack([ alloc.reflow("I am partway through parsing a list pattern, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing square brace before this, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2360,7 +2398,7 @@ fn to_plist_report<'a>( filename, doc, title: "UNFINISHED LIST PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2369,7 +2407,7 @@ fn to_plist_report<'a>( let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); let doc = alloc.stack([ alloc.reflow("It looks like you may trying to write a list rest pattern, but it's not the form I expect:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"List rest patterns, which match zero or more elements in a list, are denoted with ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2382,7 +2420,7 @@ fn to_plist_report<'a>( filename, doc, title: "INCORRECT REST PATTERN".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2401,9 +2439,11 @@ fn to_pattern_in_parens_report<'a>( ) -> Report<'a> { use roc_parse::parser::PInParens; + let severity = Severity::RuntimeError; + match *parse_problem { PInParens::Open(pos) => { - // `Open` case is for exhaustiveness, this case shouldn not be reachable practically. + // `Open` case is for exhaustiveness, this case shouldn't not be reachable practically. let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2411,7 +2451,7 @@ fn to_pattern_in_parens_report<'a>( alloc.reflow( r"I just started parsing a pattern in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"A pattern in parentheses looks like "), alloc.parser_suggestion("(Ok 32)"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2425,17 +2465,18 @@ fn to_pattern_in_parens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } PInParens::Empty(pos) => { let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.reflow("I am partway through parsing a parenthesized pattern or tuple:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I was expecting to see a pattern next."), alloc.reflow(r"Note, Roc doesn't use '()' as a null type."), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2446,7 +2487,7 @@ fn to_pattern_in_parens_report<'a>( filename, doc, title: "EMPTY PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2456,7 +2497,7 @@ fn to_pattern_in_parens_report<'a>( let doc = alloc.stack([ alloc.reflow("I am partway through parsing a pattern in parentheses, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing parenthesis before this, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2470,7 +2511,7 @@ fn to_pattern_in_parens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2488,17 +2529,18 @@ fn to_malformed_number_literal_report<'a>( ) -> Report<'a> { let surroundings = Region::new(start, start); let region = LineColumnRegion::from_pos(lines.convert_pos(start)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.reflow(r"This number literal is malformed:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), ]); Report { filename, doc, title: "INVALID NUMBER LITERAL".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2510,6 +2552,7 @@ fn to_type_report<'a>( start: Position, ) -> Report<'a> { use roc_parse::parser::EType; + let severity = Severity::RuntimeError; match parse_problem { EType::TRecord(record, pos) => to_trecord_report(alloc, lines, filename, record, *pos), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2530,7 +2573,7 @@ fn to_type_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a function argument type, but I encountered two commas in a row:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("Try removing one of them.")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2538,7 +2581,7 @@ fn to_type_report<'a>( filename, doc, title: "DOUBLE COMMA".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => todo!(), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2551,7 +2594,7 @@ fn to_type_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I am expecting a type next, like "), alloc.parser_suggestion("Bool"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2565,7 +2608,7 @@ fn to_type_report<'a>( filename, doc, title: "UNFINISHED TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2575,7 +2618,7 @@ fn to_type_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.note("I may be confused by indentation"), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2583,7 +2626,7 @@ fn to_type_report<'a>( filename, doc, title: "UNFINISHED TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2593,7 +2636,7 @@ fn to_type_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.note("I may be confused by indentation"), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2601,7 +2644,7 @@ fn to_type_report<'a>( filename, doc, title: "UNFINISHED TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2611,7 +2654,7 @@ fn to_type_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing an inline type alias, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.note("I may be confused by indentation"), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2619,7 +2662,7 @@ fn to_type_report<'a>( filename, doc, title: "UNFINISHED INLINE ALIAS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2629,14 +2672,14 @@ fn to_type_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am expecting a type variable, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), ]); Report { filename, doc, title: "BAD TYPE VARIABLE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2653,6 +2696,8 @@ fn to_trecord_report<'a>( ) -> Report<'a> { use roc_parse::parser::ETypeRecord; + let severity = Severity::RuntimeError; + match *parse_problem { ETypeRecord::Open(pos) => match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Keyword(keyword) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2661,7 +2706,7 @@ fn to_trecord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck on this field name:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Looks like you are trying to use "), alloc.keyword(keyword), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2673,7 +2718,7 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2682,7 +2727,11 @@ fn to_trecord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([ alloc.reflow(r"Record types look like "), alloc.parser_suggestion("{ name : String, age : Int },"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2694,7 +2743,7 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2707,7 +2756,7 @@ fn to_trecord_report<'a>( Next::Other(Some(c)) if c.is_alphabetic() => { let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a colon, question mark, comma or closing curly brace.", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2719,13 +2768,13 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { let doc = alloc.stack([ alloc.reflow("I am partway through parsing a record type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing curly brace before this, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2739,7 +2788,7 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2752,7 +2801,7 @@ fn to_trecord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck on this field name:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Looks like you are trying to use "), alloc.keyword(keyword), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2764,7 +2813,7 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } Next::Other(Some(',')) => todo!(), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2775,7 +2824,7 @@ fn to_trecord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a record type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I was expecting to see another record field defined next, so I am looking for a name like "), alloc.parser_suggestion("userName"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2789,7 +2838,7 @@ fn to_trecord_report<'a>( filename, doc, title: "PROBLEM IN RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2809,7 +2858,7 @@ fn to_trecord_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a record type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Record types look like "), alloc.parser_suggestion("{ name : String, age : Int },"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2822,7 +2871,7 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2836,7 +2885,7 @@ fn to_trecord_report<'a>( alloc.reflow( "I am partway through parsing a record type, but I got stuck here:", ), - alloc.region_with_subregion(surroundings, region), + alloc.region_with_subregion(surroundings, region, severity), alloc.concat([ alloc.reflow("I need this curly brace to be indented more. Try adding more spaces before it!"), ]), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2846,7 +2895,7 @@ fn to_trecord_report<'a>( filename, doc, title: "NEED MORE INDENTATION".to_string(), - severity: Severity::RuntimeError, + severity, } } None => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2857,7 +2906,11 @@ fn to_trecord_report<'a>( alloc.reflow( r"I am partway through parsing a record type, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([ alloc.reflow("I was expecting to see a closing curly "), alloc.reflow("brace before this, so try adding a "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2871,7 +2924,7 @@ fn to_trecord_report<'a>( filename, doc, title: "UNFINISHED RECORD TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2898,6 +2951,8 @@ fn to_ttag_union_report<'a>( ) -> Report<'a> { use roc_parse::parser::ETypeTagUnion; + let severity = Severity::RuntimeError; + match *parse_problem { ETypeTagUnion::Open(pos) => match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { Next::Keyword(keyword) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2906,7 +2961,7 @@ fn to_ttag_union_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a tag union, but I got stuck on this field name:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Looks like you are trying to use "), alloc.keyword(keyword), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2918,7 +2973,7 @@ fn to_ttag_union_report<'a>( filename, doc, title: "UNFINISHED TAG UNION TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } Next::Other(Some(c)) if c.is_alphabetic() => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2931,7 +2986,11 @@ fn to_ttag_union_report<'a>( alloc.reflow( r"I am partway through parsing a tag union type, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.reflow(r"I was expecting to see a tag name."), hint_for_tag_name(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2940,7 +2999,7 @@ fn to_ttag_union_report<'a>( filename, doc, title: "WEIRD TAG NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2949,7 +3008,11 @@ fn to_ttag_union_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just started parsing a tag union type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([ alloc.reflow(r"Tag unions look like "), alloc.parser_suggestion("[Many I64, None],"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2961,7 +3024,7 @@ fn to_ttag_union_report<'a>( filename, doc, title: "UNFINISHED TAG UNION TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } }, diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2978,7 +3041,11 @@ fn to_ttag_union_report<'a>( alloc.reflow( r"I am partway through parsing a tag union type, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.reflow(r"I was expecting to see a tag name."), hint_for_tag_name(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -2987,13 +3054,13 @@ fn to_ttag_union_report<'a>( filename, doc, title: "WEIRD TAG NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a tag union type, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing square bracket before this, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3007,7 +3074,7 @@ fn to_ttag_union_report<'a>( filename, doc, title: "UNFINISHED TAG UNION TYPE".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3028,6 +3095,8 @@ fn to_tinparens_report<'a>( ) -> Report<'a> { use roc_parse::parser::ETypeInParens; + let severity = Severity::RuntimeError; + match *parse_problem { ETypeInParens::Open(pos) => { match what_is_next(alloc.src_lines, lines.convert_pos(pos)) { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3037,7 +3106,7 @@ fn to_tinparens_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I just saw an open parenthesis, so I was expecting to see a type next."), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Something like "), alloc.parser_suggestion("(List Person)"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3050,7 +3119,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } Next::Other(Some(c)) if c.is_alphabetic() => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3063,7 +3132,7 @@ fn to_tinparens_report<'a>( alloc.reflow( r"I am partway through parsing a type in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow(r"I was expecting to see a tag name."), hint_for_tag_name(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3072,7 +3141,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "WEIRD TAG NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3083,7 +3152,11 @@ fn to_tinparens_report<'a>( alloc.reflow( r"I just started parsing a type in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), alloc.concat([ alloc.reflow(r"Tag unions look like "), alloc.parser_suggestion("[Many I64, None],"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3095,7 +3168,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3107,7 +3180,7 @@ fn to_tinparens_report<'a>( let doc = alloc.stack([ alloc.reflow("I am partway through parsing a parenthesized type:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"I was expecting to see an expression next."), alloc.reflow(r"Note, Roc doesn't use '()' as a null type."), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3118,7 +3191,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "EMPTY PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3135,7 +3208,7 @@ fn to_tinparens_report<'a>( alloc.reflow( r"I am partway through parsing a type in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow(r"I was expecting to see a tag name."), hint_for_tag_name(alloc), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3144,13 +3217,13 @@ fn to_tinparens_report<'a>( filename, doc, title: "WEIRD TAG NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } _ => { let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a type in parentheses, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow( r"I was expecting to see a closing parenthesis before this, so try adding a ", diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3164,7 +3237,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3179,7 +3252,7 @@ fn to_tinparens_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I just started parsing a type in parentheses, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow(r"Tag unions look like "), alloc.parser_suggestion("[Many I64, None],"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3192,7 +3265,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3206,7 +3279,7 @@ fn to_tinparens_report<'a>( alloc.reflow( "I am partway through parsing a type in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(surroundings, region), + alloc.region_with_subregion(surroundings, region, severity), alloc.concat([ alloc.reflow("I need this parenthesis to be indented more. Try adding more spaces before it!"), ]), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3216,7 +3289,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "NEED MORE INDENTATION".to_string(), - severity: Severity::RuntimeError, + severity, } } None => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3227,7 +3300,7 @@ fn to_tinparens_report<'a>( alloc.reflow( r"I am partway through parsing a type in parentheses, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I was expecting to see a parenthesis "), alloc.reflow("before this, so try adding a "), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3241,7 +3314,7 @@ fn to_tinparens_report<'a>( filename, doc, title: "UNFINISHED PARENTHESES".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3259,6 +3332,7 @@ fn to_tapply_report<'a>( _start: Position, ) -> Report<'a> { use roc_parse::parser::ETypeApply; + let severity = Severity::RuntimeError; match *parse_problem { ETypeApply::DoubleDot(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3266,7 +3340,7 @@ fn to_tapply_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I encountered two dots in a row:"), - alloc.region(region), + alloc.region(region, severity), alloc.concat([alloc.reflow("Try removing one of them.")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3274,7 +3348,7 @@ fn to_tapply_report<'a>( filename, doc, title: "DOUBLE DOT".to_string(), - severity: Severity::RuntimeError, + severity, } } ETypeApply::TrailingDot(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3282,7 +3356,7 @@ fn to_tapply_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I encountered a dot with nothing after it:"), - alloc.region(region), + alloc.region(region, severity), alloc.concat([ alloc.reflow("Dots are used to refer to a type in a qualified way, like "), alloc.parser_suggestion("Num.I64"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3296,7 +3370,7 @@ fn to_tapply_report<'a>( filename, doc, title: "TRAILING DOT".to_string(), - severity: Severity::RuntimeError, + severity, } } ETypeApply::StartIsNumber(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3304,7 +3378,7 @@ fn to_tapply_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I encountered a number at the start of a qualified name segment:"), - alloc.region(region), + alloc.region(region, severity), alloc.concat([ alloc.reflow("All parts of a qualified type name must start with an uppercase letter, like "), alloc.parser_suggestion("Num.I64"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3318,7 +3392,7 @@ fn to_tapply_report<'a>( filename, doc, title: "WEIRD QUALIFIED NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } ETypeApply::StartNotUppercase(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3326,7 +3400,7 @@ fn to_tapply_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I encountered a lowercase letter at the start of a qualified name segment:"), - alloc.region(region), + alloc.region(region, severity), alloc.concat([ alloc.reflow("All parts of a qualified type name must start with an uppercase letter, like "), alloc.parser_suggestion("Num.I64"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3340,7 +3414,7 @@ fn to_tapply_report<'a>( filename, doc, title: "WEIRD QUALIFIED NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3351,14 +3425,14 @@ fn to_tapply_report<'a>( alloc.reflow( r"I reached the end of the input file while parsing a qualified type name", ), - alloc.region(region), + alloc.region(region, severity), ]); Report { filename, doc, title: "END OF FILE".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3373,6 +3447,7 @@ fn to_talias_report<'a>( parse_problem: &roc_parse::parser::ETypeInlineAlias, ) -> Report<'a> { use roc_parse::parser::ETypeInlineAlias; + let severity = Severity::RuntimeError; match *parse_problem { ETypeInlineAlias::NotAnAlias(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3384,7 +3459,7 @@ fn to_talias_report<'a>( alloc.keyword("as"), alloc.reflow(" is not a type alias:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("Inline alias types must start with an uppercase identifier and be followed by zero or more type arguments, like "), alloc.type_str("Point"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3398,7 +3473,7 @@ fn to_talias_report<'a>( filename, doc, title: "NOT AN INLINE ALIAS".to_string(), - severity: Severity::RuntimeError, + severity, } } ETypeInlineAlias::Qualified(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3406,7 +3481,7 @@ fn to_talias_report<'a>( let doc = alloc.stack([ alloc.reflow(r"This type alias has a qualified name:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("An alias introduces a new name to the current scope, so it must be unqualified."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3414,7 +3489,7 @@ fn to_talias_report<'a>( filename, doc, title: "QUALIFIED ALIAS NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } ETypeInlineAlias::ArgumentNotLowercase(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3422,7 +3497,7 @@ fn to_talias_report<'a>( let doc = alloc.stack([ alloc.reflow(r"This alias type argument is not lowercase:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("All type arguments must be lowercase."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3430,7 +3505,7 @@ fn to_talias_report<'a>( filename, doc, title: "TYPE ARGUMENT NOT LOWERCASE".to_string(), - severity: Severity::RuntimeError, + severity, } } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3445,6 +3520,8 @@ fn to_header_report<'a>( ) -> Report<'a> { use roc_parse::parser::EHeader; + let severity = Severity::RuntimeError; + match parse_problem { EHeader::Provides(provides, pos) => { to_provides_report(alloc, lines, filename, provides, *pos) diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3470,7 +3547,7 @@ fn to_header_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("I may be confused by indentation.")]), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3478,7 +3555,7 @@ fn to_header_report<'a>( filename, doc, title: "INCOMPLETE HEADER".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3494,7 +3571,11 @@ fn to_header_report<'a>( let preamble = if is_utf8 { vec![ alloc.reflow(r"I am expecting a header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion( + lines.convert_region(surroundings), + region, + severity, + ), ] } else { vec![alloc.reflow(r"I am expecting a header, but the file is not UTF-8 encoded.")] diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3516,7 +3597,7 @@ fn to_header_report<'a>( filename, doc, title: "MISSING HEADER".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3526,7 +3607,7 @@ fn to_header_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a module name next, like "), alloc.parser_suggestion("BigNum"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3540,7 +3621,7 @@ fn to_header_report<'a>( filename, doc, title: "WEIRD MODULE NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3549,7 +3630,7 @@ fn to_header_report<'a>( alloc.reflow( r"This module name does not correspond with the file path it is defined in:", ), - alloc.region(lines.convert_region(*region)), + alloc.region(lines.convert_region(*region), severity), alloc.concat([ alloc.reflow("Module names must correspond with the file paths they are defined in. For example, I expect to see "), alloc.parser_suggestion("BigNum"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3567,7 +3648,7 @@ fn to_header_report<'a>( filename, doc, title: "WEIRD MODULE NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3577,7 +3658,7 @@ fn to_header_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting an application name next, like "), alloc.parser_suggestion("app \"main\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3591,7 +3672,7 @@ fn to_header_report<'a>( filename, doc, title: "WEIRD APP NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3601,7 +3682,7 @@ fn to_header_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a package header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a package name next, like "), alloc.parser_suggestion("\"roc/core\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3613,7 +3694,7 @@ fn to_header_report<'a>( filename, doc, title: "INVALID PACKAGE NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3624,7 +3705,7 @@ fn to_header_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a platform header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a platform name next, like "), alloc.parser_suggestion("\"roc/core\""), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3636,7 +3717,7 @@ fn to_header_report<'a>( filename, doc, title: "INVALID PLATFORM NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3647,7 +3728,7 @@ fn to_header_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a type name next, like "), alloc.parser_suggestion("Effect"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3659,7 +3740,7 @@ fn to_header_report<'a>( filename, doc, title: "WEIRD GENERATED TYPE NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } EHeader::GeneratesWith(generates_with, pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3677,6 +3758,8 @@ fn to_generates_with_report<'a>( ) -> Report<'a> { use roc_parse::parser::EGeneratesWith; + let severity = Severity::RuntimeError; + match *parse_problem { EGeneratesWith::ListEnd(pos) | // TODO: give this its own error message EGeneratesWith::Identifier(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3686,7 +3769,7 @@ fn to_generates_with_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a provides list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow( "I was expecting a type name, value name or function name next, like", )]), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3699,7 +3782,7 @@ fn to_generates_with_report<'a>( filename, doc, title: "WEIRD GENERATES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3709,7 +3792,7 @@ fn to_generates_with_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("with"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3724,7 +3807,7 @@ fn to_generates_with_report<'a>( filename, doc, title: "WEIRD GENERATES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3743,6 +3826,8 @@ fn to_provides_report<'a>( ) -> Report<'a> { use roc_parse::parser::EProvides; + let severity = Severity::RuntimeError; + match *parse_problem { EProvides::ListEnd(pos) | // TODO: give this its own error message EProvides::Identifier(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3752,7 +3837,7 @@ fn to_provides_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a provides list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow( "I was expecting a type name, value name or function name next, like", )]), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3765,7 +3850,7 @@ fn to_provides_report<'a>( filename, doc, title: "WEIRD PROVIDES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3775,7 +3860,7 @@ fn to_provides_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("provides"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3790,7 +3875,7 @@ fn to_provides_report<'a>( filename, doc, title: "WEIRD PROVIDES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3802,7 +3887,7 @@ fn to_provides_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("to"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3817,7 +3902,7 @@ fn to_provides_report<'a>( filename, doc, title: "WEIRD PROVIDES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3827,7 +3912,7 @@ fn to_provides_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.reflow("I am expecting the platform name next, like:"), alloc .parser_suggestion("to pf") diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3838,7 +3923,7 @@ fn to_provides_report<'a>( filename, doc, title: "WEIRD PROVIDES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3855,6 +3940,8 @@ fn to_params_report<'a>( ) -> Report<'a> { use roc_parse::parser::EParams; + let severity = Severity::RuntimeError; + match parse_problem { EParams::Pattern(error, pos) => to_precord_report(alloc, lines, filename, error, *pos), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3865,7 +3952,7 @@ fn to_params_report<'a>( let doc = alloc.stack([ alloc .reflow(r"I am partway through parsing a module header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting "), alloc.keyword("->"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3880,7 +3967,7 @@ fn to_params_report<'a>( filename, doc, title: "WEIRD MODULE PARAMS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3897,6 +3984,8 @@ fn to_exposes_report<'a>( ) -> Report<'a> { use roc_parse::parser::EExposes; + let severity = Severity::RuntimeError; + match *parse_problem { EExposes::ListEnd(pos) | // TODO: give this its own error message EExposes::Identifier(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3905,7 +3994,7 @@ fn to_exposes_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing an `exposes` list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow( "I was expecting a type name, value name or function name next, like", )]), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3918,7 +4007,7 @@ fn to_exposes_report<'a>( filename, doc, title: "WEIRD EXPOSES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3928,7 +4017,7 @@ fn to_exposes_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("exposes"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3943,7 +4032,7 @@ fn to_exposes_report<'a>( filename, doc, title: "WEIRD EXPOSES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3962,6 +4051,8 @@ fn to_imports_report<'a>( ) -> Report<'a> { use roc_parse::parser::EImports; + let severity = Severity::RuntimeError; + match *parse_problem { EImports::Identifier(pos) => { let surroundings = Region::new(start, pos); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3969,7 +4060,7 @@ fn to_imports_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a imports list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow( "I was expecting a type name, value name or function name next, like ", )]), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3982,7 +4073,7 @@ fn to_imports_report<'a>( filename, doc, title: "WEIRD IMPORTS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3992,7 +4083,7 @@ fn to_imports_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("imports"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4007,7 +4098,7 @@ fn to_imports_report<'a>( filename, doc, title: "WEIRD IMPORTS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4019,7 +4110,7 @@ fn to_imports_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a module name next, like "), alloc.parser_suggestion("BigNum"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4033,7 +4124,7 @@ fn to_imports_report<'a>( filename, doc, title: "WEIRD MODULE NAME".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4043,7 +4134,7 @@ fn to_imports_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a imports list, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("I am expecting a comma or end of list, like")]), alloc.parser_suggestion("imports [Shape, Vector]").indent(4), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4052,7 +4143,7 @@ fn to_imports_report<'a>( filename, doc, title: "WEIRD IMPORTS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4069,6 +4160,8 @@ fn to_requires_report<'a>( ) -> Report<'a> { use roc_parse::parser::ERequires; + let severity = Severity::RuntimeError; + match *parse_problem { ERequires::Requires(pos) => { let surroundings = Region::new(start, pos); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4076,7 +4169,7 @@ fn to_requires_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("requires"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4091,7 +4184,7 @@ fn to_requires_report<'a>( filename, doc, title: "MISSING REQUIRES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4103,7 +4196,7 @@ fn to_requires_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("requires"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4118,7 +4211,7 @@ fn to_requires_report<'a>( filename, doc, title: "MISSING REQUIRES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4128,7 +4221,7 @@ fn to_requires_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a list of rigids like "), alloc.keyword("{}"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4147,7 +4240,7 @@ fn to_requires_report<'a>( filename, doc, title: "BAD REQUIRES RIGIDS".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4157,7 +4250,7 @@ fn to_requires_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting a list of type names like "), alloc.keyword("{}"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4176,7 +4269,7 @@ fn to_requires_report<'a>( filename, doc, title: "BAD REQUIRES".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4193,6 +4286,8 @@ fn to_packages_report<'a>( ) -> Report<'a> { use roc_parse::parser::EPackages; + let severity = Severity::RuntimeError; + match *parse_problem { EPackages::Packages(pos) => { let surroundings = Region::new(start, pos); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4200,7 +4295,7 @@ fn to_packages_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I am partway through parsing a header, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([ alloc.reflow("I am expecting the "), alloc.keyword("packages"), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4213,7 +4308,7 @@ fn to_packages_report<'a>( filename, doc, title: "MISSING PACKAGES".to_string(), - severity: Severity::RuntimeError, + severity, } } EPackages::ListEnd(pos) => { diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4224,7 +4319,7 @@ fn to_packages_report<'a>( alloc.reflow( r"I am partway through parsing a list of packages, but I got stuck here:", ), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), alloc.concat([alloc.reflow("I am expecting a comma or end of list, like")]), alloc .parser_suggestion("packages { package_name: \"url-or-path\", }") diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4235,7 +4330,7 @@ fn to_packages_report<'a>( filename, doc, title: "WEIRD PACKAGES LIST".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4254,13 +4349,15 @@ fn to_space_report<'a>( ) -> Report<'a> { use roc_parse::parser::BadInputError; + let severity = Severity::RuntimeError; + match parse_problem { BadInputError::HasTab => { let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); let doc = alloc.stack([ alloc.reflow("I encountered a tab character:"), - alloc.region(region), + alloc.region(region, severity), alloc.reflow( "Tab characters are not allowed in Roc code. Please use spaces instead!", ), diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4270,7 +4367,7 @@ fn to_space_report<'a>( filename, doc, title: "TAB CHARACTER".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4279,7 +4376,7 @@ fn to_space_report<'a>( let doc = alloc.stack([ alloc.reflow("I encountered an ASCII control character:"), - alloc.region(region), + alloc.region(region, severity), alloc.reflow("ASCII control characters are not allowed."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4287,7 +4384,7 @@ fn to_space_report<'a>( filename, doc, title: "ASCII CONTROL CHARACTER".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4296,7 +4393,7 @@ fn to_space_report<'a>( let doc = alloc.stack([ alloc.reflow(r"I encountered a stray carriage return (\r):"), - alloc.region(region), + alloc.region(region, severity), alloc.reflow(r"A carriage return (\r) has to be followed by a newline (\n)."), ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4304,7 +4401,7 @@ fn to_space_report<'a>( filename, doc, title: "MISPLACED CARRIAGE RETURN".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4374,10 +4471,11 @@ fn to_unfinished_ability_report<'a>( ) -> Report<'a> { let surroundings = Region::new(start, pos); let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); + let severity = Severity::RuntimeError; let doc = alloc.stack([ alloc.reflow(r"I was partway through parsing an ability definition, but I got stuck here:"), - alloc.region_with_subregion(lines.convert_region(surroundings), region), + alloc.region_with_subregion(lines.convert_region(surroundings), region, severity), message, ]); diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -4385,7 +4483,7 @@ fn to_unfinished_ability_report<'a>( filename, doc, title: "UNFINISHED ABILITY".to_string(), - severity: Severity::RuntimeError, + severity, } } diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -85,7 +85,7 @@ pub fn type_problem<'b>( UnfulfilledAbility(incomplete) => { let title = "INCOMPLETE ABILITY IMPLEMENTATION".to_string(); - let doc = report_unfulfilled_ability(alloc, lines, incomplete); + let doc = report_unfulfilled_ability(alloc, lines, incomplete, severity); report(title, doc, filename) } diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -96,9 +96,9 @@ pub fn type_problem<'b>( let incomplete = incomplete .into_iter() - .map(|unfulfilled| report_unfulfilled_ability(alloc, lines, unfulfilled)); + .map(|unfulfilled| report_unfulfilled_ability(alloc, lines, unfulfilled, severity)); let note = alloc.stack(incomplete); - let snippet = alloc.region(lines.convert_region(region)); + let snippet = alloc.region(lines.convert_region(region), severity); let stack = [ alloc.text( "This expression has a type that does not implement the abilities it's expected to:", diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -118,9 +118,9 @@ pub fn type_problem<'b>( BadPatternMissingAbility(region, _category, _found, incomplete) => { let incomplete = incomplete .into_iter() - .map(|unfulfilled| report_unfulfilled_ability(alloc, lines, unfulfilled)); + .map(|unfulfilled| report_unfulfilled_ability(alloc, lines, unfulfilled, severity)); let note = alloc.stack(incomplete); - let snippet = alloc.region(lines.convert_region(region)); + let snippet = alloc.region(lines.convert_region(region), severity); let stack = [ alloc.text( "This expression has a type does not implement the abilities it's expected to:", diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -139,7 +139,7 @@ pub fn type_problem<'b>( } Exhaustive(problem) => Some(exhaustive_problem(alloc, lines, filename, problem)), CircularDef(entries) => { - let doc = to_circular_def_doc(alloc, lines, &entries); + let doc = to_circular_def_doc(alloc, lines, &entries, severity); let title = CIRCULAR_DEF.to_string(); Some(Report { diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -161,7 +161,7 @@ pub fn type_problem<'b>( alloc.symbol_unqualified(member), alloc.reflow(" is for a non-opaque type:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("It is specialized for"), alloc.type_block(error_type_to_doc(alloc, typ)), alloc.reflow("but structural types can never specialize abilities!"), diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -191,7 +191,7 @@ pub fn type_problem<'b>( alloc.symbol_unqualified(ability_member), alloc.reflow(" is not for the expected type:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.concat([ alloc.reflow("It was previously claimed to be a specialization for "), alloc.symbol_unqualified(expected_opaque), diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -254,6 +254,7 @@ fn report_unfulfilled_ability<'a>( alloc: &'a RocDocAllocator<'a>, lines: &LineInfo, unfulfilled: Unfulfilled, + severity: Severity, ) -> RocDocBuilder<'a> { match unfulfilled { Unfulfilled::OpaqueDoesNotImplement { typ, ability } => { diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -302,7 +303,7 @@ fn report_unfulfilled_ability<'a>( alloc.symbol_foreign_qualified(opaque), alloc.reflow(":"), ]), - alloc.region(lines.convert_region(derive_region)), + alloc.region(lines.convert_region(derive_region), severity), ] .into_iter() .chain(reason) diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -446,6 +447,7 @@ pub fn cyclic_alias<'b>( region: roc_region::all::Region, others: Vec<Symbol>, alias_kind: AliasKind, + severity: Severity, ) -> (RocDocBuilder<'b>, String) { let when_is_recursion_legal = alloc.reflow("Recursion in ") diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -460,7 +462,7 @@ pub fn cyclic_alias<'b>( .append(alloc.reflow(" ")) .append(alloc.reflow(alias_kind.as_str())) .append(alloc.reflow(" is self-recursive in an invalid way:")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), when_is_recursion_legal, ]) } else { diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -471,7 +473,7 @@ pub fn cyclic_alias<'b>( .append(alloc.reflow(" ")) .append(alloc.reflow(alias_kind.as_str())) .append(alloc.reflow(" is recursive in an invalid way:")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc .reflow("The ") .append(alloc.symbol_unqualified(symbol)) diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -515,9 +517,10 @@ fn report_mismatch<'b>( alloc.region_with_subregion( lines.convert_region(highlight), lines.convert_region(region), + severity, ) } else { - alloc.region(lines.convert_region(region)) + alloc.region(lines.convert_region(region), severity) }; let lines = vec![ problem, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -559,9 +562,10 @@ fn report_bad_type<'b>( alloc.region_with_subregion( lines.convert_region(highlight), lines.convert_region(region), + severity, ) } else { - alloc.region(lines.convert_region(region)) + alloc.region(lines.convert_region(region), severity) }; let lines = vec![ problem, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -664,7 +668,7 @@ fn to_expr_report<'b>( title: "TYPE MISMATCH".to_string(), doc: alloc.stack([ alloc.text("This expression is used in an unexpected way:"), - alloc.region(lines.convert_region(expr_region)), + alloc.region(lines.convert_region(expr_region), severity), comparison, ]), severity, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -786,6 +790,7 @@ fn to_expr_report<'b>( alloc.region_with_subregion( lines.convert_region(joined), lines.convert_region(expr_region), + severity, ) }, comparison, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1138,7 +1143,7 @@ fn to_expr_report<'b>( " is an opaque type, so it cannot be called with an argument:", ), ]), - alloc.region(lines.convert_region(expr_region)), + alloc.region(lines.convert_region(expr_region), severity), match called_via { CalledVia::RecordBuilder => { alloc.hint("Did you mean to apply it to a function first?") diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1160,7 +1165,7 @@ fn to_expr_report<'b>( } )), ]), - alloc.region(lines.convert_region(expr_region)), + alloc.region(lines.convert_region(expr_region), severity), match called_via { CalledVia::RecordBuilder => { alloc.concat([ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1208,7 +1213,7 @@ fn to_expr_report<'b>( arity )), ]), - alloc.region(lines.convert_region(expr_region)), + alloc.region(lines.convert_region(expr_region), severity), alloc.reflow("Are there any missing commas? Or missing parentheses?"), ]; diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1232,7 +1237,7 @@ fn to_expr_report<'b>( arity )), ]), - alloc.region(lines.convert_region(expr_region)), + alloc.region(lines.convert_region(expr_region), severity), alloc.reflow( "Roc does not allow functions to be partially applied. \ Use a closure to make partial application explicit.", diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1407,6 +1412,7 @@ fn to_expr_report<'b>( let snippet = alloc.region_with_subregion( lines.convert_region(region), lines.convert_region(expr_region), + severity, ); let this_is = alloc.concat([ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1460,7 +1466,7 @@ fn to_expr_report<'b>( .append(alloc.text(" argument to ")) .append(name.clone()) .append(alloc.text(" is weird:")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), pattern_type_comparison( alloc, expected_type, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1501,7 +1507,7 @@ fn to_expr_report<'b>( .reflow("This value passed to ") .append(alloc.keyword("crash")) .append(alloc.reflow(" is not a string:")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), type_comparison( alloc, found, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1915,7 +1921,7 @@ fn to_pattern_report<'b>( PExpected::NoExpectation(expected_type) => { let doc = alloc.stack([ alloc.text("This pattern is being used in an unexpected way:"), - alloc.region(lines.convert_region(expr_region)), + alloc.region(lines.convert_region(expr_region), severity), pattern_type_comparison( alloc, found, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1948,7 +1954,7 @@ fn to_pattern_report<'b>( .append(alloc.text(" argument to ")) .append(name.clone()) .append(alloc.text(" is weird:")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), pattern_type_comparison( alloc, found, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1986,6 +1992,7 @@ fn to_pattern_report<'b>( alloc.region_with_subregion( lines.convert_region(region), lines.convert_region(expr_region), + severity, ), pattern_type_comparison( alloc, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -2030,6 +2037,7 @@ fn to_pattern_report<'b>( alloc.region_with_subregion( lines.convert_region(region), lines.convert_region(expr_region), + severity, ), pattern_type_comparison( alloc, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -2059,7 +2067,7 @@ fn to_pattern_report<'b>( PReason::ListElem => { let doc = alloc.stack([ alloc.concat([alloc.reflow("This list element doesn't match the types of other elements in the pattern:")]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), pattern_type_comparison( alloc, found, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -2170,7 +2178,7 @@ fn to_circular_report<'b>( .reflow("I'm inferring a weird self-referential type for ") .append(alloc.symbol_unqualified(symbol)) .append(alloc.text(":")), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.stack([ alloc.reflow( "Here is my best effort at writing down the type. \ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -4810,7 +4818,7 @@ fn report_record_field_typo<'b>( let doc = alloc.stack([ header, - alloc.region(lines.convert_region(field_region)), + alloc.region(lines.convert_region(field_region), severity), if suggestions.is_empty() { let r_doc = match opt_sym { Some(symbol) => alloc.symbol_unqualified(symbol).append(" is"), diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -4875,7 +4883,7 @@ fn exhaustive_problem<'a>( BadArg => { let doc = alloc.stack([ alloc.reflow("This pattern does not cover all the possibilities:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Other possibilities include:"), unhandled_patterns_to_doc_block(alloc, missing), alloc.concat([ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -4898,7 +4906,7 @@ fn exhaustive_problem<'a>( BadDestruct => { let doc = alloc.stack([ alloc.reflow("This pattern does not cover all the possibilities:"), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Other possibilities include:"), unhandled_patterns_to_doc_block(alloc, missing), alloc.concat([ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -4926,7 +4934,7 @@ fn exhaustive_problem<'a>( alloc.keyword("when"), alloc.reflow(" does not cover all the possibilities:"), ]), - alloc.region(lines.convert_region(region)), + alloc.region(lines.convert_region(region), severity), alloc.reflow("Other possibilities include:"), unhandled_patterns_to_doc_block(alloc, missing), alloc.reflow( diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -4958,6 +4966,7 @@ fn exhaustive_problem<'a>( alloc.region_with_subregion( lines.convert_region(overall_region), lines.convert_region(branch_region), + severity, ), alloc.reflow( "Any value of this shape will be handled by \ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -4986,6 +4995,7 @@ fn exhaustive_problem<'a>( alloc.region_with_subregion( lines.convert_region(overall_region), lines.convert_region(branch_region), + severity, ), alloc.reflow( "It's impossible to create a value of this shape, \ diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -223,6 +223,7 @@ pub struct Palette { pub bold: &'static str, pub underline: &'static str, pub reset: &'static str, + pub warning: &'static str, } /// Set the default styles for various semantic elements, diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -250,6 +251,7 @@ const fn default_palette_from_style_codes(codes: StyleCodes) -> Palette { bold: codes.bold, underline: codes.underline, reset: codes.reset, + warning: codes.yellow, } } diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -679,6 +681,7 @@ impl<'a> RocDocAllocator<'a> { &'a self, region: LineColumnRegion, sub_region: LineColumnRegion, + severity: Severity, ) -> DocBuilder<'a, Self, Annotation> { // debug_assert!(region.contains(&sub_region)); diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -688,10 +691,15 @@ impl<'a> RocDocAllocator<'a> { // attempting this will recurse forever, so don't do that! Instead, give up and // accept that this report will take up more than 1 full screen. if !sub_region.contains(&region) { - return self.region_with_subregion(sub_region, sub_region); + return self.region_with_subregion(sub_region, sub_region, severity); } } + let annotation = match severity { + Severity::RuntimeError | Severity::Fatal => Annotation::Error, + Severity::Warning => Annotation::Warning, + }; + // if true, the final line of the snippet will be some ^^^ that point to the region where // the problem is. Otherwise, the snippet will have a > on the lines that are in the region // where the problem is. diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -731,7 +739,7 @@ impl<'a> RocDocAllocator<'a> { self.text(" ".repeat(max_line_number_length - this_line_number_length)) .append(self.text(line_number).annotate(Annotation::LineNumber)) .append(self.text(GUTTER_BAR).annotate(Annotation::GutterBar)) - .append(self.text(">").annotate(Annotation::Error)) + .append(self.text(">").annotate(annotation)) .append(rest_of_line) } else if error_highlight_line { self.text(" ".repeat(max_line_number_length - this_line_number_length)) diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -773,7 +781,7 @@ impl<'a> RocDocAllocator<'a> { } else { self.text(" ".repeat(sub_region.start().column as usize)) .indent(indent) - .append(self.text(highlight_text).annotate(Annotation::Error)) + .append(self.text(highlight_text).annotate(annotation)) }); result = result.append(highlight_line); diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -782,8 +790,12 @@ impl<'a> RocDocAllocator<'a> { result } - pub fn region(&'a self, region: LineColumnRegion) -> DocBuilder<'a, Self, Annotation> { - self.region_with_subregion(region, region) + pub fn region( + &'a self, + region: LineColumnRegion, + severity: Severity, + ) -> DocBuilder<'a, Self, Annotation> { + self.region_with_subregion(region, region, severity) } pub fn region_without_error( diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -896,6 +908,7 @@ pub enum Annotation { Tip, Header, ParserSuggestion, + Warning, } /// Render with minimal formatting diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -1109,6 +1122,9 @@ where ParserSuggestion => { self.write_str(self.palette.parser_suggestion)?; } + Warning => { + self.write_str(self.palette.warning)?; + } TypeBlock | InlineTypeBlock | Tag | RecordField | TupleElem => { /* nothing yet */ } } self.style_stack.push(*annotation); diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -1124,7 +1140,7 @@ where Emphasized | Url | TypeVariable | Alias | Symbol | BinOp | UnaryOp | Error | GutterBar | Ellipsis | Typo | TypoSuggestion | ParserSuggestion | Structure | CodeBlock | PlainText | LineNumber | Tip | Module | Shorthand | Header - | Keyword => { + | Keyword | Warning => { self.write_str(self.palette.reset)?; }
roc-lang__roc-6794
6,794
Extra warning: it does look like this change [requires changing many lines of code](https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/Use.20yellow.20underline.20in.20warnings.20.236771/near/442066162).
[ "6771" ]
0.0
roc-lang/roc
2024-06-09T17:29:24Z
diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -4772,7 +4772,7 @@ mod test_reporting { // TODO investigate this test. It was disabled in https://github.com/roc-lang/roc/pull/6634 // as the way Defs without final expressions are handled. The changes probably shouldn't have // changed this error report. The exact same test_syntax test for this has not changed, so - // we know the parser is parsing thesame thing. Therefore the way the AST is desugared must be + // we know the parser is parsing the same thing. Therefore the way the AST is desugared must be // the cause of the change in error report. // test_report!( // def_missing_final_expression, diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -8163,7 +8163,7 @@ In roc, functions are always written as a lambda, like{} "# ), // TODO(opaques): error could be improved by saying that the opaque definition demands - // that the argument be a U8, and linking to the definitin! + // that the argument be a U8, and linking to the definition! @r#" ── TYPE MISMATCH in /code/proj/Main.roc ──────────────────────────────────────── diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -13579,7 +13579,7 @@ In roc, functions are always written as a lambda, like{} 4│ crash "" "" ^^^^^ - `crash` must be given exacly one message to crash with. + `crash` must be given exactly one message to crash with. "# );
Use yellow underline in warnings We currently use `^^^^^^` in red to underline both in errors and warnings, we should use yellow (the same we use for the warning counter) in warnings. I believe changes to be made mainly in crates/reporting. I think this is feasible as good first issue, but talk to us on [zulip](https://roc.zulipchat.com/) if you need help.
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::crash_overapplied" ]
[ "test_reporting::ability_demand_value_has_args", "test_reporting::ability_non_signature_expression", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::argument_without_space", "test_reporting::always_function", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::apply_unary_negative", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::ability_specialization_is_duplicated", "test_reporting::alias_in_implements_clause", "test_reporting::ability_not_on_toplevel", "test_reporting::ability_specialization_is_unused", "test_reporting::annotation_definition_mismatch", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_shadows_ability", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::bad_double_rigid", "test_reporting::annotation_newline_body_is_fine", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::ability_specialization_is_incomplete", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::apply_opaque_as_function", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::apply_unary_not", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::alias_using_alias", "test_reporting::ability_member_binds_parent_twice", "test_reporting::backpassing_type_error", "test_reporting::bad_rigid_function", "test_reporting::comment_with_control_character", "test_reporting::comment_with_tab", "test_reporting::bad_numeric_literal_suffix", "test_reporting::bad_rigid_value", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::call_with_underscore_identifier", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::boolean_tag", "test_reporting::call_with_undeclared_identifier_starting_with_underscore", "test_reporting::cannot_derive_eq_for_function", "test_reporting::bool_vs_true_tag", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::cannot_eq_functions", "test_reporting::dbg_without_final_expression", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::cannot_derive_hash_for_function", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::cannot_not_eq_functions", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::bool_vs_false_tag", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::circular_type", "test_reporting::circular_definition_self", "test_reporting::call_with_declared_identifier_starting_with_underscore", "test_reporting::closure_underscore_ident", "test_reporting::circular_definition", "test_reporting::crash_unapplied", "test_reporting::concat_different_types", "test_reporting::compare_unsigned_to_signed", "test_reporting::crash_given_non_string", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::cycle_through_non_function_top_level", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::cyclic_opaque", "test_reporting::demanded_vs_optional_record_field", "test_reporting::cycle_through_non_function", "test_reporting::derive_decoding_for_function", "test_reporting::derive_decoding_for_tuple", "test_reporting::double_plus", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_eq_for_f64", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_encoding_for_tuple", "test_reporting::elm_function_syntax", "test_reporting::empty_or_pattern", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_eq_for_f32", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_eq_for_function", "test_reporting::error_inline_alias_qualified", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::exposes_identifier", "test_reporting::expect_without_final_expression", "test_reporting::derive_eq_for_tag", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::derive_hash_for_record", "test_reporting::derive_hash_for_function", "test_reporting::derive_hash_for_tag", "test_reporting::expression_indentation_end", "test_reporting::derive_eq_for_record", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::derive_hash_for_tuple", "test_reporting::double_equals_in_def", "test_reporting::derive_non_builtin_ability", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::dict_type_formatting", "test_reporting::different_phantom_types", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::elem_in_list", "test_reporting::error_nested_wildcards_are_related", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::error_wildcards_are_related", "test_reporting::eq_binop_is_transparent", "test_reporting::first_wildcard_is_required", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::expect_expr_type_error", "test_reporting::expected_tag_has_too_many_args", "test_reporting::float_malformed", "test_reporting::fncall_overapplied", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::fncall_underapplied", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::forgot_to_remove_underscore", "test_reporting::fncall_value", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::float_literal_has_int_suffix", "test_reporting::from_annotation_complex_pattern", "test_reporting::float_out_of_range", "test_reporting::from_annotation_function", "test_reporting::from_annotation_when", "test_reporting::function_arity_mismatch_nested_too_many", "test_reporting::if_missing_else", "test_reporting::if_guard_without_condition", "test_reporting::function_arity_mismatch_too_few", "test_reporting::function_arity_mismatch_too_many", "test_reporting::function_arity_mismatch_nested_too_few", "test_reporting::from_annotation_if", "test_reporting::imports_missing_comma", "test_reporting::if_outdented_then", "test_reporting::function_does_not_implement_encoding", "test_reporting::guard_mismatch_with_annotation", "test_reporting::gt_binop_is_transparent", "test_reporting::function_cannot_derive_encoding", "test_reporting::geq_binop_is_transparent", "test_reporting::ingested_file_import_ann_syntax_err", "test_reporting::i64_overflow", "test_reporting::has_clause_not_on_toplevel", "test_reporting::inline_hastype", "test_reporting::i16_underflow", "test_reporting::i16_overflow", "test_reporting::i128_overflow", "test_reporting::i64_underflow", "test_reporting::i8_underflow", "test_reporting::has_encoding_for_function", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::invalid_app_name", "test_reporting::i32_underflow", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::invalid_operator", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::if_2_branch_mismatch", "test_reporting::i32_overflow", "test_reporting::i8_overflow", "test_reporting::if_3_branch_mismatch", "test_reporting::if_condition_not_bool", "test_reporting::implements_type_not_ability", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::incorrect_optional_field", "test_reporting::inference_var_in_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::inference_var_too_many_in_alias", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::int_frac", "test_reporting::int_literal_has_float_suffix", "test_reporting::invalid_num_fn", "test_reporting::lambda_leading_comma", "test_reporting::lambda_double_comma", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::integer_empty", "test_reporting::integer_malformed", "test_reporting::invalid_num", "test_reporting::invalid_toplevel_cycle", "test_reporting::invalid_record_update", "test_reporting::list_double_comma", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::integer_out_of_range", "test_reporting::invalid_tag_extension_type", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::issue_1755", "test_reporting::invalid_record_extension_type", "test_reporting::issue_2326", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::issue_2380_alias_with_vars", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::issue_2380_typed_body", "test_reporting::issue_2458", "test_reporting::keyword_qualified_import", "test_reporting::keyword_record_field_access", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::leq_binop_is_transparent", "test_reporting::issue_6279", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_pattern_not_terminated", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_without_end", "test_reporting::list_get_negative_number", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::lowercase_import_alias", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_spread_as", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_with_guard", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_spread_redundant_front_back", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::malformed_hex_pattern", "test_reporting::malformed_oct_pattern", "test_reporting::malformed_int_pattern", "test_reporting::malformed_float_pattern", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_record_annotation", "test_reporting::malformed_bin_pattern", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_dec", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::lt_binop_is_transparent", "test_reporting::missing_imports", "test_reporting::mismatched_suffix_f64", "test_reporting::list_match_spread_required_front_back", "test_reporting::missing_provides_in_app_header", "test_reporting::module_params_with_missing_arrow", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_f32", "test_reporting::mismatched_suffix_i32", "test_reporting::multi_no_end", "test_reporting::multi_insufficient_indent", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::multiple_record_builders", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::module_ident_ends_with_dot", "test_reporting::module_not_imported", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::negative_u8", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::multiple_wildcards_in_alias", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::missing_fields", "test_reporting::mismatched_suffix_u8", "test_reporting::mutual_recursion_not_reached", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::negative_u32", "test_reporting::neq_binop_is_transparent", "test_reporting::negative_u128", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::negative_u64", "test_reporting::negative_u16", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::nested_datatype", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::nested_datatype_inline", "test_reporting::optional_field_in_record_builder", "test_reporting::non_exhaustive_with_guard", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::nested_specialization", "test_reporting::number_double_dot", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::numer_literal_multi_suffix", "test_reporting::not_enough_cases_for_open_union", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::num_too_general_named", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::num_too_general_wildcard", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::pattern_binds_keyword", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_ref_field_access", "test_reporting::pattern_in_parens_end", "test_reporting::opaque_ability_impl_optional", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::pattern_in_parens_indent_open", "test_reporting::opaque_ability_impl_qualified", "test_reporting::pattern_in_parens_end_comma", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_mismatch_check", "test_reporting::pattern_in_parens_open", "test_reporting::opaque_type_not_in_scope", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::optional_record_default_type_error", "test_reporting::platform_requires_rigids", "test_reporting::optional_record_default_with_signature", "test_reporting::optional_record_invalid_access", "test_reporting::optional_record_invalid_let_binding", "test_reporting::optional_record_invalid_accessor", "test_reporting::optional_record_invalid_function", "test_reporting::optional_record_invalid_when", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::provides_missing_to_in_app_header", "test_reporting::provides_to_missing_platform_in_app_header", "test_reporting::provides_to_identifier", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::patterns_int_redundant", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_let_mismatch", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::pattern_when_condition", "test_reporting::patterns_let_not_exhaustive", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::record_builder_in_module_params", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::pattern_when_pattern", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::phantom_type_variable", "test_reporting::record_type_carriage_return", "test_reporting::patterns_record_not_exhaustive", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::patterns_when_not_exhaustive", "test_reporting::record_type_keyword_field_name", "test_reporting::record_type_missing_comma", "test_reporting::record_type_open", "test_reporting::record_type_end", "test_reporting::pizza_parens_middle", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::record_type_open_indent", "test_reporting::record_update_builder", "test_reporting::record_type_tab", "test_reporting::report_module_color", "test_reporting::record_update_in_module_params", "test_reporting::report_region_in_color", "test_reporting::pizza_parens_right", "test_reporting::plus_on_str", "test_reporting::polymorphic_mutual_recursion", "test_reporting::report_value_color", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::polymorphic_recursion", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::qualified_tag", "test_reporting::qualified_opaque_reference", "test_reporting::record_builder_apply_non_function", "test_reporting::record_access_ends_with_dot", "test_reporting::record_duplicate_field_multiline", "test_reporting::record_duplicate_field_different_types", "test_reporting::record_update_value", "test_reporting::record_type_duplicate_field", "test_reporting::record_duplicate_field_same_type", "test_reporting::record_field_mismatch", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::report_precedence_problem_single_line", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::single_no_end", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::report_precedence_problem_multiline", "test_reporting::single_quote_too_long", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::recursion_var_specialization_error", "test_reporting::report_shadowing", "test_reporting::tag_union_end", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::report_shadowing_in_annotation", "test_reporting::tag_union_open", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::report_unused_def", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::type_annotation_double_colon", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::type_apply_stray_dot", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::same_phantom_types_unify", "test_reporting::type_argument_no_arrow", "test_reporting::type_double_comma", "test_reporting::self_recursive_alias", "test_reporting::second_wildcard_is_redundant", "test_reporting::type_in_parens_end", "test_reporting::type_in_parens_start", "test_reporting::self_recursive_not_reached", "test_reporting::type_inline_alias", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::self_recursive_not_reached_nested", "test_reporting::stray_dot_expr", "test_reporting::specialization_for_wrong_type", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::shift_by_negative", "test_reporting::shadowing_top_level_scope", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::tag_union_duplicate_tag", "test_reporting::unfinished_import", "test_reporting::tag_mismatch", "test_reporting::unfinished_import_alias", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::unfinished_ingested_file_name", "test_reporting::unfinished_import_as_or_exposing", "test_reporting::unfinished_import_exposing", "test_reporting::unfinished_import_exposing_name", "test_reporting::unicode_not_hex", "test_reporting::tag_with_arguments_mismatch", "test_reporting::type_apply_start_with_lowercase", "test_reporting::tag_missing", "test_reporting::tags_missing", "test_reporting::unknown_shorthand_in_app", "test_reporting::unknown_shorthand_no_deps", "test_reporting::too_many_type_arguments", "test_reporting::too_few_type_arguments", "test_reporting::type_apply_double_dot", "test_reporting::tuple_exhaustiveness_good", "test_reporting::two_different_cons", "test_reporting::type_apply_trailing_dot", "test_reporting::typo_lowercase_ok", "test_reporting::type_apply_start_with_number", "test_reporting::u16_overflow", "test_reporting::u8_overflow", "test_reporting::u32_overflow", "test_reporting::typo_uppercase_ok", "test_reporting::unapplied_record_builder", "test_reporting::u64_overflow", "test_reporting::unbound_var_in_alias", "test_reporting::weird_escape", "test_reporting::weird_import_params_record", "test_reporting::underscore_in_middle_of_identifier", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::underscore_in_alias", "test_reporting::when_missing_arrow", "test_reporting::unimported_modules_reported", "test_reporting::when_outdented_branch", "test_reporting::when_over_indented_int", "test_reporting::when_over_indented_underscore", "test_reporting::wild_case_arrow", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::unicode_too_large", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::unify_alias_other", "test_reporting::unnecessary_extension_variable", "test_reporting::unknown_type", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::unused_value_import", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::unused_arg_and_unused_def", "test_reporting::update_empty_record", "test_reporting::unused_argument", "test_reporting::update_record", "test_reporting::unused_shadow_specialization", "test_reporting::unwrap_num_elem_in_list", "test_reporting::unused_def_in_branch_pattern", "test_reporting::update_record_ext", "test_reporting::update_record_snippet", "test_reporting::weird_accessor", "test_reporting::when_branch_mismatch", "test_reporting::value_not_exposed", "test_reporting::when_if_guard", "test_reporting::wildcard_in_opaque", "test_reporting::wildcard_in_alias", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::applied_tag_function", "test_reporting::alias_type_diff" ]
[]
[]
2024-06-11T20:23:57Z
db94b555ab1946ad6bfdb5314a11ba67d9b1d1da
diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -576,6 +576,8 @@ pub fn unwrap_suffixed_expression_when_help<'a>( Err(..) => return Err(EUnwrapped::Malformed), }; + // TODO: unwrap guard + let new_branch = WhenBranch{value: *unwrapped_branch_value, patterns, guard: *guard}; let mut new_branches = Vec::new_in(arena); let (before, rest) = branches.split_at(branch_index); diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -621,7 +621,9 @@ pub fn is_expr_suffixed(expr: &Expr) -> bool { } Expr::LowLevelDbg(_, a, b) => is_expr_suffixed(&a.value) || is_expr_suffixed(&b.value), Expr::UnaryOp(a, _) => is_expr_suffixed(&a.value), - Expr::When(a, _) => is_expr_suffixed(&a.value), + Expr::When(cond, branches) => { + is_expr_suffixed(&cond.value) || branches.iter().any(|x| is_when_branch_suffixed(x)) + } Expr::SpaceBefore(a, _) => is_expr_suffixed(a), Expr::SpaceAfter(a, _) => is_expr_suffixed(a), Expr::MalformedIdent(_, _) => false, diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -633,6 +635,14 @@ pub fn is_expr_suffixed(expr: &Expr) -> bool { } } +fn is_when_branch_suffixed(branch: &WhenBranch<'_>) -> bool { + is_expr_suffixed(&branch.value.value) + || branch + .guard + .map(|x| is_expr_suffixed(&x.value)) + .unwrap_or(false) +} + fn is_assigned_value_suffixed<'a>(value: &AssignedField<'a, Expr<'a>>) -> bool { match value { AssignedField::RequiredValue(_, _, a) | AssignedField::OptionalValue(_, _, a) => {
roc-lang__roc-6786
6,786
``` roc nightly pre-release, built from commit 33075285b72 on Wed May 22 09:12:12 UTC 2024 ``` Mac Silicon Thanks for the bug report! @Anton-4 please assign it to me
[ "6778" ]
0.0
roc-lang/roc
2024-06-03T21:04:43Z
diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -865,6 +865,21 @@ mod suffixed_tests { r#"Defs { tags: [Index(2147483648)], regions: [@0-55], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-55 Expect(@30-36 Apply(@32-34 Var { module_name: "Bool", ident: "isEq" }, [@30-31 Num("1"), @35-36 Num("2")], BinOp(Equals)), @53-55 Var { module_name: "", ident: "x" }))] }"#, ); } + + #[test] + fn deep_when() { + run_test( + r#" + main = + when a is + 0 -> + when b is + 1 -> + c! + "#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-159], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-159 When(@28-29 Var { module_name: "", ident: "a" }, [WhenBranch { patterns: [@53-54 NumLiteral("0")], value: @82-159 When(@87-88 Var { module_name: "", ident: "b" }, [WhenBranch { patterns: [@120-121 NumLiteral("1")], value: @157-159 Var { module_name: "", ident: "c" }, guard: None }]), guard: None }]))] }"#, + ); + } } #[cfg(test)]
An internal compiler expectation was broken Code ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br" } import pf.Stdout import pf.Task import pf.Http main = request = { method: Get, headers: [], url: "https://google.com", mimeType: "", body: [], timeout: TimeoutMilliseconds 5000, } resp = Http.send! request output = when resp |> Http.handleStringResponse is Err err -> when err is HttpError e -> Inspect.inspect! e _ -> crash (Http.errorToString err) Ok body -> body Stdout.line output ``` ```bash ~/ RUST_BACKTRACE=full roc An internal compiler expectation was broken. This is definitely a compiler bug. Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose thread '<unnamed>' panicked at crates/compiler/can/src/expr.rs:1130:41: a Expr::TaskAwaitBang expression was not completed removed in desugar_value_def_suffixed stack backtrace: 0: 0x10531316c - __mh_execute_header 1: 0x10475344c - __mh_execute_header 2: 0x10530f150 - __mh_execute_header 3: 0x105312f64 - __mh_execute_header 4: 0x105314680 - __mh_execute_header 5: 0x10531437c - __mh_execute_header 6: 0x105314c84 - __mh_execute_header 7: 0x105314a34 - __mh_execute_header 8: 0x105313604 - __mh_execute_header 9: 0x1053147f4 - __mh_execute_header 10: 0x1069f03dc - __ZN4llvm15SmallVectorBaseIyE8grow_podEPvmm 11: 0x1049dc590 - __mh_execute_header 12: 0x1049dacac - __mh_execute_header 13: 0x1049e0ea4 - __mh_execute_header 14: 0x1049d8c70 - __mh_execute_header 15: 0x1049e0ea4 - __mh_execute_header 16: 0x1049d8c70 - __mh_execute_header 17: 0x1049b8c7c - __mh_execute_header 18: 0x1049abf0c - __mh_execute_header 19: 0x1049ddaa4 - __mh_execute_header 20: 0x1049d729c - __mh_execute_header 21: 0x1049fa410 - __mh_execute_header 22: 0x1049d8acc - __mh_execute_header 23: 0x1049d7e18 - __mh_execute_header 24: 0x1049ddb64 - __mh_execute_header 25: 0x1049d729c - __mh_execute_header 26: 0x1049b8c7c - __mh_execute_header 27: 0x1049abf0c - __mh_execute_header 28: 0x1049e9770 - __mh_execute_header 29: 0x104e36e88 - __mh_execute_header 30: 0x104e3b148 - __mh_execute_header 31: 0x104dc40f4 - __mh_execute_header 32: 0x104db01e8 - __mh_execute_header 33: 0x104dc330c - __mh_execute_header 34: 0x105319c48 - __mh_execute_header 35: 0x18cf8a034 - __pthread_joiner_wake There was an unrecoverable error in the Roc compiler. The `roc check` command can sometimes give a more helpful error report than other commands. ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "suffixed_tests::deep_when" ]
[ "suffixed_tests::apply_argument_multiple", "suffixed_tests::apply_argument_single", "suffixed_tests::apply_argument_suffixed", "suffixed_tests::defs_suffixed_middle", "suffixed_tests::apply_function_suffixed", "suffixed_tests::closure_with_defs", "suffixed_tests::bang_in_pipe_root", "suffixed_tests::simple_pizza", "suffixed_tests::when_branches", "suffixed_tests::when_simple", "test_suffixed_helpers::test_matching_answer", "suffixed_tests::nested_simple", "suffixed_tests::multiple_def_first_suffixed", "suffixed_tests::multi_defs_stmts", "suffixed_tests::expect_then_bang", "suffixed_tests::basic", "suffixed_tests::trailing_suffix_inside_when", "suffixed_tests::body_parens_apply", "suffixed_tests::if_complex", "suffixed_tests::nested_complex", "suffixed_tests::trailing_binops", "test_suffixed_helpers::test_matching_answer_task_ok", "suffixed_tests::var_suffixes", "suffixed_tests::last_suffixed_single", "suffixed_tests::closure_simple", "suffixed_tests::if_simple", "suffixed_tests::closure_with_annotations", "suffixed_tests::multiple_suffix", "suffixed_tests::dbg_simple", "suffixed_tests::last_suffixed_multiple" ]
[]
[]
2024-06-04T05:53:35Z
674b9348215118a7c977d0685979d850d3a5f649
diff --git a/crates/compiler/can/src/expr.rs b/crates/compiler/can/src/expr.rs --- a/crates/compiler/can/src/expr.rs +++ b/crates/compiler/can/src/expr.rs @@ -1127,7 +1127,7 @@ pub fn canonicalize_expr<'a>( output, ) } - ast::Expr::TaskAwaitBang(..) => internal_error!("a Expr::TaskAwaitBang expression was not completed removed in desugar_value_def_suffixed"), + ast::Expr::TaskAwaitBang(..) => internal_error!("a Expr::TaskAwaitBang expression was not completely removed in desugar_value_def_suffixed"), ast::Expr::Tag(tag) => { let variant_var = var_store.fresh(); let ext_var = var_store.fresh(); diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -170,6 +170,41 @@ pub fn unwrap_suffixed_expression<'a>( } } + Expr::Expect(condition, continuation) => { + if is_expr_suffixed(&condition.value) { + // we cannot unwrap a suffixed expression within expect + // e.g. expect (foo! "bar") + return Err(EUnwrapped::Malformed); + } + + match unwrap_suffixed_expression(arena, continuation, maybe_def_pat) { + Ok(unwrapped_expr) => { + let new_expect = arena + .alloc(Loc::at(loc_expr.region, Expect(condition, unwrapped_expr))); + return Ok(new_expect); + } + Err(EUnwrapped::UnwrappedDefExpr(unwrapped_expr)) => { + let new_expect = arena + .alloc(Loc::at(loc_expr.region, Expect(condition, unwrapped_expr))); + Err(EUnwrapped::UnwrappedDefExpr(new_expect)) + } + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg: unwrapped_expr, + sub_pat, + sub_new, + }) => { + let new_expect = arena + .alloc(Loc::at(loc_expr.region, Expect(condition, unwrapped_expr))); + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg: new_expect, + sub_pat, + sub_new, + }) + } + Err(EUnwrapped::Malformed) => Err(EUnwrapped::Malformed), + } + } + // we only need to unwrap some expressions, leave the rest as is _ => Ok(loc_expr), }
roc-lang__roc-6785
6,785
Thank you for logging this bug. @kdziamura Found the root cause. Please assign it to me
[ "6784" ]
0.0
roc-lang/roc
2024-06-03T15:07:40Z
diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -853,6 +853,18 @@ mod suffixed_tests { r##"Defs { tags: [Index(2147483648)], regions: [@0-52], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @27-34 Apply(@27-34 Var { module_name: "Task", ident: "await" }, [@27-28 Var { module_name: "", ident: "a" }, @27-34 Closure([@27-28 Identifier { ident: "#!a0" }], @27-34 Defs(Defs { tags: [Index(2147483650)], regions: [@27-34], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@23-24 Identifier { ident: "c" }, @27-34 Apply(@33-34 Var { module_name: "", ident: "b" }, [@27-28 TaskAwaitBang(Var { module_name: "", ident: "a" })], BinOp(Pizza))), Body(@23-24 Identifier { ident: "c" }, @27-34 Apply(@33-34 Var { module_name: "", ident: "b" }, [@27-28 Var { module_name: "", ident: "#!a0" }], BinOp(Pizza))), Body(@23-24 Identifier { ident: "c" }, @27-34 Apply(@33-34 Var { module_name: "", ident: "b" }, [@27-28 Var { module_name: "", ident: "#!a0" }], BinOp(Pizza)))] }, @51-52 Var { module_name: "", ident: "c" }))], BangSuffix))] }"##, ); } + + #[test] + fn expect_then_bang() { + run_test( + r#" + main = + expect 1 == 2 + x! + "#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-55], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-55 Expect(@30-36 Apply(@32-34 Var { module_name: "Bool", ident: "isEq" }, [@30-31 Num("1"), @35-36 Num("2")], BinOp(Equals)), @53-55 Var { module_name: "", ident: "x" }))] }"#, + ); + } } #[cfg(test)]
Expect statements breaks with "a Expr::TaskAwaitBang expression was not completed removed in desugar_value_def_suffixed" I'm just doing what the error told me and reporting the issue :smile: I added `expect 1 == 2` to the first line of the my main function and got the following error when running `roc dev` ```sh An internal compiler expectation was broken. This is definitely a compiler bug. Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose thread '<unnamed>' panicked at crates/compiler/can/src/expr.rs:1130:41: a Expr::TaskAwaitBang expression was not completed removed in desugar_value_def_suffixed note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace There was an unrecoverable error in the Roc compiler. The `roc check` command can sometimes give a more helpful error report than other commands. ``` The LSP is giving me this error ```sh Diagnostics: 1. INDENT ENDS AFTER EXPRESSION I am partway through parsing an expression, but I got stuck here: 9│ expect 1 == ^ Looks like the indentation ends prematurely here. Did you mean to have another expression after this line? ``` ## Source Code ```roc app "hello" packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br" } imports [pf.Stdout, pf.Task] provides [main] to pf total = addAndStringify { birds: -5, iguanas: 7 } main = expect 1 == 2 Stdout.line! "There are $(total) animals." ## This is a test ## ## x = 2 addAndStringify = \counts -> dbg "test" sum = counts.birds + counts.iguanas if sum == 0 then "" else Num.toStr sum expect temp = addAndStringify { birds: 1, iguanas: 1} temp == "2" ``` ## This is my roc version ``` roc nightly pre-release, built from commit 9fcd5a3 on Mo 27 Mai 2024 09:01:55 UTC ``` ## OS info ```sh Operating System: Ubuntu 22.04.4 LTS Kernel: Linux 6.5.0-35-generic ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "suffixed_tests::expect_then_bang" ]
[ "suffixed_tests::dbg_simple", "suffixed_tests::closure_simple", "suffixed_tests::apply_argument_multiple", "suffixed_tests::multiple_def_first_suffixed", "suffixed_tests::multiple_suffix", "suffixed_tests::last_suffixed_multiple", "suffixed_tests::multi_defs_stmts", "suffixed_tests::nested_complex", "suffixed_tests::if_simple", "suffixed_tests::nested_simple", "suffixed_tests::simple_pizza", "suffixed_tests::when_branches", "suffixed_tests::when_simple", "test_suffixed_helpers::test_matching_answer", "test_suffixed_helpers::test_matching_answer_task_ok", "suffixed_tests::closure_with_annotations", "suffixed_tests::body_parens_apply", "suffixed_tests::basic", "suffixed_tests::last_suffixed_single", "suffixed_tests::apply_function_suffixed", "suffixed_tests::var_suffixes", "suffixed_tests::if_complex", "suffixed_tests::bang_in_pipe_root", "suffixed_tests::apply_argument_single", "suffixed_tests::closure_with_defs", "suffixed_tests::defs_suffixed_middle", "suffixed_tests::apply_argument_suffixed", "suffixed_tests::trailing_suffix_inside_when", "suffixed_tests::trailing_binops" ]
[]
[]
2024-06-03T16:39:25Z
8818b37fa256ed7508f024761af595c7722e45fe
diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -122,11 +122,52 @@ pub fn unwrap_suffixed_expression<'a>( Expr::SpaceBefore(..) | Expr::SpaceAfter(..) => { internal_error!( "SpaceBefore and SpaceAfter should have been removed in desugar_expr" - ) + ); } Expr::BinOps(..) => { - internal_error!("BinOps should have been desugared in desugar_expr") + internal_error!("BinOps should have been desugared in desugar_expr"); + } + + Expr::LowLevelDbg(moduel, arg, rest) => { + if is_expr_suffixed(&arg.value) { + // we cannot unwrap a suffixed expression within dbg + // e.g. dbg (foo! "bar") + return Err(EUnwrapped::Malformed); + } + + match unwrap_suffixed_expression(arena, rest, maybe_def_pat) { + Ok(unwrapped_expr) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(moduel, arg, unwrapped_expr), + )); + return Ok(new_dbg); + } + Err(EUnwrapped::UnwrappedDefExpr(unwrapped_expr)) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(moduel, arg, unwrapped_expr), + )); + Err(EUnwrapped::UnwrappedDefExpr(new_dbg)) + } + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg: unwrapped_expr, + sub_pat, + sub_new, + }) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(moduel, arg, unwrapped_expr), + )); + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg: new_dbg, + sub_pat, + sub_new, + }) + } + Err(EUnwrapped::Malformed) => Err(EUnwrapped::Malformed), + } } // we only need to unwrap some expressions, leave the rest as is diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -610,7 +610,7 @@ pub fn is_expr_suffixed(expr: &Expr) -> bool { Expr::Expect(a, b) | Expr::Dbg(a, b) => { is_expr_suffixed(&a.value) || is_expr_suffixed(&b.value) } - Expr::LowLevelDbg(_, _, _) => todo!(), + Expr::LowLevelDbg(_, a, b) => is_expr_suffixed(&a.value) || is_expr_suffixed(&b.value), Expr::UnaryOp(a, _) => is_expr_suffixed(&a.value), Expr::When(a, _) => is_expr_suffixed(&a.value), Expr::SpaceBefore(a, _) => is_expr_suffixed(a),
roc-lang__roc-6712
6,712
[ "6672" ]
0.0
roc-lang/roc
2024-05-04T19:40:33Z
diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -775,6 +775,35 @@ mod suffixed_tests { r#"Defs { tags: [Index(2147483648)], regions: [@0-226], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @32-43 Apply(@32-43 Var { module_name: "Task", ident: "await" }, [@32-43 Var { module_name: "Stdin", ident: "line" }, @32-43 Closure([@23-29 Identifier { ident: "result" }], @61-226 When(@66-72 Var { module_name: "", ident: "result" }, [WhenBranch { patterns: [@96-99 Tag("End")], value: @127-137 Apply(@127-134 Var { module_name: "Task", ident: "ok" }, [@135-137 Record([])], Space), guard: None }, WhenBranch { patterns: [@159-169 Apply(@159-164 Tag("Input"), [@165-169 Identifier { ident: "name" }])], value: @197-226 Apply(@197-226 Var { module_name: "Stdout", ident: "line" }, [@210-226 Str(Line([Plaintext("Hello, "), Interpolated(@220-224 Var { module_name: "", ident: "name" })]))], Space), guard: None }]))], BangSuffix))] }"#, ); } + + /* + main = + foo = getFoo! + dbg foo + bar foo + + main = + Task.await getFoo \foo -> + dbg foo + bar! foo + + main = + Task.await getFoo \foo -> + dbg foo + bar foo + */ + #[test] + fn dbg_simple() { + run_test( + r#" + main = + foo = getFoo! + dbg foo + bar! foo + "#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-85], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @29-36 Apply(@29-36 Var { module_name: "Task", ident: "await" }, [@29-36 Var { module_name: "", ident: "getFoo" }, @29-36 Closure([@23-26 Identifier { ident: "foo" }], @53-85 LowLevelDbg(("test.roc:4", " "), @57-60 Apply(@57-60 Var { module_name: "Inspect", ident: "toStr" }, [@57-60 Var { module_name: "", ident: "foo" }], Space), @77-85 Apply(@77-85 Var { module_name: "", ident: "bar" }, [@82-85 Var { module_name: "", ident: "foo" }], Space)))], BangSuffix))] }"#, + ); + } } #[cfg(test)]
`!` and `dbg` statements interfere with each other Needs further investigation. When using multiple `dbg` and `!` statements in a def, they can interfere with each other.
e819c954d393eb3223dd5961556d07ce21b29831
[ "suffixed_tests::dbg_simple" ]
[ "suffixed_tests::body_parens_apply", "suffixed_tests::basic", "suffixed_tests::closure_simple", "suffixed_tests::if_simple", "suffixed_tests::apply_argument_suffixed", "suffixed_tests::multiple_def_first_suffixed", "suffixed_tests::nested_complex", "suffixed_tests::defs_suffixed_middle", "suffixed_tests::if_complex", "suffixed_tests::last_suffixed_multiple", "suffixed_tests::var_suffixes", "suffixed_tests::simple_pizza", "suffixed_tests::nested_simple", "suffixed_tests::trailing_suffix_inside_when", "suffixed_tests::when_branches", "suffixed_tests::last_suffixed_single", "suffixed_tests::multi_defs_stmts", "suffixed_tests::apply_function_suffixed", "suffixed_tests::closure_with_annotations", "suffixed_tests::trailing_binops", "suffixed_tests::closure_with_defs", "test_suffixed_helpers::test_matching_answer", "suffixed_tests::multiple_suffix", "test_suffixed_helpers::test_matching_answer_task_ok", "suffixed_tests::when_simple" ]
[]
[]
2024-05-04T21:00:52Z
05823cd1a03ac3ce0d39706dfd77b7a7b8a8c908
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2196,6 +2196,7 @@ version = "0.0.1" dependencies = [ "bumpalo", "indoc", + "regex", "roc_build", "roc_cli", "roc_repl_cli", diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -210,33 +210,7 @@ fn main() -> io::Result<()> { threading, ) { Ok((problems, total_time)) => { - println!( - "\x1B[{}m{}\x1B[39m {} and \x1B[{}m{}\x1B[39m {} found in {} ms.", - if problems.errors == 0 { - 32 // green - } else { - 33 // yellow - }, - problems.errors, - if problems.errors == 1 { - "error" - } else { - "errors" - }, - if problems.warnings == 0 { - 32 // green - } else { - 33 // yellow - }, - problems.warnings, - if problems.warnings == 1 { - "warning" - } else { - "warnings" - }, - total_time.as_millis(), - ); - + problems.print_to_stdout(total_time); Ok(problems.exit_code()) } diff --git a/crates/cli_utils/src/helpers.rs b/crates/cli_utils/src/helpers.rs --- a/crates/cli_utils/src/helpers.rs +++ b/crates/cli_utils/src/helpers.rs @@ -98,22 +98,6 @@ pub fn path_to_binary(binary_name: &str) -> PathBuf { path } -pub fn strip_colors(str: &str) -> String { - use roc_reporting::report::ANSI_STYLE_CODES; - - str.replace(ANSI_STYLE_CODES.red, "") - .replace(ANSI_STYLE_CODES.green, "") - .replace(ANSI_STYLE_CODES.yellow, "") - .replace(ANSI_STYLE_CODES.blue, "") - .replace(ANSI_STYLE_CODES.magenta, "") - .replace(ANSI_STYLE_CODES.cyan, "") - .replace(ANSI_STYLE_CODES.white, "") - .replace(ANSI_STYLE_CODES.bold, "") - .replace(ANSI_STYLE_CODES.underline, "") - .replace(ANSI_STYLE_CODES.reset, "") - .replace(ANSI_STYLE_CODES.color_reset, "") -} - pub fn run_roc_with_stdin<I, S>(args: I, stdin_vals: &[&str]) -> Out where I: IntoIterator<Item = S>, diff --git a/crates/repl_cli/src/lib.rs b/crates/repl_cli/src/lib.rs --- a/crates/repl_cli/src/lib.rs +++ b/crates/repl_cli/src/lib.rs @@ -6,7 +6,7 @@ use const_format::concatcp; use roc_load::MonomorphizedModule; use roc_mono::ir::OptLevel; use roc_repl_eval::gen::Problems; -use roc_repl_ui::colors::{BLUE, END_COL, PINK}; +use roc_repl_ui::colors::{CYAN, END_COL}; use roc_repl_ui::repl_state::{ReplAction, ReplState}; use roc_repl_ui::{format_output, is_incomplete, CONT_PROMPT, PROMPT, SHORT_INSTRUCTIONS, TIPS}; use roc_reporting::report::{ANSI_STYLE_CODES, DEFAULT_PALETTE}; diff --git a/crates/repl_cli/src/lib.rs b/crates/repl_cli/src/lib.rs --- a/crates/repl_cli/src/lib.rs +++ b/crates/repl_cli/src/lib.rs @@ -21,11 +21,8 @@ use crate::cli_gen::eval_llvm; pub const WELCOME_MESSAGE: &str = concatcp!( "\n The rockin' ", - BLUE, - "roc repl", - END_COL, - "\n", - PINK, + CYAN, + "roc repl\n", "────────────────────────", END_COL, "\n\n" diff --git a/crates/repl_ui/src/colors.rs b/crates/repl_ui/src/colors.rs --- a/crates/repl_ui/src/colors.rs +++ b/crates/repl_ui/src/colors.rs @@ -6,7 +6,6 @@ const STYLE_CODES: StyleCodes = if cfg!(target_family = "wasm") { ANSI_STYLE_CODES }; -pub const BLUE: &str = STYLE_CODES.blue; -pub const PINK: &str = STYLE_CODES.magenta; pub const GREEN: &str = STYLE_CODES.green; +pub const CYAN: &str = STYLE_CODES.cyan; pub const END_COL: &str = STYLE_CODES.reset; diff --git a/crates/repl_ui/src/lib.rs b/crates/repl_ui/src/lib.rs --- a/crates/repl_ui/src/lib.rs +++ b/crates/repl_ui/src/lib.rs @@ -4,19 +4,17 @@ pub mod colors; pub mod repl_state; use bumpalo::Bump; -use colors::{BLUE, END_COL, PINK}; +use colors::{CYAN, END_COL, GREEN}; use const_format::concatcp; use repl_state::{parse_src, ParseOutcome}; use roc_parse::ast::{Expr, ValueDef}; use roc_repl_eval::gen::{Problems, ReplOutput}; use roc_reporting::report::StyleCodes; -use crate::colors::GREEN; - // TODO add link to repl tutorial (does not yet exist). pub const TIPS: &str = concatcp!( "\nEnter an expression to evaluate, or a definition (like ", - BLUE, + CYAN, "x = 1", END_COL, ") to use later.\n\n", diff --git a/crates/repl_ui/src/lib.rs b/crates/repl_ui/src/lib.rs --- a/crates/repl_ui/src/lib.rs +++ b/crates/repl_ui/src/lib.rs @@ -25,25 +23,25 @@ pub const TIPS: &str = concatcp!( } else { // We use ctrl-v + ctrl-j for newlines because on Unix, terminals cannot distinguish between Shift-Enter and Enter concatcp!( - BLUE, + CYAN, " - ", END_COL, - PINK, + GREEN, "ctrl-v", END_COL, " + ", - PINK, + GREEN, "ctrl-j", END_COL, " makes a newline\n", - BLUE, + CYAN, " - ", END_COL, GREEN, ":q", END_COL, " quits\n", - BLUE, + CYAN, " - ", END_COL, GREEN, diff --git a/crates/repl_ui/src/lib.rs b/crates/repl_ui/src/lib.rs --- a/crates/repl_ui/src/lib.rs +++ b/crates/repl_ui/src/lib.rs @@ -57,8 +55,8 @@ pub const TIPS: &str = concatcp!( // For when nothing is entered in the repl // TODO add link to repl tutorial(does not yet exist). pub const SHORT_INSTRUCTIONS: &str = "Enter an expression, or :help, or :q to quit.\n\n"; -pub const PROMPT: &str = concatcp!(BLUE, "»", END_COL, " "); -pub const CONT_PROMPT: &str = concatcp!(BLUE, "…", END_COL, " "); +pub const PROMPT: &str = concatcp!(CYAN, "»", END_COL, " "); +pub const CONT_PROMPT: &str = concatcp!(CYAN, "…", END_COL, " "); pub fn is_incomplete(input: &str) -> bool { let arena = Bump::new(); diff --git a/crates/repl_ui/src/lib.rs b/crates/repl_ui/src/lib.rs --- a/crates/repl_ui/src/lib.rs +++ b/crates/repl_ui/src/lib.rs @@ -116,7 +114,7 @@ pub fn format_output( { buf.push('\n'); buf.push_str(&expr); - buf.push_str(style_codes.magenta); // Color for the type separator + buf.push_str(style_codes.green); // Color for the type separator buf.push_str(EXPR_TYPE_SEPARATOR); buf.push_str(style_codes.reset); buf.push_str(&expr_type); diff --git a/crates/reporting/src/cli.rs b/crates/reporting/src/cli.rs --- a/crates/reporting/src/cli.rs +++ b/crates/reporting/src/cli.rs @@ -6,6 +6,8 @@ use roc_problem::can::Problem; use roc_region::all::LineInfo; use roc_solve_problem::TypeError; +use crate::report::ANSI_STYLE_CODES; + #[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] pub struct Problems { pub fatally_errored: bool, diff --git a/crates/reporting/src/cli.rs b/crates/reporting/src/cli.rs --- a/crates/reporting/src/cli.rs +++ b/crates/reporting/src/cli.rs @@ -26,11 +28,11 @@ impl Problems { } pub fn print_to_stdout(&self, total_time: std::time::Duration) { - const GREEN: usize = 32; - const YELLOW: usize = 33; + const GREEN: &str = ANSI_STYLE_CODES.green; + const YELLOW: &str = ANSI_STYLE_CODES.yellow; print!( - "\x1B[{}m{}\x1B[39m {} and \x1B[{}m{}\x1B[39m {} found in {} ms", + "{}{}\x1B[39m {} and {}{}\x1B[39m {} found in {} ms", match self.errors { 0 => GREEN, _ => YELLOW, diff --git a/crates/reporting/src/cli.rs b/crates/reporting/src/cli.rs --- a/crates/reporting/src/cli.rs +++ b/crates/reporting/src/cli.rs @@ -54,6 +56,39 @@ impl Problems { } } +// prints e.g. `1 error and 0 warnings found in 63 ms.` +pub fn print_error_warning_count( + error_count: usize, + warning_count: usize, + total_time: std::time::Duration, +) { + const GREEN: &str = ANSI_STYLE_CODES.green; + const YELLOW: &str = ANSI_STYLE_CODES.yellow; + + print!( + "{}{}\x1B[39m {} and {}{}\x1B[39m {} found in {} ms", + match error_count { + 0 => GREEN, + _ => YELLOW, + }, + error_count, + match error_count { + 1 => "error", + _ => "errors", + }, + match warning_count { + 0 => GREEN, + _ => YELLOW, + }, + warning_count, + match warning_count { + 1 => "warning", + _ => "warnings", + }, + total_time.as_millis() + ); +} + pub fn report_problems( sources: &MutMap<ModuleId, (PathBuf, Box<str>)>, interns: &Interns, diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -219,7 +219,7 @@ const fn default_palette_from_style_codes(codes: StyleCodes) -> Palette { code_block: codes.white, keyword: codes.green, ellipsis: codes.green, - variable: codes.blue, + variable: codes.cyan, type_variable: codes.yellow, structure: codes.green, alias: codes.yellow, diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -249,8 +249,6 @@ pub struct StyleCodes { pub red: &'static str, pub green: &'static str, pub yellow: &'static str, - pub blue: &'static str, - pub magenta: &'static str, pub cyan: &'static str, pub white: &'static str, pub bold: &'static str, diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -260,12 +258,10 @@ pub struct StyleCodes { } pub const ANSI_STYLE_CODES: StyleCodes = StyleCodes { - red: "\u{001b}[31m", - green: "\u{001b}[32m", - yellow: "\u{001b}[33m", - blue: "\u{001b}[34m", - magenta: "\u{001b}[35m", - cyan: "\u{001b}[36m", + red: "\u{001b}[1;31m", + green: "\u{001b}[1;32m", + yellow: "\u{001b}[1;33m", + cyan: "\u{001b}[1;36m", white: "\u{001b}[37m", bold: "\u{001b}[1m", underline: "\u{001b}[4m", diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -283,8 +279,6 @@ pub const HTML_STYLE_CODES: StyleCodes = StyleCodes { red: html_color!("red"), green: html_color!("green"), yellow: html_color!("yellow"), - blue: html_color!("blue"), - magenta: html_color!("magenta"), cyan: html_color!("cyan"), white: html_color!("white"), bold: "<span class='bold'>",
roc-lang__roc-6525
6,525
I would like to take a look at this. It looks like we can use brighter colors out of 256 colors if terminal supports them (otherwise fallbacks to ansi colors). Oh so we can't simply check environment variables as `STYLE_CODES` is a global variable. Let's change colors in the variable into something brighter from 256 color palette assuming most of terminals today are 256-color compatible. Sounds good @hirotake111 :) I'll assign you to the issue
[ "6512" ]
0.0
roc-lang/roc
2024-02-14T17:05:12Z
diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -440,6 +440,7 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> { use roc_build::program::report_problems_monomorphized; use roc_load::{ExecutionMode, FunctionKind, LoadConfig, LoadMonomorphizedError}; use roc_packaging::cache; + use roc_reporting::report::ANSI_STYLE_CODES; use roc_target::TargetInfo; let start_time = Instant::now(); diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -541,7 +542,7 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> { let mut writer = std::io::stdout(); - let (failed, passed) = roc_repl_expect::run::run_toplevel_expects( + let (failed_count, passed_count) = roc_repl_expect::run::run_toplevel_expects( &mut writer, roc_reporting::report::RenderTarget::ColorTerminal, arena, diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -555,7 +556,7 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> { let total_time = start_time.elapsed(); - if failed == 0 && passed == 0 { + if failed_count == 0 && passed_count == 0 { // TODO print this in a more nicely formatted way! println!("No expectations were found."); diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -566,18 +567,20 @@ pub fn test(matches: &ArgMatches, triple: Triple) -> io::Result<i32> { // running tests altogether! Ok(2) } else { - let failed_color = if failed == 0 { - 32 // green + let failed_color = if failed_count == 0 { + ANSI_STYLE_CODES.green } else { - 31 // red + ANSI_STYLE_CODES.red }; + let passed_color = ANSI_STYLE_CODES.green; + println!( - "\n\x1B[{failed_color}m{failed}\x1B[39m failed and \x1B[32m{passed}\x1B[39m passed in {} ms.\n", + "\n{failed_color}{failed_count}\x1B[39m failed and {passed_color}{passed_count}\x1B[39m passed in {} ms.\n", total_time.as_millis(), ); - Ok((failed > 0) as i32) + Ok((failed_count > 0) as i32) } } diff --git a/crates/cli/tests/cli_run.rs b/crates/cli/tests/cli_run.rs --- a/crates/cli/tests/cli_run.rs +++ b/crates/cli/tests/cli_run.rs @@ -11,12 +11,13 @@ extern crate roc_module; mod cli_run { use cli_utils::helpers::{ extract_valgrind_errors, file_path_from_root, fixture_file, fixtures_dir, has_error, - known_bad_file, run_cmd, run_roc, run_with_valgrind, strip_colors, Out, ValgrindError, + known_bad_file, run_cmd, run_roc, run_with_valgrind, Out, ValgrindError, ValgrindErrorXWhat, }; use const_format::concatcp; use indoc::indoc; use roc_cli::{CMD_BUILD, CMD_CHECK, CMD_DEV, CMD_FORMAT, CMD_RUN, CMD_TEST}; + use roc_reporting::report::strip_colors; use roc_test_utils::assert_multiline_str_eq; use serial_test::serial; use std::iter; diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -462,11 +462,9 @@ mod test_reporting { fn human_readable(str: &str) -> String { str.replace(ANSI_STYLE_CODES.red, "<red>") .replace(ANSI_STYLE_CODES.white, "<white>") - .replace(ANSI_STYLE_CODES.blue, "<blue>") .replace(ANSI_STYLE_CODES.yellow, "<yellow>") .replace(ANSI_STYLE_CODES.green, "<green>") .replace(ANSI_STYLE_CODES.cyan, "<cyan>") - .replace(ANSI_STYLE_CODES.magenta, "<magenta>") .replace(ANSI_STYLE_CODES.reset, "<reset>") .replace(ANSI_STYLE_CODES.bold, "<bold>") .replace(ANSI_STYLE_CODES.underline, "<underline>") diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -759,7 +757,7 @@ mod test_reporting { &DEFAULT_PALETTE, ); - assert_eq!(human_readable(&buf), "<blue>activityIndicatorLarge<reset>"); + assert_eq!(human_readable(&buf), "<cyan>activityIndicatorLarge<reset>"); } #[test] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -26,9 +26,9 @@ use roc_module::symbol::{Interns, ModuleId}; use roc_packaging::cache::RocCacheDir; use roc_problem::can::Problem; use roc_region::all::LineInfo; -use roc_reporting::report::RenderTarget; use roc_reporting::report::RocDocAllocator; use roc_reporting::report::{can_problem, DEFAULT_PALETTE}; +use roc_reporting::report::{strip_colors, RenderTarget}; use roc_solve::FunctionKind; use roc_target::TargetInfo; use roc_types::pretty_print::name_and_print_var; diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1218,11 +1218,9 @@ fn non_roc_file_extension() { I expected a file with extension `.roc` or without extension. Instead I received a file with extension `.md`." ); - let color_start = String::from_utf8(vec![27, 91, 51, 54, 109]).unwrap(); - let color_end = String::from_utf8(vec![27, 91, 48, 109]).unwrap(); - let err = multiple_modules("non_roc_file_extension", modules).unwrap_err(); - let err = err.replace(&color_start, ""); - let err = err.replace(&color_end, ""); + + let err = strip_colors(&multiple_modules("non_roc_file_extension", modules).unwrap_err()); + assert_eq!(err, expected, "\n{}", err); } diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1255,10 +1253,8 @@ fn roc_file_no_extension() { The provided file did not start with a shebang `#!` containing the string `roc`. Is tmp/roc_file_no_extension/main a Roc file?" ); - let color_start = String::from_utf8(vec![27, 91, 51, 54, 109]).unwrap(); - let color_end = String::from_utf8(vec![27, 91, 48, 109]).unwrap(); - let err = multiple_modules("roc_file_no_extension", modules).unwrap_err(); - let err = err.replace(&color_start, ""); - let err = err.replace(&color_end, ""); + + let err = strip_colors(&multiple_modules("roc_file_no_extension", modules).unwrap_err()); + assert_eq!(err, expected, "\n{}", err); } diff --git a/crates/repl_test/Cargo.toml b/crates/repl_test/Cargo.toml --- a/crates/repl_test/Cargo.toml +++ b/crates/repl_test/Cargo.toml @@ -23,6 +23,7 @@ bumpalo.workspace = true indoc.workspace = true strip-ansi-escapes.workspace = true target-lexicon.workspace = true +regex.workspace = true rustyline.workspace = true [features] diff --git a/crates/repl_test/src/wasm.rs b/crates/repl_test/src/wasm.rs --- a/crates/repl_test/src/wasm.rs +++ b/crates/repl_test/src/wasm.rs @@ -1,4 +1,5 @@ use bumpalo::Bump; +use regex::Regex; use roc_wasm_interp::{ wasi, DefaultImportDispatcher, ImportDispatcher, Instance, Value, WasiDispatcher, }; diff --git a/crates/repl_test/src/wasm.rs b/crates/repl_test/src/wasm.rs --- a/crates/repl_test/src/wasm.rs +++ b/crates/repl_test/src/wasm.rs @@ -158,11 +159,11 @@ pub fn expect_failure(input: &'static str, expected: &str) { pub fn expect(input: &'static str, expected: &str) { let raw_output = run(input); - // We need to get rid of HTML tags, and we can be quite specific about it! - // If we ever write more complex test cases, we might need regex here. - let without_html = raw_output.replace("<span class='color-magenta'> : </span>", " : "); + // remove color HTML tags + let regx = Regex::new("<span class='color-(.*?)'> : </span>").unwrap(); + let without_html = regx.replace_all(&raw_output, " : "); - let clean_output = without_html.trim(); + let trimmed_output = without_html.trim(); - assert_eq!(clean_output, expected); + assert_eq!(trimmed_output, expected); } diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -293,6 +287,19 @@ pub const HTML_STYLE_CODES: StyleCodes = StyleCodes { color_reset: "</span>", }; +// useful for tests +pub fn strip_colors(str: &str) -> String { + str.replace(ANSI_STYLE_CODES.red, "") + .replace(ANSI_STYLE_CODES.green, "") + .replace(ANSI_STYLE_CODES.yellow, "") + .replace(ANSI_STYLE_CODES.cyan, "") + .replace(ANSI_STYLE_CODES.white, "") + .replace(ANSI_STYLE_CODES.bold, "") + .replace(ANSI_STYLE_CODES.underline, "") + .replace(ANSI_STYLE_CODES.reset, "") + .replace(ANSI_STYLE_CODES.color_reset, "") +} + // define custom allocator struct so we can `impl RocDocAllocator` custom helpers pub struct RocDocAllocator<'a> { upstream: BoxAllocator,
Improve repl contrast on (very) dark terminal background ![PXL_20240207_110908757.MP.jpg](https://github.com/roc-lang/roc/assets/17049058/91545af3-b1bd-44e8-b777-f738e6d52443) In real life the contrast is worse than in the photo. The blue text is unreadable and the pink colon's visibility is not good enough.
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::report_value_color" ]
[ "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_demand_value_has_args", "test_reporting::ability_non_signature_expression", "test_reporting::ability_specialization_is_unused", "test_reporting::apply_unary_negative", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::alias_using_alias", "test_reporting::alias_in_implements_clause", "test_reporting::apply_unary_not", "test_reporting::ability_shadows_ability", "test_reporting::annotation_newline_body_is_fine", "test_reporting::ability_specialization_is_duplicated", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::apply_opaque_as_function", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::bad_double_rigid", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::applied_tag_function", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::ability_not_on_toplevel", "test_reporting::always_function", "test_reporting::ability_specialization_is_incomplete", "test_reporting::argument_without_space", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::ability_member_binds_parent_twice", "test_reporting::alias_type_diff", "test_reporting::annotation_definition_mismatch", "test_reporting::backpassing_type_error", "test_reporting::comment_with_control_character", "test_reporting::comment_with_tab", "test_reporting::call_with_underscore_identifier", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::cannot_not_eq_functions", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::cannot_derive_eq_for_function", "test_reporting::circular_definition", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::call_with_undeclared_identifier_starting_with_underscore", "test_reporting::call_with_declared_identifier_starting_with_underscore", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::cannot_derive_hash_for_function", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::cannot_eq_functions", "test_reporting::bool_vs_false_tag", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::bool_vs_true_tag", "test_reporting::boolean_tag", "test_reporting::compare_unsigned_to_signed", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::closure_underscore_ident", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::circular_type", "test_reporting::circular_definition_self", "test_reporting::dbg_without_final_expression", "test_reporting::def_missing_final_expression", "test_reporting::crash_given_non_string", "test_reporting::concat_different_types", "test_reporting::crash_overapplied", "test_reporting::crash_unapplied", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::cycle_through_non_function", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::cycle_through_non_function_top_level", "test_reporting::cyclic_opaque", "test_reporting::demanded_vs_optional_record_field", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_encoding_for_nat", "test_reporting::derive_decoding_for_function", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::derive_encoding_for_tuple", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_eq_for_f32", "test_reporting::derive_eq_for_f64", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_eq_for_function", "test_reporting::derive_eq_for_record", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::derive_eq_for_tag", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_hash_for_function", "test_reporting::double_plus", "test_reporting::elm_function_syntax", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::exposes_identifier", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::empty_or_pattern", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::error_inline_alias_qualified", "test_reporting::expect_without_final_expression", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::derive_hash_for_record", "test_reporting::expression_indentation_end", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::derive_hash_for_tag", "test_reporting::derive_non_builtin_ability", "test_reporting::derive_hash_for_tuple", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::float_literal_has_int_suffix", "test_reporting::different_phantom_types", "test_reporting::first_wildcard_is_required", "test_reporting::error_wildcards_are_related", "test_reporting::expected_tag_has_too_many_args", "test_reporting::expect_expr_type_error", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::dict_type_formatting", "test_reporting::eq_binop_is_transparent", "test_reporting::elem_in_list", "test_reporting::double_equals_in_def", "test_reporting::error_nested_wildcards_are_related", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::fncall_overapplied", "test_reporting::float_out_of_range", "test_reporting::float_malformed", "test_reporting::fncall_underapplied", "test_reporting::from_annotation_complex_pattern", "test_reporting::forgot_to_remove_underscore", "test_reporting::fncall_value", "test_reporting::from_annotation_function", "test_reporting::from_annotation_when", "test_reporting::from_annotation_if", "test_reporting::function_arity_mismatch_nested_too_few", "test_reporting::if_guard_without_condition", "test_reporting::if_missing_else", "test_reporting::function_cannot_derive_encoding", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::geq_binop_is_transparent", "test_reporting::function_arity_mismatch_nested_too_many", "test_reporting::i16_overflow", "test_reporting::i32_overflow", "test_reporting::function_arity_mismatch_too_few", "test_reporting::imports_missing_comma", "test_reporting::i128_overflow", "test_reporting::i16_underflow", "test_reporting::guard_mismatch_with_annotation", "test_reporting::has_encoding_for_function", "test_reporting::if_outdented_then", "test_reporting::function_does_not_implement_encoding", "test_reporting::i64_overflow", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::function_arity_mismatch_too_many", "test_reporting::i32_underflow", "test_reporting::gt_binop_is_transparent", "test_reporting::has_clause_not_on_toplevel", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::invalid_module_name", "test_reporting::invalid_app_name", "test_reporting::i64_underflow", "test_reporting::i8_underflow", "test_reporting::i8_overflow", "test_reporting::if_2_branch_mismatch", "test_reporting::if_condition_not_bool", "test_reporting::inline_hastype", "test_reporting::if_3_branch_mismatch", "test_reporting::invalid_operator", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::implements_type_not_ability", "test_reporting::incorrect_optional_field", "test_reporting::inference_var_in_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::integer_malformed", "test_reporting::inference_var_too_many_in_alias", "test_reporting::int_literal_has_float_suffix", "test_reporting::invalid_record_update", "test_reporting::invalid_num_fn", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::int_frac", "test_reporting::invalid_num", "test_reporting::integer_out_of_range", "test_reporting::invalid_record_extension_type", "test_reporting::lambda_double_comma", "test_reporting::integer_empty", "test_reporting::lambda_leading_comma", "test_reporting::list_double_comma", "test_reporting::invalid_tag_extension_type", "test_reporting::issue_1755", "test_reporting::issue_2326", "test_reporting::invalid_toplevel_cycle", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_2380_typed_body", "test_reporting::keyword_qualified_import", "test_reporting::bad_rigid_function", "test_reporting::bad_numeric_literal_suffix", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::bad_rigid_value", "test_reporting::issue_2458", "test_reporting::issue_2380_alias_with_vars", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::list_get_negative_number", "test_reporting::leq_binop_is_transparent", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::keyword_record_field_access", "test_reporting::list_without_end", "test_reporting::list_pattern_not_terminated", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_spread_as", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_spread_required_front_back", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_spread_redundant_front_back", "test_reporting::malformed_float_pattern", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::malformed_int_pattern", "test_reporting::malformed_hex_pattern", "test_reporting::list_match_with_guard", "test_reporting::mismatch_within_list_pattern", "test_reporting::malformed_oct_pattern", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::lt_binop_is_transparent", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_record_annotation", "test_reporting::mismatched_suffix_i16", "test_reporting::malformed_bin_pattern", "test_reporting::missing_imports", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatched_suffix_dec", "test_reporting::missing_provides_in_app_header", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_f32", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::multi_no_end", "test_reporting::multi_insufficient_indent", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::module_ident_ends_with_dot", "test_reporting::missing_fields", "test_reporting::multiple_wildcards_in_alias", "test_reporting::multiple_record_builders", "test_reporting::mutual_recursion_not_reached", "test_reporting::mismatched_suffix_u8", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::module_not_imported", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::negative_u128", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::nested_datatype", "test_reporting::negative_u8", "test_reporting::neq_binop_is_transparent", "test_reporting::negative_u64", "test_reporting::negative_u32", "test_reporting::nested_datatype_inline", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::negative_u16", "test_reporting::non_exhaustive_with_guard", "test_reporting::nested_specialization", "test_reporting::num_too_general_named", "test_reporting::not_enough_cases_for_open_union", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::optional_field_in_record_builder", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::numer_literal_multi_suffix", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_ability_impl_not_found", "test_reporting::optional_record_invalid_let_binding", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::optional_record_invalid_function", "test_reporting::opaque_ability_impl_qualified", "test_reporting::opaque_mismatch_infer", "test_reporting::num_too_general_wildcard", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::pattern_binds_keyword", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::number_double_dot", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::optional_record_invalid_when", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::optional_record_default_with_signature", "test_reporting::opaque_ability_impl_optional", "test_reporting::platform_requires_rigids", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::optional_record_default_type_error", "test_reporting::opaque_ref_field_access", "test_reporting::optional_record_invalid_access", "test_reporting::optional_record_invalid_accessor", "test_reporting::opaque_type_not_in_scope", "test_reporting::pattern_in_parens_end", "test_reporting::provides_missing_to_in_app_header", "test_reporting::provides_to_identifier", "test_reporting::pattern_in_parens_indent_open", "test_reporting::provides_to_missing_platform_in_app_header", "test_reporting::pattern_in_parens_open", "test_reporting::pattern_in_parens_end_comma", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::polymorphic_mutual_recursion", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::patterns_when_not_exhaustive", "test_reporting::patterns_int_redundant", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::record_builder_apply_non_function", "test_reporting::plus_on_str", "test_reporting::pizza_parens_middle", "test_reporting::patterns_let_not_exhaustive", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::pattern_let_mismatch", "test_reporting::pattern_when_pattern", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::pattern_when_condition", "test_reporting::record_duplicate_field_different_types", "test_reporting::patterns_record_not_exhaustive", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::record_access_ends_with_dot", "test_reporting::qualified_tag", "test_reporting::record_type_carriage_return", "test_reporting::report_region_in_color", "test_reporting::record_type_end", "test_reporting::pizza_parens_right", "test_reporting::phantom_type_variable", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::polymorphic_recursion", "test_reporting::report_module_color", "test_reporting::record_type_keyword_field_name", "test_reporting::record_type_open", "test_reporting::qualified_opaque_reference", "test_reporting::record_type_missing_comma", "test_reporting::record_type_open_indent", "test_reporting::record_duplicate_field_multiline", "test_reporting::record_update_builder", "test_reporting::record_type_tab", "test_reporting::record_type_duplicate_field", "test_reporting::record_field_mismatch", "test_reporting::recursion_var_specialization_error", "test_reporting::record_duplicate_field_same_type", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::report_precedence_problem_multiline", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::report_precedence_problem_single_line", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::record_update_value", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::single_quote_too_long", "test_reporting::report_shadowing_in_annotation", "test_reporting::single_no_end", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::report_unused_def", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::self_recursive_not_reached", "test_reporting::self_recursive_alias", "test_reporting::second_wildcard_is_redundant", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::self_recursive_not_reached_nested", "test_reporting::same_phantom_types_unify", "test_reporting::type_double_comma", "test_reporting::type_apply_start_with_number", "test_reporting::type_apply_stray_dot", "test_reporting::tag_union_end", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::tag_union_open", "test_reporting::report_shadowing", "test_reporting::type_argument_no_arrow", "test_reporting::type_in_parens_start", "test_reporting::shadowing_top_level_scope", "test_reporting::tag_missing", "test_reporting::type_annotation_double_colon", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::type_in_parens_end", "test_reporting::tag_union_duplicate_tag", "test_reporting::type_apply_trailing_dot", "test_reporting::type_inline_alias", "test_reporting::type_apply_start_with_lowercase", "test_reporting::tags_missing", "test_reporting::stray_dot_expr", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::typo_lowercase_ok", "test_reporting::tag_mismatch", "test_reporting::shift_by_negative", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::too_many_type_arguments", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::tag_with_arguments_mismatch", "test_reporting::too_few_type_arguments", "test_reporting::tuple_exhaustiveness_good", "test_reporting::two_different_cons", "test_reporting::type_apply_double_dot", "test_reporting::u64_overflow", "test_reporting::specialization_for_wrong_type", "test_reporting::u16_overflow", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::unicode_not_hex", "test_reporting::value_not_exposed", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::unbound_var_in_alias", "test_reporting::typo_uppercase_ok", "test_reporting::unused_def_in_branch_pattern", "test_reporting::u8_overflow", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::when_over_indented_underscore", "test_reporting::unicode_too_large", "test_reporting::weird_escape", "test_reporting::unknown_type", "test_reporting::when_missing_arrow", "test_reporting::wild_case_arrow", "test_reporting::update_record", "test_reporting::when_outdented_branch", "test_reporting::unapplied_record_builder", "test_reporting::underscore_in_middle_of_identifier", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::unimported_modules_reported", "test_reporting::when_over_indented_int", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::unused_arg_and_unused_def", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::unused_shadow_specialization", "test_reporting::u32_overflow", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::weird_accessor", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::unused_argument", "test_reporting::update_record_snippet", "test_reporting::unnecessary_extension_variable", "test_reporting::update_record_ext", "test_reporting::unify_alias_other", "test_reporting::unused_value_import", "test_reporting::when_if_guard", "test_reporting::wildcard_in_opaque", "test_reporting::unwrap_num_elem_in_list", "test_reporting::update_empty_record", "test_reporting::when_branch_mismatch", "test_reporting::wildcard_in_alias", "file_not_found - should panic", "ingested_file_not_found - should panic", "roc_file_no_extension", "module_doesnt_match_file_path", "non_roc_file_extension", "module_cyclic_import_itself", "app_missing_package_import", "module_interface_with_qualified_import", "imported_file_not_found - should panic", "nested_module_has_incorrect_name", "platform_does_not_exist", "module_cyclic_import_transitive", "platform_parse_error", "parse_problem", "iface_quicksort", "load_principal_types", "ingested_file_bytes", "import_alias", "load_astar", "opaque_wrapped_unwrapped_outside_defining_module", "ingested_file", "import_transitive_alias", "test_load_and_typecheck", "app_quicksort", "quicksort_one_def", "load_unit", "issue_2863_module_type_does_not_exist", "app_dep_types", "imported_dep_regression", "import_builtin_in_platform_and_check_app", "platform_exposes_main_return_by_pointer_issue", "interface_with_deps", "iface_dep_types" ]
[]
[]
2024-02-20T14:46:30Z
b22f7939677de4e4e66dfc3b72afbbb7e16f1702
diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -3838,6 +3838,35 @@ struct HeaderOutput<'a> { opt_platform_shorthand: Option<&'a str>, } +fn ensure_roc_file<'a>(filename: &Path, src_bytes: &[u8]) -> Result<(), LoadingProblem<'a>> { + match filename.extension() { + Some(ext) => { + if ext != ROC_FILE_EXTENSION { + return Err(LoadingProblem::FileProblem { + filename: filename.to_path_buf(), + error: io::ErrorKind::Unsupported, + }); + } + } + None => { + let index = src_bytes + .iter() + .position(|a| *a == b'\n') + .unwrap_or(src_bytes.len()); + let frist_line_bytes = src_bytes[0..index].to_vec(); + if let Ok(first_line) = String::from_utf8(frist_line_bytes) { + if !(first_line.starts_with("#!") && first_line.contains("roc")) { + return Err(LoadingProblem::FileProblem { + filename: filename.to_path_buf(), + error: std::io::ErrorKind::Unsupported, + }); + } + } + } + } + Ok(()) +} + fn parse_header<'a>( arena: &'a Bump, read_file_duration: Duration, diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -3856,6 +3885,8 @@ fn parse_header<'a>( let parsed = roc_parse::module::parse_header(arena, parse_state.clone()); let parse_header_duration = parse_start.elapsed(); + ensure_roc_file(&filename, src_bytes)?; + // Insert the first entries for this module's timings let mut module_timing = ModuleTiming::new(start_time); diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -1652,6 +1652,42 @@ pub fn to_file_problem_report<'b>( severity: Severity::Fatal, } } + io::ErrorKind::Unsupported => { + let doc = match filename.extension() { + Some(ext) => alloc.concat(vec![ + alloc.reflow(r"I expected a file with extension `.roc` or without extension."), + alloc.hardline(), + alloc.reflow(r"Instead I received a file with extension `."), + alloc.as_string(ext.to_string_lossy()), + alloc.as_string("`."), + ]), + None => { + alloc.stack(vec![ + alloc.vcat(vec![ + alloc.reflow(r"I expected a file with either:"), + alloc.reflow("- extension `.roc`"), + alloc.intersperse( + "- no extension and a roc shebang as the first line, e.g. `#!/home/username/bin/roc_nightly/roc`" + .split(char::is_whitespace), + alloc.concat(vec![ alloc.hardline(), alloc.text(" ")]).flat_alt(alloc.space()).group() + ), + ]), + alloc.concat(vec![ + alloc.reflow("The provided file did not start with a shebang `#!` containing the string `roc`. Is "), + alloc.as_string(filename.to_string_lossy()), + alloc.reflow(" a Roc file?"), + ]) + ]) + } + }; + + Report { + filename, + doc, + title: "NOT A ROC FILE".to_string(), + severity: Severity::Fatal, + } + } _ => { let error = std::io::Error::from(error); let formatted = format!("{error}");
roc-lang__roc-6506
6,506
[ "6418" ]
0.0
roc-lang/roc
2024-02-05T19:44:01Z
diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -323,7 +323,7 @@ fn import_transitive_alias() { // with variables in the importee let modules = vec![ ( - "RBTree", + "RBTree.roc", indoc!( r" interface RBTree exposes [RedBlackTree, empty] imports [] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -341,7 +341,7 @@ fn import_transitive_alias() { ), ), ( - "Other", + "Other.roc", indoc!( r" interface Other exposes [empty] imports [RBTree] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -626,7 +626,7 @@ fn ingested_file_bytes() { #[test] fn parse_problem() { let modules = vec![( - "Main", + "Main.roc", indoc!( r" interface Main exposes [main] imports [] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -641,7 +641,7 @@ fn parse_problem() { report, indoc!( " - ── UNFINISHED LIST in tmp/parse_problem/Main ─────────────────────────────────── + ── UNFINISHED LIST in tmp/parse_problem/Main.roc ─────────────────────────────── I am partway through started parsing a list, but I got stuck here: diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -707,7 +707,7 @@ fn ingested_file_not_found() { #[test] fn platform_does_not_exist() { let modules = vec![( - "Main", + "main.roc", indoc!( r#" app "example" diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -753,7 +753,7 @@ fn platform_parse_error() { ), ), ( - "Main", + "main.roc", indoc!( r#" app "hello-world" diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -797,7 +797,7 @@ fn platform_exposes_main_return_by_pointer_issue() { ), ), ( - "Main", + "main.roc", indoc!( r#" app "hello-world" diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -818,7 +818,7 @@ fn platform_exposes_main_return_by_pointer_issue() { fn opaque_wrapped_unwrapped_outside_defining_module() { let modules = vec![ ( - "Age", + "Age.roc", indoc!( r" interface Age exposes [Age] imports [] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -828,7 +828,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() { ), ), ( - "Main", + "Main.roc", indoc!( r" interface Main exposes [twenty, readAge] imports [Age.{ Age }] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -847,7 +847,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() { err, indoc!( r" - ── OPAQUE TYPE DECLARED OUTSIDE SCOPE in ...apped_outside_defining_module/Main ─ + ── OPAQUE TYPE DECLARED OUTSIDE SCOPE in ...d_outside_defining_module/Main.roc ─ The unwrapped opaque type Age referenced here: diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -861,7 +861,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() { Note: Opaque types can only be wrapped and unwrapped in the module they are defined in! - ── OPAQUE TYPE DECLARED OUTSIDE SCOPE in ...apped_outside_defining_module/Main ─ + ── OPAQUE TYPE DECLARED OUTSIDE SCOPE in ...d_outside_defining_module/Main.roc ─ The unwrapped opaque type Age referenced here: diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -875,7 +875,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() { Note: Opaque types can only be wrapped and unwrapped in the module they are defined in! - ── UNUSED IMPORT in tmp/opaque_wrapped_unwrapped_outside_defining_module/Main ── + ── UNUSED IMPORT in ...aque_wrapped_unwrapped_outside_defining_module/Main.roc ─ Nothing from Age is used in this module. diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -910,7 +910,7 @@ fn issue_2863_module_type_does_not_exist() { ), ), ( - "Main", + "main.roc", indoc!( r#" app "test" diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -930,7 +930,7 @@ fn issue_2863_module_type_does_not_exist() { report, indoc!( " - ── UNRECOGNIZED NAME in tmp/issue_2863_module_type_does_not_exist/Main ───────── + ── UNRECOGNIZED NAME in tmp/issue_2863_module_type_does_not_exist/main.roc ───── Nothing is named `DoesNotExist` in this scope. diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -971,7 +971,7 @@ fn import_builtin_in_platform_and_check_app() { ), ), ( - "Main", + "main.roc", indoc!( r#" app "test" diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -991,7 +991,7 @@ fn import_builtin_in_platform_and_check_app() { #[test] fn module_doesnt_match_file_path() { let modules = vec![( - "Age", + "Age.roc", indoc!( r" interface NotAge exposes [Age] imports [] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1006,7 +1006,7 @@ fn module_doesnt_match_file_path() { err, indoc!( r" - ── WEIRD MODULE NAME in tmp/module_doesnt_match_file_path/Age ────────────────── + ── WEIRD MODULE NAME in tmp/module_doesnt_match_file_path/Age.roc ────────────── This module name does not correspond with the file path it is defined in: diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1026,7 +1026,7 @@ fn module_doesnt_match_file_path() { #[test] fn module_cyclic_import_itself() { let modules = vec![( - "Age", + "Age.roc", indoc!( r" interface Age exposes [] imports [Age] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1039,7 +1039,7 @@ fn module_cyclic_import_itself() { err, indoc!( r" - ── IMPORT CYCLE in tmp/module_cyclic_import_itself/Age ───────────────────────── + ── IMPORT CYCLE in tmp/module_cyclic_import_itself/Age.roc ───────────────────── I can't compile Age because it depends on itself through the following chain of module imports: diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1062,7 +1062,7 @@ fn module_cyclic_import_itself() { fn module_cyclic_import_transitive() { let modules = vec![ ( - "Age", + "Age.roc", indoc!( r" interface Age exposes [] imports [Person] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1070,7 +1070,7 @@ fn module_cyclic_import_transitive() { ), ), ( - "Person", + "Person.roc", indoc!( r" interface Person exposes [] imports [Age] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1150,7 +1150,7 @@ fn nested_module_has_incorrect_name() { #[test] fn module_interface_with_qualified_import() { let modules = vec![( - "A", + "A.roc", indoc!( r" interface A exposes [] imports [b.T] diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1163,7 +1163,7 @@ fn module_interface_with_qualified_import() { err, indoc!( r#" - The package shorthand 'b' that you are using in the 'imports' section of the header of module 'tmp/module_interface_with_qualified_import/A' doesn't exist. + The package shorthand 'b' that you are using in the 'imports' section of the header of module 'tmp/module_interface_with_qualified_import/A.roc' doesn't exist. Check that package shorthand is correct or reference the package in an 'app' or 'package' header. This module is an interface, because of a bug in the compiler we are unable to directly typecheck interface modules with package imports so this error may not be correct. Please start checking at an app, package or platform file that imports this file."# ), diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1174,7 +1174,7 @@ fn module_interface_with_qualified_import() { #[test] fn app_missing_package_import() { let modules = vec![( - "Main", + "main.roc", indoc!( r#" app "example" diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -1192,10 +1192,73 @@ fn app_missing_package_import() { err, indoc!( r#" - The package shorthand 'notpack' that you are using in the 'imports' section of the header of module 'tmp/app_missing_package_import/Main' doesn't exist. + The package shorthand 'notpack' that you are using in the 'imports' section of the header of module 'tmp/app_missing_package_import/main.roc' doesn't exist. Check that package shorthand is correct or reference the package in an 'app' or 'package' header."# ), "\n{}", err ); } + +#[test] +fn non_roc_file_extension() { + let modules = vec![( + "main.md", + indoc!( + r" + # Not a roc file + " + ), + )]; + + let expected = indoc!( + r" + ── NOT A ROC FILE in tmp/non_roc_file_extension/main.md ──────────────────────── + + I expected a file with extension `.roc` or without extension. + Instead I received a file with extension `.md`." + ); + let color_start = String::from_utf8(vec![27, 91, 51, 54, 109]).unwrap(); + let color_end = String::from_utf8(vec![27, 91, 48, 109]).unwrap(); + let err = multiple_modules("non_roc_file_extension", modules).unwrap_err(); + let err = err.replace(&color_start, ""); + let err = err.replace(&color_end, ""); + assert_eq!(err, expected, "\n{}", err); +} + +#[test] +fn roc_file_no_extension() { + let modules = vec![( + "main", + indoc!( + r#" + app "helloWorld" + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } + imports [pf.Stdout] + provides [main] to pf + + main = + Stdout.line "Hello, World!" + "# + ), + )]; + + let expected = indoc!( + r" + ── NOT A ROC FILE in tmp/roc_file_no_extension/main ──────────────────────────── + + I expected a file with either: + - extension `.roc` + - no extension and a roc shebang as the first line, e.g. + `#!/home/username/bin/roc_nightly/roc` + + The provided file did not start with a shebang `#!` containing the + string `roc`. Is tmp/roc_file_no_extension/main a Roc file?" + ); + let color_start = String::from_utf8(vec![27, 91, 51, 54, 109]).unwrap(); + let color_end = String::from_utf8(vec![27, 91, 48, 109]).unwrap(); + let err = multiple_modules("roc_file_no_extension", modules).unwrap_err(); + let err = err.replace(&color_start, ""); + let err = err.replace(&color_end, ""); + assert_eq!(err, expected, "\n{}", err); +}
Roc should error for non-roc files [zulip discussion](https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Handle.20non.20roc.20files/near/417371854) ## Current Behaviour Currently `roc run` on an exectutable non-`.roc` file gives the following error. ``` $ roc run examples/movies.csv ── MISSING HEADER in examples/movies.csv ─────────────────────────────────────── I am expecting a header, but the file is not UTF-8 encoded. I am expecting a module keyword next, one of interface, app, package or platform.% ``` ## Desired Behaviour Roc cli should check the file extension. If it is `.roc` or empty then proceed to build etc, however if it is anything else it should return a more helpful error. If the filename has no extension, we should require the first line to start with `#!` and contain `roc` ``` $ roc run examples/movies.csv ── EXPECTED ROC FILE in examples/movies.csv ─────────────────────────────────────── I am expecting a roc application file with either `.roc` or no extension. Instead I found a file with extension `.csv` at ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "non_roc_file_extension", "roc_file_no_extension" ]
[ "file_not_found - should panic", "ingested_file_not_found - should panic", "module_doesnt_match_file_path", "imported_file_not_found - should panic", "platform_parse_error", "test_load_and_typecheck", "app_quicksort", "imported_dep_regression", "load_principal_types", "import_alias", "ingested_file", "load_unit", "load_astar", "quicksort_one_def", "iface_dep_types", "app_dep_types", "ingested_file_bytes", "interface_with_deps", "iface_quicksort", "module_interface_with_qualified_import", "app_missing_package_import", "module_cyclic_import_transitive", "module_cyclic_import_itself", "import_builtin_in_platform_and_check_app", "import_transitive_alias", "parse_problem", "nested_module_has_incorrect_name", "platform_does_not_exist", "platform_exposes_main_return_by_pointer_issue", "opaque_wrapped_unwrapped_outside_defining_module", "issue_2863_module_type_does_not_exist" ]
[]
[]
2024-02-09T23:40:46Z
26846e14aa0a06baa8cd4017abfc60c15ff359df
diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -1782,7 +1782,7 @@ fn constrain_function_def( let signature_index = constraints.push_type(types, signature); - let (arg_types, signature_closure_type, ret_type) = match types[signature] { + let (arg_types, _signature_closure_type, ret_type) = match types[signature] { TypeTag::Function(signature_closure_type, ret_type) => ( types.get_type_arguments(signature), signature_closure_type, diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -1888,13 +1888,12 @@ fn constrain_function_def( delayed_is_open_constraints: vec![], }; let mut vars = Vec::with_capacity(argument_pattern_state.vars.capacity() + 1); - let ret_var = function_def.return_type; let closure_var = function_def.closure_type; let ret_type_index = constraints.push_type(types, ret_type); - vars.push(ret_var); - vars.push(closure_var); + vars.push(function_def.return_type); + vars.push(function_def.closure_type); let mut def_pattern_state = PatternState::default(); diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -1913,21 +1912,22 @@ fn constrain_function_def( // TODO see if we can get away with not adding this constraint at all def_pattern_state.vars.push(expr_var); - let annotation_expected = FromAnnotation( - loc_pattern.clone(), - arity, - AnnotationSource::TypedBody { - region: annotation.region, - }, - signature_index, - ); + let annotation_expected = { + constraints.push_expected_type(FromAnnotation( + loc_pattern.clone(), + arity, + AnnotationSource::TypedBody { + region: annotation.region, + }, + signature_index, + )) + }; { let expr_type_index = constraints.push_variable(expr_var); - let expected_index = constraints.push_expected_type(annotation_expected); def_pattern_state.constraints.push(constraints.equal_types( expr_type_index, - expected_index, + annotation_expected, Category::Storage(std::file!(), std::line!()), Region::span_across(&annotation.region, &loc_body_expr.region), )); diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -1955,8 +1955,8 @@ fn constrain_function_def( &mut vars, ); - let annotation_expected = constraints.push_expected_type(FromAnnotation( - loc_pattern.clone(), + let return_type_annotation_expected = constraints.push_expected_type(FromAnnotation( + loc_pattern, arity, AnnotationSource::TypedBody { region: annotation.region, diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -1964,31 +1964,34 @@ fn constrain_function_def( ret_type_index, )); - let ret_constraint = constrain_expr( - types, - constraints, - env, - loc_body_expr.region, - &loc_body_expr.value, - annotation_expected, - ); - let ret_constraint = attach_resolution_constraints(constraints, env, ret_constraint); + let solved_fn_type = { + // TODO(types-soa) optimize for Variable + let pattern_types = types.from_old_type_slice( + function_def.arguments.iter().map(|a| Type::Variable(a.0)), + ); + let lambda_set = types.from_old_type(&Type::Variable(function_def.closure_type)); + let ret_var = types.from_old_type(&Type::Variable(function_def.return_type)); + + let fn_type = types.function(pattern_types, lambda_set, ret_var); + constraints.push_type(types, fn_type) + }; + + let ret_constraint = { + let con = constrain_expr( + types, + constraints, + env, + loc_body_expr.region, + &loc_body_expr.value, + return_type_annotation_expected, + ); + attach_resolution_constraints(constraints, env, con) + }; vars.push(expr_var); + let defs_constraint = constraints.and_constraint(argument_pattern_state.constraints); - let signature_closure_type = { - let signature_closure_type_index = - constraints.push_type(types, signature_closure_type); - constraints.push_expected_type(Expected::FromAnnotation( - loc_pattern, - arity, - AnnotationSource::TypedBody { - region: annotation.region, - }, - signature_closure_type_index, - )) - }; let cons = [ constraints.let_constraint( [], diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -1999,14 +2002,24 @@ fn constrain_function_def( // This is a syntactic function, it can be generalized Generalizable(true), ), - constraints.equal_types_var( - closure_var, - signature_closure_type, - Category::ClosureSize, + // Store the inferred ret var into the function type now, so that + // when we check that the solved function type matches the annotation, we can + // display the fully inferred return variable. + constraints.store( + ret_type_index, + function_def.return_type, + std::file!(), + std::line!(), + ), + // Now, check the solved function type matches the annotation. + constraints.equal_types( + solved_fn_type, + annotation_expected, + Category::Lambda, region, ), + // Finally put the solved closure type into the dedicated def expr variable. constraints.store(signature_index, expr_var, std::file!(), std::line!()), - constraints.store(ret_type_index, ret_var, std::file!(), std::line!()), closure_constraint, ]; diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -2719,7 +2732,7 @@ fn constrain_typed_def( name, .. }), - TypeTag::Function(signature_closure_type, ret_type), + TypeTag::Function(_signature_closure_type, ret_type), ) => { let arg_types = types.get_type_arguments(signature); diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -2765,6 +2778,17 @@ fn constrain_typed_def( &mut vars, ); + let solved_fn_type = { + // TODO(types-soa) optimize for Variable + let arg_types = + types.from_old_type_slice(arguments.iter().map(|a| Type::Variable(a.0))); + let lambda_set = types.from_old_type(&Type::Variable(closure_var)); + let ret_var = types.from_old_type(&Type::Variable(ret_var)); + + let fn_type = types.function(arg_types, lambda_set, ret_var); + constraints.push_type(types, fn_type) + }; + let body_type = constraints.push_expected_type(FromAnnotation( def.loc_pattern.clone(), arguments.len(), diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -2787,18 +2811,6 @@ fn constrain_typed_def( vars.push(*fn_var); let defs_constraint = constraints.and_constraint(argument_pattern_state.constraints); - let signature_closure_type = { - let signature_closure_type_index = - constraints.push_type(types, signature_closure_type); - constraints.push_expected_type(Expected::FromAnnotation( - def.loc_pattern.clone(), - arity, - AnnotationSource::TypedBody { - region: annotation.region, - }, - signature_closure_type_index, - )) - }; let cons = [ constraints.let_constraint( [], diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -2809,15 +2821,20 @@ fn constrain_typed_def( // This is a syntactic function, it can be generalized Generalizable(true), ), - constraints.equal_types_var( - closure_var, - signature_closure_type, - Category::ClosureSize, + // Store the inferred ret var into the function type now, so that + // when we check that the solved function type matches the annotation, we can + // display the fully inferred return variable. + constraints.store(ret_type_index, ret_var, std::file!(), std::line!()), + // Now, check the solved function type matches the annotation. + constraints.equal_types( + solved_fn_type, + annotation_expected, + Category::Lambda, region, ), + // Finally put the solved closure type into the dedicated def expr variables. constraints.store(signature_index, *fn_var, std::file!(), std::line!()), constraints.store(signature_index, expr_var, std::file!(), std::line!()), - constraints.store(ret_type_index, ret_var, std::file!(), std::line!()), closure_constraint, ]; diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -3005,6 +3022,29 @@ fn constrain_typed_function_arguments( } } } + + // There may be argument idents left over that don't line up with the function arity. + // Add their patterns' symbols in so that they are present in the env, even though this will + // wind up a type error. + if arguments.len() > arg_types.len() { + for (pattern_var, _annotated_mark, loc_pattern) in &arguments[arg_types.len()..] { + let pattern_var_index = constraints.push_variable(*pattern_var); + + def_pattern_state.vars.push(*pattern_var); + + let pattern_expected = + constraints.push_pat_expected_type(PExpected::NoExpectation(pattern_var_index)); + constrain_pattern( + types, + constraints, + env, + &loc_pattern.value, + loc_pattern.region, + pattern_expected, + argument_pattern_state, + ); + } + } } fn constrain_typed_function_arguments_simple( diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -3127,6 +3167,29 @@ fn constrain_typed_function_arguments_simple( } } } + + // There may be argument idents left over that don't line up with the function arity. + // Add their patterns' symbols in so that they are present in the env, even though this will + // wind up a type error. + if arguments.len() > arg_types.len() { + for (pattern_var, _annotated_mark, loc_pattern) in &arguments[arg_types.len()..] { + let pattern_var_index = constraints.push_variable(*pattern_var); + + def_pattern_state.vars.push(*pattern_var); + + let pattern_expected = + constraints.push_pat_expected_type(PExpected::NoExpectation(pattern_var_index)); + constrain_pattern( + types, + constraints, + env, + &loc_pattern.value, + loc_pattern.region, + pattern_expected, + argument_pattern_state, + ); + } + } } #[inline(always)]
roc-lang__roc-5287
5,287
ROC_CHECK_MONO_IR fails here, this is a layout bug.
[ "5264" ]
0.0
roc-lang/roc
2023-04-12T20:36:24Z
diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -2615,6 +2615,27 @@ mod test_reporting { I would have to crash if I saw one of those! So rather than pattern matching in function arguments, put a `when` in the function body to account for all possibilities. + + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + Something is off with the body of the `f` definition: + + 9│ f : Either -> {} + 10│ f = \Left v -> v + ^^^^^^^^^^^^ + + The body is an anonymous function of type: + + […] -> {} + + But the type annotation on `f` says it should be: + + [Right Str, …] -> {} + + Tip: Looks like a closed tag union does not have the `Right` tag. + + Tip: Closed tag unions can't grow, because that might change the size + in memory. Can you use an open tag union? "### ); diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -13410,4 +13431,134 @@ I recommend using camelCase. It's the standard style in Roc code! meant to unwrap it first? "### ); + + test_report!( + function_arity_mismatch_too_few, + indoc!( + r#" + app "test" provides [f] to "./platform" + + f : U8, U8 -> U8 + f = \x -> x + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + Something is off with the body of the `f` definition: + + 3│ f : U8, U8 -> U8 + 4│ f = \x -> x + ^^^^^^^ + + The body is an anonymous function of type: + + (U8 -> U8) + + But the type annotation on `f` says it should be: + + (U8, U8 -> U8) + + Tip: It looks like it takes too few arguments. I was expecting 1 more. + "### + ); + + test_report!( + function_arity_mismatch_too_many, + indoc!( + r#" + app "test" provides [f] to "./platform" + + f : U8, U8 -> U8 + f = \x, y, z -> x + y + z + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + Something is off with the body of the `f` definition: + + 3│ f : U8, U8 -> U8 + 4│ f = \x, y, z -> x + y + z + ^^^^^^^^^^^^^^^^^^^^^ + + The body is an anonymous function of type: + + (U8, U8, Int Unsigned8 -> U8) + + But the type annotation on `f` says it should be: + + (U8, U8 -> U8) + + Tip: It looks like it takes too many arguments. I'm seeing 1 extra. + "### + ); + + test_report!( + function_arity_mismatch_nested_too_few, + indoc!( + r#" + app "test" provides [main] to "./platform" + + main = + f : U8, U8 -> U8 + f = \x -> x + + f + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + Something is off with the body of the `f` definition: + + 4│ f : U8, U8 -> U8 + 5│ f = \x -> x + ^^^^^^^ + + The body is an anonymous function of type: + + (U8 -> U8) + + But the type annotation on `f` says it should be: + + (U8, U8 -> U8) + + Tip: It looks like it takes too few arguments. I was expecting 1 more. + "### + ); + + test_report!( + function_arity_mismatch_nested_too_many, + indoc!( + r#" + app "test" provides [main] to "./platform" + + main = + f : U8, U8 -> U8 + f = \x, y, z -> x + y + z + + f + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + Something is off with the body of the `f` definition: + + 4│ f : U8, U8 -> U8 + 5│ f = \x, y, z -> x + y + z + ^^^^^^^^^^^^^^^^^^^^^ + + The body is an anonymous function of type: + + (U8, U8, Int Unsigned8 -> U8) + + But the type annotation on `f` says it should be: + + (U8, U8 -> U8) + + Tip: It looks like it takes too many arguments. I'm seeing 1 extra. + "### + ); }
roc build panics with Invalid InsertValueInst operands when importing an interface This is similar to my previous issue #5212 that was fixed, but I find I only get this error when I import LinkedList from another file. Putting all the definitions in a single file compiles and run successfully. Using MacOS 13.1 with Intel CPU, `roc_nightly-macos_x86_64-2023-04-08-3b28e89`. `main.roc`: ``` app "test" packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.3.1/97mY3sUwo433-pcnEQUlMhn-sWiIf_J9bPhcAFZoqY4.tar.br" } imports [pf.Stdout, LinkedList.{ LinkedList }] provides [main] to pf main = list = LinkedList.single "foo" newlist = LinkedList.push list "bar" Stdout.line (Num.toStr (LinkedList.len newlist)) ``` `LinkedList.roc`: ``` interface LinkedList exposes [ LinkedList, single, push, pop, toList, concat, walk, empty, len, ] imports [] LinkedList a := LL a LL a : [Nil, Cons { first : a, rest : LL a, length : Nat }] empty : {} -> LinkedList a empty = \{} -> @LinkedList Nil len : LinkedList a -> Nat len = \@LinkedList list -> when list is Nil -> 0 Cons { length } -> length single : a -> LinkedList a single = \item -> @LinkedList (Cons { first: item, rest: Nil, length: 1 }) push : LinkedList a, a -> LinkedList a push = \@LinkedList list, item -> @LinkedList (Cons { first: item, rest: list, length: (len (@LinkedList list)) + 1 }) pop : LinkedList a -> [Cons { first : a, rest : LinkedList a }, Nil] pop = \@LinkedList list -> when list is Nil -> Nil Cons { first, rest } -> Cons { first, rest: @LinkedList rest } toList : LinkedList a -> List a toList = \list -> (T out _) = walk list (T (List.withCapacity (len list)) 0) \T state index, elem -> T (List.set state index elem) (index + 1) out concat : LinkedList a, LinkedList a -> LinkedList a concat = \@LinkedList list1, @LinkedList list2 -> concatenated = when list1 is Nil -> list2 Cons { first, rest, length } -> Cons { first: first, rest: concat (@LinkedList rest) (@LinkedList list2), length: (len (@LinkedList list2)) + length, } @LinkedList concatenated walk : LinkedList elem, state, (state, elem -> state) -> state walk = \@LinkedList list, state, fn -> when list is Nil -> state Cons { first, rest } -> walk (@LinkedList rest) (fn state first) fn ``` Running `roc build` gives: ``` Invalid InsertValueInst operands! %insert_record_field3 = insertvalue { { %str.RocStr, i64, { [0 x i64], [16 x i8] }* } } zeroinitializer, { %str.RocStr, i64, { [0 x i64], [40 x i8] }* } %insert_record_field2, 0, !dbg !1795 Function "LinkedList_single_beb22fad19423347b2aa99b33212e862ded3f83df5d6238acb1a6a9ade3e" failed LLVM verification in NON-OPTIMIZED build. Its content was: define internal fastcc { [0 x i64], [40 x i8] }* @LinkedList_single_beb22fad19423347b2aa99b33212e862ded3f83df5d6238acb1a6a9ade3e(%str.RocStr* %item) !dbg !1794 { entry: %load_tag_to_put_in_struct = load %str.RocStr, %str.RocStr* %item, align 8, !dbg !1795 %insert_record_field = insertvalue { %str.RocStr, i64, { [0 x i64], [40 x i8] }* } zeroinitializer, %str.RocStr %load_tag_to_put_in_struct, 0, !dbg !1795 %insert_record_field1 = insertvalue { %str.RocStr, i64, { [0 x i64], [40 x i8] }* } %insert_record_field, i64 1, 1, !dbg !1795 %insert_record_field2 = insertvalue { %str.RocStr, i64, { [0 x i64], [40 x i8] }* } %insert_record_field1, { [0 x i64], [40 x i8] }* null, 2, !dbg !1795 %call_builtin = call i8* @roc_builtins.utils.allocate_with_refcount(i64 40, i32 8), !dbg !1795 %alloc_cast_to_desired = bitcast i8* %call_builtin to { [0 x i64], [40 x i8] }*, !dbg !1795 %insert_record_field3 = insertvalue { { %str.RocStr, i64, { [0 x i64], [16 x i8] }* } } zeroinitializer, { %str.RocStr, i64, { [0 x i64], [40 x i8] }* } %insert_record_field2, 0, !dbg !1795 %tag_alloca = alloca { [0 x i64], [40 x i8] }, align 8, !dbg !1795 %data_buffer = getelementptr inbounds { [0 x i64], [40 x i8] }, { [0 x i64], [40 x i8] }* %tag_alloca, i32 0, i32 1, !dbg !1795 %to_data_ptr = bitcast [40 x i8]* %data_buffer to { { %str.RocStr, i64, { [0 x i64], [16 x i8] }* } }*, !dbg !1795 store { { %str.RocStr, i64, { [0 x i64], [16 x i8] }* } } %insert_record_field3, { { %str.RocStr, i64, { [0 x i64], [16 x i8] }* } }* %to_data_ptr, align 8, !dbg !1795 %load_tag = load { [0 x i64], [40 x i8] }, { [0 x i64], [40 x i8] }* %tag_alloca, align 8, !dbg !1795 store { [0 x i64], [40 x i8] } %load_tag, { [0 x i64], [40 x i8] }* %alloc_cast_to_desired, align 8, !dbg !1795 ret { [0 x i64], [40 x i8] }* %alloc_cast_to_desired, !dbg !1795 } thread 'main' panicked at '😱 LLVM errors when defining function "LinkedList_single_beb22fad19423347b2aa99b33212e862ded3f83df5d6238acb1a6a9ade3e"; I wrote the full LLVM IR to "main.ll"', crates/compiler/gen_llvm/src/llvm/build.rs:4871:21 ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::function_arity_mismatch_too_few", "test_reporting::function_arity_mismatch_too_many", "test_reporting::function_arity_mismatch_nested_too_few", "test_reporting::function_arity_mismatch_nested_too_many", "test_reporting::patterns_fn_not_exhaustive" ]
[ "test_reporting::ability_demand_value_has_args", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::ability_non_signature_expression", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::alias_using_alias", "test_reporting::ability_not_on_toplevel", "test_reporting::bad_double_rigid", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::backpassing_type_error", "test_reporting::ability_specialization_is_unused", "test_reporting::ability_specialization_is_duplicated", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::alias_type_diff", "test_reporting::ability_shadows_ability", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::apply_unary_negative", "test_reporting::apply_unary_not", "test_reporting::argument_without_space", "test_reporting::alias_in_has_clause", "test_reporting::annotation_newline_body_is_fine", "test_reporting::apply_opaque_as_function", "test_reporting::ability_member_binds_parent_twice", "test_reporting::always_function", "test_reporting::applied_tag_function", "test_reporting::ability_specialization_is_incomplete", "test_reporting::annotation_definition_mismatch", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::bad_rigid_value", "test_reporting::comment_with_tab", "test_reporting::bad_numeric_literal_suffix", "test_reporting::boolean_tag", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::bad_rigid_function", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::cannot_derive_hash_for_function", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::call_with_underscore_identifier", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::bool_vs_true_tag", "test_reporting::circular_type", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::circular_definition", "test_reporting::circular_definition_self", "test_reporting::bool_vs_false_tag", "test_reporting::cannot_derive_eq_for_function", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::compare_unsigned_to_signed", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::cannot_eq_functions", "test_reporting::cannot_not_eq_functions", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::concat_different_types", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::crash_given_non_string", "test_reporting::closure_underscore_ident", "test_reporting::def_missing_final_expression", "test_reporting::dbg_without_final_expression", "test_reporting::crash_unapplied", "test_reporting::cyclic_opaque", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_decoding_for_function", "test_reporting::derive_eq_for_f64", "test_reporting::derive_eq_for_record", "test_reporting::crash_overapplied", "test_reporting::derive_encoding_for_nat", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::derive_decoding_for_nat", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::double_plus", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::derive_hash_for_record", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_hash_for_function", "test_reporting::derive_eq_for_function", "test_reporting::derive_encoding_for_tuple", "test_reporting::derive_eq_for_f32", "test_reporting::demanded_vs_optional_record_field", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_eq_for_tuple", "test_reporting::cycle_through_non_function_top_level", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::exposes_identifier", "test_reporting::empty_or_pattern", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::cycle_through_non_function", "test_reporting::derive_eq_for_tag", "test_reporting::elm_function_syntax", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_hash_for_tag", "test_reporting::error_inline_alias_qualified", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::derive_non_builtin_ability", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::dict_type_formatting", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::expression_indentation_end", "test_reporting::expect_without_final_expression", "test_reporting::double_equals_in_def", "test_reporting::elem_in_list", "test_reporting::derive_hash_for_tuple", "test_reporting::different_phantom_types", "test_reporting::error_wildcards_are_related", "test_reporting::float_malformed", "test_reporting::eq_binop_is_transparent", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::fncall_underapplied", "test_reporting::error_nested_wildcards_are_related", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::float_out_of_range", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::first_wildcard_is_required", "test_reporting::fncall_value", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::expect_expr_type_error", "test_reporting::float_literal_has_int_suffix", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::expected_tag_has_too_many_args", "test_reporting::from_annotation_function", "test_reporting::geq_binop_is_transparent", "test_reporting::gt_binop_is_transparent", "test_reporting::fncall_overapplied", "test_reporting::function_does_not_implement_encoding", "test_reporting::from_annotation_when", "test_reporting::from_annotation_if", "test_reporting::has_encoding_for_function", "test_reporting::from_annotation_complex_pattern", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::imports_missing_comma", "test_reporting::guard_mismatch_with_annotation", "test_reporting::if_missing_else", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::i16_underflow", "test_reporting::if_outdented_then", "test_reporting::if_guard_without_condition", "test_reporting::function_cannot_derive_encoding", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::has_clause_not_on_toplevel", "test_reporting::i128_overflow", "test_reporting::i16_overflow", "test_reporting::invalid_module_name", "test_reporting::invalid_app_name", "test_reporting::inline_hastype", "test_reporting::i64_underflow", "test_reporting::i32_overflow", "test_reporting::i32_underflow", "test_reporting::i8_overflow", "test_reporting::if_2_branch_mismatch", "test_reporting::invalid_operator", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::i8_underflow", "test_reporting::i64_overflow", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::if_condition_not_bool", "test_reporting::if_3_branch_mismatch", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::implements_type_not_ability", "test_reporting::inference_var_in_alias", "test_reporting::int_literal_has_float_suffix", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::incorrect_optional_field", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::int_frac", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::integer_empty", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::invalid_num_fn", "test_reporting::inference_var_too_many_in_alias", "test_reporting::interpolate_not_identifier", "test_reporting::lambda_leading_comma", "test_reporting::lambda_double_comma", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::integer_out_of_range", "test_reporting::integer_malformed", "test_reporting::invalid_num", "test_reporting::list_double_comma", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::invalid_record_extension_type", "test_reporting::invalid_tag_extension_type", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::list_get_negative_number_indirect", "test_reporting::invalid_toplevel_cycle", "test_reporting::issue_2380_typed_body", "test_reporting::leq_binop_is_transparent", "test_reporting::issue_2380_alias_with_vars", "test_reporting::issue_2458", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::keyword_record_field_access", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_1755", "test_reporting::issue_2326", "test_reporting::list_get_negative_number", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::invalid_record_update", "test_reporting::keyword_qualified_import", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::list_without_end", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_pattern_not_terminated", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::lt_binop_is_transparent", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::malformed_hex_pattern", "test_reporting::list_match_spread_exhaustive", "test_reporting::malformed_oct_pattern", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_with_guard", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::malformed_float_pattern", "test_reporting::malformed_bin_pattern", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::malformed_int_pattern", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::mismatched_suffix_f32", "test_reporting::missing_imports", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_record_annotation", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_dec", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::multi_insufficient_indent", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::multi_no_end", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::missing_fields", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mismatched_suffix_nat", "test_reporting::module_ident_ends_with_dot", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::mutual_recursion_not_reached", "test_reporting::mismatched_suffix_u8", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::module_not_imported", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::negative_u128", "test_reporting::multiple_wildcards_in_alias", "test_reporting::negative_u16", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::neq_binop_is_transparent", "test_reporting::negative_u64", "test_reporting::nested_datatype", "test_reporting::num_too_general_named", "test_reporting::nested_datatype_inline", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::nested_specialization", "test_reporting::negative_u8", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::negative_u32", "test_reporting::not_enough_cases_for_open_union", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::numer_literal_multi_suffix", "test_reporting::non_exhaustive_with_guard", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::number_double_dot", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_mismatch_check", "test_reporting::num_too_general_wildcard", "test_reporting::opaque_ability_impl_qualified", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::pattern_binds_keyword", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_ability_impl_optional", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::pattern_in_parens_end_comma", "test_reporting::pattern_in_parens_indent_open", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::opaque_ref_field_access", "test_reporting::pattern_in_parens_end", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::pattern_in_parens_open", "test_reporting::opaque_type_not_in_scope", "test_reporting::optional_record_invalid_access", "test_reporting::platform_requires_rigids", "test_reporting::optional_record_invalid_function", "test_reporting::optional_record_invalid_when", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::optional_record_default_with_signature", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::optional_record_invalid_accessor", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::provides_to_identifier", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::optional_record_default_type_error", "test_reporting::optional_record_invalid_let_binding", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::patterns_int_redundant", "test_reporting::phantom_type_variable", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::pattern_let_mismatch", "test_reporting::pattern_guard_mismatch", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::patterns_let_not_exhaustive", "test_reporting::plus_on_str", "test_reporting::pattern_when_pattern", "test_reporting::pattern_when_condition", "test_reporting::patterns_record_not_exhaustive", "test_reporting::patterns_when_not_exhaustive", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::polymorphic_mutual_recursion", "test_reporting::polymorphic_recursion", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::report_module_color", "test_reporting::report_value_color", "test_reporting::report_region_in_color", "test_reporting::record_type_end", "test_reporting::record_type_keyword_field_name", "test_reporting::record_type_open", "test_reporting::record_type_tab", "test_reporting::record_type_missing_comma", "test_reporting::record_type_open_indent", "test_reporting::record_duplicate_field_different_types", "test_reporting::qualified_tag", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::report_precedence_problem_single_line", "test_reporting::record_type_duplicate_field", "test_reporting::record_field_mismatch", "test_reporting::record_access_ends_with_dot", "test_reporting::report_unused_def", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::record_duplicate_field_multiline", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::record_duplicate_field_same_type", "test_reporting::report_precedence_problem_multiline", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::report_shadowing", "test_reporting::report_shadowing_in_annotation", "test_reporting::record_update_value", "test_reporting::qualified_opaque_reference", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::self_recursive_alias", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::recursion_var_specialization_error", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::same_phantom_types_unify", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::second_wildcard_is_redundant", "test_reporting::tag_union_open", "test_reporting::single_no_end", "test_reporting::tag_union_end", "test_reporting::single_quote_too_long", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::type_annotation_double_colon", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::self_recursive_not_reached", "test_reporting::type_apply_stray_dot", "test_reporting::type_in_parens_end", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::self_recursive_not_reached_nested", "test_reporting::type_argument_no_arrow", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::tag_mismatch", "test_reporting::type_in_parens_start", "test_reporting::type_double_comma", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::specialization_for_wrong_type", "test_reporting::type_inline_alias", "test_reporting::too_few_type_arguments", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::type_apply_double_dot", "test_reporting::type_apply_trailing_dot", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::shadowing_top_level_scope", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::tags_missing", "test_reporting::tuple_exhaustiveness_good", "test_reporting::type_apply_start_with_lowercase", "test_reporting::tag_with_arguments_mismatch", "test_reporting::type_apply_start_with_number", "test_reporting::tag_missing", "test_reporting::shift_by_negative", "test_reporting::stray_dot_expr", "test_reporting::tag_union_duplicate_tag", "test_reporting::two_different_cons", "test_reporting::too_many_type_arguments", "test_reporting::u8_overflow", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::unicode_not_hex", "test_reporting::typo_uppercase_ok", "test_reporting::unify_alias_other", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::u16_overflow", "test_reporting::u64_overflow", "test_reporting::unicode_too_large", "test_reporting::u32_overflow", "test_reporting::unbound_var_in_alias", "test_reporting::unimported_modules_reported", "test_reporting::typo_lowercase_ok", "test_reporting::when_over_indented_underscore", "test_reporting::when_missing_arrow", "test_reporting::when_over_indented_int", "test_reporting::weird_escape", "test_reporting::when_outdented_branch", "test_reporting::unused_def_in_branch_pattern", "test_reporting::weird_accessor", "test_reporting::unused_argument", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::unused_shadow_specialization", "test_reporting::when_branch_mismatch", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::update_record_ext", "test_reporting::wildcard_in_alias", "test_reporting::update_empty_record", "test_reporting::unnecessary_extension_variable", "test_reporting::unwrap_num_elem_in_list", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::update_record", "test_reporting::when_if_guard", "test_reporting::update_record_snippet", "test_reporting::unused_arg_and_unused_def", "test_reporting::unused_value_import", "test_reporting::wildcard_in_opaque", "test_reporting::value_not_exposed", "test_reporting::unknown_type", "test_reporting::wild_case_arrow" ]
[]
[]
2023-05-01T19:46:22Z
191d8a74086267b102bb2a388dbd37f5b814b6e8
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -5084,8 +5084,12 @@ dependencies = [ "pretty_assertions", "regex", "roc_builtins", + "roc_collections", "roc_derive", "roc_load", + "roc_module", + "roc_mono", + "roc_packaging", "roc_parse", "roc_problem", "roc_reporting", diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -5049,9 +5049,12 @@ pub fn with_hole<'a>( ); } CopyExisting(index) => { - let record_needs_specialization = - procs.ability_member_aliases.get(structure).is_some(); - let specialized_structure_sym = if record_needs_specialization { + let structure_needs_specialization = + procs.ability_member_aliases.get(structure).is_some() + || procs.is_module_thunk(structure) + || procs.is_imported_module_thunk(structure); + + let specialized_structure_sym = if structure_needs_specialization { // We need to specialize the record now; create a new one for it. // TODO: reuse this symbol for all updates env.unique_symbol() diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -5068,10 +5071,7 @@ pub fn with_hole<'a>( stmt = Stmt::Let(*symbol, access_expr, *field_layout, arena.alloc(stmt)); - // If the records needs specialization or it's a thunk, we need to - // create the specialized definition or force the thunk, respectively. - // Both cases are handled below. - if record_needs_specialization || procs.is_module_thunk(structure) { + if structure_needs_specialization { stmt = specialize_symbol( env, procs,
roc-lang__roc-5284
5,284
This issue was originally reported [here](https://github.com/roc-lang/basic-cli/issues/23).
[ "5131" ]
0.0
roc-lang/roc
2023-04-12T16:41:00Z
diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -31,7 +31,7 @@ mod solve_expr { .. }, src, - ) = run_load_and_infer(src, false)?; + ) = run_load_and_infer(src, [], false)?; let mut can_problems = can_problems.remove(&home).unwrap_or_default(); let type_problems = type_problems.remove(&home).unwrap_or_default(); diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -103,7 +103,7 @@ mod solve_expr { interns, abilities_store, .. - } = run_load_and_infer(src, false).unwrap().0; + } = run_load_and_infer(src, [], false).unwrap().0; let can_problems = can_problems.remove(&home).unwrap_or_default(); let type_problems = type_problems.remove(&home).unwrap_or_default(); diff --git a/crates/compiler/test_solve_helpers/src/lib.rs b/crates/compiler/test_solve_helpers/src/lib.rs --- a/crates/compiler/test_solve_helpers/src/lib.rs +++ b/crates/compiler/test_solve_helpers/src/lib.rs @@ -44,8 +44,9 @@ fn promote_expr_to_module(src: &str) -> String { buffer } -pub fn run_load_and_infer( +pub fn run_load_and_infer<'a>( src: &str, + dependencies: impl IntoIterator<Item = (&'a str, &'a str)>, no_promote: bool, ) -> Result<(LoadedModule, String), std::io::Error> { use tempfile::tempdir; diff --git a/crates/compiler/test_solve_helpers/src/lib.rs b/crates/compiler/test_solve_helpers/src/lib.rs --- a/crates/compiler/test_solve_helpers/src/lib.rs +++ b/crates/compiler/test_solve_helpers/src/lib.rs @@ -65,6 +66,11 @@ pub fn run_load_and_infer( let loaded = { let dir = tempdir()?; + + for (file, source) in dependencies { + std::fs::write(dir.path().join(format!("{file}.roc")), source)?; + } + let filename = PathBuf::from("Test.roc"); let file_path = dir.path().join(filename); let result = roc_load::load_and_typecheck_str( diff --git a/crates/compiler/test_solve_helpers/src/lib.rs b/crates/compiler/test_solve_helpers/src/lib.rs --- a/crates/compiler/test_solve_helpers/src/lib.rs +++ b/crates/compiler/test_solve_helpers/src/lib.rs @@ -338,7 +344,11 @@ impl InferredProgram { } } -pub fn infer_queries(src: &str, options: InferOptions) -> Result<InferredProgram, Box<dyn Error>> { +pub fn infer_queries<'a>( + src: &str, + dependencies: impl IntoIterator<Item = (&'a str, &'a str)>, + options: InferOptions, +) -> Result<InferredProgram, Box<dyn Error>> { let ( LoadedModule { module_id: home, diff --git a/crates/compiler/test_solve_helpers/src/lib.rs b/crates/compiler/test_solve_helpers/src/lib.rs --- a/crates/compiler/test_solve_helpers/src/lib.rs +++ b/crates/compiler/test_solve_helpers/src/lib.rs @@ -351,7 +361,7 @@ pub fn infer_queries(src: &str, options: InferOptions) -> Result<InferredProgram .. }, src, - ) = run_load_and_infer(src, options.no_promote)?; + ) = run_load_and_infer(src, dependencies, options.no_promote)?; let declarations = declarations_by_id.remove(&home).unwrap(); let subs = solved.inner_mut(); diff --git a/crates/compiler/test_solve_helpers/src/lib.rs b/crates/compiler/test_solve_helpers/src/lib.rs --- a/crates/compiler/test_solve_helpers/src/lib.rs +++ b/crates/compiler/test_solve_helpers/src/lib.rs @@ -373,9 +383,6 @@ pub fn infer_queries(src: &str, options: InferOptions) -> Result<InferredProgram let line_info = LineInfo::new(&src); let queries = parse_queries(&src, &line_info); - if queries.is_empty() { - return Err("No queries provided!".into()); - } let mut inferred_queries = Vec::with_capacity(queries.len()); let exposed_by_module = ExposedByModule::default(); diff --git a/crates/compiler/test_solve_helpers/src/lib.rs b/crates/compiler/test_solve_helpers/src/lib.rs --- a/crates/compiler/test_solve_helpers/src/lib.rs +++ b/crates/compiler/test_solve_helpers/src/lib.rs @@ -561,40 +568,3 @@ impl<'a> QueryCtx<'a> { }) } } - -pub fn infer_queries_help(src: &str, expected: impl FnOnce(&str), options: InferOptions) { - let InferredProgram { - program, - inferred_queries, - } = infer_queries(src, options).unwrap(); - - let mut output_parts = Vec::with_capacity(inferred_queries.len() + 2); - - if options.print_can_decls { - use roc_can::debug::{pretty_print_declarations, PPCtx}; - let ctx = PPCtx { - home: program.home, - interns: &program.interns, - print_lambda_names: true, - }; - let pretty_decls = pretty_print_declarations(&ctx, &program.declarations); - output_parts.push(pretty_decls); - output_parts.push("\n".to_owned()); - } - - for InferredQuery { elaboration, .. } in inferred_queries { - let output_part = match elaboration { - Elaboration::Specialization { - specialized_name, - typ, - } => format!("{specialized_name} : {typ}"), - Elaboration::Source { source, typ } => format!("{source} : {typ}"), - Elaboration::Instantiation { .. } => panic!("Use uitest instead"), - }; - output_parts.push(output_part); - } - - let pretty_output = output_parts.join("\n"); - - expected(&pretty_output); -} diff --git a/crates/compiler/uitest/Cargo.toml b/crates/compiler/uitest/Cargo.toml --- a/crates/compiler/uitest/Cargo.toml +++ b/crates/compiler/uitest/Cargo.toml @@ -14,8 +14,12 @@ harness = false [dev-dependencies] roc_builtins = { path = "../builtins" } +roc_collections = { path = "../collections" } roc_derive = { path = "../derive", features = ["debug-derived-symbols"] } roc_load = { path = "../load" } +roc_packaging = { path = "../../packaging" } +roc_module = { path = "../module", features = ["debug-symbols"] } +roc_mono = { path = "../mono" } roc_parse = { path = "../parse" } roc_problem = { path = "../problem" } roc_reporting = { path = "../../reporting" } diff --git /dev/null b/crates/compiler/uitest/src/mono.rs new file mode 100644 --- /dev/null +++ b/crates/compiler/uitest/src/mono.rs @@ -0,0 +1,135 @@ +use std::io; + +use bumpalo::Bump; +use roc_collections::MutMap; +use roc_load::{ExecutionMode, LoadConfig, LoadMonomorphizedError, Threading}; +use roc_module::symbol::{Interns, Symbol}; +use roc_mono::{ + ir::{Proc, ProcLayout}, + layout::STLayoutInterner, +}; +use tempfile::tempdir; + +#[derive(Default)] +pub struct MonoOptions { + pub no_check: bool, +} + +pub fn write_compiled_ir<'a>( + writer: &mut impl io::Write, + test_module: &str, + dependencies: impl IntoIterator<Item = (&'a str, &'a str)>, + options: MonoOptions, +) -> io::Result<()> { + use roc_packaging::cache::RocCacheDir; + use std::path::PathBuf; + + let exec_mode = ExecutionMode::Executable; + + let arena = &Bump::new(); + + let dir = tempdir()?; + + for (file, source) in dependencies { + std::fs::write(dir.path().join(format!("{file}.roc")), source)?; + } + + let filename = PathBuf::from("Test.roc"); + let file_path = dir.path().join(filename); + + let load_config = LoadConfig { + target_info: roc_target::TargetInfo::default_x86_64(), + threading: Threading::Single, + render: roc_reporting::report::RenderTarget::Generic, + palette: roc_reporting::report::DEFAULT_PALETTE, + exec_mode, + }; + let loaded = roc_load::load_and_monomorphize_from_str( + arena, + file_path, + test_module, + dir.path().to_path_buf(), + RocCacheDir::Disallowed, + load_config, + ); + + let loaded = match loaded { + Ok(x) => x, + Err(LoadMonomorphizedError::LoadingProblem(roc_load::LoadingProblem::FormattedReport( + report, + ))) => { + println!("{}", report); + panic!(); + } + Err(e) => panic!("{:?}", e), + }; + + use roc_load::MonomorphizedModule; + let MonomorphizedModule { + procedures, + exposed_to_host, + mut layout_interner, + interns, + .. + } = loaded; + + let main_fn_symbol = exposed_to_host.top_level_values.keys().copied().next(); + + if !options.no_check { + check_procedures(arena, &interns, &mut layout_interner, &procedures); + } + + write_procedures(writer, layout_interner, procedures, main_fn_symbol) +} + +fn check_procedures<'a>( + arena: &'a Bump, + interns: &Interns, + interner: &mut STLayoutInterner<'a>, + procedures: &MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>, +) { + use roc_mono::debug::{check_procs, format_problems}; + let problems = check_procs(arena, interner, procedures); + if problems.is_empty() { + return; + } + let formatted = format_problems(interns, interner, problems); + panic!("IR problems found:\n{formatted}"); +} + +fn write_procedures<'a>( + writer: &mut impl io::Write, + interner: STLayoutInterner<'a>, + procedures: MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>, + opt_main_fn_symbol: Option<Symbol>, +) -> io::Result<()> { + let mut procs_strings = procedures + .values() + .map(|proc| proc.to_pretty(&interner, 200, false)) + .collect::<Vec<_>>(); + + let opt_main_fn = opt_main_fn_symbol.map(|main_fn_symbol| { + let index = procedures + .keys() + .position(|(s, _)| *s == main_fn_symbol) + .unwrap(); + procs_strings.swap_remove(index) + }); + + procs_strings.sort(); + + if let Some(main_fn) = opt_main_fn { + procs_strings.push(main_fn); + } + + let mut procs = procs_strings.iter().peekable(); + while let Some(proc) = procs.next() { + if procs.peek().is_some() { + writeln!(writer, "{}", proc)?; + } else { + write!(writer, "{}", proc)?; + } + } + + Ok(()) +} diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -8,11 +8,15 @@ use std::{ use lazy_static::lazy_static; use libtest_mimic::{run, Arguments, Failed, Trial}; +use mono::MonoOptions; use regex::Regex; +use roc_collections::VecMap; use test_solve_helpers::{ infer_queries, Elaboration, InferOptions, InferredProgram, InferredQuery, MUTLILINE_MARKER, }; +mod mono; + fn main() -> Result<(), Box<dyn Error>> { let args = Arguments::from_args(); diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -36,9 +40,17 @@ lazy_static! { static ref RE_OPT_INFER: Regex = Regex::new(r#"# \+opt infer:(?P<opt>.*)"#).unwrap(); - /// # +opt print:<opt> - static ref RE_OPT_PRINT: Regex = - Regex::new(r#"# \+opt print:(?P<opt>.*)"#).unwrap(); + /// # +opt mono:<opt> + static ref RE_OPT_MONO: Regex = + Regex::new(r#"# \+opt mono:(?P<opt>.*)"#).unwrap(); + + /// # +emit:<opt> + static ref RE_EMIT: Regex = + Regex::new(r#"# \+emit:(?P<opt>.*)"#).unwrap(); + + /// ## module <name> + static ref RE_MODULE: Regex = + Regex::new(r#"## module (?P<name>.*)"#).unwrap(); } fn collect_uitest_files() -> io::Result<Vec<PathBuf>> { diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -79,11 +91,19 @@ fn run_test(path: PathBuf) -> Result<(), Failed> { let data = std::fs::read_to_string(&path)?; let TestCase { infer_options, - print_options, - source, - } = TestCase::parse(data)?; - - let inferred_program = infer_queries(&source, infer_options)?; + emit_options, + mono_options, + program, + } = TestCase::parse(&data)?; + + let inferred_program = infer_queries( + program.test_module, + program + .other_modules + .iter() + .map(|(md, src)| (&**md, &**src)), + infer_options, + )?; { let mut fd = fs::OpenOptions::new() diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -91,7 +111,13 @@ fn run_test(path: PathBuf) -> Result<(), Failed> { .truncate(true) .open(&path)?; - assemble_query_output(&mut fd, &source, inferred_program, print_options)?; + assemble_query_output( + &mut fd, + program, + inferred_program, + mono_options, + emit_options, + )?; } check_for_changes(&path)?; diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -101,32 +127,93 @@ fn run_test(path: PathBuf) -> Result<(), Failed> { const EMIT_HEADER: &str = "# -emit:"; -struct TestCase { +struct Modules<'a> { + before_any: &'a str, + other_modules: VecMap<&'a str, &'a str>, + test_module: &'a str, +} + +struct TestCase<'a> { infer_options: InferOptions, - print_options: PrintOptions, - source: String, + mono_options: MonoOptions, + emit_options: EmitOptions, + program: Modules<'a>, } #[derive(Default)] -struct PrintOptions { +struct EmitOptions { can_decls: bool, + mono: bool, } -impl TestCase { - fn parse(mut data: String) -> Result<Self, Failed> { +impl<'a> TestCase<'a> { + fn parse(mut data: &'a str) -> Result<Self, Failed> { // Drop anything following `# -emit:` header lines; that's the output. if let Some(drop_at) = data.find(EMIT_HEADER) { - data.truncate(drop_at); - data.truncate(data.trim_end().len()); + data = data[..drop_at].trim_end(); } + let infer_options = Self::parse_infer_options(data)?; + let mono_options = Self::parse_mono_options(data)?; + let emit_options = Self::parse_emit_options(data)?; + + let program = Self::parse_modules(data); + Ok(TestCase { - infer_options: Self::parse_infer_options(&data)?, - print_options: Self::parse_print_options(&data)?, - source: data, + infer_options, + mono_options, + emit_options, + program, }) } + fn parse_modules(data: &'a str) -> Modules<'a> { + let mut module_starts = RE_MODULE.captures_iter(data).peekable(); + + let first_module_start = match module_starts.peek() { + None => { + // This is just a single module with no name; it is the test module. + return Modules { + before_any: Default::default(), + other_modules: Default::default(), + test_module: data, + }; + } + Some(p) => p.get(0).unwrap().start(), + }; + + let before_any = data[..first_module_start].trim(); + + let mut test_module = None; + let mut other_modules = VecMap::new(); + + while let Some(module_start) = module_starts.next() { + let module_name = module_start.name("name").unwrap().as_str(); + let module_start = module_start.get(0).unwrap().end(); + let module = match module_starts.peek() { + None => &data[module_start..], + Some(next_module_start) => { + let module_end = next_module_start.get(0).unwrap().start(); + &data[module_start..module_end] + } + } + .trim(); + + if module_name == "Test" { + test_module = Some(module); + } else { + other_modules.insert(module_name, module); + } + } + + let test_module = test_module.expect("no Test module found"); + Modules { + before_any, + other_modules, + test_module, + } + } + fn parse_infer_options(data: &str) -> Result<InferOptions, Failed> { let mut infer_opts = InferOptions { no_promote: true, diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -146,19 +233,35 @@ impl TestCase { Ok(infer_opts) } - fn parse_print_options(data: &str) -> Result<PrintOptions, Failed> { - let mut print_opts = PrintOptions::default(); + fn parse_mono_options(data: &str) -> Result<MonoOptions, Failed> { + let mut mono_opts = MonoOptions::default(); - let found_infer_opts = RE_OPT_PRINT.captures_iter(data); + let found_infer_opts = RE_OPT_MONO.captures_iter(data); for infer_opt in found_infer_opts { let opt = infer_opt.name("opt").unwrap().as_str(); match opt.trim() { - "can_decls" => print_opts.can_decls = true, - other => return Err(format!("unknown print option: {other:?}").into()), + "no_check" => mono_opts.no_check = true, + other => return Err(format!("unknown mono option: {other:?}").into()), } } - Ok(print_opts) + Ok(mono_opts) + } + + fn parse_emit_options(data: &str) -> Result<EmitOptions, Failed> { + let mut emit_opts = EmitOptions::default(); + + let found_infer_opts = RE_EMIT.captures_iter(data); + for infer_opt in found_infer_opts { + let opt = infer_opt.name("opt").unwrap().as_str(); + match opt.trim() { + "can_decls" => emit_opts.can_decls = true, + "mono" => emit_opts.mono = true, + other => return Err(format!("unknown emit option: {other:?}").into()), + } + } + + Ok(emit_opts) } } diff --git a/crates/compiler/uitest/src/uitest.rs b/crates/compiler/uitest/src/uitest.rs --- a/crates/compiler/uitest/src/uitest.rs +++ b/crates/compiler/uitest/src/uitest.rs @@ -184,25 +287,53 @@ fn check_for_changes(path: &Path) -> Result<(), Failed> { /// Assemble the output for a test, with queries elaborated in-line. fn assemble_query_output( writer: &mut impl io::Write, - source: &str, + program: Modules<'_>, inferred_program: InferredProgram, - print_options: PrintOptions, + mono_options: MonoOptions, + emit_options: EmitOptions, ) -> io::Result<()> { + let Modules { + before_any, + other_modules, + test_module, + } = program; + + if !before_any.is_empty() { + writeln!(writer, "{before_any}\n")?; + } + + for (module, source) in other_modules.iter() { + writeln!(writer, "## module {module}")?; + writeln!(writer, "{}\n", source)?; + } + + if !other_modules.is_empty() { + writeln!(writer, "## module Test")?; + } + // Reverse the queries so that we can pop them off the end as we pass through the lines. let (queries, program) = inferred_program.decompose(); let mut sorted_queries = queries.into_sorted(); sorted_queries.reverse(); let mut reflow = Reflow::new_unindented(writer); - write_source_with_answers(&mut reflow, source, sorted_queries, 0)?; + write_source_with_answers(&mut reflow, test_module, sorted_queries, 0)?; - // Finish up with any remaining print options we were asked to provide. - let PrintOptions { can_decls } = print_options; + // Finish up with any remaining emit options we were asked to provide. + let EmitOptions { can_decls, mono } = emit_options; if can_decls { writeln!(writer, "\n{EMIT_HEADER}can_decls")?; program.write_can_decls(writer)?; } + if mono { + writeln!(writer, "\n{EMIT_HEADER}mono")?; + // Unfortunately, with the current setup we must now recompile into the IR. + // TODO: extend the data returned by a monomorphized module to include + // that of a solved module. + mono::write_compiled_ir(writer, test_module, other_modules, mono_options)?; + } + Ok(()) } diff --git a/crates/compiler/uitest/tests/lambda_set/disjoint_nested_lambdas_result_in_disjoint_parents_issue_4712.txt b/crates/compiler/uitest/tests/lambda_set/disjoint_nested_lambdas_result_in_disjoint_parents_issue_4712.txt --- a/crates/compiler/uitest/tests/lambda_set/disjoint_nested_lambdas_result_in_disjoint_parents_issue_4712.txt +++ b/crates/compiler/uitest/tests/lambda_set/disjoint_nested_lambdas_result_in_disjoint_parents_issue_4712.txt @@ -1,5 +1,5 @@ -# +opt print:can_decls # +opt infer:print_only_under_alias +# +emit:can_decls app "test" provides [main] to "./platform" Parser a : {} -> a diff --git /dev/null b/crates/compiler/uitest/tests/specialize/record_update_between_modules.txt new file mode 100644 --- /dev/null +++ b/crates/compiler/uitest/tests/specialize/record_update_between_modules.txt @@ -0,0 +1,32 @@ +# +emit:mono +# +opt mono:no_check + +## module Dep +interface Dep exposes [defaultRequest] imports [] + +defaultRequest = { + url: "", + body: "", +} + +## module Test +app "test" imports [Dep.{ defaultRequest }] provides [main] to "./platform" + +main = + { defaultRequest & url: "http://www.example.com" } + +# -emit:mono +procedure Dep.0 (): + let Dep.2 : Str = ""; + let Dep.3 : Str = ""; + let Dep.1 : {Str, Str} = Struct {Dep.2, Dep.3}; + ret Dep.1; + +procedure Test.0 (): + let Test.3 : Str = "http://www.example.com"; + let Test.4 : {Str, Str} = CallByName Dep.0; + let Test.2 : Str = StructAtIndex 0 Test.4; + inc Test.2; + dec Test.4; + let Test.1 : {Str, Str} = Struct {Test.2, Test.3}; + ret Test.1;
Record update with `&` fails on imported record This is similar to https://github.com/roc-lang/roc/issues/3908 which has been resolved, I think the issue may be caused by the fact that `defaultRequest` is imported. ``` app "temptest" packages { pf: "cli-platform/main.roc" } imports [pf.Stdout, pf.Http.{defaultRequest}] provides [main] to pf main = request = { defaultRequest & url: "http://www.example.com" } Stdout.line request.url ``` The error: ``` ❯ RUST_BACKTRACE=1 ./target/release/roc run examples/cli/temptest.roc 🔨 Rebuilding platform... thread 'main' panicked at 'no entry found for key', crates/compiler/alias_analysis/src/lib.rs:1404:28 stack backtrace: 0: rust_begin_unwind at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14 2: core::panicking::panic_display at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:72:5 3: core::panicking::panic_str at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:56:5 4: core::option::expect_failed at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:1880:5 5: roc_alias_analysis::expr_spec 6: roc_alias_analysis::stmt_spec 7: roc_alias_analysis::proc_spec 8: roc_gen_llvm::llvm::build::build_procedures_help 9: roc_gen_llvm::llvm::build::build_procedures 10: roc_build::program::gen_from_mono_module_llvm 11: roc_build::program::gen_from_mono_module 12: roc_build::program::build_loaded_file 13: roc_build::program::build_file 14: roc_cli::build 15: roc::main note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ``` Using a non-imported record works: ``` app "temptest" packages { pf: "cli-platform/main.roc" } imports [pf.Stdout] provides [main] to pf main = defaultRequest = { url: "", } request = { defaultRequest & url: "http://www.example.com" } Stdout.line request.url ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "tests/lambda_set/disjoint_nested_lambdas_result_in_disjoint_parents_issue_4712.txt " ]
[ "solve_expr::annotated_using_i16", "solve_expr::annotation_f64", "solve_expr::annotated_f32", "solve_expr::annotated_using_i64", "solve_expr::ability_constrained_in_non_member_infer", "solve_expr::annotated_using_u8", "solve_expr::annotated_using_u16", "solve_expr::annotated_using_u64", "solve_expr::ability_constrained_in_non_member_multiple_specializations", "solve_expr::ability_constrained_in_non_member_infer_usage", "solve_expr::ability_checked_specialization_with_annotation_only", "solve_expr::annotation_num_integer", "solve_expr::annotation_f32", "solve_expr::annotated_using_u32", "solve_expr::ability_specialization_called", "solve_expr::annotation_num_floatingpoint", "solve_expr::annotated_using_u128", "solve_expr::always_return_empty_record", "solve_expr::annotated_f64", "solve_expr::annotated_using_i32", "solve_expr::annotated_using_i128", "solve_expr::annotated_using_i8", "solve_expr::accessor_function", "solve_expr::alias_in_opaque", "solve_expr::always_function", "solve_expr::always_with_list", "solve_expr::ability_constrained_in_non_member_check", "solve_expr::ability_checked_specialization_with_typed_body", "solve_expr::alias_ability_member", "solve_expr::annotated_num_floatingpoint", "solve_expr::annotated_num_integer", "solve_expr::alias_propagates_able_var", "solve_expr::annotation_using_i128", "solve_expr::annotation_using_i8", "solve_expr::annotation_using_i16", "solve_expr::annotation_using_i32", "solve_expr::annotation_using_i64", "solve_expr::annotation_using_u16", "solve_expr::annotation_using_u128", "solve_expr::applied_tag_function_list", "solve_expr::annotation_using_u8", "solve_expr::anonymous_identity", "solve_expr::applied_tag", "solve_expr::annotation_using_u64", "solve_expr::atan", "solve_expr::applied_tag_function_list_map", "solve_expr::annotation_using_u32", "solve_expr::basic_result_conditional", "solve_expr::apply_function", "solve_expr::applied_tag_function_list_other_way", "solve_expr::call_returns_int", "solve_expr::call_returns_list", "solve_expr::applied_tag_function", "solve_expr::basic_result_err", "solve_expr::applied_tag_function_with_annotation", "solve_expr::applied_tag_function_record", "solve_expr::bare_tag", "solve_expr::basic_result_ok", "solve_expr::ceiling", "solve_expr::copy_vars_referencing_copied_vars", "solve_expr::dec_literal", "solve_expr::def_2_arg_closure", "solve_expr::def_1_arg_closure", "solve_expr::check_phantom_type", "solve_expr::def_3_arg_closure", "solve_expr::def_multiple_ints", "solve_expr::def_multiple_functions", "solve_expr::def_empty_record", "solve_expr::def_returning_closure", "solve_expr::def_multiple_strings", "solve_expr::div_ceil", "solve_expr::div_ceil_checked", "solve_expr::defs_from_load", "solve_expr::div", "solve_expr::def_string", "solve_expr::div_trunc", "solve_expr::div_checked", "solve_expr::div_trunc_checked", "solve_expr::double_named_rigids", "solve_expr::empty_list", "solve_expr::double_tag_application_pattern", "solve_expr::empty_string", "solve_expr::exposed_ability_name", "solve_expr::empty_record_pattern", "solve_expr::flip_function", "solve_expr::export_rigid_to_lower_rank", "solve_expr::expr_to_str", "solve_expr::fake_result_ok", "solve_expr::empty_record", "solve_expr::fake_result_err", "solve_expr::float_literal", "solve_expr::from_bit", "solve_expr::function_alias_in_signature", "solve_expr::floor", "solve_expr::function_that_captures_nothing_is_not_captured", "solve_expr::generalize_and_specialize_recursion_var", "solve_expr::identity_alias", "solve_expr::generalized_accessor_function_applied", "solve_expr::identity_infers_principal_type", "solve_expr::identity_list", "solve_expr::identity_function", "solve_expr::identity_map", "solve_expr::identity_works_on_incompatible_types", "solve_expr::identity_returns_given_type", "solve_expr::infer_interpolated_field", "solve_expr::infer_interpolated_string", "solve_expr::indirect_always", "solve_expr::infer_interpolated_var", "solve_expr::infer_linked_list_map", "solve_expr::if_with_int_literals", "solve_expr::identity_of_identity", "solve_expr::infer_phantom_type_flow", "solve_expr::infer_union_input_position2", "solve_expr::infer_union_input_position1", "solve_expr::infer_mutually_recursive_tag_union", "solve_expr::infer_unbound_phantom_type_star", "solve_expr::infer_record_linked_list_map", "solve_expr::infer_union_argument_position", "solve_expr::infer_union_input_position10", "solve_expr::infer_union_def_position", "solve_expr::infer_union_input_position5", "solve_expr::infer_union_input_position7", "solve_expr::double_tag_application", "solve_expr::infer_union_input_position3", "solve_expr::infer_union_input_position8", "solve_expr::infer_union_input_position6", "solve_expr::infer_union_input_position4", "solve_expr::infer_union_input_position9", "solve_expr::infer_variables_in_value_def_signature", "solve_expr::infer_variables_in_destructure_def_signature", "solve_expr::inference_var_inside_ctor_linked", "solve_expr::inference_var_inside_ctor", "solve_expr::inference_var_inside_tag_ctor", "solve_expr::inference_var_rcd_union_ext", "solve_expr::inference_var_link_with_rigid", "solve_expr::inference_var_inside_arrow", "solve_expr::inference_var_tag_union_ext", "solve_expr::int_literal", "solve_expr::issue_2217", "solve_expr::int_type_let_polymorphism", "solve_expr::issue_2458", "solve_expr::issue_2458_swapped_order", "solve_expr::let_record_pattern_with_alias_annotation", "solve_expr::integer_sum", "solve_expr::let_tag_pattern_with_annotation", "solve_expr::lambda_set_within_alias_is_quantified", "solve_expr::let_record_pattern_with_annotation_alias", "solve_expr::linked_list_empty", "solve_expr::let_record_pattern_with_annotation", "solve_expr::issue_2583_specialize_errors_behind_unified_branches", "solve_expr::list_drop_last", "solve_expr::linked_list_singleton", "solve_expr::list_intersperse", "solve_expr::list_of_ints", "solve_expr::issue_2217_inlined", "solve_expr::list_of_one_int", "solve_expr::list_of_lists", "solve_expr::list_of_one_string", "solve_expr::list_drop_at", "solve_expr::list_of_strings", "solve_expr::list_split", "solve_expr::list_take_last", "solve_expr::list_sublist", "solve_expr::map_insert", "solve_expr::list_take_first", "solve_expr::list_walk_backwards", "solve_expr::list_walk_backwards_example", "solve_expr::max_i32", "solve_expr::max_u32", "solve_expr::max_u64", "solve_expr::min_i128", "solve_expr::max_i64", "solve_expr::lots_of_type_variables", "solve_expr::min_u32", "solve_expr::max_i128", "solve_expr::mismatch_heterogeneous_nested_empty_list", "solve_expr::min_i64", "solve_expr::min_u64", "solve_expr::mismatch_heterogeneous_nested_list", "solve_expr::mismatch_in_alias_args_gets_reported", "solve_expr::list_get", "solve_expr::mismatch_heterogeneous_list", "solve_expr::mismatch_in_apply_gets_reported", "solve_expr::mismatch_in_tag_gets_reported", "solve_expr::mutual_recursion_with_inference_var", "solve_expr::multiple_abilities_multiple_members_specializations", "solve_expr::nested_empty_list", "solve_expr::nested_list_of_ints", "solve_expr::nested_open_tag_union", "solve_expr::min_i32", "solve_expr::num_identity", "solve_expr::num_to_frac", "solve_expr::numeric_literal_suffixes", "solve_expr::numeric_literal_suffixes_in_pattern", "solve_expr::one_field_record", "solve_expr::opaque_unwrap_infer", "solve_expr::opaque_and_alias_unify", "solve_expr::opaque_unwrap_polymorphic_from_multiple_branches_check", "solve_expr::opaque_unwrap_polymorphic_from_multiple_branches_infer", "solve_expr::opaque_unwrap_check", "solve_expr::opaque_unwrap_polymorphic_check", "solve_expr::opaque_unwrap_polymorphic_specialized_infer", "solve_expr::opaque_wrap_function", "solve_expr::opaque_unwrap_polymorphic_infer", "solve_expr::opaque_wrap_check", "solve_expr::opaque_wrap_function_with_inferred_arg", "solve_expr::opaque_wrap_polymorphic_infer", "solve_expr::opaque_wrap_polymorphic_check", "solve_expr::opaque_wrap_infer", "solve_expr::open_optional_field_unifies_with_missing", "solve_expr::optional_field_let", "solve_expr::opaque_unwrap_polymorphic_specialized_check", "solve_expr::qualified_annotated_using_i64", "solve_expr::pass_a_function", "solve_expr::peano_map_infer", "solve_expr::qualified_annotated_using_i32", "solve_expr::pizza_desugar", "solve_expr::open_optional_field_unifies_with_present", "solve_expr::pattern_rigid_problem", "solve_expr::qualified_annotated_f64", "solve_expr::pizza_desugar_two_arguments", "solve_expr::opaque_wrap_polymorphic_from_multiple_branches_check", "solve_expr::optional_field_let_with_signature", "solve_expr::pow", "solve_expr::optional_field_function", "solve_expr::optional_field_when", "solve_expr::qualified_annotated_using_u32", "solve_expr::optional_field_unifies_with_present", "solve_expr::opaque_wrap_polymorphic_from_multiple_branches_infer", "solve_expr::optional_field_unifies_with_missing", "solve_expr::peano_length", "solve_expr::qualified_annotated_using_i16", "solve_expr::peano_map_alias", "solve_expr::peano_map_infer_nested", "solve_expr::qualified_annotated_num_floatingpoint", "solve_expr::qualified_annotated_num_integer", "solve_expr::qualified_annotated_using_i128", "solve_expr::qualified_annotated_using_u64", "solve_expr::qualified_annotated_using_i8", "solve_expr::qualified_annotated_f32", "solve_expr::peano_map", "solve_expr::qualified_annotated_using_u128", "solve_expr::qualified_annotated_using_u8", "solve_expr::qualified_annotated_using_u16", "solve_expr::qualified_annotation_using_u8", "solve_expr::reconstruct_path", "solve_expr::qualified_annotation_using_i16", "solve_expr::qualified_annotation_using_u64", "solve_expr::qualified_annotation_using_u32", "solve_expr::quicksort_partition_help", "solve_expr::qualified_annotation_using_u128", "solve_expr::rbtree_balance_simplified", "solve_expr::qualified_annotation_f32", "solve_expr::qualified_annotation_using_i64", "solve_expr::rbtree_old_balance_simplified", "solve_expr::qualified_annotation_f64", "solve_expr::qualified_annotation_using_i8", "solve_expr::record_extension_variable_is_alias", "solve_expr::qualified_annotation_num_floatingpoint", "solve_expr::rbtree_foobar", "solve_expr::qualified_annotation_num_integer", "solve_expr::qualified_annotation_using_u16", "solve_expr::record_from_load", "solve_expr::rbtree_insert", "solve_expr::rbtree_balance", "solve_expr::rbtree_empty", "solve_expr::record_field_pattern_match_with_guard", "solve_expr::record_arg", "solve_expr::record_extraction", "solve_expr::qualified_annotation_using_i32", "solve_expr::qualified_annotation_using_i128", "solve_expr::quicksort_partition", "solve_expr::record_literal_accessor_function", "solve_expr::rbtree_full_remove_min", "solve_expr::record_literal_accessor", "solve_expr::rbtree_remove_min_1", "solve_expr::recursive_function_with_rigid", "solve_expr::record_with_bound_var", "solve_expr::self_recursion_with_inference_var", "solve_expr::record_update", "solve_expr::result_map_alias", "solve_expr::recursive_identity", "solve_expr::str_trim_left", "solve_expr::single_ability_multiple_members_specializations", "solve_expr::result_map_explicit", "solve_expr::str_trim", "solve_expr::rigid_record_quantification - should panic", "solve_expr::record_type_annotation", "solve_expr::rigids", "solve_expr::string_from_utf8", "solve_expr::rigid_in_letrec_ignored", "solve_expr::solve_list_get", "solve_expr::string_starts_with", "solve_expr::tag_extension_variable_is_alias", "solve_expr::single_ability_single_member_specializations", "solve_expr::rigid_in_letrec", "solve_expr::rigid_in_letnonrec", "solve_expr::sorting", "solve_expr::string_literal", "solve_expr::rosetree_with_result_is_legal_recursive_type", "solve_expr::rigid_type_variable_problem", "solve_expr::single_tag_pattern", "solve_expr::string_from_int", "solve_expr::tag_inclusion_behind_opaque", "solve_expr::tag_inclusion_behind_opaque_infer", "solve_expr::tag_inclusion_behind_opaque_infer_single_ctor", "solve_expr::tag_application", "solve_expr::tag_union_pattern_match", "solve_expr::tag_with_field", "solve_expr::tag_union_pattern_match_ignored_field", "solve_expr::to_bit_record", "solve_expr::task_wildcard_wildcard", "solve_expr::stdlib_encode_json", "solve_expr::to_float", "solve_expr::triple_nested_int_list", "solve_expr::to_int", "solve_expr::to_bit", "solve_expr::triple_nested_list", "solve_expr::tuple_literal_accessor", "solve_expr::tuple_accessor_generalization", "solve_expr::tuple_literal_ty", "solve_expr::tuple_literal_accessor_function", "solve_expr::type_signature_without_body_record", "solve_expr::three_arg_return_string", "solve_expr::two_field_record", "solve_expr::two_tag_pattern", "solve_expr::two_arg_return_int", "solve_expr::type_signature_without_body_rigid", "solve_expr::triple_nested_string_list", "solve_expr::typecheck_mutually_recursive_tag_union_2", "solve_expr::typecheck_linked_list_map", "solve_expr::type_more_general_than_signature", "solve_expr::typecheck_mutually_recursive_tag_union_listabc", "solve_expr::unit_alias", "solve_expr::type_signature_without_body", "solve_expr::use_alias_in_let", "solve_expr::typecheck_record_linked_list_map", "solve_expr::use_alias_with_argument_in_let", "solve_expr::use_apply", "solve_expr::when_with_int_literals", "solve_expr::using_type_signature", "solve_expr::use_correct_ext_tag_union", "solve_expr::use_correct_ext_record", "solve_expr::use_as_in_signature", "solve_expr::wrap_recursive_opaque_positive_position", "solve_expr::when_branch_and_body_flipflop", "solve_expr::when_with_or_pattern_and_guard", "solve_expr::when_with_annotation", "solve_expr::use_rigid_twice", "solve_expr::wrap_recursive_opaque_negative_position", "solve_expr::tuple_literal_accessor_ty", "tests/recursion/self_recursive_function_not_syntactically_a_function.txt ", "tests/recursion/issue_4246_admit_recursion_between_opaque_functions.txt ", "tests/ranged/check_char_as_u32.txt ", "tests/ranged/check_char_pattern_as_u32.txt ", "tests/ranged/check_char_as_u16.txt ", "tests/pattern/as/uses_inferred_type.txt ", "tests/recursion/issue_3261.txt ", "tests/pattern/infer_type_with_underscore_destructure_assignment.txt ", "tests/recursive_type/inferred_fixed_fixpoints.txt ", "tests/recursive_type/fix_recursion_under_alias_issue_4368.txt ", "tests/lambda_set/dispatch_tag_union_function_inferred.txt ", "tests/pattern/as/list.txt ", "tests/constrain_dbg_flex_var.txt ", "tests/ranged/check_char_as_u8.txt ", "tests/infer_contextual_crash.txt ", "tests/infer_concrete_type_with_inference_var.txt ", "tests/lambda_set/transient_captures.txt ", "tests/lambda_set/lambda_sets_collide_with_captured_var.txt ", "tests/ranged/check_char_pattern_as_u16.txt ", "tests/lambda_set/mutually_recursive_captures.txt ", "tests/recursion/choose_correct_recursion_var_under_record.txt ", "tests/recursion/constrain_recursive_annotation_independently_issue_5256.txt ", "tests/lambda_set/recursive_closure_issue_3444.txt ", "tests/recursion/self_recursive_function_not_syntactically_a_function_nested.txt ", "tests/pattern/as/does_not_narrow.txt ", "tests/ranged/check_char_pattern_as_u8.txt ", "tests/lambda_set/lambda_set_niche_same_layout_different_constructor.txt ", "tests/recursive_type/unify_types_with_fixed_fixpoints_outside_fixing_region.txt ", "tests/recursive_type/solve_inference_var_in_annotation_requiring_recursion_fix.txt ", "tests/recursion/calls_result_in_unique_specializations.txt ", "tests/lambda_set/lambda_sets_collide_with_captured_function.txt ", "tests/ability/bounds/multiple_variables_bound_to_an_ability_from_type_def.txt ", "tests/lambda_set/list_of_lambdas.txt ", "tests/ability/specialize/resolve_lambda_set_branches_ability_vs_non_ability.txt ", "tests/ability/specialize/resolve_mutually_recursive_ability_lambda_sets_inferred.txt ", "tests/ability/specialize/opaque_eq_derive.txt ", "tests/ability/bounds/rigid_able_bounds_are_superset_of_flex_bounds_admitted.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_with_deep_specialization_and_capture.txt ", "tests/ability/generalize_inferred_opaque_variable_bound_to_ability_issue_4408.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_with_let_weakened.txt ", "tests/ability/impl_ability_for_opaque_with_lambda_sets.txt ", "tests/ability/specialize/ranged_num_hash.txt ", "tests/ability/specialize/resolve_lambda_set_ability_chain.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_varying_over_multiple_variables.txt ", "tests/ability/specialize/static_specialization.txt ", "tests/ability/specialize/opaque_encoder_derive.txt ", "tests/ability/specialize/set_eq_issue_4761.txt ", "tests/ability/specialize/float_eq_forces_dec.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_varying_over_multiple_variables_two_results.txt", "tests/ability/smoke/decoder.txt ", "tests/ability/bounds/expand_able_variables_in_type_alias.txt ", "tests/ability/specialize/resolve_unspecialized_lambda_set_behind_opaque.txt ", "tests/ability/specialize/bool_decoder.txt ", "tests/ability/smoke/encoder.txt ", "tests/ability/impl_ability_for_opaque_with_lambda_sets_material.txt ", "tests/ability/specialize/resolve_unspecialized_lambda_set_behind_alias.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_branching_over_single_variable.txt ", "tests/ability/specialize/opaque_hash_derive.txt ", "tests/ability/specialize/resolve_recursive_ability_lambda_set.txt ", "tests/ability/specialize/resolve_lambda_set_generalized_ability_alias.txt ", "tests/ability/specialize/opaque_hash_custom.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization.txt ", "tests/lambda_set/recursive_closure_with_transiently_used_capture.txt ", "tests/ability/specialize/resolve_lambda_set_weakened_ability_alias.txt ", "tests/lambda_set/transient_captures_after_def_ordering.txt ", "tests/ability/specialize/opaque_decoder_derive.txt ", "tests/ability/specialize/record_to_encoder_with_nested_custom_impl.txt ", "tests/ability/specialize/bool_eq.txt ", "tests/ability/specialize/resolve_lambda_set_branches_same_ability.txt ", "tests/exhaustive/match_on_result_with_uninhabited_error_destructuring_in_lambda_syntax.txt ", "tests/ability/specialize/record_to_encoder.txt ", "tests/exhaustive/intermediate_branch_types.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_with_let_weakened_unapplied.txt ", "tests/exhaustive/match_on_result_with_uninhabited_error_destructuring.txt ", "tests/ability/specialize/resolve_two_unspecialized_lambda_sets_in_one_lambda_set.txt ", "tests/ability/specialize/resolve_mutually_recursive_ability_lambda_sets.txt ", "tests/exhaustive/extend_uninhabited_without_opening_union.txt ", "tests/ability/specialize/bool_hash.txt ", "tests/ability/specialize/opaque_eq_custom.txt ", "tests/exhaustive/shared_pattern_variable_in_when_patterns.txt ", "tests/exhaustive/catchall_branch_walk_into_nested_types.txt ", "tests/record/unify_optional_record_fields_in_two_closed_records.txt ", "tests/weaken/when_branch_variables_not_generalized.txt ", "tests/exhaustive/shared_pattern_variable_in_multiple_branch_when_patterns.txt ", "tests/oiop/contextual_openness_for_type_alias.txt ", "tests/weaken/rank_no_overgeneralization.txt ", "tests/instantiate/call_generic_ability_member.txt ", "tests/exhaustive/catchall_branch_for_pattern_not_last.txt ", "tests/weaken/weakened_list.txt ", "tests/ability/specialize/polymorphic_lambda_set_specialization_bound_output.txt ", "tests/exhaustive/match_on_result_with_uninhabited_error_branch.txt ", "tests/ability/specialize/bool_to_encoder.txt " ]
[]
[ "tests/specialize/record_update_between_modules.txt " ]
2023-04-12T22:08:03Z
191d8a74086267b102bb2a388dbd37f5b814b6e8
diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1138,8 +1138,8 @@ fn to_expr_report<'b>( ), } } - Reason::FnCall { name, arity } => match count_arguments(&found) { - 0 => { + Reason::FnCall { name, arity } => match describe_wanted_function(&found) { + DescribedFunction::NotAFunction(tag) => { let this_value = match name { None => alloc.text("This value"), Some(symbol) => alloc.concat([ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1149,30 +1149,43 @@ fn to_expr_report<'b>( ]), }; - let lines = vec![ - alloc.concat([ - this_value, - alloc.string(format!( - " is not a function, but it was given {}:", - if arity == 1 { - "1 argument".into() - } else { - format!("{} arguments", arity) - } - )), + use NotAFunctionTag::*; + let doc = match tag { + OpaqueNeedsUnwrap => alloc.stack([ + alloc.concat([ + this_value, + alloc.reflow( + " is an opaque type, so it cannot be called with an argument:", + ), + ]), + alloc.region(lines.convert_region(expr_region)), + alloc.reflow("I can't call an opaque type because I don't know what it is! Maybe you meant to unwrap it first?"), + ]), + Other => alloc.stack([ + alloc.concat([ + this_value, + alloc.string(format!( + " is not a function, but it was given {}:", + if arity == 1 { + "1 argument".into() + } else { + format!("{} arguments", arity) + } + )), + ]), + alloc.region(lines.convert_region(expr_region)), + alloc.reflow("Are there any missing commas? Or missing parentheses?"), ]), - alloc.region(lines.convert_region(expr_region)), - alloc.reflow("Are there any missing commas? Or missing parentheses?"), - ]; + }; Report { filename, title: "TOO MANY ARGS".to_string(), - doc: alloc.stack(lines), + doc, severity, } } - n => { + DescribedFunction::Arguments(n) => { let this_function = match name { None => alloc.text("This function"), Some(symbol) => alloc.concat([ diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1543,13 +1556,35 @@ fn does_not_implement<'a>( ]) } -fn count_arguments(tipe: &ErrorType) -> usize { +enum DescribedFunction { + Arguments(usize), + NotAFunction(NotAFunctionTag), +} + +enum NotAFunctionTag { + OpaqueNeedsUnwrap, + Other, +} + +fn describe_wanted_function(tipe: &ErrorType) -> DescribedFunction { use ErrorType::*; match tipe { - Function(args, _, _) => args.len(), - Alias(_, _, actual, _) => count_arguments(actual), - _ => 0, + Function(args, _, _) => DescribedFunction::Arguments(args.len()), + Alias(_, _, actual, AliasKind::Structural) => describe_wanted_function(actual), + Alias(_, _, actual, AliasKind::Opaque) => { + let tag = if matches!( + describe_wanted_function(actual), + DescribedFunction::Arguments(_) + ) { + NotAFunctionTag::OpaqueNeedsUnwrap + } else { + NotAFunctionTag::Other + }; + + DescribedFunction::NotAFunction(tag) + } + _ => DescribedFunction::NotAFunction(NotAFunctionTag::Other), } }
roc-lang__roc-5280
5,280
[ "5094" ]
0.0
roc-lang/roc
2023-04-12T15:06:58Z
diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -13381,4 +13381,33 @@ I recommend using camelCase. It's the standard style in Roc code! "# ) ); + + test_report!( + apply_opaque_as_function, + indoc!( + r#" + app "test" provides [main] to "./platform" + + Parser a := Str -> a + + parser : Parser Str + parser = @Parser \s -> Str.concat s "asd" + + main : Str + main = parser "hi" + "# + ), + @r###" + ── TOO MANY ARGS ───────────────────────────────────────── /code/proj/Main.roc ─ + + The `parser` value is an opaque type, so it cannot be called with an + argument: + + 9│ main = parser "hi" + ^^^^^^ + + I can't call an opaque type because I don't know what it is! Maybe you + meant to unwrap it first? + "### + ); }
Confusing error message when forgetting to unwrap function from opaque type The following code tries to apply a function wrapped in an opaque type without unwrapping it first: ``` interface Package exposes [] imports [] Parser a := Str -> a parser : Parser Str parser = @Parser \s -> Str.concat s "asd" instance : Str instance = parser "hi" ``` This gives the following error message ``` ── TOO FEW ARGS ──────────────────────────────────────── The parser function expects 1 argument, but it got only 1: 11│ instance = parser "hi" ^^^^^^ Roc does not allow functions to be partially applied. Use a closure to make partial application explicit. ──────────────────────────────────────────────────────────────────────────────── ``` Beyond the confusing statement "expects 1 argument, but it got only 1", it does not transparently address the true issue that one should first unwrap the function: ``` instance = @Parser f = parser f "hi" ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::apply_opaque_as_function" ]
[ "test_reporting::ability_demand_value_has_args", "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::ability_non_signature_expression", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::backpassing_type_error", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::annotation_definition_mismatch", "test_reporting::annotation_newline_body_is_fine", "test_reporting::ability_specialization_is_incomplete", "test_reporting::alias_in_has_clause", "test_reporting::always_function", "test_reporting::ability_shadows_ability", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::alias_using_alias", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::apply_unary_negative", "test_reporting::ability_specialization_is_unused", "test_reporting::applied_tag_function", "test_reporting::ability_member_binds_parent_twice", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::argument_without_space", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_specialization_is_duplicated", "test_reporting::alias_type_diff", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::ability_not_on_toplevel", "test_reporting::apply_unary_not", "test_reporting::bad_double_rigid", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::comment_with_tab", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::bool_vs_true_tag", "test_reporting::boolean_tag", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::bool_vs_false_tag", "test_reporting::bad_rigid_function", "test_reporting::cannot_derive_hash_for_function", "test_reporting::bad_rigid_value", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::bad_numeric_literal_suffix", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::call_with_underscore_identifier", "test_reporting::cannot_derive_eq_for_function", "test_reporting::closure_underscore_ident", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::cannot_eq_functions", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::def_missing_final_expression", "test_reporting::circular_definition_self", "test_reporting::concat_different_types", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::circular_definition", "test_reporting::cannot_not_eq_functions", "test_reporting::circular_type", "test_reporting::crash_given_non_string", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::compare_unsigned_to_signed", "test_reporting::dbg_without_final_expression", "test_reporting::crash_unapplied", "test_reporting::crash_overapplied", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::cyclic_opaque", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::derive_encoding_for_nat", "test_reporting::cycle_through_non_function_top_level", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_decoding_for_function", "test_reporting::cycle_through_non_function", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::demanded_vs_optional_record_field", "test_reporting::derive_eq_for_f64", "test_reporting::derive_eq_for_function", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_encoding_for_tuple", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::derive_eq_for_f32", "test_reporting::empty_or_pattern", "test_reporting::double_plus", "test_reporting::elm_function_syntax", "test_reporting::derive_hash_for_tag", "test_reporting::exposes_identifier", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::error_inline_alias_qualified", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::derive_hash_for_function", "test_reporting::derive_hash_for_tuple", "test_reporting::derive_non_builtin_ability", "test_reporting::derive_hash_for_record", "test_reporting::derive_eq_for_record", "test_reporting::expect_without_final_expression", "test_reporting::expression_indentation_end", "test_reporting::dict_type_formatting", "test_reporting::derive_eq_for_tag", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::different_phantom_types", "test_reporting::double_equals_in_def", "test_reporting::elem_in_list", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::eq_binop_is_transparent", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::error_wildcards_are_related", "test_reporting::error_nested_wildcards_are_related", "test_reporting::expect_expr_type_error", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::fncall_overapplied", "test_reporting::function_does_not_implement_encoding", "test_reporting::float_malformed", "test_reporting::geq_binop_is_transparent", "test_reporting::float_literal_has_int_suffix", "test_reporting::expected_tag_has_too_many_args", "test_reporting::from_annotation_complex_pattern", "test_reporting::from_annotation_when", "test_reporting::float_out_of_range", "test_reporting::gt_binop_is_transparent", "test_reporting::guard_mismatch_with_annotation", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::fncall_underapplied", "test_reporting::imports_missing_comma", "test_reporting::function_cannot_derive_encoding", "test_reporting::has_clause_not_on_toplevel", "test_reporting::fncall_value", "test_reporting::from_annotation_if", "test_reporting::if_guard_without_condition", "test_reporting::first_wildcard_is_required", "test_reporting::from_annotation_function", "test_reporting::has_encoding_for_function", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::if_outdented_then", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::if_missing_else", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::i128_overflow", "test_reporting::inline_hastype", "test_reporting::invalid_app_name", "test_reporting::invalid_module_name", "test_reporting::i16_underflow", "test_reporting::i16_overflow", "test_reporting::i32_overflow", "test_reporting::i64_underflow", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::i32_underflow", "test_reporting::i64_overflow", "test_reporting::if_3_branch_mismatch", "test_reporting::i8_underflow", "test_reporting::invalid_operator", "test_reporting::if_condition_not_bool", "test_reporting::if_2_branch_mismatch", "test_reporting::i8_overflow", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::integer_empty", "test_reporting::implements_type_not_ability", "test_reporting::incorrect_optional_field", "test_reporting::inference_var_in_alias", "test_reporting::invalid_num", "test_reporting::int_literal_has_float_suffix", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::integer_malformed", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::int_frac", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::lambda_double_comma", "test_reporting::inference_var_too_many_in_alias", "test_reporting::integer_out_of_range", "test_reporting::invalid_num_fn", "test_reporting::lambda_leading_comma", "test_reporting::list_double_comma", "test_reporting::issue_1755", "test_reporting::interpolate_not_identifier", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::invalid_record_extension_type", "test_reporting::invalid_record_update", "test_reporting::issue_2380_annotations_only", "test_reporting::invalid_toplevel_cycle", "test_reporting::invalid_tag_extension_type", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::issue_2380_typed_body", "test_reporting::issue_2326", "test_reporting::issue_2380_alias_with_vars", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::keyword_record_field_access", "test_reporting::keyword_qualified_import", "test_reporting::issue_2458", "test_reporting::list_get_negative_number", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_pattern_not_terminated", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::leq_binop_is_transparent", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::list_without_end", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_with_guard", "test_reporting::malformed_int_pattern", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::malformed_bin_pattern", "test_reporting::lt_binop_is_transparent", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::malformed_float_pattern", "test_reporting::malformed_oct_pattern", "test_reporting::mismatched_single_tag_arg", "test_reporting::malformed_hex_pattern", "test_reporting::missing_imports", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::multi_insufficient_indent", "test_reporting::multi_no_end", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_suffix_dec", "test_reporting::mismatched_suffix_f32", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_record_annotation", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_u8", "test_reporting::mismatched_suffix_u64", "test_reporting::module_ident_ends_with_dot", "test_reporting::module_not_imported", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::missing_fields", "test_reporting::negative_u128", "test_reporting::multiple_wildcards_in_alias", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::nested_datatype", "test_reporting::negative_u32", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::nested_specialization", "test_reporting::negative_u16", "test_reporting::neq_binop_is_transparent", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::nested_datatype_inline", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::negative_u64", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::mutual_recursion_not_reached", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::num_too_general_named", "test_reporting::number_double_dot", "test_reporting::num_too_general_wildcard", "test_reporting::negative_u8", "test_reporting::not_enough_cases_for_open_union", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::numer_literal_multi_suffix", "test_reporting::non_exhaustive_with_guard", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_type_not_in_scope", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::opaque_ref_field_access", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_ability_impl_qualified", "test_reporting::opaque_ability_impl_optional", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::optional_record_invalid_function", "test_reporting::optional_record_default_with_signature", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::optional_record_invalid_accessor", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::optional_record_invalid_when", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::optional_record_default_type_error", "test_reporting::optional_record_invalid_let_binding", "test_reporting::platform_requires_rigids", "test_reporting::pattern_binds_keyword", "test_reporting::optional_record_invalid_access", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::pattern_in_parens_end", "test_reporting::provides_to_identifier", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::pattern_in_parens_open", "test_reporting::pattern_in_parens_indent_open", "test_reporting::pattern_in_parens_end_comma", "test_reporting::record_type_end", "test_reporting::record_type_keyword_field_name", "test_reporting::phantom_type_variable", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::record_duplicate_field_same_type", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::record_duplicate_field_multiline", "test_reporting::patterns_let_not_exhaustive", "test_reporting::record_type_missing_comma", "test_reporting::qualified_tag", "test_reporting::patterns_int_redundant", "test_reporting::record_type_open", "test_reporting::pattern_when_pattern", "test_reporting::patterns_record_not_exhaustive", "test_reporting::report_module_color", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::patterns_when_not_exhaustive", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::record_field_mismatch", "test_reporting::pattern_let_mismatch", "test_reporting::polymorphic_mutual_recursion", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::pattern_when_condition", "test_reporting::qualified_opaque_reference", "test_reporting::polymorphic_recursion", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::record_access_ends_with_dot", "test_reporting::report_region_in_color", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::plus_on_str", "test_reporting::record_type_open_indent", "test_reporting::report_value_color", "test_reporting::record_type_tab", "test_reporting::record_duplicate_field_different_types", "test_reporting::record_type_duplicate_field", "test_reporting::single_quote_too_long", "test_reporting::single_no_end", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::recursion_var_specialization_error", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::report_unused_def", "test_reporting::record_update_value", "test_reporting::same_phantom_types_unify", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::report_shadowing_in_annotation", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::report_shadowing", "test_reporting::report_precedence_problem_single_line", "test_reporting::self_recursive_not_reached", "test_reporting::second_wildcard_is_redundant", "test_reporting::tag_union_end", "test_reporting::shadowing_top_level_scope", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::tag_union_open", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::report_precedence_problem_multiline", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::self_recursive_alias", "test_reporting::shift_by_negative", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::self_recursive_not_reached_nested", "test_reporting::type_annotation_double_colon", "test_reporting::type_apply_stray_dot", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::type_in_parens_start", "test_reporting::type_double_comma", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::type_argument_no_arrow", "test_reporting::type_inline_alias", "test_reporting::type_in_parens_end", "test_reporting::specialization_for_wrong_type", "test_reporting::stray_dot_expr", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::unicode_not_hex", "test_reporting::tag_mismatch", "test_reporting::tag_missing", "test_reporting::tag_union_duplicate_tag", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::tag_with_arguments_mismatch", "test_reporting::type_apply_start_with_number", "test_reporting::type_apply_double_dot", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::two_different_cons", "test_reporting::tuple_exhaustiveness_good", "test_reporting::typo_lowercase_ok", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::tags_missing", "test_reporting::too_few_type_arguments", "test_reporting::typo_uppercase_ok", "test_reporting::type_apply_start_with_lowercase", "test_reporting::too_many_type_arguments", "test_reporting::type_apply_trailing_dot", "test_reporting::u16_overflow", "test_reporting::u32_overflow", "test_reporting::u8_overflow", "test_reporting::u64_overflow", "test_reporting::unbound_var_in_alias", "test_reporting::unimported_modules_reported", "test_reporting::unify_alias_other", "test_reporting::weird_escape", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::unicode_too_large", "test_reporting::when_over_indented_int", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::when_missing_arrow", "test_reporting::when_over_indented_underscore", "test_reporting::when_outdented_branch", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::wild_case_arrow", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::unnecessary_extension_variable", "test_reporting::unused_def_in_branch_pattern", "test_reporting::unused_argument", "test_reporting::unwrap_num_elem_in_list", "test_reporting::unused_arg_and_unused_def", "test_reporting::update_empty_record", "test_reporting::update_record", "test_reporting::weird_accessor", "test_reporting::unused_value_import", "test_reporting::unused_shadow_specialization", "test_reporting::update_record_ext", "test_reporting::unknown_type", "test_reporting::update_record_snippet", "test_reporting::when_branch_mismatch", "test_reporting::when_if_guard", "test_reporting::value_not_exposed", "test_reporting::wildcard_in_opaque", "test_reporting::wildcard_in_alias" ]
[]
[]
2023-04-12T21:57:55Z
41d7ade5a363f3c6d1512409b328404501e14940
diff --git a/crates/compiler/solve/src/solve.rs b/crates/compiler/solve/src/solve.rs --- a/crates/compiler/solve/src/solve.rs +++ b/crates/compiler/solve/src/solve.rs @@ -1847,6 +1847,11 @@ fn open_tag_union(subs: &mut Subs, var: Variable) { stack.extend(subs.get_subs_slice(fields.variables())); } + Structure(Tuple(elems, _)) => { + // Open up all nested tag unions. + stack.extend(subs.get_subs_slice(elems.variables())); + } + Structure(Apply(Symbol::LIST_LIST, args)) => { // Open up nested tag unions. stack.extend(subs.get_subs_slice(args));
roc-lang__roc-5188
5,188
[ "5177" ]
0.0
roc-lang/roc
2023-03-24T19:13:24Z
diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -13170,4 +13170,17 @@ I recommend using camelCase. It's the standard style in Roc code! I would have to crash if I saw one of those! Add branches for them! "### ); + + test_no_problem!( + openness_constraint_opens_under_tuple, + indoc!( + r#" + x : [A, B, C] + when (x, 1u8) is + (A, _) -> Bool.true + (B, _) -> Bool.true + _ -> Bool.true + "# + ) + ); }
Wildcard in when expression does not open tag unions inside tuples ``` interface B exposes [] imports [] expect x : [A, B, C] when (x, 1u8) is (A, _) -> Bool.true (B, _) -> Bool.true _ -> Bool.true ``` should not error but it does ``` ── TYPE MISMATCH ─────────────────────────────────────────────────────── B.roc ─ The branches of this when expression don't match the condition: 5│> when (x, 1u8) is 6│ (A, _) -> Bool.true 7│ (B, _) -> Bool.true 8│ _ -> Bool.true The when condition is a tuple of type: ( [A, B, C], U8, )b But the branch patterns have type: ( [A, B], U8, )b The branches must be cases of the when condition's type! ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::openness_constraint_opens_under_tuple" ]
[ "test_reporting::ability_specialization_is_unused", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_non_signature_expression", "test_reporting::annotation_newline_body_is_fine", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_member_binds_parent_twice", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::ability_demand_value_has_args", "test_reporting::bad_double_rigid", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::ability_not_on_toplevel", "test_reporting::alias_using_alias", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::bad_numeric_literal_suffix", "test_reporting::alias_in_has_clause", "test_reporting::ability_specialization_is_incomplete", "test_reporting::ability_shadows_ability", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::annotation_definition_mismatch", "test_reporting::apply_unary_negative", "test_reporting::apply_unary_not", "test_reporting::backpassing_type_error", "test_reporting::argument_without_space", "test_reporting::alias_type_diff", "test_reporting::always_function", "test_reporting::ability_specialization_is_duplicated", "test_reporting::applied_tag_function", "test_reporting::comment_with_tab", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::bool_vs_false_tag", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::circular_definition", "test_reporting::cannot_eq_functions", "test_reporting::circular_definition_self", "test_reporting::cannot_derive_eq_for_function", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::call_with_underscore_identifier", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::cannot_not_eq_functions", "test_reporting::bad_rigid_value", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::crash_given_non_string", "test_reporting::bad_rigid_function", "test_reporting::closure_underscore_ident", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::bool_vs_true_tag", "test_reporting::cycle_through_non_function", "test_reporting::concat_different_types", "test_reporting::boolean_tag", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::crash_overapplied", "test_reporting::crash_unapplied", "test_reporting::cannot_derive_hash_for_function", "test_reporting::compare_unsigned_to_signed", "test_reporting::circular_type", "test_reporting::def_missing_final_expression", "test_reporting::double_plus", "test_reporting::dbg_without_final_expression", "test_reporting::elm_function_syntax", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::empty_or_pattern", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_encoding_for_nat", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_eq_for_f32", "test_reporting::derive_eq_for_f64", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::derive_eq_for_tag", "test_reporting::cyclic_opaque", "test_reporting::derive_hash_for_function", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_eq_for_function", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::derive_decoding_for_function", "test_reporting::different_phantom_types", "test_reporting::cycle_through_non_function_top_level", "test_reporting::exposes_identifier", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::derive_eq_for_record", "test_reporting::double_equals_in_def", "test_reporting::derive_non_builtin_ability", "test_reporting::demanded_vs_optional_record_field", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::dict_type_formatting", "test_reporting::derive_hash_for_tag", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_hash_for_record", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::elem_in_list", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::error_inline_alias_qualified", "test_reporting::expression_indentation_end", "test_reporting::expect_without_final_expression", "test_reporting::first_wildcard_is_required", "test_reporting::geq_binop_is_transparent", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::has_encoding_for_function", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::from_annotation_function", "test_reporting::float_literal_has_int_suffix", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::error_wildcards_are_related", "test_reporting::from_annotation_complex_pattern", "test_reporting::function_does_not_implement_encoding", "test_reporting::from_annotation_if", "test_reporting::fncall_underapplied", "test_reporting::float_out_of_range", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::fncall_overapplied", "test_reporting::expect_expr_type_error", "test_reporting::float_malformed", "test_reporting::eq_binop_is_transparent", "test_reporting::guard_mismatch_with_annotation", "test_reporting::error_nested_wildcards_are_related", "test_reporting::function_cannot_derive_encoding", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::gt_binop_is_transparent", "test_reporting::has_clause_not_on_toplevel", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::expected_tag_has_too_many_args", "test_reporting::fncall_value", "test_reporting::from_annotation_when", "test_reporting::imports_missing_comma", "test_reporting::if_guard_without_condition", "test_reporting::if_outdented_then", "test_reporting::inline_hastype", "test_reporting::if_missing_else", "test_reporting::inference_var_in_alias", "test_reporting::if_3_branch_mismatch", "test_reporting::i128_overflow", "test_reporting::i8_underflow", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::integer_malformed", "test_reporting::invalid_app_name", "test_reporting::invalid_module_name", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::i32_overflow", "test_reporting::implements_type_not_ability", "test_reporting::if_condition_not_bool", "test_reporting::int_frac", "test_reporting::if_2_branch_mismatch", "test_reporting::incorrect_optional_field", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::int_literal_has_float_suffix", "test_reporting::inference_var_too_many_in_alias", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::i8_overflow", "test_reporting::interpolate_not_identifier", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::integer_empty", "test_reporting::integer_out_of_range", "test_reporting::i16_overflow", "test_reporting::i64_overflow", "test_reporting::i32_underflow", "test_reporting::i16_underflow", "test_reporting::i64_underflow", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::lambda_double_comma", "test_reporting::invalid_operator", "test_reporting::lambda_leading_comma", "test_reporting::list_double_comma", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::invalid_num", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::issue_2458", "test_reporting::invalid_num_fn", "test_reporting::issue_2380_alias_with_vars", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_2380_typed_body", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_get_negative_number", "test_reporting::invalid_record_extension_type", "test_reporting::invalid_tag_extension_type", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::invalid_toplevel_cycle", "test_reporting::issue_2326", "test_reporting::issue_1755", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::keyword_record_field_access", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::leq_binop_is_transparent", "test_reporting::invalid_record_update", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::keyword_qualified_import", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_without_end", "test_reporting::list_pattern_not_terminated", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::mismatched_record_annotation", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_with_guard", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::malformed_oct_pattern", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::mismatched_suffix_f64", "test_reporting::malformed_hex_pattern", "test_reporting::mismatched_suffix_f32", "test_reporting::malformed_float_pattern", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::mismatched_single_tag_arg", "test_reporting::lt_binop_is_transparent", "test_reporting::missing_imports", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::list_match_spread_exhaustive", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatched_suffix_dec", "test_reporting::malformed_bin_pattern", "test_reporting::malformed_int_pattern", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_suffix_i32", "test_reporting::multi_insufficient_indent", "test_reporting::multi_no_end", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::multiple_wildcards_in_alias", "test_reporting::mismatched_suffix_u8", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::mutual_recursion_not_reached", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::module_ident_ends_with_dot", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::missing_fields", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::module_not_imported", "test_reporting::negative_u128", "test_reporting::negative_u16", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::negative_u8", "test_reporting::negative_u32", "test_reporting::neq_binop_is_transparent", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::nested_datatype_inline", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::negative_u64", "test_reporting::nested_specialization", "test_reporting::nested_datatype", "test_reporting::not_enough_cases_for_open_union", "test_reporting::num_too_general_wildcard", "test_reporting::num_too_general_named", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::number_double_dot", "test_reporting::non_exhaustive_with_guard", "test_reporting::numer_literal_multi_suffix", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_ability_impl_optional", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::opaque_ability_impl_qualified", "test_reporting::pattern_in_parens_end_comma", "test_reporting::pattern_in_parens_end", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::pattern_binds_keyword", "test_reporting::pattern_in_parens_indent_open", "test_reporting::pattern_in_parens_open", "test_reporting::opaque_ref_field_access", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::patterns_record_not_exhaustive", "test_reporting::patterns_let_not_exhaustive", "test_reporting::platform_requires_rigids", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::patterns_int_redundant", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::patterns_when_not_exhaustive", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::polymorphic_mutual_recursion", "test_reporting::provides_to_identifier", "test_reporting::phantom_type_variable", "test_reporting::polymorphic_recursion_forces_ungeneralized_type", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::plus_on_str", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::polymorphic_recursion", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::qualified_opaque_reference", "test_reporting::record_type_end", "test_reporting::record_access_ends_with_dot", "test_reporting::record_type_keyword_field_name", "test_reporting::record_duplicate_field_same_type", "test_reporting::qualified_tag", "test_reporting::record_duplicate_field_different_types", "test_reporting::record_type_missing_comma", "test_reporting::record_duplicate_field_multiline", "test_reporting::record_type_open", "test_reporting::record_type_open_indent", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::record_field_mismatch", "test_reporting::optional_record_invalid_accessor", "test_reporting::optional_record_invalid_function", "test_reporting::opaque_type_not_in_scope", "test_reporting::report_module_color", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::optional_record_default_type_error", "test_reporting::optional_record_invalid_let_binding", "test_reporting::optional_record_default_with_signature", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::optional_record_invalid_access", "test_reporting::report_value_color", "test_reporting::report_region_in_color", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::record_type_tab", "test_reporting::record_type_duplicate_field", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_let_mismatch", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::pattern_when_condition", "test_reporting::pattern_when_pattern", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::optional_record_invalid_when", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::record_update_value", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::report_precedence_problem_multiline", "test_reporting::report_precedence_problem_single_line", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::report_shadowing", "test_reporting::recursion_var_specialization_error", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::report_unused_def", "test_reporting::report_shadowing_in_annotation", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::stray_dot_expr", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::tag_union_end", "test_reporting::tag_union_open", "test_reporting::type_apply_double_dot", "test_reporting::type_apply_start_with_lowercase", "test_reporting::two_different_cons", "test_reporting::type_apply_stray_dot", "test_reporting::too_many_type_arguments", "test_reporting::tag_union_duplicate_tag", "test_reporting::tags_missing", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::tag_mismatch", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::single_no_end", "test_reporting::single_quote_too_long", "test_reporting::same_phantom_types_unify", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::specialization_for_wrong_type", "test_reporting::second_wildcard_is_redundant", "test_reporting::tag_missing", "test_reporting::type_annotation_double_colon", "test_reporting::self_recursive_not_reached_nested", "test_reporting::self_recursive_alias", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::tuple_exhaustiveness_good", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::type_apply_start_with_number", "test_reporting::shift_by_negative", "test_reporting::tag_with_arguments_mismatch", "test_reporting::too_few_type_arguments", "test_reporting::self_recursive_not_reached", "test_reporting::shadowing_top_level_scope", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::u8_overflow", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::unify_alias_other", "test_reporting::unused_value_import", "test_reporting::unused_shadow_specialization", "test_reporting::unused_argument", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::unimported_modules_reported", "test_reporting::unused_def_in_branch_pattern", "test_reporting::unwrap_num_elem_in_list", "test_reporting::weird_escape", "test_reporting::when_missing_arrow", "test_reporting::when_over_indented_int", "test_reporting::when_outdented_branch", "test_reporting::when_over_indented_underscore", "test_reporting::update_record", "test_reporting::update_record_snippet", "test_reporting::update_empty_record", "test_reporting::weird_accessor", "test_reporting::wild_case_arrow", "test_reporting::value_not_exposed", "test_reporting::when_branch_mismatch", "test_reporting::update_record_ext", "test_reporting::when_if_guard", "test_reporting::wildcard_in_alias", "test_reporting::wildcard_in_opaque", "test_reporting::type_apply_trailing_dot", "test_reporting::type_in_parens_start", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::type_argument_no_arrow", "test_reporting::type_inline_alias", "test_reporting::unicode_not_hex", "test_reporting::unicode_too_large", "test_reporting::unnecessary_extension_variable", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::type_double_comma", "test_reporting::unused_arg_and_unused_def", "test_reporting::typo_uppercase_ok", "test_reporting::unbound_var_in_alias", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::u32_overflow", "test_reporting::u16_overflow", "test_reporting::type_in_parens_end", "test_reporting::typo_lowercase_ok", "test_reporting::u64_overflow", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::unknown_type" ]
[]
[]
2023-03-25T20:52:11Z
bf41570648d99822a2f6591615c507038d3a26cc
diff --git a/crates/compiler/builtins/roc/Decode.roc b/crates/compiler/builtins/roc/Decode.roc --- a/crates/compiler/builtins/roc/Decode.roc +++ b/crates/compiler/builtins/roc/Decode.roc @@ -23,6 +23,7 @@ interface Decode string, list, record, + tuple, custom, decodeWith, fromBytesPartial, diff --git a/crates/compiler/builtins/roc/Decode.roc b/crates/compiler/builtins/roc/Decode.roc --- a/crates/compiler/builtins/roc/Decode.roc +++ b/crates/compiler/builtins/roc/Decode.roc @@ -43,6 +44,7 @@ interface Decode I32, I64, I128, + Nat, F32, F64, Dec, diff --git a/crates/compiler/builtins/roc/Decode.roc b/crates/compiler/builtins/roc/Decode.roc --- a/crates/compiler/builtins/roc/Decode.roc +++ b/crates/compiler/builtins/roc/Decode.roc @@ -76,8 +78,24 @@ DecoderFormatting has bool : Decoder Bool fmt | fmt has DecoderFormatting string : Decoder Str fmt | fmt has DecoderFormatting list : Decoder elem fmt -> Decoder (List elem) fmt | fmt has DecoderFormatting + + ## `record state stepField finalizer` decodes a record field-by-field. + ## + ## `stepField` returns a decoder for the given field in the record, or + ## `Skip` if the field is not a part of the decoded record. + ## + ## `finalizer` should produce the record value from the decoded `state`. record : state, (state, Str -> [Keep (Decoder state fmt), Skip]), (state -> Result val DecodeError) -> Decoder val fmt | fmt has DecoderFormatting + ## `tuple state stepElem finalizer` decodes a tuple element-by-element. + ## + ## `stepElem` returns a decoder for the nth index in the tuple, or + ## `TooLong` if the index is larger than the expected size of the tuple. The + ## index passed to `stepElem` is 0-indexed. + ## + ## `finalizer` should produce the tuple value from the decoded `state`. + tuple : state, (state, Nat -> [Next (Decoder state fmt), TooLong]), (state -> Result val DecodeError) -> Decoder val fmt | fmt has DecoderFormatting + custom : (List U8, fmt -> DecodeResult val) -> Decoder val fmt | fmt has DecoderFormatting custom = \decode -> @Decoder decode diff --git a/crates/compiler/builtins/roc/Encode.roc b/crates/compiler/builtins/roc/Encode.roc --- a/crates/compiler/builtins/roc/Encode.roc +++ b/crates/compiler/builtins/roc/Encode.roc @@ -22,6 +22,7 @@ interface Encode list, record, tag, + tuple, custom, appendWith, append, diff --git a/crates/compiler/builtins/roc/Encode.roc b/crates/compiler/builtins/roc/Encode.roc --- a/crates/compiler/builtins/roc/Encode.roc +++ b/crates/compiler/builtins/roc/Encode.roc @@ -69,6 +70,7 @@ EncoderFormatting has string : Str -> Encoder fmt | fmt has EncoderFormatting list : List elem, (elem -> Encoder fmt) -> Encoder fmt | fmt has EncoderFormatting record : List { key : Str, value : Encoder fmt } -> Encoder fmt | fmt has EncoderFormatting + tuple : List (Encoder fmt) -> Encoder fmt | fmt has EncoderFormatting tag : Str, List (Encoder fmt) -> Encoder fmt | fmt has EncoderFormatting custom : (List U8, fmt -> List U8) -> Encoder fmt | fmt has EncoderFormatting diff --git a/crates/compiler/builtins/roc/Json.roc b/crates/compiler/builtins/roc/Json.roc --- a/crates/compiler/builtins/roc/Json.roc +++ b/crates/compiler/builtins/roc/Json.roc @@ -96,6 +96,7 @@ Json := {} has [ string: encodeString, list: encodeList, record: encodeRecord, + tuple: encodeTuple, tag: encodeTag, }, DecoderFormatting { diff --git a/crates/compiler/builtins/roc/Json.roc b/crates/compiler/builtins/roc/Json.roc --- a/crates/compiler/builtins/roc/Json.roc +++ b/crates/compiler/builtins/roc/Json.roc @@ -116,6 +117,7 @@ Json := {} has [ string: decodeString, list: decodeList, record: decodeRecord, + tuple: decodeTuple, }, ] diff --git a/crates/compiler/builtins/roc/Json.roc b/crates/compiler/builtins/roc/Json.roc --- a/crates/compiler/builtins/roc/Json.roc +++ b/crates/compiler/builtins/roc/Json.roc @@ -207,6 +209,25 @@ encodeRecord = \fields -> List.append bytesWithRecord (Num.toU8 '}') +encodeTuple = \elems -> + Encode.custom \bytes, @Json {} -> + writeTuple = \{ buffer, elemsLeft }, elemEncoder -> + bufferWithElem = + appendWith buffer elemEncoder (@Json {}) + + bufferWithSuffix = + if elemsLeft > 1 then + List.append bufferWithElem (Num.toU8 ',') + else + bufferWithElem + + { buffer: bufferWithSuffix, elemsLeft: elemsLeft - 1 } + + bytesHead = List.append bytes (Num.toU8 '[') + { buffer: bytesWithRecord } = List.walk elems { buffer: bytesHead, elemsLeft: List.len elems } writeTuple + + List.append bytesWithRecord (Num.toU8 ']') + encodeTag = \name, payload -> Encode.custom \bytes, @Json {} -> # Idea: encode `A v1 v2` as `{"A": [v1, v2]}` diff --git a/crates/compiler/builtins/roc/Json.roc b/crates/compiler/builtins/roc/Json.roc --- a/crates/compiler/builtins/roc/Json.roc +++ b/crates/compiler/builtins/roc/Json.roc @@ -477,6 +498,12 @@ openBrace = \bytes -> parseExactChar bytes '{' closingBrace : List U8 -> DecodeResult {} closingBrace = \bytes -> parseExactChar bytes '}' +openBracket : List U8 -> DecodeResult {} +openBracket = \bytes -> parseExactChar bytes '[' + +closingBracket : List U8 -> DecodeResult {} +closingBracket = \bytes -> parseExactChar bytes ']' + recordKey : List U8 -> DecodeResult Str recordKey = \bytes -> jsonString bytes diff --git a/crates/compiler/builtins/roc/Json.roc b/crates/compiler/builtins/roc/Json.roc --- a/crates/compiler/builtins/roc/Json.roc +++ b/crates/compiler/builtins/roc/Json.roc @@ -527,6 +554,36 @@ decodeRecord = \initialState, stepField, finalizer -> Decode.custom \bytes, @Jso Ok val -> { result: Ok val, rest: afterRecordBytes } Err e -> { result: Err e, rest: afterRecordBytes } +decodeTuple = \initialState, stepElem, finalizer -> Decode.custom \initialBytes, @Json {} -> + # NB: the stepper function must be passed explicitly until #2894 is resolved. + decodeElems = \stepper, state, index, bytes -> + { val: newState, rest: beforeCommaOrBreak } <- tryDecode + ( + when stepper state index is + TooLong -> + { rest: beforeCommaOrBreak } <- bytes |> anything |> tryDecode + { result: Ok state, rest: beforeCommaOrBreak } + + Next decoder -> + Decode.decodeWith bytes decoder (@Json {}) + ) + + { result: commaResult, rest: nextBytes } = comma beforeCommaOrBreak + + when commaResult is + Ok {} -> decodeElems stepElem newState (index + 1) nextBytes + Err _ -> { result: Ok newState, rest: nextBytes } + + { rest: afterBracketBytes } <- initialBytes |> openBracket |> tryDecode + + { val: endStateResult, rest: beforeClosingBracketBytes } <- decodeElems stepElem initialState 0 afterBracketBytes |> tryDecode + + { rest: afterTupleBytes } <- beforeClosingBracketBytes |> closingBracket |> tryDecode + + when finalizer endStateResult is + Ok val -> { result: Ok val, rest: afterTupleBytes } + Err e -> { result: Err e, rest: afterTupleBytes } + # Helper to eat leading Json whitespace characters eatWhitespace = \input -> when input is diff --git a/crates/compiler/can/src/debug/pretty_print.rs b/crates/compiler/can/src/debug/pretty_print.rs --- a/crates/compiler/can/src/debug/pretty_print.rs +++ b/crates/compiler/can/src/debug/pretty_print.rs @@ -330,7 +330,11 @@ fn expr<'a>(c: &Ctx, p: EPrec, f: &'a Arena<'a>, e: &'a Expr) -> DocBuilder<'a, } => expr(c, AppArg, f, &loc_expr.value) .append(f.text(format!(".{}", field.as_str()))) .group(), - TupleAccess { .. } => todo!(), + TupleAccess { + loc_expr, index, .. + } => expr(c, AppArg, f, &loc_expr.value) + .append(f.text(format!(".{index}"))) + .group(), OpaqueWrapFunction(OpaqueWrapFunctionData { opaque_name, .. }) => { f.text(format!("@{}", opaque_name.as_str(c.interns))) } diff --git a/crates/compiler/derive/src/decoding.rs b/crates/compiler/derive/src/decoding.rs --- a/crates/compiler/derive/src/decoding.rs +++ b/crates/compiler/derive/src/decoding.rs @@ -1,33 +1,32 @@ //! Derivers for the `Decoding` ability. -use roc_can::expr::{ - AnnotatedMark, ClosureData, Expr, Field, Recursive, WhenBranch, WhenBranchPattern, -}; +use roc_can::expr::{AnnotatedMark, ClosureData, Expr, Recursive}; use roc_can::pattern::Pattern; -use roc_collections::SendMap; + use roc_derive_key::decoding::FlatDecodableKey; -use roc_error_macros::internal_error; use roc_module::called_via::CalledVia; -use roc_module::ident::Lowercase; use roc_module::symbol::Symbol; -use roc_region::all::{Loc, Region}; +use roc_region::all::Loc; use roc_types::subs::{ - Content, ExhaustiveMark, FlatType, GetSubsSlice, LambdaSet, OptVariable, RecordFields, - RedundantMark, SubsSlice, TagExt, UnionLambdas, UnionTags, Variable, + Content, FlatType, LambdaSet, OptVariable, SubsSlice, UnionLambdas, Variable, }; -use roc_types::types::{AliasKind, RecordField}; -use crate::util::{Env, ExtensionKind}; +use crate::util::Env; use crate::{synth_var, DerivedBody}; +mod list; +mod record; +mod tuple; + pub(crate) fn derive_decoder( env: &mut Env<'_>, key: FlatDecodableKey, def_symbol: Symbol, ) -> DerivedBody { let (body, body_type) = match key { - FlatDecodableKey::List() => decoder_list(env, def_symbol), - FlatDecodableKey::Record(fields) => decoder_record(env, def_symbol, fields), + FlatDecodableKey::List() => list::decoder(env, def_symbol), + FlatDecodableKey::Record(fields) => record::decoder(env, def_symbol, fields), + FlatDecodableKey::Tuple(arity) => tuple::decoder(env, def_symbol, arity), }; let specialization_lambda_sets = diff --git a/crates/compiler/derive/src/decoding.rs b/crates/compiler/derive/src/decoding.rs --- a/crates/compiler/derive/src/decoding.rs +++ b/crates/compiler/derive/src/decoding.rs @@ -40,1062 +39,9 @@ pub(crate) fn derive_decoder( } } -// Implements decoding of a record. For example, for -// -// {first: a, second: b} -// -// we'd like to generate an impl like -// -// decoder : Decoder {first: a, second: b} fmt | a has Decoding, b has Decoding, fmt has DecoderFormatting -// decoder = -// initialState : {f0: Result a [NoField], f1: Result b [NoField]} -// initialState = {f0: Err NoField, f1: Err NoField} -// -// stepField = \state, field -> -// when field is -// "first" -> -// Keep (Decode.custom \bytes, fmt -> -// when Decode.decodeWith bytes Decode.decoder fmt is -// {result, rest} -> -// {result: Result.map result \val -> {state & f0: Ok val}, rest}) -// "second" -> -// Keep (Decode.custom \bytes, fmt -> -// when Decode.decodeWith bytes Decode.decoder fmt is -// {result, rest} -> -// {result: Result.map result \val -> {state & f1: Ok val}, rest}) -// _ -> Skip -// -// finalizer = \{f0, f1} -> -// when f0 is -// Ok first -> -// when f1 is -// Ok second -> Ok {first, second} -// Err NoField -> Err TooShort -// Err NoField -> Err TooShort -// -// Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.record initialState stepField finalizer) fmt -fn decoder_record(env: &mut Env, _def_symbol: Symbol, fields: Vec<Lowercase>) -> (Expr, Variable) { - // The decoded type of each field in the record, e.g. {first: a, second: b}. - let mut field_vars = Vec::with_capacity(fields.len()); - // The type of each field in the decoding state, e.g. {first: Result a [NoField], second: Result b [NoField]} - let mut result_field_vars = Vec::with_capacity(fields.len()); - - // initialState = ... - let (initial_state_var, initial_state) = - decoder_record_initial_state(env, &fields, &mut field_vars, &mut result_field_vars); - - // finalizer = ... - let (finalizer, finalizer_var, decode_err_var) = decoder_record_finalizer( - env, - initial_state_var, - &fields, - &field_vars, - &result_field_vars, - ); - - // stepField = ... - let (step_field, step_var) = decoder_record_step_field( - env, - fields, - &field_vars, - &result_field_vars, - initial_state_var, - decode_err_var, - ); - - // Build up the type of `Decode.record` we expect - let record_decoder_var = env.subs.fresh_unnamed_flex_var(); - let decode_record_lambda_set = env.subs.fresh_unnamed_flex_var(); - let decode_record_var = env.import_builtin_symbol_var(Symbol::DECODE_RECORD); - let this_decode_record_var = { - let flat_type = FlatType::Func( - SubsSlice::insert_into_subs(env.subs, [initial_state_var, step_var, finalizer_var]), - decode_record_lambda_set, - record_decoder_var, - ); - - synth_var(env.subs, Content::Structure(flat_type)) - }; - - env.unify(decode_record_var, this_decode_record_var); - - // Decode.record initialState stepField finalizer - let call_decode_record = Expr::Call( - Box::new(( - this_decode_record_var, - Loc::at_zero(Expr::AbilityMember( - Symbol::DECODE_RECORD, - None, - this_decode_record_var, - )), - decode_record_lambda_set, - record_decoder_var, - )), - vec![ - (initial_state_var, Loc::at_zero(initial_state)), - (step_var, Loc::at_zero(step_field)), - (finalizer_var, Loc::at_zero(finalizer)), - ], - CalledVia::Space, - ); - - let (call_decode_custom, decode_custom_ret_var) = { - let bytes_sym = env.new_symbol("bytes"); - let fmt_sym = env.new_symbol("fmt"); - let fmt_var = env.subs.fresh_unnamed_flex_var(); - - let (decode_custom, decode_custom_var) = wrap_in_decode_custom_decode_with( - env, - bytes_sym, - (fmt_sym, fmt_var), - vec![], - (call_decode_record, record_decoder_var), - ); - - (decode_custom, decode_custom_var) - }; - - (call_decode_custom, decode_custom_ret_var) -} - -// Example: -// stepField = \state, field -> -// when field is -// "first" -> -// Keep (Decode.custom \bytes, fmt -> -// # Uses a single-branch `when` because `let` is more expensive to monomorphize -// # due to checks for polymorphic expressions, and `rec` would be polymorphic. -// when Decode.decodeWith bytes Decode.decoder fmt is -// rec -> -// { -// rest: rec.rest, -// result: when rec.result is -// Ok val -> Ok {state & first: Ok val}, -// Err err -> Err err -// }) -// -// "second" -> -// Keep (Decode.custom \bytes, fmt -> -// when Decode.decodeWith bytes Decode.decoder fmt is -// rec -> -// { -// rest: rec.rest, -// result: when rec.result is -// Ok val -> Ok {state & second: Ok val}, -// Err err -> Err err -// }) -// -// _ -> Skip -fn decoder_record_step_field( - env: &mut Env, - fields: Vec<Lowercase>, - field_vars: &[Variable], - result_field_vars: &[Variable], - state_record_var: Variable, - decode_err_var: Variable, -) -> (Expr, Variable) { - let state_arg_symbol = env.new_symbol("stateRecord"); - let field_arg_symbol = env.new_symbol("field"); - - // +1 because of the default branch. - let mut branches = Vec::with_capacity(fields.len() + 1); - let keep_payload_var = env.subs.fresh_unnamed_flex_var(); - let keep_or_skip_var = { - let keep_payload_subs_slice = SubsSlice::insert_into_subs(env.subs, [keep_payload_var]); - let flat_type = FlatType::TagUnion( - UnionTags::insert_slices_into_subs( - env.subs, - [ - ("Keep".into(), keep_payload_subs_slice), - ("Skip".into(), Default::default()), - ], - ), - TagExt::Any(Variable::EMPTY_TAG_UNION), - ); - - synth_var(env.subs, Content::Structure(flat_type)) - }; - - for ((field_name, &field_var), &result_field_var) in fields - .into_iter() - .zip(field_vars.iter()) - .zip(result_field_vars.iter()) - { - // Example: - // "first" -> - // Keep (Decode.custom \bytes, fmt -> - // # Uses a single-branch `when` because `let` is more expensive to monomorphize - // # due to checks for polymorphic expressions, and `rec` would be polymorphic. - // when Decode.decodeWith bytes Decode.decoder fmt is - // rec -> - // { - // rest: rec.rest, - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - // } - // ) - - let this_custom_callback_var; - let custom_callback_ret_var; - let custom_callback = { - // \bytes, fmt -> - // when Decode.decodeWith bytes Decode.decoder fmt is - // rec -> - // { - // rest: rec.rest, - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - // } - let bytes_arg_symbol = env.new_symbol("bytes"); - let fmt_arg_symbol = env.new_symbol("fmt"); - let bytes_arg_var = env.subs.fresh_unnamed_flex_var(); - let fmt_arg_var = env.subs.fresh_unnamed_flex_var(); - - // rec.result : [Ok field_var, Err DecodeError] - let rec_dot_result = { - let tag_union = FlatType::TagUnion( - UnionTags::for_result(env.subs, field_var, decode_err_var), - TagExt::Any(Variable::EMPTY_TAG_UNION), - ); - - synth_var(env.subs, Content::Structure(tag_union)) - }; - - // rec : { rest: List U8, result: (typeof rec.result) } - let rec_var = { - let fields = RecordFields::insert_into_subs( - env.subs, - [ - ("rest".into(), RecordField::Required(Variable::LIST_U8)), - ("result".into(), RecordField::Required(rec_dot_result)), - ], - ); - let record = FlatType::Record(fields, Variable::EMPTY_RECORD); - - synth_var(env.subs, Content::Structure(record)) - }; - - // `Decode.decoder` for the field's value - let decoder_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODER); - let decode_with_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODE_WITH); - let lambda_set_var = env.subs.fresh_unnamed_flex_var(); - let this_decode_with_var = { - let subs_slice = SubsSlice::insert_into_subs( - env.subs, - [bytes_arg_var, decoder_var, fmt_arg_var], - ); - let this_decode_with_var = synth_var( - env.subs, - Content::Structure(FlatType::Func(subs_slice, lambda_set_var, rec_var)), - ); - - env.unify(decode_with_var, this_decode_with_var); - - this_decode_with_var - }; - - // The result of decoding this field's value - either the updated state, or a decoding error. - let when_expr_var = { - let flat_type = FlatType::TagUnion( - UnionTags::for_result(env.subs, state_record_var, decode_err_var), - TagExt::Any(Variable::EMPTY_TAG_UNION), - ); - - synth_var(env.subs, Content::Structure(flat_type)) - }; - - // What our decoder passed to `Decode.custom` returns - the result of decoding the - // field's value, and the remaining bytes. - custom_callback_ret_var = { - let rest_field = RecordField::Required(Variable::LIST_U8); - let result_field = RecordField::Required(when_expr_var); - let flat_type = FlatType::Record( - RecordFields::insert_into_subs( - env.subs, - [("rest".into(), rest_field), ("result".into(), result_field)], - ), - Variable::EMPTY_RECORD, - ); - - synth_var(env.subs, Content::Structure(flat_type)) - }; - - let custom_callback_body = { - let rec_symbol = env.new_symbol("rec"); - - // # Uses a single-branch `when` because `let` is more expensive to monomorphize - // # due to checks for polymorphic expressions, and `rec` would be polymorphic. - // when Decode.decodeWith bytes Decode.decoder fmt is - // rec -> - // { - // rest: rec.rest, - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - // } - let branch_body = { - let result_val = { - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - let ok_val_symbol = env.new_symbol("val"); - let err_val_symbol = env.new_symbol("err"); - let ok_branch_expr = { - // Ok {state & first: Ok val}, - let mut updates = SendMap::default(); - - updates.insert( - field_name.clone(), - Field { - var: result_field_var, - region: Region::zero(), - loc_expr: Box::new(Loc::at_zero(Expr::Tag { - tag_union_var: result_field_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Ok".into(), - arguments: vec![( - field_var, - Loc::at_zero(Expr::Var(ok_val_symbol, field_var)), - )], - })), - }, - ); - - let updated_record = Expr::RecordUpdate { - record_var: state_record_var, - ext_var: env.new_ext_var(ExtensionKind::Record), - symbol: state_arg_symbol, - updates, - }; - - Expr::Tag { - tag_union_var: when_expr_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Ok".into(), - arguments: vec![(state_record_var, Loc::at_zero(updated_record))], - } - }; - - let branches = vec![ - // Ok val -> Ok {state & first: Ok val}, - WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::AppliedTag { - whole_var: rec_dot_result, - ext_var: Variable::EMPTY_TAG_UNION, - tag_name: "Ok".into(), - arguments: vec![( - field_var, - Loc::at_zero(Pattern::Identifier(ok_val_symbol)), - )], - }), - degenerate: false, - }], - value: Loc::at_zero(ok_branch_expr), - guard: None, - redundant: RedundantMark::known_non_redundant(), - }, - // Err err -> Err err - WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::AppliedTag { - whole_var: rec_dot_result, - ext_var: Variable::EMPTY_TAG_UNION, - tag_name: "Err".into(), - arguments: vec![( - decode_err_var, - Loc::at_zero(Pattern::Identifier(err_val_symbol)), - )], - }), - degenerate: false, - }], - value: Loc::at_zero(Expr::Tag { - tag_union_var: when_expr_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Err".into(), - arguments: vec![( - decode_err_var, - Loc::at_zero(Expr::Var(err_val_symbol, decode_err_var)), - )], - }), - guard: None, - redundant: RedundantMark::known_non_redundant(), - }, - ]; - - // when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - Expr::When { - loc_cond: Box::new(Loc::at_zero(Expr::RecordAccess { - record_var: rec_var, - ext_var: env.new_ext_var(ExtensionKind::Record), - field_var: rec_dot_result, - loc_expr: Box::new(Loc::at_zero(Expr::Var(rec_symbol, rec_var))), - field: "result".into(), - })), - cond_var: rec_dot_result, - expr_var: when_expr_var, - region: Region::zero(), - branches, - branches_cond_var: rec_dot_result, - exhaustive: ExhaustiveMark::known_exhaustive(), - } - }; - - // { - // rest: rec.rest, - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - // } - let mut fields_map = SendMap::default(); - - fields_map.insert( - "rest".into(), - Field { - var: Variable::LIST_U8, - region: Region::zero(), - loc_expr: Box::new(Loc::at_zero(Expr::RecordAccess { - record_var: rec_var, - ext_var: env.new_ext_var(ExtensionKind::Record), - field_var: Variable::LIST_U8, - loc_expr: Box::new(Loc::at_zero(Expr::Var(rec_symbol, rec_var))), - field: "rest".into(), - })), - }, - ); - - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - fields_map.insert( - "result".into(), - Field { - var: when_expr_var, - region: Region::zero(), - loc_expr: Box::new(Loc::at_zero(result_val)), - }, - ); - - Expr::Record { - record_var: custom_callback_ret_var, - fields: fields_map, - } - }; - - let branch = WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::Identifier(rec_symbol)), - degenerate: false, - }], - value: Loc::at_zero(branch_body), - guard: None, - redundant: RedundantMark::known_non_redundant(), - }; - - let condition_expr = Expr::Call( - Box::new(( - this_decode_with_var, - Loc::at_zero(Expr::Var(Symbol::DECODE_DECODE_WITH, this_decode_with_var)), - lambda_set_var, - rec_var, - )), - vec![ - ( - Variable::LIST_U8, - Loc::at_zero(Expr::Var(bytes_arg_symbol, Variable::LIST_U8)), - ), - ( - decoder_var, - Loc::at_zero(Expr::AbilityMember( - Symbol::DECODE_DECODER, - None, - decoder_var, - )), - ), - ( - fmt_arg_var, - Loc::at_zero(Expr::Var(fmt_arg_symbol, fmt_arg_var)), - ), - ], - CalledVia::Space, - ); - - // when Decode.decodeWith bytes Decode.decoder fmt is - Expr::When { - loc_cond: Box::new(Loc::at_zero(condition_expr)), - cond_var: rec_var, - expr_var: custom_callback_ret_var, - region: Region::zero(), - branches: vec![branch], - branches_cond_var: rec_var, - exhaustive: ExhaustiveMark::known_exhaustive(), - } - }; - - let custom_closure_symbol = env.new_symbol("customCallback"); - this_custom_callback_var = env.subs.fresh_unnamed_flex_var(); - let custom_callback_lambda_set_var = { - let content = Content::LambdaSet(LambdaSet { - solved: UnionLambdas::insert_into_subs( - env.subs, - [(custom_closure_symbol, [state_record_var])], - ), - recursion_var: OptVariable::NONE, - unspecialized: Default::default(), - ambient_function: this_custom_callback_var, - }); - let custom_callback_lambda_set_var = synth_var(env.subs, content); - let subs_slice = - SubsSlice::insert_into_subs(env.subs, [bytes_arg_var, fmt_arg_var]); - - env.subs.set_content( - this_custom_callback_var, - Content::Structure(FlatType::Func( - subs_slice, - custom_callback_lambda_set_var, - custom_callback_ret_var, - )), - ); - - custom_callback_lambda_set_var - }; - - // \bytes, fmt -> … - Expr::Closure(ClosureData { - function_type: this_custom_callback_var, - closure_type: custom_callback_lambda_set_var, - return_type: custom_callback_ret_var, - name: custom_closure_symbol, - captured_symbols: vec![(state_arg_symbol, state_record_var)], - recursive: Recursive::NotRecursive, - arguments: vec![ - ( - bytes_arg_var, - AnnotatedMark::known_exhaustive(), - Loc::at_zero(Pattern::Identifier(bytes_arg_symbol)), - ), - ( - fmt_arg_var, - AnnotatedMark::known_exhaustive(), - Loc::at_zero(Pattern::Identifier(fmt_arg_symbol)), - ), - ], - loc_body: Box::new(Loc::at_zero(custom_callback_body)), - }) - }; - - let decode_custom_ret_var = env.subs.fresh_unnamed_flex_var(); - let decode_custom = { - let decode_custom_var = env.import_builtin_symbol_var(Symbol::DECODE_CUSTOM); - let decode_custom_closure_var = env.subs.fresh_unnamed_flex_var(); - let this_decode_custom_var = { - let subs_slice = SubsSlice::insert_into_subs(env.subs, [this_custom_callback_var]); - let flat_type = - FlatType::Func(subs_slice, decode_custom_closure_var, decode_custom_ret_var); - - synth_var(env.subs, Content::Structure(flat_type)) - }; - - env.unify(decode_custom_var, this_decode_custom_var); - - // Decode.custom \bytes, fmt -> … - Expr::Call( - Box::new(( - this_decode_custom_var, - Loc::at_zero(Expr::Var(Symbol::DECODE_CUSTOM, this_decode_custom_var)), - decode_custom_closure_var, - decode_custom_ret_var, - )), - vec![(this_custom_callback_var, Loc::at_zero(custom_callback))], - CalledVia::Space, - ) - }; - - env.unify(keep_payload_var, decode_custom_ret_var); - - let keep = { - // Keep (Decode.custom \bytes, fmt -> - // when Decode.decodeWith bytes Decode.decoder fmt is - // rec -> - // { - // rest: rec.rest, - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - // } - // ) - Expr::Tag { - tag_union_var: keep_or_skip_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Keep".into(), - arguments: vec![(decode_custom_ret_var, Loc::at_zero(decode_custom))], - } - }; - - let branch = { - // "first" -> - // Keep (Decode.custom \bytes, fmt -> - // when Decode.decodeWith bytes Decode.decoder fmt is - // rec -> - // { - // rest: rec.rest, - // result: when rec.result is - // Ok val -> Ok {state & first: Ok val}, - // Err err -> Err err - // } - // ) - WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::StrLiteral(field_name.into())), - degenerate: false, - }], - value: Loc::at_zero(keep), - guard: None, - redundant: RedundantMark::known_non_redundant(), - } - }; - - branches.push(branch); - } - - // Example: `_ -> Skip` - let default_branch = WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::Underscore), - degenerate: false, - }], - value: Loc::at_zero(Expr::Tag { - tag_union_var: keep_or_skip_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Skip".into(), - arguments: Vec::new(), - }), - guard: None, - redundant: RedundantMark::known_non_redundant(), - }; - - branches.push(default_branch); - - // when field is - let body = Expr::When { - loc_cond: Box::new(Loc::at_zero(Expr::Var(field_arg_symbol, Variable::STR))), - cond_var: Variable::STR, - expr_var: keep_or_skip_var, - region: Region::zero(), - branches, - branches_cond_var: Variable::STR, - exhaustive: ExhaustiveMark::known_exhaustive(), - }; - - let step_field_closure = env.new_symbol("stepField"); - let function_type = env.subs.fresh_unnamed_flex_var(); - let closure_type = { - let lambda_set = LambdaSet { - solved: UnionLambdas::tag_without_arguments(env.subs, step_field_closure), - recursion_var: OptVariable::NONE, - unspecialized: Default::default(), - ambient_function: function_type, - }; - - synth_var(env.subs, Content::LambdaSet(lambda_set)) - }; - - { - let args_slice = SubsSlice::insert_into_subs(env.subs, [state_record_var, Variable::STR]); - - env.subs.set_content( - function_type, - Content::Structure(FlatType::Func(args_slice, closure_type, keep_or_skip_var)), - ) - }; - - let expr = Expr::Closure(ClosureData { - function_type, - closure_type, - return_type: keep_or_skip_var, - name: step_field_closure, - captured_symbols: Vec::new(), - recursive: Recursive::NotRecursive, - arguments: vec![ - ( - state_record_var, - AnnotatedMark::known_exhaustive(), - Loc::at_zero(Pattern::Identifier(state_arg_symbol)), - ), - ( - Variable::STR, - AnnotatedMark::known_exhaustive(), - Loc::at_zero(Pattern::Identifier(field_arg_symbol)), - ), - ], - loc_body: Box::new(Loc::at_zero(body)), - }); - - (expr, function_type) -} - -// Example: -// finalizer = \rec -> -// when rec.first is -// Ok first -> -// when rec.second is -// Ok second -> Ok {first, second} -// Err NoField -> Err TooShort -// Err NoField -> Err TooShort -fn decoder_record_finalizer( - env: &mut Env, - state_record_var: Variable, - fields: &[Lowercase], - field_vars: &[Variable], - result_field_vars: &[Variable], -) -> (Expr, Variable, Variable) { - let state_arg_symbol = env.new_symbol("stateRecord"); - let mut fields_map = SendMap::default(); - let mut pattern_symbols = Vec::with_capacity(fields.len()); - let decode_err_var = { - let flat_type = FlatType::TagUnion( - UnionTags::tag_without_arguments(env.subs, "TooShort".into()), - TagExt::Any(Variable::EMPTY_TAG_UNION), - ); - - synth_var(env.subs, Content::Structure(flat_type)) - }; - - for (field_name, &field_var) in fields.iter().zip(field_vars.iter()) { - let symbol = env.new_symbol(field_name.as_str()); - - pattern_symbols.push(symbol); - - let field_expr = Expr::Var(symbol, field_var); - let field = Field { - var: field_var, - region: Region::zero(), - loc_expr: Box::new(Loc::at_zero(field_expr)), - }; - - fields_map.insert(field_name.clone(), field); - } - - // The bottom of the happy path - return the decoded record {first: a, second: b} wrapped with - // "Ok". - let return_type_var; - let mut body = { - let subs = &mut env.subs; - let record_field_iter = fields - .iter() - .zip(field_vars.iter()) - .map(|(field_name, &field_var)| (field_name.clone(), RecordField::Required(field_var))); - let flat_type = FlatType::Record( - RecordFields::insert_into_subs(subs, record_field_iter), - Variable::EMPTY_RECORD, - ); - let done_record_var = synth_var(subs, Content::Structure(flat_type)); - let done_record = Expr::Record { - record_var: done_record_var, - fields: fields_map, - }; - - return_type_var = { - let flat_type = FlatType::TagUnion( - UnionTags::for_result(subs, done_record_var, decode_err_var), - TagExt::Any(Variable::EMPTY_TAG_UNION), - ); - - synth_var(subs, Content::Structure(flat_type)) - }; - - Expr::Tag { - tag_union_var: return_type_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Ok".into(), - arguments: vec![(done_record_var, Loc::at_zero(done_record))], - } - }; - - // Unwrap each result in the decoded state - // - // when rec.first is - // Ok first -> ...happy path... - // Err NoField -> Err TooShort - for (((symbol, field_name), &field_var), &result_field_var) in pattern_symbols - .iter() - .rev() - .zip(fields.iter().rev()) - .zip(field_vars.iter().rev()) - .zip(result_field_vars.iter().rev()) - { - // when rec.first is - let cond_expr = Expr::RecordAccess { - record_var: state_record_var, - ext_var: env.new_ext_var(ExtensionKind::Record), - field_var: result_field_var, - loc_expr: Box::new(Loc::at_zero(Expr::Var(state_arg_symbol, state_record_var))), - field: field_name.clone(), - }; - - // Example: `Ok x -> expr` - let ok_branch = WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::AppliedTag { - whole_var: result_field_var, - ext_var: Variable::EMPTY_TAG_UNION, - tag_name: "Ok".into(), - arguments: vec![(field_var, Loc::at_zero(Pattern::Identifier(*symbol)))], - }), - degenerate: false, - }], - value: Loc::at_zero(body), - guard: None, - redundant: RedundantMark::known_non_redundant(), - }; - - // Example: `_ -> Err TooShort` - let err_branch = WhenBranch { - patterns: vec![WhenBranchPattern { - pattern: Loc::at_zero(Pattern::Underscore), - degenerate: false, - }], - value: Loc::at_zero(Expr::Tag { - tag_union_var: return_type_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: "Err".into(), - arguments: vec![( - decode_err_var, - Loc::at_zero(Expr::Tag { - tag_union_var: decode_err_var, - ext_var: Variable::EMPTY_TAG_UNION, - name: "TooShort".into(), - arguments: Vec::new(), - }), - )], - }), - guard: None, - redundant: RedundantMark::known_non_redundant(), - }; - - body = Expr::When { - loc_cond: Box::new(Loc::at_zero(cond_expr)), - cond_var: result_field_var, - expr_var: return_type_var, - region: Region::zero(), - branches: vec![ok_branch, err_branch], - branches_cond_var: result_field_var, - exhaustive: ExhaustiveMark::known_exhaustive(), - }; - } - - let function_var = synth_var(env.subs, Content::Error); // We'll fix this up in subs later. - let function_symbol = env.new_symbol("finalizer"); - let lambda_set = LambdaSet { - solved: UnionLambdas::tag_without_arguments(env.subs, function_symbol), - recursion_var: OptVariable::NONE, - unspecialized: Default::default(), - ambient_function: function_var, - }; - let closure_type = synth_var(env.subs, Content::LambdaSet(lambda_set)); - let flat_type = FlatType::Func( - SubsSlice::insert_into_subs(env.subs, [state_record_var]), - closure_type, - return_type_var, - ); - - // Fix up function_var so it's not Content::Error anymore - env.subs - .set_content(function_var, Content::Structure(flat_type)); - - let finalizer = Expr::Closure(ClosureData { - function_type: function_var, - closure_type, - return_type: return_type_var, - name: function_symbol, - captured_symbols: Vec::new(), - recursive: Recursive::NotRecursive, - arguments: vec![( - state_record_var, - AnnotatedMark::known_exhaustive(), - Loc::at_zero(Pattern::Identifier(state_arg_symbol)), - )], - loc_body: Box::new(Loc::at_zero(body)), - }); - - (finalizer, function_var, decode_err_var) -} - -// Example: -// initialState : {first: Result a [NoField], second: Result b [NoField]} -// initialState = {first: Err NoField, second: Err NoField} -fn decoder_record_initial_state( - env: &mut Env<'_>, - field_names: &[Lowercase], - field_vars: &mut Vec<Variable>, - result_field_vars: &mut Vec<Variable>, -) -> (Variable, Expr) { - let mut initial_state_fields = SendMap::default(); - - for field_name in field_names { - let subs = &mut env.subs; - let field_var = subs.fresh_unnamed_flex_var(); - - field_vars.push(field_var); - - let no_field_label = "NoField"; - let union_tags = UnionTags::tag_without_arguments(subs, no_field_label.into()); - let no_field_var = synth_var( - subs, - Content::Structure(FlatType::TagUnion( - union_tags, - TagExt::Any(Variable::EMPTY_TAG_UNION), - )), - ); - let no_field = Expr::Tag { - tag_union_var: no_field_var, - ext_var: Variable::EMPTY_TAG_UNION, - name: no_field_label.into(), - arguments: Vec::new(), - }; - let err_label = "Err"; - let union_tags = UnionTags::for_result(subs, field_var, no_field_var); - let result_var = synth_var( - subs, - Content::Structure(FlatType::TagUnion( - union_tags, - TagExt::Any(Variable::EMPTY_TAG_UNION), - )), - ); - let field_expr = Expr::Tag { - tag_union_var: result_var, - ext_var: env.new_ext_var(ExtensionKind::TagUnion), - name: err_label.into(), - arguments: vec![(no_field_var, Loc::at_zero(no_field))], - }; - result_field_vars.push(result_var); - let field = Field { - var: result_var, - region: Region::zero(), - loc_expr: Box::new(Loc::at_zero(field_expr)), - }; - - initial_state_fields.insert(field_name.clone(), field); - } - - let subs = &mut env.subs; - let record_field_iter = field_names - .iter() - .zip(result_field_vars.iter()) - .map(|(field_name, &var)| (field_name.clone(), RecordField::Required(var))); - let flat_type = FlatType::Record( - RecordFields::insert_into_subs(subs, record_field_iter), - Variable::EMPTY_RECORD, - ); - - let state_record_var = synth_var(subs, Content::Structure(flat_type)); - - ( - state_record_var, - Expr::Record { - record_var: state_record_var, - fields: initial_state_fields, - }, - ) -} - -fn decoder_list(env: &mut Env<'_>, _def_symbol: Symbol) -> (Expr, Variable) { - // Build - // - // def_symbol : Decoder (List elem) fmt | elem has Decoding, fmt has DecoderFormatting - // def_symbol = Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.list Decode.decoder) fmt - // - // TODO try to reduce to `Decode.list Decode.decoder` - - use Expr::*; - - // Decode.list Decode.decoder : Decoder (List elem) fmt - let (decode_list_call, this_decode_list_ret_var) = { - // List elem - let elem_var = env.subs.fresh_unnamed_flex_var(); - - // Decode.decoder : Decoder elem fmt | elem has Decoding, fmt has EncoderFormatting - let (elem_decoder, elem_decoder_var) = { - // build `Decode.decoder : Decoder elem fmt` type - // Decoder val fmt | val has Decoding, fmt has EncoderFormatting - let elem_decoder_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODER); - - // set val ~ elem - let val_var = match env.subs.get_content_without_compacting(elem_decoder_var) { - Content::Alias(Symbol::DECODE_DECODER_OPAQUE, vars, _, AliasKind::Opaque) - if vars.type_variables_len == 2 => - { - env.subs.get_subs_slice(vars.type_variables())[0] - } - _ => internal_error!("Decode.decode not an opaque type"), - }; - - env.unify(val_var, elem_var); - - ( - AbilityMember(Symbol::DECODE_DECODER, None, elem_decoder_var), - elem_decoder_var, - ) - }; - - // Build `Decode.list Decode.decoder` type - // Decoder val fmt -[uls]-> Decoder (List val) fmt | fmt has DecoderFormatting - let decode_list_fn_var = env.import_builtin_symbol_var(Symbol::DECODE_LIST); - - // Decoder elem fmt -a-> b - let elem_decoder_var_slice = SubsSlice::insert_into_subs(env.subs, [elem_decoder_var]); - let this_decode_list_clos_var = env.subs.fresh_unnamed_flex_var(); - let this_decode_list_ret_var = env.subs.fresh_unnamed_flex_var(); - let this_decode_list_fn_var = synth_var( - env.subs, - Content::Structure(FlatType::Func( - elem_decoder_var_slice, - this_decode_list_clos_var, - this_decode_list_ret_var, - )), - ); - - // Decoder val fmt -[uls]-> Decoder (List val) fmt | fmt has DecoderFormatting - // ~ Decoder elem fmt -a -> b - env.unify(decode_list_fn_var, this_decode_list_fn_var); - - let decode_list_member = AbilityMember(Symbol::DECODE_LIST, None, this_decode_list_fn_var); - let decode_list_fn = Box::new(( - decode_list_fn_var, - Loc::at_zero(decode_list_member), - this_decode_list_clos_var, - this_decode_list_ret_var, - )); - - let decode_list_call = Call( - decode_list_fn, - vec![(elem_decoder_var, Loc::at_zero(elem_decoder))], - CalledVia::Space, - ); - - (decode_list_call, this_decode_list_ret_var) - }; - - let bytes_sym = env.new_symbol("bytes"); - let fmt_sym = env.new_symbol("fmt"); - let fmt_var = env.subs.fresh_unnamed_flex_var(); - let captures = vec![]; - - wrap_in_decode_custom_decode_with( - env, - bytes_sym, - (fmt_sym, fmt_var), - captures, - (decode_list_call, this_decode_list_ret_var), - ) -} - // Wraps `myDecoder` in `Decode.custom \bytes, fmt -> Decode.decodeWith bytes myDecoder fmt`. -// I think most can be removed when https://github.com/roc-lang/roc/issues/3724 is resolved. +// +// Needed to work around the Higher-Region Restriction. See https://github.com/roc-lang/roc/issues/3724. fn wrap_in_decode_custom_decode_with( env: &mut Env, bytes: Symbol, diff --git /dev/null b/crates/compiler/derive/src/decoding/list.rs new file mode 100644 --- /dev/null +++ b/crates/compiler/derive/src/decoding/list.rs @@ -0,0 +1,104 @@ +use roc_can::expr::Expr; + +use roc_error_macros::internal_error; +use roc_module::called_via::CalledVia; + +use roc_module::symbol::Symbol; +use roc_region::all::Loc; +use roc_types::subs::{Content, FlatType, GetSubsSlice, SubsSlice, Variable}; +use roc_types::types::AliasKind; + +use crate::decoding::wrap_in_decode_custom_decode_with; +use crate::synth_var; +use crate::util::Env; + +pub(crate) fn decoder(env: &mut Env<'_>, _def_symbol: Symbol) -> (Expr, Variable) { + // Build + // + // def_symbol : Decoder (List elem) fmt | elem has Decoding, fmt has DecoderFormatting + // def_symbol = Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.list Decode.decoder) fmt + // + // NB: reduction to `Decode.list Decode.decoder` is not possible to the HRR. + + use Expr::*; + + // Decode.list Decode.decoder : Decoder (List elem) fmt + let (decode_list_call, this_decode_list_ret_var) = { + // List elem + let elem_var = env.subs.fresh_unnamed_flex_var(); + + // Decode.decoder : Decoder elem fmt | elem has Decoding, fmt has EncoderFormatting + let (elem_decoder, elem_decoder_var) = { + // build `Decode.decoder : Decoder elem fmt` type + // Decoder val fmt | val has Decoding, fmt has EncoderFormatting + let elem_decoder_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODER); + + // set val ~ elem + let val_var = match env.subs.get_content_without_compacting(elem_decoder_var) { + Content::Alias(Symbol::DECODE_DECODER_OPAQUE, vars, _, AliasKind::Opaque) + if vars.type_variables_len == 2 => + { + env.subs.get_subs_slice(vars.type_variables())[0] + } + _ => internal_error!("Decode.decode not an opaque type"), + }; + + env.unify(val_var, elem_var); + + ( + AbilityMember(Symbol::DECODE_DECODER, None, elem_decoder_var), + elem_decoder_var, + ) + }; + + // Build `Decode.list Decode.decoder` type + // Decoder val fmt -[uls]-> Decoder (List val) fmt | fmt has DecoderFormatting + let decode_list_fn_var = env.import_builtin_symbol_var(Symbol::DECODE_LIST); + + // Decoder elem fmt -a-> b + let elem_decoder_var_slice = SubsSlice::insert_into_subs(env.subs, [elem_decoder_var]); + let this_decode_list_clos_var = env.subs.fresh_unnamed_flex_var(); + let this_decode_list_ret_var = env.subs.fresh_unnamed_flex_var(); + let this_decode_list_fn_var = synth_var( + env.subs, + Content::Structure(FlatType::Func( + elem_decoder_var_slice, + this_decode_list_clos_var, + this_decode_list_ret_var, + )), + ); + + // Decoder val fmt -[uls]-> Decoder (List val) fmt | fmt has DecoderFormatting + // ~ Decoder elem fmt -a -> b + env.unify(decode_list_fn_var, this_decode_list_fn_var); + + let decode_list_member = AbilityMember(Symbol::DECODE_LIST, None, this_decode_list_fn_var); + let decode_list_fn = Box::new(( + decode_list_fn_var, + Loc::at_zero(decode_list_member), + this_decode_list_clos_var, + this_decode_list_ret_var, + )); + + let decode_list_call = Call( + decode_list_fn, + vec![(elem_decoder_var, Loc::at_zero(elem_decoder))], + CalledVia::Space, + ); + + (decode_list_call, this_decode_list_ret_var) + }; + + let bytes_sym = env.new_symbol("bytes"); + let fmt_sym = env.new_symbol("fmt"); + let fmt_var = env.subs.fresh_unnamed_flex_var(); + let captures = vec![]; + + wrap_in_decode_custom_decode_with( + env, + bytes_sym, + (fmt_sym, fmt_var), + captures, + (decode_list_call, this_decode_list_ret_var), + ) +} diff --git /dev/null b/crates/compiler/derive/src/decoding/record.rs new file mode 100644 --- /dev/null +++ b/crates/compiler/derive/src/decoding/record.rs @@ -0,0 +1,990 @@ +use roc_can::expr::{ + AnnotatedMark, ClosureData, Expr, Field, Recursive, WhenBranch, WhenBranchPattern, +}; +use roc_can::pattern::Pattern; +use roc_collections::SendMap; +use roc_module::called_via::CalledVia; +use roc_module::ident::Lowercase; +use roc_module::symbol::Symbol; +use roc_region::all::{Loc, Region}; +use roc_types::subs::{ + Content, ExhaustiveMark, FlatType, LambdaSet, OptVariable, RecordFields, RedundantMark, + SubsSlice, TagExt, UnionLambdas, UnionTags, Variable, +}; +use roc_types::types::RecordField; + +use crate::synth_var; +use crate::util::{Env, ExtensionKind}; + +use super::wrap_in_decode_custom_decode_with; + +/// Implements decoding of a record. For example, for +/// +/// ```text +/// {first: a, second: b} +/// ``` +/// +/// we'd like to generate an impl like +/// +/// ```roc +/// decoder : Decoder {first: a, second: b} fmt | a has Decoding, b has Decoding, fmt has DecoderFormatting +/// decoder = +/// initialState : {f0: Result a [NoField], f1: Result b [NoField]} +/// initialState = {f0: Err NoField, f1: Err NoField} +/// +/// stepField = \state, field -> +/// when field is +/// "first" -> +/// Keep (Decode.custom \bytes, fmt -> +/// when Decode.decodeWith bytes Decode.decoder fmt is +/// {result, rest} -> +/// {result: Result.map result \val -> {state & f0: Ok val}, rest}) +/// "second" -> +/// Keep (Decode.custom \bytes, fmt -> +/// when Decode.decodeWith bytes Decode.decoder fmt is +/// {result, rest} -> +/// {result: Result.map result \val -> {state & f1: Ok val}, rest}) +/// _ -> Skip +/// +/// finalizer = \{f0, f1} -> +/// when f0 is +/// Ok first -> +/// when f1 is +/// Ok second -> Ok {first, second} +/// Err NoField -> Err TooShort +/// Err NoField -> Err TooShort +/// +/// Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.record initialState stepField finalizer) fmt +/// ``` +pub(crate) fn decoder( + env: &mut Env, + _def_symbol: Symbol, + fields: Vec<Lowercase>, +) -> (Expr, Variable) { + // The decoded type of each field in the record, e.g. {first: a, second: b}. + let mut field_vars = Vec::with_capacity(fields.len()); + // The type of each field in the decoding state, e.g. {first: Result a [NoField], second: Result b [NoField]} + let mut result_field_vars = Vec::with_capacity(fields.len()); + + // initialState = ... + let (initial_state_var, initial_state) = + initial_state(env, &fields, &mut field_vars, &mut result_field_vars); + + // finalizer = ... + let (finalizer, finalizer_var, decode_err_var) = finalizer( + env, + initial_state_var, + &fields, + &field_vars, + &result_field_vars, + ); + + // stepField = ... + let (step_field, step_var) = step_field( + env, + fields, + &field_vars, + &result_field_vars, + initial_state_var, + decode_err_var, + ); + + // Build up the type of `Decode.record` we expect + let record_decoder_var = env.subs.fresh_unnamed_flex_var(); + let decode_record_lambda_set = env.subs.fresh_unnamed_flex_var(); + let decode_record_var = env.import_builtin_symbol_var(Symbol::DECODE_RECORD); + let this_decode_record_var = { + let flat_type = FlatType::Func( + SubsSlice::insert_into_subs(env.subs, [initial_state_var, step_var, finalizer_var]), + decode_record_lambda_set, + record_decoder_var, + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + env.unify(decode_record_var, this_decode_record_var); + + // Decode.record initialState stepField finalizer + let call_decode_record = Expr::Call( + Box::new(( + this_decode_record_var, + Loc::at_zero(Expr::AbilityMember( + Symbol::DECODE_RECORD, + None, + this_decode_record_var, + )), + decode_record_lambda_set, + record_decoder_var, + )), + vec![ + (initial_state_var, Loc::at_zero(initial_state)), + (step_var, Loc::at_zero(step_field)), + (finalizer_var, Loc::at_zero(finalizer)), + ], + CalledVia::Space, + ); + + let (call_decode_custom, decode_custom_ret_var) = { + let bytes_sym = env.new_symbol("bytes"); + let fmt_sym = env.new_symbol("fmt"); + let fmt_var = env.subs.fresh_unnamed_flex_var(); + + let (decode_custom, decode_custom_var) = wrap_in_decode_custom_decode_with( + env, + bytes_sym, + (fmt_sym, fmt_var), + vec![], + (call_decode_record, record_decoder_var), + ); + + (decode_custom, decode_custom_var) + }; + + (call_decode_custom, decode_custom_ret_var) +} + +// Example: +// stepField = \state, field -> +// when field is +// "first" -> +// Keep (Decode.custom \bytes, fmt -> +// # Uses a single-branch `when` because `let` is more expensive to monomorphize +// # due to checks for polymorphic expressions, and `rec` would be polymorphic. +// when Decode.decodeWith bytes Decode.decoder fmt is +// rec -> +// { +// rest: rec.rest, +// result: when rec.result is +// Ok val -> Ok {state & first: Ok val}, +// Err err -> Err err +// }) +// +// "second" -> +// Keep (Decode.custom \bytes, fmt -> +// when Decode.decodeWith bytes Decode.decoder fmt is +// rec -> +// { +// rest: rec.rest, +// result: when rec.result is +// Ok val -> Ok {state & second: Ok val}, +// Err err -> Err err +// }) +// +// _ -> Skip +fn step_field( + env: &mut Env, + fields: Vec<Lowercase>, + field_vars: &[Variable], + result_field_vars: &[Variable], + state_record_var: Variable, + decode_err_var: Variable, +) -> (Expr, Variable) { + let state_arg_symbol = env.new_symbol("stateRecord"); + let field_arg_symbol = env.new_symbol("field"); + + // +1 because of the default branch. + let mut branches = Vec::with_capacity(fields.len() + 1); + let keep_payload_var = env.subs.fresh_unnamed_flex_var(); + let keep_or_skip_var = { + let keep_payload_subs_slice = SubsSlice::insert_into_subs(env.subs, [keep_payload_var]); + let flat_type = FlatType::TagUnion( + UnionTags::insert_slices_into_subs( + env.subs, + [ + ("Keep".into(), keep_payload_subs_slice), + ("Skip".into(), Default::default()), + ], + ), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + for ((field_name, &field_var), &result_field_var) in fields + .into_iter() + .zip(field_vars.iter()) + .zip(result_field_vars.iter()) + { + // Example: + // "first" -> + // Keep (Decode.custom \bytes, fmt -> + // # Uses a single-branch `when` because `let` is more expensive to monomorphize + // # due to checks for polymorphic expressions, and `rec` would be polymorphic. + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + // } + // ) + + let this_custom_callback_var; + let custom_callback_ret_var; + let custom_callback = { + // \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + // } + let bytes_arg_symbol = env.new_symbol("bytes"); + let fmt_arg_symbol = env.new_symbol("fmt"); + let bytes_arg_var = env.subs.fresh_unnamed_flex_var(); + let fmt_arg_var = env.subs.fresh_unnamed_flex_var(); + + // rec.result : [Ok field_var, Err DecodeError] + let rec_dot_result = { + let tag_union = FlatType::TagUnion( + UnionTags::for_result(env.subs, field_var, decode_err_var), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(tag_union)) + }; + + // rec : { rest: List U8, result: (typeof rec.result) } + let rec_var = { + let fields = RecordFields::insert_into_subs( + env.subs, + [ + ("rest".into(), RecordField::Required(Variable::LIST_U8)), + ("result".into(), RecordField::Required(rec_dot_result)), + ], + ); + let record = FlatType::Record(fields, Variable::EMPTY_RECORD); + + synth_var(env.subs, Content::Structure(record)) + }; + + // `Decode.decoder` for the field's value + let decoder_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODER); + let decode_with_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODE_WITH); + let lambda_set_var = env.subs.fresh_unnamed_flex_var(); + let this_decode_with_var = { + let subs_slice = SubsSlice::insert_into_subs( + env.subs, + [bytes_arg_var, decoder_var, fmt_arg_var], + ); + let this_decode_with_var = synth_var( + env.subs, + Content::Structure(FlatType::Func(subs_slice, lambda_set_var, rec_var)), + ); + + env.unify(decode_with_var, this_decode_with_var); + + this_decode_with_var + }; + + // The result of decoding this field's value - either the updated state, or a decoding error. + let when_expr_var = { + let flat_type = FlatType::TagUnion( + UnionTags::for_result(env.subs, state_record_var, decode_err_var), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + // What our decoder passed to `Decode.custom` returns - the result of decoding the + // field's value, and the remaining bytes. + custom_callback_ret_var = { + let rest_field = RecordField::Required(Variable::LIST_U8); + let result_field = RecordField::Required(when_expr_var); + let flat_type = FlatType::Record( + RecordFields::insert_into_subs( + env.subs, + [("rest".into(), rest_field), ("result".into(), result_field)], + ), + Variable::EMPTY_RECORD, + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + let custom_callback_body = { + let rec_symbol = env.new_symbol("rec"); + + // # Uses a single-branch `when` because `let` is more expensive to monomorphize + // # due to checks for polymorphic expressions, and `rec` would be polymorphic. + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + // } + let branch_body = { + let result_val = { + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + let ok_val_symbol = env.new_symbol("val"); + let err_val_symbol = env.new_symbol("err"); + let ok_branch_expr = { + // Ok {state & first: Ok val}, + let mut updates = SendMap::default(); + + updates.insert( + field_name.clone(), + Field { + var: result_field_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(Expr::Tag { + tag_union_var: result_field_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Ok".into(), + arguments: vec![( + field_var, + Loc::at_zero(Expr::Var(ok_val_symbol, field_var)), + )], + })), + }, + ); + + let updated_record = Expr::RecordUpdate { + record_var: state_record_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + symbol: state_arg_symbol, + updates, + }; + + Expr::Tag { + tag_union_var: when_expr_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Ok".into(), + arguments: vec![(state_record_var, Loc::at_zero(updated_record))], + } + }; + + let branches = vec![ + // Ok val -> Ok {state & first: Ok val}, + WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::AppliedTag { + whole_var: rec_dot_result, + ext_var: Variable::EMPTY_TAG_UNION, + tag_name: "Ok".into(), + arguments: vec![( + field_var, + Loc::at_zero(Pattern::Identifier(ok_val_symbol)), + )], + }), + degenerate: false, + }], + value: Loc::at_zero(ok_branch_expr), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }, + // Err err -> Err err + WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::AppliedTag { + whole_var: rec_dot_result, + ext_var: Variable::EMPTY_TAG_UNION, + tag_name: "Err".into(), + arguments: vec![( + decode_err_var, + Loc::at_zero(Pattern::Identifier(err_val_symbol)), + )], + }), + degenerate: false, + }], + value: Loc::at_zero(Expr::Tag { + tag_union_var: when_expr_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Err".into(), + arguments: vec![( + decode_err_var, + Loc::at_zero(Expr::Var(err_val_symbol, decode_err_var)), + )], + }), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }, + ]; + + // when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + Expr::When { + loc_cond: Box::new(Loc::at_zero(Expr::RecordAccess { + record_var: rec_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + field_var: rec_dot_result, + loc_expr: Box::new(Loc::at_zero(Expr::Var(rec_symbol, rec_var))), + field: "result".into(), + })), + cond_var: rec_dot_result, + expr_var: when_expr_var, + region: Region::zero(), + branches, + branches_cond_var: rec_dot_result, + exhaustive: ExhaustiveMark::known_exhaustive(), + } + }; + + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + // } + let mut fields_map = SendMap::default(); + + fields_map.insert( + "rest".into(), + Field { + var: Variable::LIST_U8, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(Expr::RecordAccess { + record_var: rec_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + field_var: Variable::LIST_U8, + loc_expr: Box::new(Loc::at_zero(Expr::Var(rec_symbol, rec_var))), + field: "rest".into(), + })), + }, + ); + + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + fields_map.insert( + "result".into(), + Field { + var: when_expr_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(result_val)), + }, + ); + + Expr::Record { + record_var: custom_callback_ret_var, + fields: fields_map, + } + }; + + let branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::Identifier(rec_symbol)), + degenerate: false, + }], + value: Loc::at_zero(branch_body), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + let condition_expr = Expr::Call( + Box::new(( + this_decode_with_var, + Loc::at_zero(Expr::Var(Symbol::DECODE_DECODE_WITH, this_decode_with_var)), + lambda_set_var, + rec_var, + )), + vec![ + ( + Variable::LIST_U8, + Loc::at_zero(Expr::Var(bytes_arg_symbol, Variable::LIST_U8)), + ), + ( + decoder_var, + Loc::at_zero(Expr::AbilityMember( + Symbol::DECODE_DECODER, + None, + decoder_var, + )), + ), + ( + fmt_arg_var, + Loc::at_zero(Expr::Var(fmt_arg_symbol, fmt_arg_var)), + ), + ], + CalledVia::Space, + ); + + // when Decode.decodeWith bytes Decode.decoder fmt is + Expr::When { + loc_cond: Box::new(Loc::at_zero(condition_expr)), + cond_var: rec_var, + expr_var: custom_callback_ret_var, + region: Region::zero(), + branches: vec![branch], + branches_cond_var: rec_var, + exhaustive: ExhaustiveMark::known_exhaustive(), + } + }; + + let custom_closure_symbol = env.new_symbol("customCallback"); + this_custom_callback_var = env.subs.fresh_unnamed_flex_var(); + let custom_callback_lambda_set_var = { + let content = Content::LambdaSet(LambdaSet { + solved: UnionLambdas::insert_into_subs( + env.subs, + [(custom_closure_symbol, [state_record_var])], + ), + recursion_var: OptVariable::NONE, + unspecialized: Default::default(), + ambient_function: this_custom_callback_var, + }); + let custom_callback_lambda_set_var = synth_var(env.subs, content); + let subs_slice = + SubsSlice::insert_into_subs(env.subs, [bytes_arg_var, fmt_arg_var]); + + env.subs.set_content( + this_custom_callback_var, + Content::Structure(FlatType::Func( + subs_slice, + custom_callback_lambda_set_var, + custom_callback_ret_var, + )), + ); + + custom_callback_lambda_set_var + }; + + // \bytes, fmt -> … + Expr::Closure(ClosureData { + function_type: this_custom_callback_var, + closure_type: custom_callback_lambda_set_var, + return_type: custom_callback_ret_var, + name: custom_closure_symbol, + captured_symbols: vec![(state_arg_symbol, state_record_var)], + recursive: Recursive::NotRecursive, + arguments: vec![ + ( + bytes_arg_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(bytes_arg_symbol)), + ), + ( + fmt_arg_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(fmt_arg_symbol)), + ), + ], + loc_body: Box::new(Loc::at_zero(custom_callback_body)), + }) + }; + + let decode_custom_ret_var = env.subs.fresh_unnamed_flex_var(); + let decode_custom = { + let decode_custom_var = env.import_builtin_symbol_var(Symbol::DECODE_CUSTOM); + let decode_custom_closure_var = env.subs.fresh_unnamed_flex_var(); + let this_decode_custom_var = { + let subs_slice = SubsSlice::insert_into_subs(env.subs, [this_custom_callback_var]); + let flat_type = + FlatType::Func(subs_slice, decode_custom_closure_var, decode_custom_ret_var); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + env.unify(decode_custom_var, this_decode_custom_var); + + // Decode.custom \bytes, fmt -> … + Expr::Call( + Box::new(( + this_decode_custom_var, + Loc::at_zero(Expr::Var(Symbol::DECODE_CUSTOM, this_decode_custom_var)), + decode_custom_closure_var, + decode_custom_ret_var, + )), + vec![(this_custom_callback_var, Loc::at_zero(custom_callback))], + CalledVia::Space, + ) + }; + + env.unify(keep_payload_var, decode_custom_ret_var); + + let keep = { + // Keep (Decode.custom \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + // } + // ) + Expr::Tag { + tag_union_var: keep_or_skip_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Keep".into(), + arguments: vec![(decode_custom_ret_var, Loc::at_zero(decode_custom))], + } + }; + + let branch = { + // "first" -> + // Keep (Decode.custom \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & first: Ok val}, + // Err err -> Err err + // } + // ) + WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::StrLiteral(field_name.into())), + degenerate: false, + }], + value: Loc::at_zero(keep), + guard: None, + redundant: RedundantMark::known_non_redundant(), + } + }; + + branches.push(branch); + } + + // Example: `_ -> Skip` + let default_branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::Underscore), + degenerate: false, + }], + value: Loc::at_zero(Expr::Tag { + tag_union_var: keep_or_skip_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Skip".into(), + arguments: Vec::new(), + }), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + branches.push(default_branch); + + // when field is + let body = Expr::When { + loc_cond: Box::new(Loc::at_zero(Expr::Var(field_arg_symbol, Variable::STR))), + cond_var: Variable::STR, + expr_var: keep_or_skip_var, + region: Region::zero(), + branches, + branches_cond_var: Variable::STR, + exhaustive: ExhaustiveMark::known_exhaustive(), + }; + + let step_field_closure = env.new_symbol("stepField"); + let function_type = env.subs.fresh_unnamed_flex_var(); + let closure_type = { + let lambda_set = LambdaSet { + solved: UnionLambdas::tag_without_arguments(env.subs, step_field_closure), + recursion_var: OptVariable::NONE, + unspecialized: Default::default(), + ambient_function: function_type, + }; + + synth_var(env.subs, Content::LambdaSet(lambda_set)) + }; + + { + let args_slice = SubsSlice::insert_into_subs(env.subs, [state_record_var, Variable::STR]); + + env.subs.set_content( + function_type, + Content::Structure(FlatType::Func(args_slice, closure_type, keep_or_skip_var)), + ) + }; + + let expr = Expr::Closure(ClosureData { + function_type, + closure_type, + return_type: keep_or_skip_var, + name: step_field_closure, + captured_symbols: Vec::new(), + recursive: Recursive::NotRecursive, + arguments: vec![ + ( + state_record_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(state_arg_symbol)), + ), + ( + Variable::STR, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(field_arg_symbol)), + ), + ], + loc_body: Box::new(Loc::at_zero(body)), + }); + + (expr, function_type) +} + +// Example: +// finalizer = \rec -> +// when rec.first is +// Ok first -> +// when rec.second is +// Ok second -> Ok {first, second} +// Err NoField -> Err TooShort +// Err NoField -> Err TooShort +fn finalizer( + env: &mut Env, + state_record_var: Variable, + fields: &[Lowercase], + field_vars: &[Variable], + result_field_vars: &[Variable], +) -> (Expr, Variable, Variable) { + let state_arg_symbol = env.new_symbol("stateRecord"); + let mut fields_map = SendMap::default(); + let mut pattern_symbols = Vec::with_capacity(fields.len()); + let decode_err_var = { + let flat_type = FlatType::TagUnion( + UnionTags::tag_without_arguments(env.subs, "TooShort".into()), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + for (field_name, &field_var) in fields.iter().zip(field_vars.iter()) { + let symbol = env.new_symbol(field_name.as_str()); + + pattern_symbols.push(symbol); + + let field_expr = Expr::Var(symbol, field_var); + let field = Field { + var: field_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(field_expr)), + }; + + fields_map.insert(field_name.clone(), field); + } + + // The bottom of the happy path - return the decoded record {first: a, second: b} wrapped with + // "Ok". + let return_type_var; + let mut body = { + let subs = &mut env.subs; + let record_field_iter = fields + .iter() + .zip(field_vars.iter()) + .map(|(field_name, &field_var)| (field_name.clone(), RecordField::Required(field_var))); + let flat_type = FlatType::Record( + RecordFields::insert_into_subs(subs, record_field_iter), + Variable::EMPTY_RECORD, + ); + let done_record_var = synth_var(subs, Content::Structure(flat_type)); + let done_record = Expr::Record { + record_var: done_record_var, + fields: fields_map, + }; + + return_type_var = { + let flat_type = FlatType::TagUnion( + UnionTags::for_result(subs, done_record_var, decode_err_var), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(subs, Content::Structure(flat_type)) + }; + + Expr::Tag { + tag_union_var: return_type_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Ok".into(), + arguments: vec![(done_record_var, Loc::at_zero(done_record))], + } + }; + + // Unwrap each result in the decoded state + // + // when rec.first is + // Ok first -> ...happy path... + // Err NoField -> Err TooShort + for (((symbol, field_name), &field_var), &result_field_var) in pattern_symbols + .iter() + .rev() + .zip(fields.iter().rev()) + .zip(field_vars.iter().rev()) + .zip(result_field_vars.iter().rev()) + { + // when rec.first is + let cond_expr = Expr::RecordAccess { + record_var: state_record_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + field_var: result_field_var, + loc_expr: Box::new(Loc::at_zero(Expr::Var(state_arg_symbol, state_record_var))), + field: field_name.clone(), + }; + + // Example: `Ok x -> expr` + let ok_branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::AppliedTag { + whole_var: result_field_var, + ext_var: Variable::EMPTY_TAG_UNION, + tag_name: "Ok".into(), + arguments: vec![(field_var, Loc::at_zero(Pattern::Identifier(*symbol)))], + }), + degenerate: false, + }], + value: Loc::at_zero(body), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + // Example: `_ -> Err TooShort` + let err_branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::Underscore), + degenerate: false, + }], + value: Loc::at_zero(Expr::Tag { + tag_union_var: return_type_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Err".into(), + arguments: vec![( + decode_err_var, + Loc::at_zero(Expr::Tag { + tag_union_var: decode_err_var, + ext_var: Variable::EMPTY_TAG_UNION, + name: "TooShort".into(), + arguments: Vec::new(), + }), + )], + }), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + body = Expr::When { + loc_cond: Box::new(Loc::at_zero(cond_expr)), + cond_var: result_field_var, + expr_var: return_type_var, + region: Region::zero(), + branches: vec![ok_branch, err_branch], + branches_cond_var: result_field_var, + exhaustive: ExhaustiveMark::known_exhaustive(), + }; + } + + let function_var = synth_var(env.subs, Content::Error); // We'll fix this up in subs later. + let function_symbol = env.new_symbol("finalizer"); + let lambda_set = LambdaSet { + solved: UnionLambdas::tag_without_arguments(env.subs, function_symbol), + recursion_var: OptVariable::NONE, + unspecialized: Default::default(), + ambient_function: function_var, + }; + let closure_type = synth_var(env.subs, Content::LambdaSet(lambda_set)); + let flat_type = FlatType::Func( + SubsSlice::insert_into_subs(env.subs, [state_record_var]), + closure_type, + return_type_var, + ); + + // Fix up function_var so it's not Content::Error anymore + env.subs + .set_content(function_var, Content::Structure(flat_type)); + + let finalizer = Expr::Closure(ClosureData { + function_type: function_var, + closure_type, + return_type: return_type_var, + name: function_symbol, + captured_symbols: Vec::new(), + recursive: Recursive::NotRecursive, + arguments: vec![( + state_record_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(state_arg_symbol)), + )], + loc_body: Box::new(Loc::at_zero(body)), + }); + + (finalizer, function_var, decode_err_var) +} + +// Example: +// initialState : {first: Result a [NoField], second: Result b [NoField]} +// initialState = {first: Err NoField, second: Err NoField} +fn initial_state( + env: &mut Env<'_>, + field_names: &[Lowercase], + field_vars: &mut Vec<Variable>, + result_field_vars: &mut Vec<Variable>, +) -> (Variable, Expr) { + let mut initial_state_fields = SendMap::default(); + + for field_name in field_names { + let subs = &mut env.subs; + let field_var = subs.fresh_unnamed_flex_var(); + + field_vars.push(field_var); + + let no_field_label = "NoField"; + let union_tags = UnionTags::tag_without_arguments(subs, no_field_label.into()); + let no_field_var = synth_var( + subs, + Content::Structure(FlatType::TagUnion( + union_tags, + TagExt::Any(Variable::EMPTY_TAG_UNION), + )), + ); + let no_field = Expr::Tag { + tag_union_var: no_field_var, + ext_var: Variable::EMPTY_TAG_UNION, + name: no_field_label.into(), + arguments: Vec::new(), + }; + let err_label = "Err"; + let union_tags = UnionTags::for_result(subs, field_var, no_field_var); + let result_var = synth_var( + subs, + Content::Structure(FlatType::TagUnion( + union_tags, + TagExt::Any(Variable::EMPTY_TAG_UNION), + )), + ); + let field_expr = Expr::Tag { + tag_union_var: result_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: err_label.into(), + arguments: vec![(no_field_var, Loc::at_zero(no_field))], + }; + result_field_vars.push(result_var); + let field = Field { + var: result_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(field_expr)), + }; + + initial_state_fields.insert(field_name.clone(), field); + } + + let subs = &mut env.subs; + let record_field_iter = field_names + .iter() + .zip(result_field_vars.iter()) + .map(|(field_name, &var)| (field_name.clone(), RecordField::Required(var))); + let flat_type = FlatType::Record( + RecordFields::insert_into_subs(subs, record_field_iter), + Variable::EMPTY_RECORD, + ); + + let state_record_var = synth_var(subs, Content::Structure(flat_type)); + + ( + state_record_var, + Expr::Record { + record_var: state_record_var, + fields: initial_state_fields, + }, + ) +} diff --git /dev/null b/crates/compiler/derive/src/decoding/tuple.rs new file mode 100644 --- /dev/null +++ b/crates/compiler/derive/src/decoding/tuple.rs @@ -0,0 +1,994 @@ +use roc_can::expr::{ + AnnotatedMark, ClosureData, Expr, Field, IntValue, Recursive, WhenBranch, WhenBranchPattern, +}; +use roc_can::num::{IntBound, IntLitWidth}; +use roc_can::pattern::Pattern; +use roc_collections::SendMap; +use roc_module::called_via::CalledVia; +use roc_module::ident::Lowercase; +use roc_module::symbol::Symbol; +use roc_region::all::{Loc, Region}; +use roc_types::subs::{ + Content, ExhaustiveMark, FlatType, LambdaSet, OptVariable, RecordFields, RedundantMark, + SubsSlice, TagExt, TupleElems, UnionLambdas, UnionTags, Variable, +}; +use roc_types::types::RecordField; + +use crate::synth_var; +use crate::util::{Env, ExtensionKind}; + +use super::wrap_in_decode_custom_decode_with; + +/// Implements decoding of a tuple. For example, for +/// +/// ```text +/// (a, b) +/// ``` +/// +/// we'd like to generate an impl like +/// +/// ```roc +/// decoder : Decoder (a, b) fmt | a has Decoding, b has Decoding, fmt has DecoderFormatting +/// decoder = +/// initialState : {e0: Result a [NoElem], e1: Result b [NoElem]} +/// initialState = {e0: Err NoElem, e1: Err NoElem} +/// +/// stepElem = \state, index -> +/// when index is +/// 0 -> +/// Next (Decode.custom \bytes, fmt -> +/// when Decode.decodeWith bytes Decode.decoder fmt is +/// {result, rest} -> +/// {result: Result.map result \val -> {state & e0: Ok val}, rest}) +/// 1 -> +/// Next (Decode.custom \bytes, fmt -> +/// when Decode.decodeWith bytes Decode.decoder fmt is +/// {result, rest} -> +/// {result: Result.map result \val -> {state & e1: Ok val}, rest}) +/// _ -> TooLong +/// +/// finalizer = \st -> +/// when st.e0 is +/// Ok e0 -> +/// when st.e1 is +/// Ok e1 -> Ok (e0, e1) +/// Err NoElem -> Err TooShort +/// Err NoElem -> Err TooShort +/// +/// Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.tuple initialState stepElem finalizer) fmt +/// ``` +pub(crate) fn decoder(env: &mut Env, _def_symbol: Symbol, arity: u32) -> (Expr, Variable) { + // The decoded type of each index in the tuple, e.g. (a, b). + let mut index_vars = Vec::with_capacity(arity as _); + // The type of each index in the decoding state, e.g. {e0: Result a [NoElem], e1: Result b [NoElem]} + let mut state_fields = Vec::with_capacity(arity as _); + let mut state_field_vars = Vec::with_capacity(arity as _); + + // initialState = ... + let (state_var, initial_state) = initial_state( + env, + arity, + &mut index_vars, + &mut state_fields, + &mut state_field_vars, + ); + + // finalizer = ... + let (finalizer, finalizer_var, decode_err_var) = finalizer( + env, + &index_vars, + state_var, + &state_fields, + &state_field_vars, + ); + + // stepElem = ... + let (step_elem, step_var) = step_elem( + env, + &index_vars, + state_var, + &state_fields, + &state_field_vars, + decode_err_var, + ); + + // Build up the type of `Decode.tuple` we expect + let tuple_decoder_var = env.subs.fresh_unnamed_flex_var(); + let decode_record_lambda_set = env.subs.fresh_unnamed_flex_var(); + let decode_record_var = env.import_builtin_symbol_var(Symbol::DECODE_TUPLE); + let this_decode_record_var = { + let flat_type = FlatType::Func( + SubsSlice::insert_into_subs(env.subs, [state_var, step_var, finalizer_var]), + decode_record_lambda_set, + tuple_decoder_var, + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + env.unify(decode_record_var, this_decode_record_var); + + // Decode.tuple initialState stepElem finalizer + let call_decode_record = Expr::Call( + Box::new(( + this_decode_record_var, + Loc::at_zero(Expr::AbilityMember( + Symbol::DECODE_TUPLE, + None, + this_decode_record_var, + )), + decode_record_lambda_set, + tuple_decoder_var, + )), + vec![ + (state_var, Loc::at_zero(initial_state)), + (step_var, Loc::at_zero(step_elem)), + (finalizer_var, Loc::at_zero(finalizer)), + ], + CalledVia::Space, + ); + + let (call_decode_custom, decode_custom_ret_var) = { + let bytes_sym = env.new_symbol("bytes"); + let fmt_sym = env.new_symbol("fmt"); + let fmt_var = env.subs.fresh_unnamed_flex_var(); + + let (decode_custom, decode_custom_var) = wrap_in_decode_custom_decode_with( + env, + bytes_sym, + (fmt_sym, fmt_var), + vec![], + (call_decode_record, tuple_decoder_var), + ); + + (decode_custom, decode_custom_var) + }; + + (call_decode_custom, decode_custom_ret_var) +} + +// Example: +// stepElem = \state, index -> +// when index is +// 0 -> +// Next (Decode.custom \bytes, fmt -> +// # Uses a single-branch `when` because `let` is more expensive to monomorphize +// # due to checks for polymorphic expressions, and `rec` would be polymorphic. +// when Decode.decodeWith bytes Decode.decoder fmt is +// rec -> +// { +// rest: rec.rest, +// result: when rec.result is +// Ok val -> Ok {state & e0: Ok val}, +// Err err -> Err err +// }) +// +// "e1" -> +// Next (Decode.custom \bytes, fmt -> +// when Decode.decodeWith bytes Decode.decoder fmt is +// rec -> +// { +// rest: rec.rest, +// result: when rec.result is +// Ok val -> Ok {state & e1: Ok val}, +// Err err -> Err err +// }) +// +// _ -> TooLong +fn step_elem( + env: &mut Env, + index_vars: &[Variable], + state_record_var: Variable, + state_fields: &[Lowercase], + state_field_vars: &[Variable], + decode_err_var: Variable, +) -> (Expr, Variable) { + let state_arg_symbol = env.new_symbol("stateRecord"); + let index_arg_symbol = env.new_symbol("index"); + + // +1 because of the default branch. + let mut branches = Vec::with_capacity(index_vars.len() + 1); + let keep_payload_var = env.subs.fresh_unnamed_flex_var(); + let keep_or_skip_var = { + let keep_payload_subs_slice = SubsSlice::insert_into_subs(env.subs, [keep_payload_var]); + let flat_type = FlatType::TagUnion( + UnionTags::insert_slices_into_subs( + env.subs, + [ + ("Next".into(), keep_payload_subs_slice), + ("TooLong".into(), Default::default()), + ], + ), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + for (((index, state_field), &index_var), &result_index_var) in state_fields + .iter() + .enumerate() + .zip(index_vars) + .zip(state_field_vars) + { + // Example: + // 0 -> + // Next (Decode.custom \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + // } + // ) + + let this_custom_callback_var; + let custom_callback_ret_var; + let custom_callback = { + // \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + // } + let bytes_arg_symbol = env.new_symbol("bytes"); + let fmt_arg_symbol = env.new_symbol("fmt"); + let bytes_arg_var = env.subs.fresh_unnamed_flex_var(); + let fmt_arg_var = env.subs.fresh_unnamed_flex_var(); + + // rec.result : [Ok index_var, Err DecodeError] + let rec_dot_result = { + let tag_union = FlatType::TagUnion( + UnionTags::for_result(env.subs, index_var, decode_err_var), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(tag_union)) + }; + + // rec : { rest: List U8, result: (typeof rec.result) } + let rec_var = { + let indexs = RecordFields::insert_into_subs( + env.subs, + [ + ("rest".into(), RecordField::Required(Variable::LIST_U8)), + ("result".into(), RecordField::Required(rec_dot_result)), + ], + ); + let record = FlatType::Record(indexs, Variable::EMPTY_RECORD); + + synth_var(env.subs, Content::Structure(record)) + }; + + // `Decode.decoder` for the index's value + let decoder_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODER); + let decode_with_var = env.import_builtin_symbol_var(Symbol::DECODE_DECODE_WITH); + let lambda_set_var = env.subs.fresh_unnamed_flex_var(); + let this_decode_with_var = { + let subs_slice = SubsSlice::insert_into_subs( + env.subs, + [bytes_arg_var, decoder_var, fmt_arg_var], + ); + let this_decode_with_var = synth_var( + env.subs, + Content::Structure(FlatType::Func(subs_slice, lambda_set_var, rec_var)), + ); + + env.unify(decode_with_var, this_decode_with_var); + + this_decode_with_var + }; + + // The result of decoding this index's value - either the updated state, or a decoding error. + let when_expr_var = { + let flat_type = FlatType::TagUnion( + UnionTags::for_result(env.subs, state_record_var, decode_err_var), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + // What our decoder passed to `Decode.custom` returns - the result of decoding the + // index's value, and the remaining bytes. + custom_callback_ret_var = { + let rest_index = RecordField::Required(Variable::LIST_U8); + let result_index = RecordField::Required(when_expr_var); + let flat_type = FlatType::Record( + RecordFields::insert_into_subs( + env.subs, + [("rest".into(), rest_index), ("result".into(), result_index)], + ), + Variable::EMPTY_RECORD, + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + let custom_callback_body = { + let rec_symbol = env.new_symbol("rec"); + + // # Uses a single-branch `when` because `let` is more expensive to monomorphize + // # due to checks for polymorphic expressions, and `rec` would be polymorphic. + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + // } + let branch_body = { + let result_val = { + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + let ok_val_symbol = env.new_symbol("val"); + let err_val_symbol = env.new_symbol("err"); + let ok_branch_expr = { + // Ok {state & e0: Ok val}, + let mut updates = SendMap::default(); + + updates.insert( + state_field.clone(), + Field { + var: result_index_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(Expr::Tag { + tag_union_var: result_index_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Ok".into(), + arguments: vec![( + index_var, + Loc::at_zero(Expr::Var(ok_val_symbol, index_var)), + )], + })), + }, + ); + + let updated_record = Expr::RecordUpdate { + record_var: state_record_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + symbol: state_arg_symbol, + updates, + }; + + Expr::Tag { + tag_union_var: when_expr_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Ok".into(), + arguments: vec![(state_record_var, Loc::at_zero(updated_record))], + } + }; + + let branches = vec![ + // Ok val -> Ok {state & e0: Ok val}, + WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::AppliedTag { + whole_var: rec_dot_result, + ext_var: Variable::EMPTY_TAG_UNION, + tag_name: "Ok".into(), + arguments: vec![( + index_var, + Loc::at_zero(Pattern::Identifier(ok_val_symbol)), + )], + }), + degenerate: false, + }], + value: Loc::at_zero(ok_branch_expr), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }, + // Err err -> Err err + WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::AppliedTag { + whole_var: rec_dot_result, + ext_var: Variable::EMPTY_TAG_UNION, + tag_name: "Err".into(), + arguments: vec![( + decode_err_var, + Loc::at_zero(Pattern::Identifier(err_val_symbol)), + )], + }), + degenerate: false, + }], + value: Loc::at_zero(Expr::Tag { + tag_union_var: when_expr_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Err".into(), + arguments: vec![( + decode_err_var, + Loc::at_zero(Expr::Var(err_val_symbol, decode_err_var)), + )], + }), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }, + ]; + + // when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + Expr::When { + loc_cond: Box::new(Loc::at_zero(Expr::RecordAccess { + record_var: rec_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + field_var: rec_dot_result, + loc_expr: Box::new(Loc::at_zero(Expr::Var(rec_symbol, rec_var))), + field: "result".into(), + })), + cond_var: rec_dot_result, + expr_var: when_expr_var, + region: Region::zero(), + branches, + branches_cond_var: rec_dot_result, + exhaustive: ExhaustiveMark::known_exhaustive(), + } + }; + + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + // } + let mut fields_map = SendMap::default(); + + fields_map.insert( + "rest".into(), + Field { + var: Variable::LIST_U8, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(Expr::RecordAccess { + record_var: rec_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + field_var: Variable::LIST_U8, + loc_expr: Box::new(Loc::at_zero(Expr::Var(rec_symbol, rec_var))), + field: "rest".into(), + })), + }, + ); + + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + fields_map.insert( + "result".into(), + Field { + var: when_expr_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(result_val)), + }, + ); + + Expr::Record { + record_var: custom_callback_ret_var, + fields: fields_map, + } + }; + + let branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::Identifier(rec_symbol)), + degenerate: false, + }], + value: Loc::at_zero(branch_body), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + let condition_expr = Expr::Call( + Box::new(( + this_decode_with_var, + Loc::at_zero(Expr::Var(Symbol::DECODE_DECODE_WITH, this_decode_with_var)), + lambda_set_var, + rec_var, + )), + vec![ + ( + Variable::LIST_U8, + Loc::at_zero(Expr::Var(bytes_arg_symbol, Variable::LIST_U8)), + ), + ( + decoder_var, + Loc::at_zero(Expr::AbilityMember( + Symbol::DECODE_DECODER, + None, + decoder_var, + )), + ), + ( + fmt_arg_var, + Loc::at_zero(Expr::Var(fmt_arg_symbol, fmt_arg_var)), + ), + ], + CalledVia::Space, + ); + + // when Decode.decodeWith bytes Decode.decoder fmt is + Expr::When { + loc_cond: Box::new(Loc::at_zero(condition_expr)), + cond_var: rec_var, + expr_var: custom_callback_ret_var, + region: Region::zero(), + branches: vec![branch], + branches_cond_var: rec_var, + exhaustive: ExhaustiveMark::known_exhaustive(), + } + }; + + let custom_closure_symbol = env.new_symbol("customCallback"); + this_custom_callback_var = env.subs.fresh_unnamed_flex_var(); + let custom_callback_lambda_set_var = { + let content = Content::LambdaSet(LambdaSet { + solved: UnionLambdas::insert_into_subs( + env.subs, + [(custom_closure_symbol, [state_record_var])], + ), + recursion_var: OptVariable::NONE, + unspecialized: Default::default(), + ambient_function: this_custom_callback_var, + }); + let custom_callback_lambda_set_var = synth_var(env.subs, content); + let subs_slice = + SubsSlice::insert_into_subs(env.subs, [bytes_arg_var, fmt_arg_var]); + + env.subs.set_content( + this_custom_callback_var, + Content::Structure(FlatType::Func( + subs_slice, + custom_callback_lambda_set_var, + custom_callback_ret_var, + )), + ); + + custom_callback_lambda_set_var + }; + + // \bytes, fmt -> … + Expr::Closure(ClosureData { + function_type: this_custom_callback_var, + closure_type: custom_callback_lambda_set_var, + return_type: custom_callback_ret_var, + name: custom_closure_symbol, + captured_symbols: vec![(state_arg_symbol, state_record_var)], + recursive: Recursive::NotRecursive, + arguments: vec![ + ( + bytes_arg_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(bytes_arg_symbol)), + ), + ( + fmt_arg_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(fmt_arg_symbol)), + ), + ], + loc_body: Box::new(Loc::at_zero(custom_callback_body)), + }) + }; + + let decode_custom_ret_var = env.subs.fresh_unnamed_flex_var(); + let decode_custom = { + let decode_custom_var = env.import_builtin_symbol_var(Symbol::DECODE_CUSTOM); + let decode_custom_closure_var = env.subs.fresh_unnamed_flex_var(); + let this_decode_custom_var = { + let subs_slice = SubsSlice::insert_into_subs(env.subs, [this_custom_callback_var]); + let flat_type = + FlatType::Func(subs_slice, decode_custom_closure_var, decode_custom_ret_var); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + env.unify(decode_custom_var, this_decode_custom_var); + + // Decode.custom \bytes, fmt -> … + Expr::Call( + Box::new(( + this_decode_custom_var, + Loc::at_zero(Expr::Var(Symbol::DECODE_CUSTOM, this_decode_custom_var)), + decode_custom_closure_var, + decode_custom_ret_var, + )), + vec![(this_custom_callback_var, Loc::at_zero(custom_callback))], + CalledVia::Space, + ) + }; + + env.unify(keep_payload_var, decode_custom_ret_var); + + let keep = { + // Next (Decode.custom \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + // } + // ) + Expr::Tag { + tag_union_var: keep_or_skip_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Next".into(), + arguments: vec![(decode_custom_ret_var, Loc::at_zero(decode_custom))], + } + }; + + let branch = { + // 0 -> + // Next (Decode.custom \bytes, fmt -> + // when Decode.decodeWith bytes Decode.decoder fmt is + // rec -> + // { + // rest: rec.rest, + // result: when rec.result is + // Ok val -> Ok {state & e0: Ok val}, + // Err err -> Err err + // } + // ) + WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::IntLiteral( + Variable::NAT, + Variable::NATURAL, + index.to_string().into_boxed_str(), + IntValue::I128((index as i128).to_ne_bytes()), + IntBound::Exact(IntLitWidth::Nat), + )), + degenerate: false, + }], + value: Loc::at_zero(keep), + guard: None, + redundant: RedundantMark::known_non_redundant(), + } + }; + + branches.push(branch); + } + + // Example: `_ -> TooLong` + let default_branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::Underscore), + degenerate: false, + }], + value: Loc::at_zero(Expr::Tag { + tag_union_var: keep_or_skip_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "TooLong".into(), + arguments: Vec::new(), + }), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + branches.push(default_branch); + + // when index is + let body = Expr::When { + loc_cond: Box::new(Loc::at_zero(Expr::Var(index_arg_symbol, Variable::NAT))), + cond_var: Variable::NAT, + expr_var: keep_or_skip_var, + region: Region::zero(), + branches, + branches_cond_var: Variable::NAT, + exhaustive: ExhaustiveMark::known_exhaustive(), + }; + + let step_elem_closure = env.new_symbol("stepElem"); + let function_type = env.subs.fresh_unnamed_flex_var(); + let closure_type = { + let lambda_set = LambdaSet { + solved: UnionLambdas::tag_without_arguments(env.subs, step_elem_closure), + recursion_var: OptVariable::NONE, + unspecialized: Default::default(), + ambient_function: function_type, + }; + + synth_var(env.subs, Content::LambdaSet(lambda_set)) + }; + + { + let args_slice = SubsSlice::insert_into_subs(env.subs, [state_record_var, Variable::NAT]); + + env.subs.set_content( + function_type, + Content::Structure(FlatType::Func(args_slice, closure_type, keep_or_skip_var)), + ) + }; + + let expr = Expr::Closure(ClosureData { + function_type, + closure_type, + return_type: keep_or_skip_var, + name: step_elem_closure, + captured_symbols: Vec::new(), + recursive: Recursive::NotRecursive, + arguments: vec![ + ( + state_record_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(state_arg_symbol)), + ), + ( + Variable::NAT, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(index_arg_symbol)), + ), + ], + loc_body: Box::new(Loc::at_zero(body)), + }); + + (expr, function_type) +} + +// Example: +// finalizer = \rec -> +// when rec.e0 is +// Ok e0 -> +// when rec.e1 is +// Ok e1 -> Ok (e0, e1) +// Err NoElem -> Err TooShort +// Err NoElem -> Err TooShort +fn finalizer( + env: &mut Env, + index_vars: &[Variable], + state_record_var: Variable, + state_fields: &[Lowercase], + state_field_vars: &[Variable], +) -> (Expr, Variable, Variable) { + let state_arg_symbol = env.new_symbol("stateRecord"); + let mut tuple_elems = Vec::with_capacity(index_vars.len()); + let mut pattern_symbols = Vec::with_capacity(index_vars.len()); + let decode_err_var = { + let flat_type = FlatType::TagUnion( + UnionTags::tag_without_arguments(env.subs, "TooShort".into()), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(env.subs, Content::Structure(flat_type)) + }; + + for (i, &index_var) in index_vars.iter().enumerate() { + let symbol = env.new_symbol(i); + + pattern_symbols.push(symbol); + + let index_expr = Expr::Var(symbol, index_var); + + tuple_elems.push((index_var, Box::new(Loc::at_zero(index_expr)))); + } + + // The bottom of the happy path - return the decoded tuple (a, b) wrapped with + // "Ok". + let return_type_var; + let mut body = { + let subs = &mut env.subs; + let tuple_indices_iter = index_vars.iter().copied().enumerate(); + let flat_type = FlatType::Tuple( + TupleElems::insert_into_subs(subs, tuple_indices_iter), + Variable::EMPTY_TUPLE, + ); + let done_tuple_var = synth_var(subs, Content::Structure(flat_type)); + let done_record = Expr::Tuple { + tuple_var: done_tuple_var, + elems: tuple_elems, + }; + + return_type_var = { + let flat_type = FlatType::TagUnion( + UnionTags::for_result(subs, done_tuple_var, decode_err_var), + TagExt::Any(Variable::EMPTY_TAG_UNION), + ); + + synth_var(subs, Content::Structure(flat_type)) + }; + + Expr::Tag { + tag_union_var: return_type_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Ok".into(), + arguments: vec![(done_tuple_var, Loc::at_zero(done_record))], + } + }; + + // Unwrap each result in the decoded state + // + // when rec.e0 is + // Ok e0 -> ...happy path... + // Err NoElem -> Err TooShort + for (((symbol, field), &index_var), &result_index_var) in pattern_symbols + .iter() + .zip(state_fields) + .zip(index_vars) + .zip(state_field_vars) + .rev() + { + // when rec.e0 is + let cond_expr = Expr::RecordAccess { + record_var: state_record_var, + ext_var: env.new_ext_var(ExtensionKind::Record), + field_var: result_index_var, + loc_expr: Box::new(Loc::at_zero(Expr::Var(state_arg_symbol, state_record_var))), + field: field.clone(), + }; + + // Example: `Ok x -> expr` + let ok_branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::AppliedTag { + whole_var: result_index_var, + ext_var: Variable::EMPTY_TAG_UNION, + tag_name: "Ok".into(), + arguments: vec![(index_var, Loc::at_zero(Pattern::Identifier(*symbol)))], + }), + degenerate: false, + }], + value: Loc::at_zero(body), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + // Example: `_ -> Err TooShort` + let err_branch = WhenBranch { + patterns: vec![WhenBranchPattern { + pattern: Loc::at_zero(Pattern::Underscore), + degenerate: false, + }], + value: Loc::at_zero(Expr::Tag { + tag_union_var: return_type_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: "Err".into(), + arguments: vec![( + decode_err_var, + Loc::at_zero(Expr::Tag { + tag_union_var: decode_err_var, + ext_var: Variable::EMPTY_TAG_UNION, + name: "TooShort".into(), + arguments: Vec::new(), + }), + )], + }), + guard: None, + redundant: RedundantMark::known_non_redundant(), + }; + + body = Expr::When { + loc_cond: Box::new(Loc::at_zero(cond_expr)), + cond_var: result_index_var, + expr_var: return_type_var, + region: Region::zero(), + branches: vec![ok_branch, err_branch], + branches_cond_var: result_index_var, + exhaustive: ExhaustiveMark::known_exhaustive(), + }; + } + + let function_var = synth_var(env.subs, Content::Error); // We'll fix this up in subs later. + let function_symbol = env.new_symbol("finalizer"); + let lambda_set = LambdaSet { + solved: UnionLambdas::tag_without_arguments(env.subs, function_symbol), + recursion_var: OptVariable::NONE, + unspecialized: Default::default(), + ambient_function: function_var, + }; + let closure_type = synth_var(env.subs, Content::LambdaSet(lambda_set)); + let flat_type = FlatType::Func( + SubsSlice::insert_into_subs(env.subs, [state_record_var]), + closure_type, + return_type_var, + ); + + // Fix up function_var so it's not Content::Error anymore + env.subs + .set_content(function_var, Content::Structure(flat_type)); + + let finalizer = Expr::Closure(ClosureData { + function_type: function_var, + closure_type, + return_type: return_type_var, + name: function_symbol, + captured_symbols: Vec::new(), + recursive: Recursive::NotRecursive, + arguments: vec![( + state_record_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(state_arg_symbol)), + )], + loc_body: Box::new(Loc::at_zero(body)), + }); + + (finalizer, function_var, decode_err_var) +} + +// Example: +// initialState : {e0: Result a [NoElem], e1: Result b [NoElem]} +// initialState = {e0: Err NoElem, e1: Err NoElem} +fn initial_state( + env: &mut Env<'_>, + arity: u32, + index_vars: &mut Vec<Variable>, + state_fields: &mut Vec<Lowercase>, + state_field_vars: &mut Vec<Variable>, +) -> (Variable, Expr) { + let mut initial_state_fields = SendMap::default(); + + for i in 0..arity { + let subs = &mut env.subs; + let index_var = subs.fresh_unnamed_flex_var(); + + index_vars.push(index_var); + + let state_field = Lowercase::from(format!("e{i}")); + state_fields.push(state_field.clone()); + + let no_index_label = "NoElem"; + let union_tags = UnionTags::tag_without_arguments(subs, no_index_label.into()); + let no_index_var = synth_var( + subs, + Content::Structure(FlatType::TagUnion( + union_tags, + TagExt::Any(Variable::EMPTY_TAG_UNION), + )), + ); + let no_index = Expr::Tag { + tag_union_var: no_index_var, + ext_var: Variable::EMPTY_TAG_UNION, + name: no_index_label.into(), + arguments: Vec::new(), + }; + let err_label = "Err"; + let union_tags = UnionTags::for_result(subs, index_var, no_index_var); + let result_var = synth_var( + subs, + Content::Structure(FlatType::TagUnion( + union_tags, + TagExt::Any(Variable::EMPTY_TAG_UNION), + )), + ); + let index_expr = Expr::Tag { + tag_union_var: result_var, + ext_var: env.new_ext_var(ExtensionKind::TagUnion), + name: err_label.into(), + arguments: vec![(no_index_var, Loc::at_zero(no_index))], + }; + state_field_vars.push(result_var); + let index = Field { + var: result_var, + region: Region::zero(), + loc_expr: Box::new(Loc::at_zero(index_expr)), + }; + + initial_state_fields.insert(state_field, index); + } + + let subs = &mut env.subs; + let record_index_iter = state_fields + .iter() + .zip(state_field_vars.iter()) + .map(|(index_name, &var)| (index_name.clone(), RecordField::Required(var))); + let flat_type = FlatType::Record( + RecordFields::insert_into_subs(subs, record_index_iter), + Variable::EMPTY_RECORD, + ); + + let state_record_var = synth_var(subs, Content::Structure(flat_type)); + + ( + state_record_var, + Expr::Record { + record_var: state_record_var, + fields: initial_state_fields, + }, + ) +} diff --git a/crates/compiler/derive/src/encoding.rs b/crates/compiler/derive/src/encoding.rs --- a/crates/compiler/derive/src/encoding.rs +++ b/crates/compiler/derive/src/encoding.rs @@ -14,7 +14,8 @@ use roc_module::symbol::Symbol; use roc_region::all::{Loc, Region}; use roc_types::subs::{ Content, ExhaustiveMark, FlatType, GetSubsSlice, LambdaSet, OptVariable, RecordFields, - RedundantMark, SubsSlice, TagExt, UnionLambdas, UnionTags, Variable, VariableSubsSlice, + RedundantMark, SubsSlice, TagExt, TupleElems, UnionLambdas, UnionTags, Variable, + VariableSubsSlice, }; use roc_types::types::RecordField; diff --git a/crates/compiler/derive/src/encoding.rs b/crates/compiler/derive/src/encoding.rs --- a/crates/compiler/derive/src/encoding.rs +++ b/crates/compiler/derive/src/encoding.rs @@ -50,6 +51,21 @@ pub(crate) fn derive_to_encoder( to_encoder_record(env, record_var, fields, def_symbol) } + FlatEncodableKey::Tuple(arity) => { + // Generalized tuple var so we can reuse this impl between many tuples: + // if arity = n, this is (t1, ..., tn) for fresh t1, ..., tn. + let flex_elems = (0..arity) + .into_iter() + .map(|idx| (idx as usize, env.subs.fresh_unnamed_flex_var())) + .collect::<Vec<_>>(); + let elems = TupleElems::insert_into_subs(env.subs, flex_elems); + let tuple_var = synth_var( + env.subs, + Content::Structure(FlatType::Tuple(elems, Variable::EMPTY_TUPLE)), + ); + + to_encoder_tuple(env, tuple_var, elems, def_symbol) + } FlatEncodableKey::TagUnion(tags) => { // Generalized tag union var so we can reuse this impl between many unions: // if tags = [ A arity=2, B arity=1 ], this is [ A t1 t2, B t3 ] for fresh t1, t2, t3 diff --git a/crates/compiler/derive/src/encoding.rs b/crates/compiler/derive/src/encoding.rs --- a/crates/compiler/derive/src/encoding.rs +++ b/crates/compiler/derive/src/encoding.rs @@ -490,6 +506,189 @@ fn to_encoder_record( (clos, fn_var) } +fn to_encoder_tuple( + env: &mut Env<'_>, + tuple_var: Variable, + elems: TupleElems, + fn_name: Symbol, +) -> (Expr, Variable) { + // Suppose tup = (t1, t2). Build + // + // \tup -> Encode.tuple [ + // Encode.toEncoder tup.0, + // Encode.toEncoder tup.1, + // ] + + let tup_sym = env.new_symbol("tup"); + let whole_encoder_in_list_var = env.subs.fresh_unnamed_flex_var(); // type of the encoder in the list + + use Expr::*; + + let elem_encoders_list = elems + .iter_all() + .map(|(elem_index, elem_var_index)| { + let index = env.subs[elem_index]; + let elem_var = env.subs[elem_var_index]; + let elem_var_slice = VariableSubsSlice::new(elem_var_index.index, 1); + + // tup.0 + let tuple_access = TupleAccess { + tuple_var, + ext_var: env.subs.fresh_unnamed_flex_var(), + elem_var, + loc_expr: Box::new(Loc::at_zero(Var( + tup_sym, + env.subs.fresh_unnamed_flex_var(), + ))), + index, + }; + + // build `toEncoder tup.0` type + // val -[uls]-> Encoder fmt | fmt has EncoderFormatting + let to_encoder_fn_var = env.import_builtin_symbol_var(Symbol::ENCODE_TO_ENCODER); + + // (typeof tup.0) -[clos]-> t1 + let to_encoder_clos_var = env.subs.fresh_unnamed_flex_var(); // clos + let encoder_var = env.subs.fresh_unnamed_flex_var(); // t1 + let this_to_encoder_fn_var = synth_var( + env.subs, + Content::Structure(FlatType::Func( + elem_var_slice, + to_encoder_clos_var, + encoder_var, + )), + ); + + // val -[uls]-> Encoder fmt | fmt has EncoderFormatting + // ~ (typeof tup.0) -[clos]-> t1 + env.unify(to_encoder_fn_var, this_to_encoder_fn_var); + + // toEncoder : (typeof tup.0) -[clos]-> Encoder fmt | fmt has EncoderFormatting + let to_encoder_var = AbilityMember(Symbol::ENCODE_TO_ENCODER, None, to_encoder_fn_var); + let to_encoder_fn = Box::new(( + to_encoder_fn_var, + Loc::at_zero(to_encoder_var), + to_encoder_clos_var, + encoder_var, + )); + + // toEncoder tup.0 + let to_encoder_call = Call( + to_encoder_fn, + vec![(elem_var, Loc::at_zero(tuple_access))], + CalledVia::Space, + ); + + // NOTE: must be done to unify the lambda sets under `encoder_var` + env.unify(encoder_var, whole_encoder_in_list_var); + + Loc::at_zero(to_encoder_call) + }) + .collect::<Vec<_>>(); + + // typeof [ toEncoder tup.0, toEncoder tup.1 ] + let whole_encoder_in_list_var_slice = + VariableSubsSlice::insert_into_subs(env.subs, once(whole_encoder_in_list_var)); + let elem_encoders_list_var = synth_var( + env.subs, + Content::Structure(FlatType::Apply( + Symbol::LIST_LIST, + whole_encoder_in_list_var_slice, + )), + ); + + // [ toEncoder tup.0, toEncoder tup.1 ] + let elem_encoders_list = List { + elem_var: whole_encoder_in_list_var, + loc_elems: elem_encoders_list, + }; + + // build `Encode.tuple [ toEncoder tup.0, toEncoder tup.1 ]` type + // List (Encoder fmt) -[uls]-> Encoder fmt | fmt has EncoderFormatting + let encode_tuple_fn_var = env.import_builtin_symbol_var(Symbol::ENCODE_TUPLE); + + // elem_encoders_list_var -[clos]-> t1 + let elem_encoders_list_var_slice = + VariableSubsSlice::insert_into_subs(env.subs, once(elem_encoders_list_var)); + let encode_tuple_clos_var = env.subs.fresh_unnamed_flex_var(); // clos + let encoder_var = env.subs.fresh_unnamed_flex_var(); // t1 + let this_encode_tuple_fn_var = synth_var( + env.subs, + Content::Structure(FlatType::Func( + elem_encoders_list_var_slice, + encode_tuple_clos_var, + encoder_var, + )), + ); + + // List (Encoder fmt) -[uls]-> Encoder fmt | fmt has EncoderFormatting + // ~ elem_encoders_list_var -[clos]-> t1 + env.unify(encode_tuple_fn_var, this_encode_tuple_fn_var); + + // Encode.tuple : elem_encoders_list_var -[clos]-> Encoder fmt | fmt has EncoderFormatting + let encode_tuple_var = AbilityMember(Symbol::ENCODE_TUPLE, None, encode_tuple_fn_var); + let encode_tuple_fn = Box::new(( + encode_tuple_fn_var, + Loc::at_zero(encode_tuple_var), + encode_tuple_clos_var, + encoder_var, + )); + + // Encode.tuple [ { key: .., value: .. }, .. ] + let encode_tuple_call = Call( + encode_tuple_fn, + vec![(elem_encoders_list_var, Loc::at_zero(elem_encoders_list))], + CalledVia::Space, + ); + + // Encode.custom \bytes, fmt -> Encode.appendWith bytes (Encode.tuple_var ..) fmt + let (body, this_encoder_var) = + wrap_in_encode_custom(env, encode_tuple_call, encoder_var, tup_sym, tuple_var); + + // Create fn_var for ambient capture; we fix it up below. + let fn_var = synth_var(env.subs, Content::Error); + + // -[fn_name]-> + let fn_name_labels = UnionLambdas::insert_into_subs(env.subs, once((fn_name, vec![]))); + let fn_clos_var = synth_var( + env.subs, + Content::LambdaSet(LambdaSet { + solved: fn_name_labels, + recursion_var: OptVariable::NONE, + unspecialized: SubsSlice::default(), + ambient_function: fn_var, + }), + ); + // typeof tup -[fn_name]-> (typeof Encode.tuple [ .. ] = Encoder fmt) + let tuple_var_slice = SubsSlice::insert_into_subs(env.subs, once(tuple_var)); + env.subs.set_content( + fn_var, + Content::Structure(FlatType::Func( + tuple_var_slice, + fn_clos_var, + this_encoder_var, + )), + ); + + // \tup -[fn_name]-> Encode.tuple [ { key: .., value: .. }, .. ] + let clos = Closure(ClosureData { + function_type: fn_var, + closure_type: fn_clos_var, + return_type: this_encoder_var, + name: fn_name, + captured_symbols: vec![], + recursive: Recursive::NotRecursive, + arguments: vec![( + tuple_var, + AnnotatedMark::known_exhaustive(), + Loc::at_zero(Pattern::Identifier(tup_sym)), + )], + loc_body: Box::new(Loc::at_zero(body)), + }); + + (clos, fn_var) +} + fn to_encoder_tag_union( env: &mut Env<'_>, tag_union_var: Variable, diff --git a/crates/compiler/derive/src/hash.rs b/crates/compiler/derive/src/hash.rs --- a/crates/compiler/derive/src/hash.rs +++ b/crates/compiler/derive/src/hash.rs @@ -19,8 +19,8 @@ use roc_types::{ num::int_lit_width_to_variable, subs::{ Content, ExhaustiveMark, FlatType, GetSubsSlice, LambdaSet, OptVariable, RecordFields, - RedundantMark, Subs, SubsIndex, SubsSlice, TagExt, UnionLambdas, UnionTags, Variable, - VariableSubsSlice, + RedundantMark, Subs, SubsIndex, SubsSlice, TagExt, TupleElems, UnionLambdas, UnionTags, + Variable, VariableSubsSlice, }, types::RecordField, }; diff --git a/crates/compiler/derive/src/hash.rs b/crates/compiler/derive/src/hash.rs --- a/crates/compiler/derive/src/hash.rs +++ b/crates/compiler/derive/src/hash.rs @@ -30,6 +30,7 @@ use crate::{synth_var, util::Env, DerivedBody}; pub(crate) fn derive_hash(env: &mut Env<'_>, key: FlatHashKey, def_symbol: Symbol) -> DerivedBody { let (body_type, body) = match key { FlatHashKey::Record(fields) => hash_record(env, def_symbol, fields), + FlatHashKey::Tuple(arity) => hash_tuple(env, def_symbol, arity), FlatHashKey::TagUnion(tags) => { if tags.len() == 1 { hash_newtype_tag_union(env, def_symbol, tags.into_iter().next().unwrap()) diff --git a/crates/compiler/derive/src/hash.rs b/crates/compiler/derive/src/hash.rs --- a/crates/compiler/derive/src/hash.rs +++ b/crates/compiler/derive/src/hash.rs @@ -122,6 +123,76 @@ fn hash_record(env: &mut Env<'_>, fn_name: Symbol, fields: Vec<Lowercase>) -> (V ) } +fn hash_tuple(env: &mut Env<'_>, fn_name: Symbol, arity: u32) -> (Variable, Expr) { + // Suppose tup = (v1, ..., vn). + // Build a generalized type t_tup = (t1, ..., tn), with fresh t1, ..., tn, + // so that we can re-use the derived impl for many tuples of the same arity. + let (tuple_var, tuple_elems) = { + // TODO: avoid an allocation here by pre-allocating the indices and variables `TupleElems` + // will be instantiated with. + let flex_elems: Vec<_> = (0..arity) + .into_iter() + .map(|i| (i as usize, env.subs.fresh_unnamed_flex_var())) + .collect(); + let elems = TupleElems::insert_into_subs(env.subs, flex_elems); + let tuple_var = synth_var( + env.subs, + Content::Structure(FlatType::Tuple(elems, Variable::EMPTY_TUPLE)), + ); + + (tuple_var, elems) + }; + + // Now, a hasher for this tuple is + // + // hash_tup : hasher, (t1, ..., tn) -> hasher | hasher has Hasher + // hash_tup = \hasher, tup -> + // Hash.hash ( + // Hash.hash + // ... + // (Hash.hash hasher tup.0) + // ... + // tup.n1) + // tup.n + // + // So, just a build a fold travelling up the elements. + let tup_sym = env.new_symbol("tup"); + + let hasher_sym = env.new_symbol("hasher"); + let hasher_var = synth_var(env.subs, Content::FlexAbleVar(None, Subs::AB_HASHER)); + + let (body_var, body) = tuple_elems.iter_all().fold( + (hasher_var, Expr::Var(hasher_sym, hasher_var)), + |total_hasher, (elem_idx, elem_var)| { + let index = env.subs[elem_idx]; + let elem_var = env.subs[elem_var]; + + let elem_access = Expr::TupleAccess { + tuple_var, + elem_var, + ext_var: env.subs.fresh_unnamed_flex_var(), + loc_expr: Box::new(Loc::at_zero(Expr::Var( + tup_sym, + env.subs.fresh_unnamed_flex_var(), + ))), + index, + }; + + call_hash_hash(env, total_hasher, (elem_var, elem_access)) + }, + ); + + // Finally, build the closure + // \hasher, rcd -> body + build_outer_derived_closure( + env, + fn_name, + (hasher_var, hasher_sym), + (tuple_var, Pattern::Identifier(tup_sym)), + (body_var, body), + ) +} + /// Build a `hash` implementation for a non-singleton tag union. fn hash_tag_union( env: &mut Env<'_>, diff --git a/crates/compiler/derive_key/src/decoding.rs b/crates/compiler/derive_key/src/decoding.rs --- a/crates/compiler/derive_key/src/decoding.rs +++ b/crates/compiler/derive_key/src/decoding.rs @@ -2,7 +2,7 @@ use roc_module::{ident::Lowercase, symbol::Symbol}; use roc_types::subs::{Content, FlatType, Subs, Variable}; use crate::{ - util::{check_derivable_ext_var, debug_name_record}, + util::{check_derivable_ext_var, debug_name_record, debug_name_tuple}, DeriveError, }; diff --git a/crates/compiler/derive_key/src/decoding.rs b/crates/compiler/derive_key/src/decoding.rs --- a/crates/compiler/derive_key/src/decoding.rs +++ b/crates/compiler/derive_key/src/decoding.rs @@ -18,6 +18,7 @@ pub enum FlatDecodableKey { // Unfortunate that we must allocate here, c'est la vie Record(Vec<Lowercase>), + Tuple(u32), } impl FlatDecodableKey { diff --git a/crates/compiler/derive_key/src/decoding.rs b/crates/compiler/derive_key/src/decoding.rs --- a/crates/compiler/derive_key/src/decoding.rs +++ b/crates/compiler/derive_key/src/decoding.rs @@ -25,6 +26,7 @@ impl FlatDecodableKey { match self { FlatDecodableKey::List() => "list".to_string(), FlatDecodableKey::Record(fields) => debug_name_record(fields), + FlatDecodableKey::Tuple(arity) => debug_name_tuple(*arity), } } } diff --git a/crates/compiler/derive_key/src/decoding.rs b/crates/compiler/derive_key/src/decoding.rs --- a/crates/compiler/derive_key/src/decoding.rs +++ b/crates/compiler/derive_key/src/decoding.rs @@ -61,8 +63,14 @@ impl FlatDecodable { Ok(Key(FlatDecodableKey::Record(field_names))) } - FlatType::Tuple(_elems, _ext) => { - todo!() + FlatType::Tuple(elems, ext) => { + let (elems_iter, ext) = elems.sorted_iterator_and_ext(subs, ext); + + check_derivable_ext_var(subs, ext, |ext| { + matches!(ext, Content::Structure(FlatType::EmptyTuple)) + })?; + + Ok(Key(FlatDecodableKey::Tuple(elems_iter.count() as _))) } FlatType::TagUnion(_tags, _ext) | FlatType::RecursiveTagUnion(_, _tags, _ext) => { Err(Underivable) // yet diff --git a/crates/compiler/derive_key/src/encoding.rs b/crates/compiler/derive_key/src/encoding.rs --- a/crates/compiler/derive_key/src/encoding.rs +++ b/crates/compiler/derive_key/src/encoding.rs @@ -5,7 +5,7 @@ use roc_module::{ use roc_types::subs::{Content, FlatType, GetSubsSlice, Subs, Variable}; use crate::{ - util::{check_derivable_ext_var, debug_name_record, debug_name_tag}, + util::{check_derivable_ext_var, debug_name_record, debug_name_tag, debug_name_tuple}, DeriveError, }; diff --git a/crates/compiler/derive_key/src/encoding.rs b/crates/compiler/derive_key/src/encoding.rs --- a/crates/compiler/derive_key/src/encoding.rs +++ b/crates/compiler/derive_key/src/encoding.rs @@ -22,6 +22,7 @@ pub enum FlatEncodableKey { Dict(/* takes two variables */), // Unfortunate that we must allocate here, c'est la vie Record(Vec<Lowercase>), + Tuple(u32), TagUnion(Vec<(TagName, u16)>), } diff --git a/crates/compiler/derive_key/src/encoding.rs b/crates/compiler/derive_key/src/encoding.rs --- a/crates/compiler/derive_key/src/encoding.rs +++ b/crates/compiler/derive_key/src/encoding.rs @@ -32,6 +33,7 @@ impl FlatEncodableKey { FlatEncodableKey::Set() => "set".to_string(), FlatEncodableKey::Dict() => "dict".to_string(), FlatEncodableKey::Record(fields) => debug_name_record(fields), + FlatEncodableKey::Tuple(arity) => debug_name_tuple(*arity), FlatEncodableKey::TagUnion(tags) => debug_name_tag(tags), } } diff --git a/crates/compiler/derive_key/src/encoding.rs b/crates/compiler/derive_key/src/encoding.rs --- a/crates/compiler/derive_key/src/encoding.rs +++ b/crates/compiler/derive_key/src/encoding.rs @@ -66,8 +68,14 @@ impl FlatEncodable { Ok(Key(FlatEncodableKey::Record(field_names))) } - FlatType::Tuple(_elems, _ext) => { - todo!() + FlatType::Tuple(elems, ext) => { + let (elems_iter, ext) = elems.sorted_iterator_and_ext(subs, ext); + + check_derivable_ext_var(subs, ext, |ext| { + matches!(ext, Content::Structure(FlatType::EmptyTuple)) + })?; + + Ok(Key(FlatEncodableKey::Tuple(elems_iter.count() as _))) } FlatType::TagUnion(tags, ext) | FlatType::RecursiveTagUnion(_, tags, ext) => { // The recursion var doesn't matter, because the derived implementation will only diff --git a/crates/compiler/derive_key/src/hash.rs b/crates/compiler/derive_key/src/hash.rs --- a/crates/compiler/derive_key/src/hash.rs +++ b/crates/compiler/derive_key/src/hash.rs @@ -5,7 +5,7 @@ use roc_module::{ use roc_types::subs::{Content, FlatType, GetSubsSlice, Subs, Variable}; use crate::{ - util::{check_derivable_ext_var, debug_name_record, debug_name_tag}, + util::{check_derivable_ext_var, debug_name_record, debug_name_tag, debug_name_tuple}, DeriveError, }; diff --git a/crates/compiler/derive_key/src/hash.rs b/crates/compiler/derive_key/src/hash.rs --- a/crates/compiler/derive_key/src/hash.rs +++ b/crates/compiler/derive_key/src/hash.rs @@ -21,6 +21,7 @@ pub enum FlatHash { pub enum FlatHashKey { // Unfortunate that we must allocate here, c'est la vie Record(Vec<Lowercase>), + Tuple(u32), TagUnion(Vec<(TagName, u16)>), } diff --git a/crates/compiler/derive_key/src/hash.rs b/crates/compiler/derive_key/src/hash.rs --- a/crates/compiler/derive_key/src/hash.rs +++ b/crates/compiler/derive_key/src/hash.rs @@ -28,6 +29,7 @@ impl FlatHashKey { pub(crate) fn debug_name(&self) -> String { match self { FlatHashKey::Record(fields) => debug_name_record(fields), + FlatHashKey::Tuple(arity) => debug_name_tuple(*arity), FlatHashKey::TagUnion(tags) => debug_name_tag(tags), } } diff --git a/crates/compiler/derive_key/src/hash.rs b/crates/compiler/derive_key/src/hash.rs --- a/crates/compiler/derive_key/src/hash.rs +++ b/crates/compiler/derive_key/src/hash.rs @@ -65,8 +67,14 @@ impl FlatHash { Ok(Key(FlatHashKey::Record(field_names))) } - FlatType::Tuple(_elems, _ext) => { - todo!(); + FlatType::Tuple(elems, ext) => { + let (elems_iter, ext) = elems.sorted_iterator_and_ext(subs, ext); + + check_derivable_ext_var(subs, ext, |ext| { + matches!(ext, Content::Structure(FlatType::EmptyTuple)) + })?; + + Ok(Key(FlatHashKey::Tuple(elems_iter.count() as _))) } FlatType::TagUnion(tags, ext) | FlatType::RecursiveTagUnion(_, tags, ext) => { // The recursion var doesn't matter, because the derived implementation will only diff --git a/crates/compiler/derive_key/src/util.rs b/crates/compiler/derive_key/src/util.rs --- a/crates/compiler/derive_key/src/util.rs +++ b/crates/compiler/derive_key/src/util.rs @@ -43,6 +43,10 @@ pub(crate) fn debug_name_record(fields: &[Lowercase]) -> String { str } +pub(crate) fn debug_name_tuple(arity: u32) -> String { + format!("(arity:{arity})") +} + pub(crate) fn debug_name_tag(tags: &[(TagName, u16)]) -> String { let mut str = String::from('['); tags.iter().enumerate().for_each(|(i, (tag, arity))| { diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1500,11 +1500,12 @@ define_builtins! { 18 ENCODE_STRING: "string" 19 ENCODE_LIST: "list" 20 ENCODE_RECORD: "record" - 21 ENCODE_TAG: "tag" - 22 ENCODE_CUSTOM: "custom" - 23 ENCODE_APPEND_WITH: "appendWith" - 24 ENCODE_APPEND: "append" - 25 ENCODE_TO_BYTES: "toBytes" + 21 ENCODE_TUPLE: "tuple" + 22 ENCODE_TAG: "tag" + 23 ENCODE_CUSTOM: "custom" + 24 ENCODE_APPEND_WITH: "appendWith" + 25 ENCODE_APPEND: "append" + 26 ENCODE_TO_BYTES: "toBytes" } 12 DECODE: "Decode" => { 0 DECODE_DECODE_ERROR: "DecodeError" exposed_type=true diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1530,11 +1531,12 @@ define_builtins! { 20 DECODE_STRING: "string" 21 DECODE_LIST: "list" 22 DECODE_RECORD: "record" - 23 DECODE_CUSTOM: "custom" - 24 DECODE_DECODE_WITH: "decodeWith" - 25 DECODE_FROM_BYTES_PARTIAL: "fromBytesPartial" - 26 DECODE_FROM_BYTES: "fromBytes" - 27 DECODE_MAP_RESULT: "mapResult" + 23 DECODE_TUPLE: "tuple" + 24 DECODE_CUSTOM: "custom" + 25 DECODE_DECODE_WITH: "decodeWith" + 26 DECODE_FROM_BYTES_PARTIAL: "fromBytesPartial" + 27 DECODE_FROM_BYTES: "fromBytes" + 28 DECODE_MAP_RESULT: "mapResult" } 13 HASH: "Hash" => { 0 HASH_HASH_ABILITY: "Hash" exposed_type=true diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -861,6 +861,15 @@ impl DerivableVisitor for DeriveEncoding { Ok(Descend(true)) } + #[inline(always)] + fn visit_tuple( + _subs: &Subs, + _var: Variable, + _elems: TupleElems, + ) -> Result<Descend, NotDerivable> { + Ok(Descend(true)) + } + #[inline(always)] fn visit_tag_union(_var: Variable) -> Result<Descend, NotDerivable> { Ok(Descend(true)) diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -967,6 +976,15 @@ impl DerivableVisitor for DeriveDecoding { Ok(Descend(true)) } + #[inline(always)] + fn visit_tuple( + _subs: &Subs, + _var: Variable, + _elems: TupleElems, + ) -> Result<Descend, NotDerivable> { + Ok(Descend(true)) + } + #[inline(always)] fn visit_tag_union(_var: Variable) -> Result<Descend, NotDerivable> { Ok(Descend(true)) diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -1073,6 +1091,15 @@ impl DerivableVisitor for DeriveHash { Ok(Descend(true)) } + #[inline(always)] + fn visit_tuple( + _subs: &Subs, + _var: Variable, + _elems: TupleElems, + ) -> Result<Descend, NotDerivable> { + Ok(Descend(true)) + } + #[inline(always)] fn visit_tag_union(_var: Variable) -> Result<Descend, NotDerivable> { Ok(Descend(true)) diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -1178,6 +1205,15 @@ impl DerivableVisitor for DeriveEq { Ok(Descend(true)) } + #[inline(always)] + fn visit_tuple( + _subs: &Subs, + _var: Variable, + _elems: TupleElems, + ) -> Result<Descend, NotDerivable> { + Ok(Descend(true)) + } + #[inline(always)] fn visit_tag_union(_var: Variable) -> Result<Descend, NotDerivable> { Ok(Descend(true)) diff --git a/crates/compiler/solve/src/specialize.rs b/crates/compiler/solve/src/specialize.rs --- a/crates/compiler/solve/src/specialize.rs +++ b/crates/compiler/solve/src/specialize.rs @@ -743,7 +743,7 @@ fn get_specialization_lambda_set_ambient_function<P: Phase>( let specialized_lambda_set = *specialization .specialization_lambda_sets .get(&lset_region) - .expect("lambda set region not resolved"); + .unwrap_or_else(|| panic!("lambda set region not resolved: {:?}", (spec_symbol, specialization))); Ok(specialized_lambda_set) } MemberImpl::Error => todo_abilities!(), diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -4459,6 +4459,7 @@ pub struct StorageSubs { struct StorageSubsOffsets { utable: u32, variables: u32, + tuple_elem_indices: u32, tag_names: u32, symbol_names: u32, field_names: u32, diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -4542,6 +4543,7 @@ impl StorageSubs { let self_offsets = StorageSubsOffsets { utable: self.subs.utable.len() as u32, variables: self.subs.variables.len() as u32, + tuple_elem_indices: self.subs.tuple_elem_indices.len() as u32, tag_names: self.subs.tag_names.len() as u32, symbol_names: self.subs.symbol_names.len() as u32, field_names: self.subs.field_names.len() as u32, diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -4553,6 +4555,7 @@ impl StorageSubs { let offsets = StorageSubsOffsets { utable: (target.utable.len() - Variable::NUM_RESERVED_VARS) as u32, variables: target.variables.len() as u32, + tuple_elem_indices: target.tuple_elem_indices.len() as u32, tag_names: target.tag_names.len() as u32, symbol_names: target.symbol_names.len() as u32, field_names: target.field_names.len() as u32, diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -4593,6 +4596,10 @@ impl StorageSubs { .map(|v| Self::offset_variable(&offsets, *v)), ); + target + .tuple_elem_indices + .extend(self.subs.tuple_elem_indices); + target.variable_slices.extend( self.subs .variable_slices diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -4613,6 +4620,11 @@ impl StorageSubs { (self_offsets.utable + offsets.utable) as usize ); + debug_assert_eq!( + target.tuple_elem_indices.len(), + (self_offsets.tuple_elem_indices + offsets.tuple_elem_indices) as usize + ); + debug_assert_eq!( target.tag_names.len(), (self_offsets.tag_names + offsets.tag_names) as usize diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -4756,6 +4768,7 @@ impl StorageSubs { } fn offset_tuple_elems(offsets: &StorageSubsOffsets, mut tuple_elems: TupleElems) -> TupleElems { + tuple_elems.elem_index_start += offsets.tuple_elem_indices; tuple_elems.variables_start += offsets.variables; tuple_elems diff --git a/examples/cli/cli-platform/EnvDecoding.roc b/examples/cli/cli-platform/EnvDecoding.roc --- a/examples/cli/cli-platform/EnvDecoding.roc +++ b/examples/cli/cli-platform/EnvDecoding.roc @@ -19,6 +19,7 @@ EnvFormat := {} has [ string: envString, list: envList, record: envRecord, + tuple: envTuple, }, ] diff --git a/examples/cli/cli-platform/EnvDecoding.roc b/examples/cli/cli-platform/EnvDecoding.roc --- a/examples/cli/cli-platform/EnvDecoding.roc +++ b/examples/cli/cli-platform/EnvDecoding.roc @@ -93,3 +94,10 @@ envList = \decodeElem -> Decode.custom \bytes, @EnvFormat {} -> envRecord : _, (_, _ -> [Keep (Decoder _ _), Skip]), (_ -> _) -> Decoder _ _ envRecord = \_initialState, _stepField, _finalizer -> Decode.custom \bytes, @EnvFormat {} -> { result: Err TooShort, rest: bytes } + +# TODO: we must currently annotate the arrows here so that the lambda sets are +# exercised, and the solver can find an ambient lambda set for the +# specialization. +envTuple : _, (_, _ -> [Next (Decoder _ _), TooLong]), (_ -> _) -> Decoder _ _ +envTuple = \_initialState, _stepElem, _finalizer -> Decode.custom \bytes, @EnvFormat {} -> + { result: Err TooShort, rest: bytes }
roc-lang__roc-5179
5,179
Yes, they should - just like records! This is a bug.
[ "5143" ]
0.0
roc-lang/roc
2023-03-22T21:57:07Z
diff --git a/crates/compiler/derive/src/util.rs b/crates/compiler/derive/src/util.rs --- a/crates/compiler/derive/src/util.rs +++ b/crates/compiler/derive/src/util.rs @@ -18,19 +18,20 @@ pub(crate) struct Env<'a> { } impl Env<'_> { - pub fn new_symbol(&mut self, name_hint: &str) -> Symbol { + pub fn new_symbol(&mut self, name_hint: impl std::string::ToString) -> Symbol { if cfg!(any( debug_assertions, test, feature = "debug-derived-symbols" )) { let mut i = 0; + let hint = name_hint.to_string(); let debug_name = loop { i += 1; let name = if i == 1 { - name_hint.to_owned() + hint.clone() } else { - format!("{}{}", name_hint, i) + format!("{}{}", hint, i) }; if self.derived_ident_ids.get_id(&name).is_none() { break name; diff --git a/crates/compiler/test_derive/src/decoding.rs b/crates/compiler/test_derive/src/decoding.rs --- a/crates/compiler/test_derive/src/decoding.rs +++ b/crates/compiler/test_derive/src/decoding.rs @@ -28,6 +28,11 @@ test_key_eq! { explicit_empty_record_and_implicit_empty_record: v!(EMPTY_RECORD), v!({}) + same_tuple: + v!((v!(U8), v!(U16),)), v!((v!(U8), v!(U16),)) + same_tuple_fields_diff_types: + v!((v!(U8), v!(U16),)), v!((v!(U32), v!(U64),)) + list_list_diff_types: v!(Symbol::LIST_LIST v!(STR)), v!(Symbol::LIST_LIST v!(U8)) str_str: diff --git a/crates/compiler/test_derive/src/decoding.rs b/crates/compiler/test_derive/src/decoding.rs --- a/crates/compiler/test_derive/src/decoding.rs +++ b/crates/compiler/test_derive/src/decoding.rs @@ -41,6 +46,9 @@ test_key_neq! { v!({ a: v!(U8), }), v!({ b: v!(U8), }) record_empty_vs_nonempty: v!(EMPTY_RECORD), v!({ a: v!(U8), }) + + different_tuple_arities: + v!((v!(U8), v!(U16),)), v!((v!(U8), v!(U16), v!(U32),)) } #[test] diff --git a/crates/compiler/test_derive/src/decoding.rs b/crates/compiler/test_derive/src/decoding.rs --- a/crates/compiler/test_derive/src/decoding.rs +++ b/crates/compiler/test_derive/src/decoding.rs @@ -167,3 +175,59 @@ fn record_2_fields() { ) }) } + +#[test] +fn tuple_2_fields() { + derive_test(Decoder, v!((v!(STR), v!(U8),)), |golden| { + assert_snapshot!(golden, @r###" + # derived for ( Str, U8 )* + # Decoder ( val, val1 )* fmt | fmt has DecoderFormatting, val has Decoding, val1 has Decoding + # List U8, fmt -[[custom(22)]]-> { rest : List U8, result : [Err [TooShort], Ok ( val, val1 )a] } | fmt has DecoderFormatting, val has Decoding, val1 has Decoding + # Specialization lambda sets: + # @<1>: [[custom(22)]] + #Derived.decoder_(arity:2) = + custom + \#Derived.bytes3, #Derived.fmt3 -> + decodeWith + #Derived.bytes3 + (tuple + { e1: Err NoElem, e0: Err NoElem } + \#Derived.stateRecord2, #Derived.index -> + when #Derived.index is + 0 -> + Next (custom + \#Derived.bytes, #Derived.fmt -> + when decodeWith #Derived.bytes decoder #Derived.fmt is + #Derived.rec -> + { + result: when #Derived.rec.result is + Ok #Derived.val -> + Ok { stateRecord2 & e0: Ok #Derived.val } + Err #Derived.err -> Err #Derived.err, + rest: #Derived.rec.rest + }) + 1 -> + Next (custom + \#Derived.bytes2, #Derived.fmt2 -> + when decodeWith #Derived.bytes2 decoder #Derived.fmt2 is + #Derived.rec2 -> + { + result: when #Derived.rec2.result is + Ok #Derived.val2 -> + Ok { stateRecord2 & e1: Ok #Derived.val2 } + Err #Derived.err2 -> Err #Derived.err2, + rest: #Derived.rec2.rest + }) + _ -> TooLong + \#Derived.stateRecord -> + when #Derived.stateRecord.e0 is + Ok #Derived.0 -> + when #Derived.stateRecord.e1 is + Ok #Derived.1 -> Ok ( #Derived.0, #Derived.1 ) + _ -> Err TooShort + _ -> Err TooShort) + #Derived.fmt3 + "### + ) + }) +} diff --git a/crates/compiler/test_derive/src/encoding.rs b/crates/compiler/test_derive/src/encoding.rs --- a/crates/compiler/test_derive/src/encoding.rs +++ b/crates/compiler/test_derive/src/encoding.rs @@ -33,6 +33,11 @@ test_key_eq! { v!({ a: v!(U8), b: v!(U8), }), v!({ ?a: v!(U8), ?b: v!(U8), }) + same_tuple: + v!((v!(U8), v!(U16),)), v!((v!(U8), v!(U16),)) + same_tuple_fields_diff_types: + v!((v!(U8), v!(U16),)), v!((v!(U32), v!(U64),)) + same_tag_union: v!([ A v!(U8) v!(STR), B v!(STR) ]), v!([ A v!(U8) v!(STR), B v!(STR) ]) same_tag_union_tags_diff_types: diff --git a/crates/compiler/test_derive/src/encoding.rs b/crates/compiler/test_derive/src/encoding.rs --- a/crates/compiler/test_derive/src/encoding.rs +++ b/crates/compiler/test_derive/src/encoding.rs @@ -78,6 +83,9 @@ test_key_neq! { record_empty_vs_nonempty: v!(EMPTY_RECORD), v!({ a: v!(U8), }) + different_tuple_arities: + v!((v!(U8), v!(U16),)), v!((v!(U8), v!(U16), v!(U32),)) + different_tag_union_tags: v!([ A v!(U8) ]), v!([ B v!(U8) ]) tag_union_empty_vs_nonempty: diff --git a/crates/compiler/test_derive/src/encoding.rs b/crates/compiler/test_derive/src/encoding.rs --- a/crates/compiler/test_derive/src/encoding.rs +++ b/crates/compiler/test_derive/src/encoding.rs @@ -265,6 +273,29 @@ fn two_field_record() { }) } +#[test] +fn two_field_tuple() { + derive_test(ToEncoder, v!((v!(U8), v!(STR),)), |golden| { + assert_snapshot!(golden, @r###" + # derived for ( U8, Str )* + # ( val, val1 )* -[[toEncoder_(arity:2)(0)]]-> Encoder fmt | fmt has EncoderFormatting, val has Encoding, val1 has Encoding + # ( val, val1 )a -[[toEncoder_(arity:2)(0)]]-> (List U8, fmt -[[custom(2) ( val, val1 )a]]-> List U8) | fmt has EncoderFormatting, val has Encoding, val1 has Encoding + # Specialization lambda sets: + # @<1>: [[toEncoder_(arity:2)(0)]] + # @<2>: [[custom(2) ( val, val1 )*]] | val has Encoding, val1 has Encoding + #Derived.toEncoder_(arity:2) = + \#Derived.tup -> + custom + \#Derived.bytes, #Derived.fmt -> + appendWith + #Derived.bytes + (tuple [toEncoder #Derived.tup.0, toEncoder #Derived.tup.1]) + #Derived.fmt + "### + ) + }) +} + #[test] #[ignore = "NOTE: this would never actually happen, because [] is uninhabited, and hence toEncoder can never be called with a value of []! Rightfully it induces broken assertions in other parts of the compiler, so we ignore it."] diff --git a/crates/compiler/test_derive/src/hash.rs b/crates/compiler/test_derive/src/hash.rs --- a/crates/compiler/test_derive/src/hash.rs +++ b/crates/compiler/test_derive/src/hash.rs @@ -28,6 +28,11 @@ test_key_eq! { explicit_empty_record_and_implicit_empty_record: v!(EMPTY_RECORD), v!({}) + same_tuple: + v!((v!(U8), v!(U16),)), v!((v!(U8), v!(U16),)) + same_tuple_fields_diff_types: + v!((v!(U8), v!(U16),)), v!((v!(U32), v!(U64),)) + same_tag_union: v!([ A v!(U8) v!(STR), B v!(STR) ]), v!([ A v!(U8) v!(STR), B v!(STR) ]) same_tag_union_tags_diff_types: diff --git a/crates/compiler/test_derive/src/hash.rs b/crates/compiler/test_derive/src/hash.rs --- a/crates/compiler/test_derive/src/hash.rs +++ b/crates/compiler/test_derive/src/hash.rs @@ -51,6 +56,9 @@ test_key_neq! { record_empty_vs_nonempty: v!(EMPTY_RECORD), v!({ a: v!(U8), }) + different_tuple_arities: + v!((v!(U8), v!(U16),)), v!((v!(U8), v!(U16), v!(U32),)) + different_tag_union_tags: v!([ A v!(U8) ]), v!([ B v!(U8) ]) tag_union_empty_vs_nonempty: diff --git a/crates/compiler/test_derive/src/hash.rs b/crates/compiler/test_derive/src/hash.rs --- a/crates/compiler/test_derive/src/hash.rs +++ b/crates/compiler/test_derive/src/hash.rs @@ -201,6 +209,23 @@ fn two_field_record() { }) } +#[test] +fn two_element_tuple() { + derive_test(Hash, v!((v!(U8), v!(STR),)), |golden| { + assert_snapshot!(golden, @r###" + # derived for ( U8, Str )* + # hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher + # hasher, ( a, a1 )* -[[hash_(arity:2)(0)]]-> hasher | a has Hash, a1 has Hash, hasher has Hasher + # Specialization lambda sets: + # @<1>: [[hash_(arity:2)(0)]] + #Derived.hash_(arity:2) = + \#Derived.hasher, #Derived.tup -> + hash (hash #Derived.hasher #Derived.tup.0) #Derived.tup.1 + "### + ) + }) +} + #[test] fn tag_one_label_no_payloads() { derive_test(Hash, v!([A]), |golden| { diff --git a/crates/compiler/test_derive/src/util.rs b/crates/compiler/test_derive/src/util.rs --- a/crates/compiler/test_derive/src/util.rs +++ b/crates/compiler/test_derive/src/util.rs @@ -89,6 +89,22 @@ macro_rules! v { roc_derive::synth_var(subs, Content::Structure(FlatType::Record(fields, ext))) } }}; + (( $($make_v:expr,)* )$( $($ext:tt)+ )?) => {{ + #[allow(unused)] + use roc_types::subs::{Subs, RecordFields, Content, FlatType, Variable, TupleElems}; + |subs: &mut Subs| { + let elems = [ + $($make_v(subs),)* + ].into_iter().enumerate(); + let elems = TupleElems::insert_into_subs(subs, elems); + + #[allow(unused_mut, unused)] + let mut ext = Variable::EMPTY_TUPLE; + $( ext = $crate::v!($($ext)+)(subs); )? + + roc_derive::synth_var(subs, Content::Structure(FlatType::Tuple(elems, ext))) + } + }}; ([ $($tag:ident $($payload:expr)*),* ] as $rec_var:ident) => {{ use roc_types::subs::{Subs, SubsIndex, Variable, Content, FlatType, TagExt, UnionTags}; use roc_module::ident::TagName; diff --git a/crates/compiler/test_gen/src/gen_abilities.rs b/crates/compiler/test_gen/src/gen_abilities.rs --- a/crates/compiler/test_gen/src/gen_abilities.rs +++ b/crates/compiler/test_gen/src/gen_abilities.rs @@ -787,6 +787,52 @@ fn encode_derived_record_with_many_types() { ) } +#[test] +#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] +fn encode_derived_tuple_two_fields() { + assert_evals_to!( + indoc!( + r#" + app "test" + imports [Encode, Json] + provides [main] to "./platform" + + main = + tup = ("foo", 10u8) + result = Str.fromUtf8 (Encode.toBytes tup Json.toUtf8) + when result is + Ok s -> s + _ -> "<bad>" + "# + ), + RocStr::from(r#"["foo",10]"#), + RocStr + ) +} + +#[test] +#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] +fn encode_derived_tuple_of_tuples() { + assert_evals_to!( + indoc!( + r#" + app "test" + imports [Encode, Json] + provides [main] to "./platform" + + main = + tup = ( ("foo", 10u8), (23u8, "bar", 15u8) ) + result = Str.fromUtf8 (Encode.toBytes tup Json.toUtf8) + when result is + Ok s -> s + _ -> "<bad>" + "# + ), + RocStr::from(r#"[["foo",10],[23,"bar",15]]"#), + RocStr + ) +} + #[test] #[cfg(all(any(feature = "gen-llvm", feature = "gen-wasm")))] fn encode_derived_generic_record_with_different_field_types() { diff --git a/crates/compiler/test_gen/src/gen_abilities.rs b/crates/compiler/test_gen/src/gen_abilities.rs --- a/crates/compiler/test_gen/src/gen_abilities.rs +++ b/crates/compiler/test_gen/src/gen_abilities.rs @@ -1233,6 +1279,50 @@ fn decode_record_of_record() { ) } +#[test] +#[cfg(all( + any(feature = "gen-llvm", feature = "gen-wasm"), + not(debug_assertions) // https://github.com/roc-lang/roc/issues/3898 +))] +fn decode_tuple_two_elements() { + assert_evals_to!( + indoc!( + r#" + app "test" imports [Json] provides [main] to "./platform" + + main = + when Str.toUtf8 "[\"ab\",10]" |> Decode.fromBytes Json.fromUtf8 is + Ok ("ab", 10u8) -> "abcd" + _ -> "something went wrong" + "# + ), + RocStr::from("abcd"), + RocStr + ) +} + +#[test] +#[cfg(all( + any(feature = "gen-llvm", feature = "gen-wasm"), + not(debug_assertions) // https://github.com/roc-lang/roc/issues/3898 +))] +fn decode_tuple_of_tuples() { + assert_evals_to!( + indoc!( + r#" + app "test" imports [Json] provides [main] to "./platform" + + main = + when Str.toUtf8 "[[\"ab\",10],[\"cd\",25]]" |> Decode.fromBytes Json.fromUtf8 is + Ok ( ("ab", 10u8), ("cd", 25u8) ) -> "abcd" + _ -> "something went wrong" + "# + ), + RocStr::from("abcd"), + RocStr + ) +} + #[cfg(all(test, any(feature = "gen-llvm", feature = "gen-wasm")))] mod hash { #[cfg(feature = "gen-llvm")] diff --git a/crates/compiler/test_gen/src/gen_abilities.rs b/crates/compiler/test_gen/src/gen_abilities.rs --- a/crates/compiler/test_gen/src/gen_abilities.rs +++ b/crates/compiler/test_gen/src/gen_abilities.rs @@ -1493,6 +1583,35 @@ mod hash { ) } + #[test] + fn tuple_of_u8_and_str() { + assert_evals_to!( + &build_test(r#"(15u8, "bc")"#), + RocList::from_slice(&[15, 98, 99]), + RocList<u8> + ) + } + + #[test] + fn tuple_of_tuples() { + assert_evals_to!( + &build_test(r#"( (15u8, "bc"), (23u8, "ef") )"#), + RocList::from_slice(&[15, 98, 99, 23, 101, 102]), + RocList<u8> + ) + } + + #[test] + fn tuple_of_list_of_tuples() { + assert_evals_to!( + &build_test( + r#"( [ ( 15u8, 32u8 ), ( 23u8, 41u8 ) ], [ (45u8, 63u8), (58u8, 73u8) ] )"# + ), + RocList::from_slice(&[15, 32, 23, 41, 45, 63, 58, 73]), + RocList<u8> + ) + } + #[test] fn hash_singleton_union() { assert_evals_to!( diff --git a/crates/compiler/test_gen/src/gen_abilities.rs b/crates/compiler/test_gen/src/gen_abilities.rs --- a/crates/compiler/test_gen/src/gen_abilities.rs +++ b/crates/compiler/test_gen/src/gen_abilities.rs @@ -1761,6 +1880,22 @@ mod eq { use indoc::indoc; use roc_std::RocStr; + #[test] + fn eq_tuple() { + assert_evals_to!( + indoc!( + r#" + app "test" provides [main] to "./platform" + + main = + ("a", "b") == ("a", "b") + "# + ), + true, + bool + ) + } + #[test] fn custom_eq_impl() { assert_evals_to!( diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt @@ -1,5 +1,5 @@ procedure #Derived.0 (#Derived.1): - let #Derived_gen.0 : Str = CallByName Encode.22 #Derived.1; + let #Derived_gen.0 : Str = CallByName Encode.23 #Derived.1; ret #Derived_gen.0; procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt @@ -8,11 +8,11 @@ procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): let #Derived_gen.6 : {Str, Str} = Struct {#Derived_gen.7, #Derived_gen.8}; let #Derived_gen.5 : List {Str, Str} = Array [#Derived_gen.6]; let #Derived_gen.4 : List {Str, Str} = CallByName Json.20 #Derived_gen.5; - let #Derived_gen.3 : List U8 = CallByName Encode.23 #Derived.3 #Derived_gen.4 #Derived.4; + let #Derived_gen.3 : List U8 = CallByName Encode.24 #Derived.3 #Derived_gen.4 #Derived.4; ret #Derived_gen.3; procedure #Derived.5 (#Derived.6): - let #Derived_gen.14 : Str = CallByName Encode.22 #Derived.6; + let #Derived_gen.14 : Str = CallByName Encode.23 #Derived.6; ret #Derived_gen.14; procedure #Derived.7 (#Derived.8, #Derived.9, #Derived.6): diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt @@ -21,195 +21,195 @@ procedure #Derived.7 (#Derived.8, #Derived.9, #Derived.6): let #Derived_gen.20 : {Str, Str} = Struct {#Derived_gen.21, #Derived_gen.22}; let #Derived_gen.19 : List {Str, Str} = Array [#Derived_gen.20]; let #Derived_gen.18 : List {Str, Str} = CallByName Json.20 #Derived_gen.19; - let #Derived_gen.17 : List U8 = CallByName Encode.23 #Derived.8 #Derived_gen.18 #Derived.9; + let #Derived_gen.17 : List U8 = CallByName Encode.24 #Derived.8 #Derived_gen.18 #Derived.9; ret #Derived_gen.17; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName #Derived.2 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName #Derived.2 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.114 Encode.94 Encode.96 Encode.102; - ret Encode.113; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.118 Encode.99 Encode.101 Encode.107; + ret Encode.118; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.115 : List U8 = CallByName #Derived.7 Encode.94 Encode.96 Encode.102; - ret Encode.115; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.120 : List U8 = CallByName #Derived.7 Encode.99 Encode.101 Encode.107; + ret Encode.120; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.125 : List U8 = CallByName Json.114 Encode.94 Encode.96 Encode.102; - ret Encode.125; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.130 : List U8 = CallByName Json.118 Encode.99 Encode.101 Encode.107; + ret Encode.130; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.128 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; - ret Encode.128; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.133 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.133; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : Str = CallByName #Derived.0 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : Str = CallByName #Derived.0 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.114 (Json.115, Json.428, Json.113): - let Json.461 : I64 = 123i64; - let Json.460 : U8 = CallByName Num.127 Json.461; - let Json.117 : List U8 = CallByName List.4 Json.115 Json.460; - let Json.459 : U64 = CallByName List.6 Json.113; - let Json.436 : {List U8, U64} = Struct {Json.117, Json.459}; - let Json.437 : {} = Struct {}; - let Json.435 : {List U8, U64} = CallByName List.18 Json.113 Json.436 Json.437; - dec Json.113; - let Json.119 : List U8 = StructAtIndex 0 Json.435; - inc Json.119; - dec Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.432 : List U8 = CallByName List.4 Json.119 Json.433; - ret Json.432; - -procedure Json.114 (Json.115, Json.428, Json.113): - let Json.501 : I64 = 123i64; - let Json.500 : U8 = CallByName Num.127 Json.501; - let Json.117 : List U8 = CallByName List.4 Json.115 Json.500; - let Json.499 : U64 = CallByName List.6 Json.113; - let Json.476 : {List U8, U64} = Struct {Json.117, Json.499}; - let Json.477 : {} = Struct {}; - let Json.475 : {List U8, U64} = CallByName List.18 Json.113 Json.476 Json.477; - dec Json.113; - let Json.119 : List U8 = StructAtIndex 0 Json.475; - inc Json.119; - dec Json.475; - let Json.474 : I64 = 125i64; - let Json.473 : U8 = CallByName Num.127 Json.474; - let Json.472 : List U8 = CallByName List.4 Json.119 Json.473; - ret Json.472; - -procedure Json.116 (Json.430, Json.431): - let Json.122 : Str = StructAtIndex 0 Json.431; - inc Json.122; - let Json.123 : Str = StructAtIndex 1 Json.431; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.102 (Json.103, Json.562, Json.101): + let Json.571 : I64 = 34i64; + let Json.570 : U8 = CallByName Num.127 Json.571; + let Json.568 : List U8 = CallByName List.4 Json.103 Json.570; + let Json.569 : List U8 = CallByName Str.12 Json.101; + let Json.565 : List U8 = CallByName List.8 Json.568 Json.569; + let Json.567 : I64 = 34i64; + let Json.566 : U8 = CallByName Num.127 Json.567; + let Json.564 : List U8 = CallByName List.4 Json.565 Json.566; + ret Json.564; + +procedure Json.118 (Json.119, Json.486, Json.117): + let Json.519 : I64 = 123i64; + let Json.518 : U8 = CallByName Num.127 Json.519; + let Json.121 : List U8 = CallByName List.4 Json.119 Json.518; + let Json.517 : U64 = CallByName List.6 Json.117; + let Json.494 : {List U8, U64} = Struct {Json.121, Json.517}; + let Json.495 : {} = Struct {}; + let Json.493 : {List U8, U64} = CallByName List.18 Json.117 Json.494 Json.495; + dec Json.117; + let Json.123 : List U8 = StructAtIndex 0 Json.493; inc Json.123; - dec Json.431; - let Json.120 : List U8 = StructAtIndex 0 Json.430; - inc Json.120; - let Json.121 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.458 : I64 = 34i64; - let Json.457 : U8 = CallByName Num.127 Json.458; - let Json.455 : List U8 = CallByName List.4 Json.120 Json.457; - let Json.456 : List U8 = CallByName Str.12 Json.122; - let Json.452 : List U8 = CallByName List.8 Json.455 Json.456; - let Json.454 : I64 = 34i64; - let Json.453 : U8 = CallByName Num.127 Json.454; - let Json.449 : List U8 = CallByName List.4 Json.452 Json.453; - let Json.451 : I64 = 58i64; - let Json.450 : U8 = CallByName Num.127 Json.451; - let Json.447 : List U8 = CallByName List.4 Json.449 Json.450; - let Json.448 : {} = Struct {}; - let Json.124 : List U8 = CallByName Encode.23 Json.447 Json.123 Json.448; - joinpoint Json.442 Json.125: - let Json.440 : U64 = 1i64; - let Json.439 : U64 = CallByName Num.20 Json.121 Json.440; - let Json.438 : {List U8, U64} = Struct {Json.125, Json.439}; - ret Json.438; + dec Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.490 : List U8 = CallByName List.4 Json.123 Json.491; + ret Json.490; + +procedure Json.118 (Json.119, Json.486, Json.117): + let Json.559 : I64 = 123i64; + let Json.558 : U8 = CallByName Num.127 Json.559; + let Json.121 : List U8 = CallByName List.4 Json.119 Json.558; + let Json.557 : U64 = CallByName List.6 Json.117; + let Json.534 : {List U8, U64} = Struct {Json.121, Json.557}; + let Json.535 : {} = Struct {}; + let Json.533 : {List U8, U64} = CallByName List.18 Json.117 Json.534 Json.535; + dec Json.117; + let Json.123 : List U8 = StructAtIndex 0 Json.533; + inc Json.123; + dec Json.533; + let Json.532 : I64 = 125i64; + let Json.531 : U8 = CallByName Num.127 Json.532; + let Json.530 : List U8 = CallByName List.4 Json.123 Json.531; + ret Json.530; + +procedure Json.120 (Json.488, Json.489): + let Json.126 : Str = StructAtIndex 0 Json.489; + inc Json.126; + let Json.127 : Str = StructAtIndex 1 Json.489; + inc Json.127; + dec Json.489; + let Json.124 : List U8 = StructAtIndex 0 Json.488; + inc Json.124; + let Json.125 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.516 : I64 = 34i64; + let Json.515 : U8 = CallByName Num.127 Json.516; + let Json.513 : List U8 = CallByName List.4 Json.124 Json.515; + let Json.514 : List U8 = CallByName Str.12 Json.126; + let Json.510 : List U8 = CallByName List.8 Json.513 Json.514; + let Json.512 : I64 = 34i64; + let Json.511 : U8 = CallByName Num.127 Json.512; + let Json.507 : List U8 = CallByName List.4 Json.510 Json.511; + let Json.509 : I64 = 58i64; + let Json.508 : U8 = CallByName Num.127 Json.509; + let Json.505 : List U8 = CallByName List.4 Json.507 Json.508; + let Json.506 : {} = Struct {}; + let Json.128 : List U8 = CallByName Encode.24 Json.505 Json.127 Json.506; + joinpoint Json.500 Json.129: + let Json.498 : U64 = 1i64; + let Json.497 : U64 = CallByName Num.20 Json.125 Json.498; + let Json.496 : {List U8, U64} = Struct {Json.129, Json.497}; + ret Json.496; in - let Json.446 : U64 = 1i64; - let Json.443 : Int1 = CallByName Num.24 Json.121 Json.446; - if Json.443 then - let Json.445 : I64 = 44i64; - let Json.444 : U8 = CallByName Num.127 Json.445; - let Json.441 : List U8 = CallByName List.4 Json.124 Json.444; - jump Json.442 Json.441; + let Json.504 : U64 = 1i64; + let Json.501 : Int1 = CallByName Num.24 Json.125 Json.504; + if Json.501 then + let Json.503 : I64 = 44i64; + let Json.502 : U8 = CallByName Num.127 Json.503; + let Json.499 : List U8 = CallByName List.4 Json.128 Json.502; + jump Json.500 Json.499; else - jump Json.442 Json.124; - -procedure Json.116 (Json.430, Json.431): - let Json.122 : Str = StructAtIndex 0 Json.431; - inc Json.122; - let Json.123 : Str = StructAtIndex 1 Json.431; - inc Json.123; - dec Json.431; - let Json.120 : List U8 = StructAtIndex 0 Json.430; - inc Json.120; - let Json.121 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.498 : I64 = 34i64; - let Json.497 : U8 = CallByName Num.127 Json.498; - let Json.495 : List U8 = CallByName List.4 Json.120 Json.497; - let Json.496 : List U8 = CallByName Str.12 Json.122; - let Json.492 : List U8 = CallByName List.8 Json.495 Json.496; - let Json.494 : I64 = 34i64; - let Json.493 : U8 = CallByName Num.127 Json.494; - let Json.489 : List U8 = CallByName List.4 Json.492 Json.493; - let Json.491 : I64 = 58i64; - let Json.490 : U8 = CallByName Num.127 Json.491; - let Json.487 : List U8 = CallByName List.4 Json.489 Json.490; - let Json.488 : {} = Struct {}; - let Json.124 : List U8 = CallByName Encode.23 Json.487 Json.123 Json.488; - joinpoint Json.482 Json.125: - let Json.480 : U64 = 1i64; - let Json.479 : U64 = CallByName Num.20 Json.121 Json.480; - let Json.478 : {List U8, U64} = Struct {Json.125, Json.479}; - ret Json.478; + jump Json.500 Json.128; + +procedure Json.120 (Json.488, Json.489): + let Json.126 : Str = StructAtIndex 0 Json.489; + inc Json.126; + let Json.127 : Str = StructAtIndex 1 Json.489; + inc Json.127; + dec Json.489; + let Json.124 : List U8 = StructAtIndex 0 Json.488; + inc Json.124; + let Json.125 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.556 : I64 = 34i64; + let Json.555 : U8 = CallByName Num.127 Json.556; + let Json.553 : List U8 = CallByName List.4 Json.124 Json.555; + let Json.554 : List U8 = CallByName Str.12 Json.126; + let Json.550 : List U8 = CallByName List.8 Json.553 Json.554; + let Json.552 : I64 = 34i64; + let Json.551 : U8 = CallByName Num.127 Json.552; + let Json.547 : List U8 = CallByName List.4 Json.550 Json.551; + let Json.549 : I64 = 58i64; + let Json.548 : U8 = CallByName Num.127 Json.549; + let Json.545 : List U8 = CallByName List.4 Json.547 Json.548; + let Json.546 : {} = Struct {}; + let Json.128 : List U8 = CallByName Encode.24 Json.545 Json.127 Json.546; + joinpoint Json.540 Json.129: + let Json.538 : U64 = 1i64; + let Json.537 : U64 = CallByName Num.20 Json.125 Json.538; + let Json.536 : {List U8, U64} = Struct {Json.129, Json.537}; + ret Json.536; in - let Json.486 : U64 = 1i64; - let Json.483 : Int1 = CallByName Num.24 Json.121 Json.486; - if Json.483 then - let Json.485 : I64 = 44i64; - let Json.484 : U8 = CallByName Num.127 Json.485; - let Json.481 : List U8 = CallByName List.4 Json.124 Json.484; - jump Json.482 Json.481; + let Json.544 : U64 = 1i64; + let Json.541 : Int1 = CallByName Num.24 Json.125 Json.544; + if Json.541 then + let Json.543 : I64 = 44i64; + let Json.542 : U8 = CallByName Num.127 Json.543; + let Json.539 : List U8 = CallByName List.4 Json.128 Json.542; + jump Json.540 Json.539; else - jump Json.482 Json.124; - -procedure Json.18 (Json.97): - let Json.502 : Str = CallByName Encode.22 Json.97; - ret Json.502; - -procedure Json.20 (Json.113): - let Json.426 : List {Str, Str} = CallByName Encode.22 Json.113; - ret Json.426; - -procedure Json.20 (Json.113): - let Json.468 : List {Str, Str} = CallByName Encode.22 Json.113; - ret Json.468; - -procedure Json.98 (Json.99, Json.504, Json.97): - let Json.513 : I64 = 34i64; - let Json.512 : U8 = CallByName Num.127 Json.513; - let Json.510 : List U8 = CallByName List.4 Json.99 Json.512; - let Json.511 : List U8 = CallByName Str.12 Json.97; - let Json.507 : List U8 = CallByName List.8 Json.510 Json.511; - let Json.509 : I64 = 34i64; - let Json.508 : U8 = CallByName Num.127 Json.509; - let Json.506 : List U8 = CallByName List.4 Json.507 Json.508; - ret Json.506; + jump Json.540 Json.128; + +procedure Json.18 (Json.101): + let Json.560 : Str = CallByName Encode.23 Json.101; + ret Json.560; + +procedure Json.20 (Json.117): + let Json.484 : List {Str, Str} = CallByName Encode.23 Json.117; + ret Json.484; + +procedure Json.20 (Json.117): + let Json.526 : List {Str, Str} = CallByName Encode.23 Json.117; + ret Json.526; procedure List.139 (List.140, List.141, List.138): - let List.535 : {List U8, U64} = CallByName Json.116 List.140 List.141; + let List.535 : {List U8, U64} = CallByName Json.120 List.140 List.141; ret List.535; procedure List.139 (List.140, List.141, List.138): - let List.608 : {List U8, U64} = CallByName Json.116 List.140 List.141; + let List.608 : {List U8, U64} = CallByName Json.120 List.140 List.141; ret List.608; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt @@ -348,7 +348,7 @@ procedure Str.9 (Str.77): procedure Test.0 (): let Test.12 : Str = "bar"; let Test.10 : {} = CallByName Json.1; - let Test.8 : List U8 = CallByName Encode.25 Test.12 Test.10; + let Test.8 : List U8 = CallByName Encode.26 Test.12 Test.10; let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8; let Test.5 : U8 = 1i64; let Test.6 : U8 = GetTagId Test.1; diff --git a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt @@ -1,5 +1,5 @@ procedure #Derived.0 (#Derived.1): - let #Derived_gen.0 : Str = CallByName Encode.22 #Derived.1; + let #Derived_gen.0 : Str = CallByName Encode.23 #Derived.1; ret #Derived_gen.0; procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): diff --git a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt @@ -8,117 +8,117 @@ procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): let #Derived_gen.6 : {Str, Str} = Struct {#Derived_gen.7, #Derived_gen.8}; let #Derived_gen.5 : List {Str, Str} = Array [#Derived_gen.6]; let #Derived_gen.4 : List {Str, Str} = CallByName Json.20 #Derived_gen.5; - let #Derived_gen.3 : List U8 = CallByName Encode.23 #Derived.3 #Derived_gen.4 #Derived.4; + let #Derived_gen.3 : List U8 = CallByName Encode.24 #Derived.3 #Derived_gen.4 #Derived.4; ret #Derived_gen.3; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName #Derived.2 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName #Derived.2 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.114 Encode.94 Encode.96 Encode.102; - ret Encode.113; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.118 Encode.99 Encode.101 Encode.107; + ret Encode.118; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.116 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; - ret Encode.116; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.121 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.121; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : Str = CallByName #Derived.0 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : Str = CallByName #Derived.0 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.114 (Json.115, Json.428, Json.113): - let Json.461 : I64 = 123i64; - let Json.460 : U8 = CallByName Num.127 Json.461; - let Json.117 : List U8 = CallByName List.4 Json.115 Json.460; - let Json.459 : U64 = CallByName List.6 Json.113; - let Json.436 : {List U8, U64} = Struct {Json.117, Json.459}; - let Json.437 : {} = Struct {}; - let Json.435 : {List U8, U64} = CallByName List.18 Json.113 Json.436 Json.437; - dec Json.113; - let Json.119 : List U8 = StructAtIndex 0 Json.435; - inc Json.119; - dec Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.432 : List U8 = CallByName List.4 Json.119 Json.433; - ret Json.432; - -procedure Json.116 (Json.430, Json.431): - let Json.122 : Str = StructAtIndex 0 Json.431; - inc Json.122; - let Json.123 : Str = StructAtIndex 1 Json.431; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.102 (Json.103, Json.522, Json.101): + let Json.531 : I64 = 34i64; + let Json.530 : U8 = CallByName Num.127 Json.531; + let Json.528 : List U8 = CallByName List.4 Json.103 Json.530; + let Json.529 : List U8 = CallByName Str.12 Json.101; + let Json.525 : List U8 = CallByName List.8 Json.528 Json.529; + let Json.527 : I64 = 34i64; + let Json.526 : U8 = CallByName Num.127 Json.527; + let Json.524 : List U8 = CallByName List.4 Json.525 Json.526; + ret Json.524; + +procedure Json.118 (Json.119, Json.486, Json.117): + let Json.519 : I64 = 123i64; + let Json.518 : U8 = CallByName Num.127 Json.519; + let Json.121 : List U8 = CallByName List.4 Json.119 Json.518; + let Json.517 : U64 = CallByName List.6 Json.117; + let Json.494 : {List U8, U64} = Struct {Json.121, Json.517}; + let Json.495 : {} = Struct {}; + let Json.493 : {List U8, U64} = CallByName List.18 Json.117 Json.494 Json.495; + dec Json.117; + let Json.123 : List U8 = StructAtIndex 0 Json.493; inc Json.123; - dec Json.431; - let Json.120 : List U8 = StructAtIndex 0 Json.430; - inc Json.120; - let Json.121 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.458 : I64 = 34i64; - let Json.457 : U8 = CallByName Num.127 Json.458; - let Json.455 : List U8 = CallByName List.4 Json.120 Json.457; - let Json.456 : List U8 = CallByName Str.12 Json.122; - let Json.452 : List U8 = CallByName List.8 Json.455 Json.456; - let Json.454 : I64 = 34i64; - let Json.453 : U8 = CallByName Num.127 Json.454; - let Json.449 : List U8 = CallByName List.4 Json.452 Json.453; - let Json.451 : I64 = 58i64; - let Json.450 : U8 = CallByName Num.127 Json.451; - let Json.447 : List U8 = CallByName List.4 Json.449 Json.450; - let Json.448 : {} = Struct {}; - let Json.124 : List U8 = CallByName Encode.23 Json.447 Json.123 Json.448; - joinpoint Json.442 Json.125: - let Json.440 : U64 = 1i64; - let Json.439 : U64 = CallByName Num.20 Json.121 Json.440; - let Json.438 : {List U8, U64} = Struct {Json.125, Json.439}; - ret Json.438; + dec Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.490 : List U8 = CallByName List.4 Json.123 Json.491; + ret Json.490; + +procedure Json.120 (Json.488, Json.489): + let Json.126 : Str = StructAtIndex 0 Json.489; + inc Json.126; + let Json.127 : Str = StructAtIndex 1 Json.489; + inc Json.127; + dec Json.489; + let Json.124 : List U8 = StructAtIndex 0 Json.488; + inc Json.124; + let Json.125 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.516 : I64 = 34i64; + let Json.515 : U8 = CallByName Num.127 Json.516; + let Json.513 : List U8 = CallByName List.4 Json.124 Json.515; + let Json.514 : List U8 = CallByName Str.12 Json.126; + let Json.510 : List U8 = CallByName List.8 Json.513 Json.514; + let Json.512 : I64 = 34i64; + let Json.511 : U8 = CallByName Num.127 Json.512; + let Json.507 : List U8 = CallByName List.4 Json.510 Json.511; + let Json.509 : I64 = 58i64; + let Json.508 : U8 = CallByName Num.127 Json.509; + let Json.505 : List U8 = CallByName List.4 Json.507 Json.508; + let Json.506 : {} = Struct {}; + let Json.128 : List U8 = CallByName Encode.24 Json.505 Json.127 Json.506; + joinpoint Json.500 Json.129: + let Json.498 : U64 = 1i64; + let Json.497 : U64 = CallByName Num.20 Json.125 Json.498; + let Json.496 : {List U8, U64} = Struct {Json.129, Json.497}; + ret Json.496; in - let Json.446 : U64 = 1i64; - let Json.443 : Int1 = CallByName Num.24 Json.121 Json.446; - if Json.443 then - let Json.445 : I64 = 44i64; - let Json.444 : U8 = CallByName Num.127 Json.445; - let Json.441 : List U8 = CallByName List.4 Json.124 Json.444; - jump Json.442 Json.441; + let Json.504 : U64 = 1i64; + let Json.501 : Int1 = CallByName Num.24 Json.125 Json.504; + if Json.501 then + let Json.503 : I64 = 44i64; + let Json.502 : U8 = CallByName Num.127 Json.503; + let Json.499 : List U8 = CallByName List.4 Json.128 Json.502; + jump Json.500 Json.499; else - jump Json.442 Json.124; - -procedure Json.18 (Json.97): - let Json.462 : Str = CallByName Encode.22 Json.97; - ret Json.462; - -procedure Json.20 (Json.113): - let Json.426 : List {Str, Str} = CallByName Encode.22 Json.113; - ret Json.426; - -procedure Json.98 (Json.99, Json.464, Json.97): - let Json.473 : I64 = 34i64; - let Json.472 : U8 = CallByName Num.127 Json.473; - let Json.470 : List U8 = CallByName List.4 Json.99 Json.472; - let Json.471 : List U8 = CallByName Str.12 Json.97; - let Json.467 : List U8 = CallByName List.8 Json.470 Json.471; - let Json.469 : I64 = 34i64; - let Json.468 : U8 = CallByName Num.127 Json.469; - let Json.466 : List U8 = CallByName List.4 Json.467 Json.468; - ret Json.466; + jump Json.500 Json.128; + +procedure Json.18 (Json.101): + let Json.520 : Str = CallByName Encode.23 Json.101; + ret Json.520; + +procedure Json.20 (Json.117): + let Json.484 : List {Str, Str} = CallByName Encode.23 Json.117; + ret Json.484; procedure List.139 (List.140, List.141, List.138): - let List.541 : {List U8, U64} = CallByName Json.116 List.140 List.141; + let List.541 : {List U8, U64} = CallByName Json.120 List.140 List.141; ret List.541; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt @@ -225,7 +225,7 @@ procedure Str.9 (Str.77): procedure Test.0 (): let Test.11 : Str = "foo"; let Test.10 : {} = CallByName Json.1; - let Test.8 : List U8 = CallByName Encode.25 Test.11 Test.10; + let Test.8 : List U8 = CallByName Encode.26 Test.11 Test.10; let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8; let Test.5 : U8 = 1i64; let Test.6 : U8 = GetTagId Test.1; diff --git a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt --- a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt @@ -1,5 +1,5 @@ procedure #Derived.0 (#Derived.1): - let #Derived_gen.0 : {Str, Str} = CallByName Encode.22 #Derived.1; + let #Derived_gen.0 : {Str, Str} = CallByName Encode.23 #Derived.1; ret #Derived_gen.0; procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): diff --git a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt --- a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt @@ -16,117 +16,117 @@ procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): let #Derived_gen.7 : {Str, Str} = Struct {#Derived_gen.8, #Derived_gen.9}; let #Derived_gen.5 : List {Str, Str} = Array [#Derived_gen.6, #Derived_gen.7]; let #Derived_gen.4 : List {Str, Str} = CallByName Json.20 #Derived_gen.5; - let #Derived_gen.3 : List U8 = CallByName Encode.23 #Derived.3 #Derived_gen.4 #Derived.4; + let #Derived_gen.3 : List U8 = CallByName Encode.24 #Derived.3 #Derived_gen.4 #Derived.4; ret #Derived_gen.3; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName #Derived.2 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName #Derived.2 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.114 Encode.94 Encode.96 Encode.102; - ret Encode.113; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.118 Encode.99 Encode.101 Encode.107; + ret Encode.118; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.117 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; - ret Encode.117; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.122 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.122; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : {Str, Str} = CallByName #Derived.0 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : {Str, Str} = CallByName #Derived.0 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.114 (Json.115, Json.428, Json.113): - let Json.461 : I64 = 123i64; - let Json.460 : U8 = CallByName Num.127 Json.461; - let Json.117 : List U8 = CallByName List.4 Json.115 Json.460; - let Json.459 : U64 = CallByName List.6 Json.113; - let Json.436 : {List U8, U64} = Struct {Json.117, Json.459}; - let Json.437 : {} = Struct {}; - let Json.435 : {List U8, U64} = CallByName List.18 Json.113 Json.436 Json.437; - dec Json.113; - let Json.119 : List U8 = StructAtIndex 0 Json.435; - inc Json.119; - dec Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.432 : List U8 = CallByName List.4 Json.119 Json.433; - ret Json.432; - -procedure Json.116 (Json.430, Json.431): - let Json.122 : Str = StructAtIndex 0 Json.431; - inc Json.122; - let Json.123 : Str = StructAtIndex 1 Json.431; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.102 (Json.103, Json.522, Json.101): + let Json.531 : I64 = 34i64; + let Json.530 : U8 = CallByName Num.127 Json.531; + let Json.528 : List U8 = CallByName List.4 Json.103 Json.530; + let Json.529 : List U8 = CallByName Str.12 Json.101; + let Json.525 : List U8 = CallByName List.8 Json.528 Json.529; + let Json.527 : I64 = 34i64; + let Json.526 : U8 = CallByName Num.127 Json.527; + let Json.524 : List U8 = CallByName List.4 Json.525 Json.526; + ret Json.524; + +procedure Json.118 (Json.119, Json.486, Json.117): + let Json.519 : I64 = 123i64; + let Json.518 : U8 = CallByName Num.127 Json.519; + let Json.121 : List U8 = CallByName List.4 Json.119 Json.518; + let Json.517 : U64 = CallByName List.6 Json.117; + let Json.494 : {List U8, U64} = Struct {Json.121, Json.517}; + let Json.495 : {} = Struct {}; + let Json.493 : {List U8, U64} = CallByName List.18 Json.117 Json.494 Json.495; + dec Json.117; + let Json.123 : List U8 = StructAtIndex 0 Json.493; inc Json.123; - dec Json.431; - let Json.120 : List U8 = StructAtIndex 0 Json.430; - inc Json.120; - let Json.121 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.458 : I64 = 34i64; - let Json.457 : U8 = CallByName Num.127 Json.458; - let Json.455 : List U8 = CallByName List.4 Json.120 Json.457; - let Json.456 : List U8 = CallByName Str.12 Json.122; - let Json.452 : List U8 = CallByName List.8 Json.455 Json.456; - let Json.454 : I64 = 34i64; - let Json.453 : U8 = CallByName Num.127 Json.454; - let Json.449 : List U8 = CallByName List.4 Json.452 Json.453; - let Json.451 : I64 = 58i64; - let Json.450 : U8 = CallByName Num.127 Json.451; - let Json.447 : List U8 = CallByName List.4 Json.449 Json.450; - let Json.448 : {} = Struct {}; - let Json.124 : List U8 = CallByName Encode.23 Json.447 Json.123 Json.448; - joinpoint Json.442 Json.125: - let Json.440 : U64 = 1i64; - let Json.439 : U64 = CallByName Num.20 Json.121 Json.440; - let Json.438 : {List U8, U64} = Struct {Json.125, Json.439}; - ret Json.438; + dec Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.490 : List U8 = CallByName List.4 Json.123 Json.491; + ret Json.490; + +procedure Json.120 (Json.488, Json.489): + let Json.126 : Str = StructAtIndex 0 Json.489; + inc Json.126; + let Json.127 : Str = StructAtIndex 1 Json.489; + inc Json.127; + dec Json.489; + let Json.124 : List U8 = StructAtIndex 0 Json.488; + inc Json.124; + let Json.125 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.516 : I64 = 34i64; + let Json.515 : U8 = CallByName Num.127 Json.516; + let Json.513 : List U8 = CallByName List.4 Json.124 Json.515; + let Json.514 : List U8 = CallByName Str.12 Json.126; + let Json.510 : List U8 = CallByName List.8 Json.513 Json.514; + let Json.512 : I64 = 34i64; + let Json.511 : U8 = CallByName Num.127 Json.512; + let Json.507 : List U8 = CallByName List.4 Json.510 Json.511; + let Json.509 : I64 = 58i64; + let Json.508 : U8 = CallByName Num.127 Json.509; + let Json.505 : List U8 = CallByName List.4 Json.507 Json.508; + let Json.506 : {} = Struct {}; + let Json.128 : List U8 = CallByName Encode.24 Json.505 Json.127 Json.506; + joinpoint Json.500 Json.129: + let Json.498 : U64 = 1i64; + let Json.497 : U64 = CallByName Num.20 Json.125 Json.498; + let Json.496 : {List U8, U64} = Struct {Json.129, Json.497}; + ret Json.496; in - let Json.446 : U64 = 1i64; - let Json.443 : Int1 = CallByName Num.24 Json.121 Json.446; - if Json.443 then - let Json.445 : I64 = 44i64; - let Json.444 : U8 = CallByName Num.127 Json.445; - let Json.441 : List U8 = CallByName List.4 Json.124 Json.444; - jump Json.442 Json.441; + let Json.504 : U64 = 1i64; + let Json.501 : Int1 = CallByName Num.24 Json.125 Json.504; + if Json.501 then + let Json.503 : I64 = 44i64; + let Json.502 : U8 = CallByName Num.127 Json.503; + let Json.499 : List U8 = CallByName List.4 Json.128 Json.502; + jump Json.500 Json.499; else - jump Json.442 Json.124; - -procedure Json.18 (Json.97): - let Json.474 : Str = CallByName Encode.22 Json.97; - ret Json.474; - -procedure Json.20 (Json.113): - let Json.426 : List {Str, Str} = CallByName Encode.22 Json.113; - ret Json.426; - -procedure Json.98 (Json.99, Json.464, Json.97): - let Json.473 : I64 = 34i64; - let Json.472 : U8 = CallByName Num.127 Json.473; - let Json.470 : List U8 = CallByName List.4 Json.99 Json.472; - let Json.471 : List U8 = CallByName Str.12 Json.97; - let Json.467 : List U8 = CallByName List.8 Json.470 Json.471; - let Json.469 : I64 = 34i64; - let Json.468 : U8 = CallByName Num.127 Json.469; - let Json.466 : List U8 = CallByName List.4 Json.467 Json.468; - ret Json.466; + jump Json.500 Json.128; + +procedure Json.18 (Json.101): + let Json.532 : Str = CallByName Encode.23 Json.101; + ret Json.532; + +procedure Json.20 (Json.117): + let Json.484 : List {Str, Str} = CallByName Encode.23 Json.117; + ret Json.484; procedure List.139 (List.140, List.141, List.138): - let List.541 : {List U8, U64} = CallByName Json.116 List.140 List.141; + let List.541 : {List U8, U64} = CallByName Json.120 List.140 List.141; ret List.541; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt --- a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt @@ -235,7 +235,7 @@ procedure Test.0 (): let Test.12 : Str = "bar"; let Test.9 : {Str, Str} = Struct {Test.11, Test.12}; let Test.10 : {} = CallByName Json.1; - let Test.8 : List U8 = CallByName Encode.25 Test.9 Test.10; + let Test.8 : List U8 = CallByName Encode.26 Test.9 Test.10; let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8; let Test.5 : U8 = 1i64; let Test.6 : U8 = GetTagId Test.1; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -1,34 +1,34 @@ -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : Str = CallByName Json.18 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : Str = CallByName Json.18 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; + let Json.483 : {} = Struct {}; + ret Json.483; -procedure Json.18 (Json.97): - let Json.426 : Str = CallByName Encode.22 Json.97; - ret Json.426; +procedure Json.102 (Json.103, Json.486, Json.101): + let Json.495 : I64 = 34i64; + let Json.494 : U8 = CallByName Num.127 Json.495; + let Json.492 : List U8 = CallByName List.4 Json.103 Json.494; + let Json.493 : List U8 = CallByName Str.12 Json.101; + let Json.489 : List U8 = CallByName List.8 Json.492 Json.493; + let Json.491 : I64 = 34i64; + let Json.490 : U8 = CallByName Num.127 Json.491; + let Json.488 : List U8 = CallByName List.4 Json.489 Json.490; + ret Json.488; -procedure Json.98 (Json.99, Json.428, Json.97): - let Json.437 : I64 = 34i64; - let Json.436 : U8 = CallByName Num.127 Json.437; - let Json.434 : List U8 = CallByName List.4 Json.99 Json.436; - let Json.435 : List U8 = CallByName Str.12 Json.97; - let Json.431 : List U8 = CallByName List.8 Json.434 Json.435; - let Json.433 : I64 = 34i64; - let Json.432 : U8 = CallByName Num.127 Json.433; - let Json.430 : List U8 = CallByName List.4 Json.431 Json.432; - ret Json.430; +procedure Json.18 (Json.101): + let Json.484 : Str = CallByName Encode.23 Json.101; + ret Json.484; procedure List.4 (List.107, List.108): let List.503 : U64 = 1i64; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -86,7 +86,7 @@ procedure Str.9 (Str.77): procedure Test.0 (): let Test.9 : Str = "abc"; let Test.10 : {} = CallByName Json.1; - let Test.8 : List U8 = CallByName Encode.25 Test.9 Test.10; + let Test.8 : List U8 = CallByName Encode.26 Test.9 Test.10; let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8; let Test.5 : U8 = 1i64; let Test.6 : U8 = GetTagId Test.1; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt @@ -1,133 +1,133 @@ procedure #Derived.0 (#Derived.1): - let #Derived_gen.0 : Str = CallByName Encode.22 #Derived.1; + let #Derived_gen.0 : Str = CallByName Encode.23 #Derived.1; ret #Derived_gen.0; procedure #Derived.3 (#Derived.4, #Derived.5, #Derived.1): joinpoint #Derived_gen.5 #Derived_gen.4: - let #Derived_gen.3 : List U8 = CallByName Encode.23 #Derived.4 #Derived_gen.4 #Derived.5; + let #Derived_gen.3 : List U8 = CallByName Encode.24 #Derived.4 #Derived_gen.4 #Derived.5; ret #Derived_gen.3; in let #Derived_gen.7 : Str = "A"; let #Derived_gen.9 : Str = CallByName Json.18 #Derived.1; let #Derived_gen.8 : List Str = Array [#Derived_gen.9]; - let #Derived_gen.6 : {Str, List Str} = CallByName Json.21 #Derived_gen.7 #Derived_gen.8; + let #Derived_gen.6 : {Str, List Str} = CallByName Json.22 #Derived_gen.7 #Derived_gen.8; jump #Derived_gen.5 #Derived_gen.6; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName #Derived.3 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName #Derived.3 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.128 Encode.94 Encode.96 Encode.102; - ret Encode.113; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.144 Encode.99 Encode.101 Encode.107; + ret Encode.118; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.116 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; - ret Encode.116; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.121 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.121; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : Str = CallByName #Derived.0 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : Str = CallByName #Derived.0 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.128 (Json.129, Json.428, #Attr.12): - let Json.127 : List Str = StructAtIndex 1 #Attr.12; - inc Json.127; - let Json.126 : Str = StructAtIndex 0 #Attr.12; - inc Json.126; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.102 (Json.103, Json.527, Json.101): + let Json.536 : I64 = 34i64; + let Json.535 : U8 = CallByName Num.127 Json.536; + let Json.533 : List U8 = CallByName List.4 Json.103 Json.535; + let Json.534 : List U8 = CallByName Str.12 Json.101; + let Json.530 : List U8 = CallByName List.8 Json.533 Json.534; + let Json.532 : I64 = 34i64; + let Json.531 : U8 = CallByName Num.127 Json.532; + let Json.529 : List U8 = CallByName List.4 Json.530 Json.531; + ret Json.529; + +procedure Json.144 (Json.145, Json.486, #Attr.12): + let Json.143 : List Str = StructAtIndex 1 #Attr.12; + inc Json.143; + let Json.142 : Str = StructAtIndex 0 #Attr.12; + inc Json.142; dec #Attr.12; - let Json.466 : I64 = 123i64; - let Json.465 : U8 = CallByName Num.127 Json.466; - let Json.462 : List U8 = CallByName List.4 Json.129 Json.465; - let Json.464 : I64 = 34i64; - let Json.463 : U8 = CallByName Num.127 Json.464; - let Json.460 : List U8 = CallByName List.4 Json.462 Json.463; - let Json.461 : List U8 = CallByName Str.12 Json.126; - let Json.457 : List U8 = CallByName List.8 Json.460 Json.461; - let Json.459 : I64 = 34i64; - let Json.458 : U8 = CallByName Num.127 Json.459; - let Json.454 : List U8 = CallByName List.4 Json.457 Json.458; - let Json.456 : I64 = 58i64; - let Json.455 : U8 = CallByName Num.127 Json.456; - let Json.451 : List U8 = CallByName List.4 Json.454 Json.455; - let Json.453 : I64 = 91i64; - let Json.452 : U8 = CallByName Num.127 Json.453; - let Json.131 : List U8 = CallByName List.4 Json.451 Json.452; - let Json.450 : U64 = CallByName List.6 Json.127; - let Json.438 : {List U8, U64} = Struct {Json.131, Json.450}; - let Json.439 : {} = Struct {}; - let Json.437 : {List U8, U64} = CallByName List.18 Json.127 Json.438 Json.439; - dec Json.127; - let Json.133 : List U8 = StructAtIndex 0 Json.437; - inc Json.133; - dec Json.437; - let Json.436 : I64 = 93i64; - let Json.435 : U8 = CallByName Num.127 Json.436; - let Json.432 : List U8 = CallByName List.4 Json.133 Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.431 : List U8 = CallByName List.4 Json.432 Json.433; - ret Json.431; - -procedure Json.130 (Json.430, Json.136): - let Json.134 : List U8 = StructAtIndex 0 Json.430; - inc Json.134; - let Json.135 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.449 : {} = Struct {}; - let Json.137 : List U8 = CallByName Encode.23 Json.134 Json.136 Json.449; - joinpoint Json.444 Json.138: - let Json.442 : U64 = 1i64; - let Json.441 : U64 = CallByName Num.20 Json.135 Json.442; - let Json.440 : {List U8, U64} = Struct {Json.138, Json.441}; - ret Json.440; + let Json.524 : I64 = 123i64; + let Json.523 : U8 = CallByName Num.127 Json.524; + let Json.520 : List U8 = CallByName List.4 Json.145 Json.523; + let Json.522 : I64 = 34i64; + let Json.521 : U8 = CallByName Num.127 Json.522; + let Json.518 : List U8 = CallByName List.4 Json.520 Json.521; + let Json.519 : List U8 = CallByName Str.12 Json.142; + let Json.515 : List U8 = CallByName List.8 Json.518 Json.519; + let Json.517 : I64 = 34i64; + let Json.516 : U8 = CallByName Num.127 Json.517; + let Json.512 : List U8 = CallByName List.4 Json.515 Json.516; + let Json.514 : I64 = 58i64; + let Json.513 : U8 = CallByName Num.127 Json.514; + let Json.509 : List U8 = CallByName List.4 Json.512 Json.513; + let Json.511 : I64 = 91i64; + let Json.510 : U8 = CallByName Num.127 Json.511; + let Json.147 : List U8 = CallByName List.4 Json.509 Json.510; + let Json.508 : U64 = CallByName List.6 Json.143; + let Json.496 : {List U8, U64} = Struct {Json.147, Json.508}; + let Json.497 : {} = Struct {}; + let Json.495 : {List U8, U64} = CallByName List.18 Json.143 Json.496 Json.497; + dec Json.143; + let Json.149 : List U8 = StructAtIndex 0 Json.495; + inc Json.149; + dec Json.495; + let Json.494 : I64 = 93i64; + let Json.493 : U8 = CallByName Num.127 Json.494; + let Json.490 : List U8 = CallByName List.4 Json.149 Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.489 : List U8 = CallByName List.4 Json.490 Json.491; + ret Json.489; + +procedure Json.146 (Json.488, Json.152): + let Json.150 : List U8 = StructAtIndex 0 Json.488; + inc Json.150; + let Json.151 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.507 : {} = Struct {}; + let Json.153 : List U8 = CallByName Encode.24 Json.150 Json.152 Json.507; + joinpoint Json.502 Json.154: + let Json.500 : U64 = 1i64; + let Json.499 : U64 = CallByName Num.20 Json.151 Json.500; + let Json.498 : {List U8, U64} = Struct {Json.154, Json.499}; + ret Json.498; in - let Json.448 : U64 = 1i64; - let Json.445 : Int1 = CallByName Num.24 Json.135 Json.448; - if Json.445 then - let Json.447 : I64 = 44i64; - let Json.446 : U8 = CallByName Num.127 Json.447; - let Json.443 : List U8 = CallByName List.4 Json.137 Json.446; - jump Json.444 Json.443; + let Json.506 : U64 = 1i64; + let Json.503 : Int1 = CallByName Num.24 Json.151 Json.506; + if Json.503 then + let Json.505 : I64 = 44i64; + let Json.504 : U8 = CallByName Num.127 Json.505; + let Json.501 : List U8 = CallByName List.4 Json.153 Json.504; + jump Json.502 Json.501; else - jump Json.444 Json.137; - -procedure Json.18 (Json.97): - let Json.467 : Str = CallByName Encode.22 Json.97; - ret Json.467; - -procedure Json.21 (Json.126, Json.127): - let Json.427 : {Str, List Str} = Struct {Json.126, Json.127}; - let Json.426 : {Str, List Str} = CallByName Encode.22 Json.427; - ret Json.426; - -procedure Json.98 (Json.99, Json.469, Json.97): - let Json.478 : I64 = 34i64; - let Json.477 : U8 = CallByName Num.127 Json.478; - let Json.475 : List U8 = CallByName List.4 Json.99 Json.477; - let Json.476 : List U8 = CallByName Str.12 Json.97; - let Json.472 : List U8 = CallByName List.8 Json.475 Json.476; - let Json.474 : I64 = 34i64; - let Json.473 : U8 = CallByName Num.127 Json.474; - let Json.471 : List U8 = CallByName List.4 Json.472 Json.473; - ret Json.471; + jump Json.502 Json.153; + +procedure Json.18 (Json.101): + let Json.525 : Str = CallByName Encode.23 Json.101; + ret Json.525; + +procedure Json.22 (Json.142, Json.143): + let Json.485 : {Str, List Str} = Struct {Json.142, Json.143}; + let Json.484 : {Str, List Str} = CallByName Encode.23 Json.485; + ret Json.484; procedure List.139 (List.140, List.141, List.138): - let List.547 : {List U8, U64} = CallByName Json.130 List.140 List.141; + let List.547 : {List U8, U64} = CallByName Json.146 List.140 List.141; ret List.547; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt @@ -234,7 +234,7 @@ procedure Str.9 (Str.77): procedure Test.0 (): let Test.12 : Str = "foo"; let Test.11 : {} = CallByName Json.1; - let Test.10 : List U8 = CallByName Encode.25 Test.12 Test.11; + let Test.10 : List U8 = CallByName Encode.26 Test.12 Test.11; let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10; let Test.7 : U8 = 1i64; let Test.8 : U8 = GetTagId Test.2; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt @@ -1,10 +1,10 @@ procedure #Derived.0 (#Derived.1): - let #Derived_gen.0 : {Str, Str} = CallByName Encode.22 #Derived.1; + let #Derived_gen.0 : {Str, Str} = CallByName Encode.23 #Derived.1; ret #Derived_gen.0; procedure #Derived.4 (#Derived.5, #Derived.6, #Derived.1): joinpoint #Derived_gen.5 #Derived_gen.4: - let #Derived_gen.3 : List U8 = CallByName Encode.23 #Derived.5 #Derived_gen.4 #Derived.6; + let #Derived_gen.3 : List U8 = CallByName Encode.24 #Derived.5 #Derived_gen.4 #Derived.6; ret #Derived_gen.3; in let #Derived.2 : Str = StructAtIndex 0 #Derived.1; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt @@ -16,124 +16,124 @@ procedure #Derived.4 (#Derived.5, #Derived.6, #Derived.1): let #Derived_gen.9 : Str = CallByName Json.18 #Derived.2; let #Derived_gen.10 : Str = CallByName Json.18 #Derived.3; let #Derived_gen.8 : List Str = Array [#Derived_gen.9, #Derived_gen.10]; - let #Derived_gen.6 : {Str, List Str} = CallByName Json.21 #Derived_gen.7 #Derived_gen.8; + let #Derived_gen.6 : {Str, List Str} = CallByName Json.22 #Derived_gen.7 #Derived_gen.8; jump #Derived_gen.5 #Derived_gen.6; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName #Derived.4 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName #Derived.4 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.128 Encode.94 Encode.96 Encode.102; - ret Encode.113; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.144 Encode.99 Encode.101 Encode.107; + ret Encode.118; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.117 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; - ret Encode.117; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.122 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.122; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : {Str, Str} = CallByName #Derived.0 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : {Str, Str} = CallByName #Derived.0 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.128 (Json.129, Json.428, #Attr.12): - let Json.127 : List Str = StructAtIndex 1 #Attr.12; - inc Json.127; - let Json.126 : Str = StructAtIndex 0 #Attr.12; - inc Json.126; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.102 (Json.103, Json.527, Json.101): + let Json.536 : I64 = 34i64; + let Json.535 : U8 = CallByName Num.127 Json.536; + let Json.533 : List U8 = CallByName List.4 Json.103 Json.535; + let Json.534 : List U8 = CallByName Str.12 Json.101; + let Json.530 : List U8 = CallByName List.8 Json.533 Json.534; + let Json.532 : I64 = 34i64; + let Json.531 : U8 = CallByName Num.127 Json.532; + let Json.529 : List U8 = CallByName List.4 Json.530 Json.531; + ret Json.529; + +procedure Json.144 (Json.145, Json.486, #Attr.12): + let Json.143 : List Str = StructAtIndex 1 #Attr.12; + inc Json.143; + let Json.142 : Str = StructAtIndex 0 #Attr.12; + inc Json.142; dec #Attr.12; - let Json.466 : I64 = 123i64; - let Json.465 : U8 = CallByName Num.127 Json.466; - let Json.462 : List U8 = CallByName List.4 Json.129 Json.465; - let Json.464 : I64 = 34i64; - let Json.463 : U8 = CallByName Num.127 Json.464; - let Json.460 : List U8 = CallByName List.4 Json.462 Json.463; - let Json.461 : List U8 = CallByName Str.12 Json.126; - let Json.457 : List U8 = CallByName List.8 Json.460 Json.461; - let Json.459 : I64 = 34i64; - let Json.458 : U8 = CallByName Num.127 Json.459; - let Json.454 : List U8 = CallByName List.4 Json.457 Json.458; - let Json.456 : I64 = 58i64; - let Json.455 : U8 = CallByName Num.127 Json.456; - let Json.451 : List U8 = CallByName List.4 Json.454 Json.455; - let Json.453 : I64 = 91i64; - let Json.452 : U8 = CallByName Num.127 Json.453; - let Json.131 : List U8 = CallByName List.4 Json.451 Json.452; - let Json.450 : U64 = CallByName List.6 Json.127; - let Json.438 : {List U8, U64} = Struct {Json.131, Json.450}; - let Json.439 : {} = Struct {}; - let Json.437 : {List U8, U64} = CallByName List.18 Json.127 Json.438 Json.439; - dec Json.127; - let Json.133 : List U8 = StructAtIndex 0 Json.437; - inc Json.133; - dec Json.437; - let Json.436 : I64 = 93i64; - let Json.435 : U8 = CallByName Num.127 Json.436; - let Json.432 : List U8 = CallByName List.4 Json.133 Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.431 : List U8 = CallByName List.4 Json.432 Json.433; - ret Json.431; - -procedure Json.130 (Json.430, Json.136): - let Json.134 : List U8 = StructAtIndex 0 Json.430; - inc Json.134; - let Json.135 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.449 : {} = Struct {}; - let Json.137 : List U8 = CallByName Encode.23 Json.134 Json.136 Json.449; - joinpoint Json.444 Json.138: - let Json.442 : U64 = 1i64; - let Json.441 : U64 = CallByName Num.20 Json.135 Json.442; - let Json.440 : {List U8, U64} = Struct {Json.138, Json.441}; - ret Json.440; + let Json.524 : I64 = 123i64; + let Json.523 : U8 = CallByName Num.127 Json.524; + let Json.520 : List U8 = CallByName List.4 Json.145 Json.523; + let Json.522 : I64 = 34i64; + let Json.521 : U8 = CallByName Num.127 Json.522; + let Json.518 : List U8 = CallByName List.4 Json.520 Json.521; + let Json.519 : List U8 = CallByName Str.12 Json.142; + let Json.515 : List U8 = CallByName List.8 Json.518 Json.519; + let Json.517 : I64 = 34i64; + let Json.516 : U8 = CallByName Num.127 Json.517; + let Json.512 : List U8 = CallByName List.4 Json.515 Json.516; + let Json.514 : I64 = 58i64; + let Json.513 : U8 = CallByName Num.127 Json.514; + let Json.509 : List U8 = CallByName List.4 Json.512 Json.513; + let Json.511 : I64 = 91i64; + let Json.510 : U8 = CallByName Num.127 Json.511; + let Json.147 : List U8 = CallByName List.4 Json.509 Json.510; + let Json.508 : U64 = CallByName List.6 Json.143; + let Json.496 : {List U8, U64} = Struct {Json.147, Json.508}; + let Json.497 : {} = Struct {}; + let Json.495 : {List U8, U64} = CallByName List.18 Json.143 Json.496 Json.497; + dec Json.143; + let Json.149 : List U8 = StructAtIndex 0 Json.495; + inc Json.149; + dec Json.495; + let Json.494 : I64 = 93i64; + let Json.493 : U8 = CallByName Num.127 Json.494; + let Json.490 : List U8 = CallByName List.4 Json.149 Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.489 : List U8 = CallByName List.4 Json.490 Json.491; + ret Json.489; + +procedure Json.146 (Json.488, Json.152): + let Json.150 : List U8 = StructAtIndex 0 Json.488; + inc Json.150; + let Json.151 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.507 : {} = Struct {}; + let Json.153 : List U8 = CallByName Encode.24 Json.150 Json.152 Json.507; + joinpoint Json.502 Json.154: + let Json.500 : U64 = 1i64; + let Json.499 : U64 = CallByName Num.20 Json.151 Json.500; + let Json.498 : {List U8, U64} = Struct {Json.154, Json.499}; + ret Json.498; in - let Json.448 : U64 = 1i64; - let Json.445 : Int1 = CallByName Num.24 Json.135 Json.448; - if Json.445 then - let Json.447 : I64 = 44i64; - let Json.446 : U8 = CallByName Num.127 Json.447; - let Json.443 : List U8 = CallByName List.4 Json.137 Json.446; - jump Json.444 Json.443; + let Json.506 : U64 = 1i64; + let Json.503 : Int1 = CallByName Num.24 Json.151 Json.506; + if Json.503 then + let Json.505 : I64 = 44i64; + let Json.504 : U8 = CallByName Num.127 Json.505; + let Json.501 : List U8 = CallByName List.4 Json.153 Json.504; + jump Json.502 Json.501; else - jump Json.444 Json.137; - -procedure Json.18 (Json.97): - let Json.479 : Str = CallByName Encode.22 Json.97; - ret Json.479; - -procedure Json.21 (Json.126, Json.127): - let Json.427 : {Str, List Str} = Struct {Json.126, Json.127}; - let Json.426 : {Str, List Str} = CallByName Encode.22 Json.427; - ret Json.426; - -procedure Json.98 (Json.99, Json.469, Json.97): - let Json.478 : I64 = 34i64; - let Json.477 : U8 = CallByName Num.127 Json.478; - let Json.475 : List U8 = CallByName List.4 Json.99 Json.477; - let Json.476 : List U8 = CallByName Str.12 Json.97; - let Json.472 : List U8 = CallByName List.8 Json.475 Json.476; - let Json.474 : I64 = 34i64; - let Json.473 : U8 = CallByName Num.127 Json.474; - let Json.471 : List U8 = CallByName List.4 Json.472 Json.473; - ret Json.471; + jump Json.502 Json.153; + +procedure Json.18 (Json.101): + let Json.537 : Str = CallByName Encode.23 Json.101; + ret Json.537; + +procedure Json.22 (Json.142, Json.143): + let Json.485 : {Str, List Str} = Struct {Json.142, Json.143}; + let Json.484 : {Str, List Str} = CallByName Encode.23 Json.485; + ret Json.484; procedure List.139 (List.140, List.141, List.138): - let List.547 : {List U8, U64} = CallByName Json.130 List.140 List.141; + let List.547 : {List U8, U64} = CallByName Json.146 List.140 List.141; ret List.547; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt --- a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt @@ -242,7 +242,7 @@ procedure Test.0 (): let Test.12 : Str = "foo"; let Test.1 : {Str, Str} = Struct {Test.12, Test.13}; let Test.11 : {} = CallByName Json.1; - let Test.10 : List U8 = CallByName Encode.25 Test.1 Test.11; + let Test.10 : List U8 = CallByName Encode.26 Test.1 Test.11; let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10; let Test.7 : U8 = 1i64; let Test.8 : U8 = GetTagId Test.2; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -28,229 +28,229 @@ procedure Bool.7 (Bool.19, Bool.20): let Bool.37 : Int1 = CallByName Bool.12 Bool.19 Bool.20; ret Bool.37; -procedure Decode.23 (Decode.94): - ret Decode.94; - -procedure Decode.24 (Decode.95, Decode.114, Decode.97): - let Decode.127 : {List U8, [C {}, C Str]} = CallByName Json.299 Decode.95 Decode.97; - ret Decode.127; - -procedure Decode.25 (Decode.98, Decode.99): - let Decode.126 : {} = CallByName Json.42; - let Decode.125 : {List U8, [C {}, C Str]} = CallByName Decode.24 Decode.98 Decode.126 Decode.99; - ret Decode.125; - -procedure Decode.26 (Decode.100, Decode.101): - let Decode.115 : {List U8, [C {}, C Str]} = CallByName Decode.25 Decode.100 Decode.101; - let Decode.103 : List U8 = StructAtIndex 0 Decode.115; - inc Decode.103; - let Decode.102 : [C {}, C Str] = StructAtIndex 1 Decode.115; - inc Decode.102; - dec Decode.115; - let Decode.118 : Int1 = CallByName List.1 Decode.103; - if Decode.118 then - dec Decode.103; - let Decode.122 : U8 = 1i64; - let Decode.123 : U8 = GetTagId Decode.102; - let Decode.124 : Int1 = lowlevel Eq Decode.122 Decode.123; - if Decode.124 then - let Decode.104 : Str = UnionAtIndex (Id 1) (Index 0) Decode.102; - inc Decode.104; - dec Decode.102; - let Decode.119 : [C [C List U8, C ], C Str] = TagId(1) Decode.104; - ret Decode.119; +procedure Decode.24 (Decode.101): + ret Decode.101; + +procedure Decode.25 (Decode.102, Decode.121, Decode.104): + let Decode.134 : {List U8, [C {}, C Str]} = CallByName Json.315 Decode.102 Decode.104; + ret Decode.134; + +procedure Decode.26 (Decode.105, Decode.106): + let Decode.133 : {} = CallByName Json.43; + let Decode.132 : {List U8, [C {}, C Str]} = CallByName Decode.25 Decode.105 Decode.133 Decode.106; + ret Decode.132; + +procedure Decode.27 (Decode.107, Decode.108): + let Decode.122 : {List U8, [C {}, C Str]} = CallByName Decode.26 Decode.107 Decode.108; + let Decode.110 : List U8 = StructAtIndex 0 Decode.122; + inc Decode.110; + let Decode.109 : [C {}, C Str] = StructAtIndex 1 Decode.122; + inc Decode.109; + dec Decode.122; + let Decode.125 : Int1 = CallByName List.1 Decode.110; + if Decode.125 then + dec Decode.110; + let Decode.129 : U8 = 1i64; + let Decode.130 : U8 = GetTagId Decode.109; + let Decode.131 : Int1 = lowlevel Eq Decode.129 Decode.130; + if Decode.131 then + let Decode.111 : Str = UnionAtIndex (Id 1) (Index 0) Decode.109; + inc Decode.111; + dec Decode.109; + let Decode.126 : [C [C List U8, C ], C Str] = TagId(1) Decode.111; + ret Decode.126; else - dec Decode.102; - let Decode.121 : [C List U8, C ] = TagId(1) ; - let Decode.120 : [C [C List U8, C ], C Str] = TagId(0) Decode.121; - ret Decode.120; + dec Decode.109; + let Decode.128 : [C List U8, C ] = TagId(1) ; + let Decode.127 : [C [C List U8, C ], C Str] = TagId(0) Decode.128; + ret Decode.127; else - dec Decode.102; - let Decode.117 : [C List U8, C ] = TagId(0) Decode.103; - let Decode.116 : [C [C List U8, C ], C Str] = TagId(0) Decode.117; - ret Decode.116; - -procedure Json.144 (Json.512, Json.513): - joinpoint Json.450 Json.447 Json.143: - let Json.146 : List U8 = StructAtIndex 0 Json.447; - inc Json.146; - let Json.145 : List U8 = StructAtIndex 1 Json.447; - inc Json.145; - dec Json.447; - joinpoint Json.490: - let Json.487 : {List U8, List U8} = Struct {Json.146, Json.145}; - ret Json.487; + dec Decode.109; + let Decode.124 : [C List U8, C ] = TagId(0) Decode.110; + let Decode.123 : [C [C List U8, C ], C Str] = TagId(0) Decode.124; + ret Decode.123; + +procedure Json.160 (Json.570, Json.571): + joinpoint Json.508 Json.505 Json.159: + let Json.162 : List U8 = StructAtIndex 0 Json.505; + inc Json.162; + let Json.161 : List U8 = StructAtIndex 1 Json.505; + inc Json.161; + dec Json.505; + joinpoint Json.548: + let Json.545 : {List U8, List U8} = Struct {Json.162, Json.161}; + ret Json.545; in - let Json.496 : U64 = lowlevel ListLen Json.146; - let Json.497 : U64 = 2i64; - let Json.498 : Int1 = lowlevel NumGte Json.496 Json.497; - if Json.498 then - let Json.489 : U64 = 0i64; - let Json.147 : U8 = lowlevel ListGetUnsafe Json.146 Json.489; - let Json.488 : U64 = 1i64; - let Json.148 : U8 = lowlevel ListGetUnsafe Json.146 Json.488; - let Json.458 : Int1 = CallByName Json.22 Json.147 Json.148; - if Json.458 then - let Json.465 : U64 = 2i64; - let Json.462 : List U8 = CallByName List.29 Json.146 Json.465; - let Json.464 : List U8 = CallByName List.4 Json.145 Json.147; - let Json.463 : List U8 = CallByName List.4 Json.464 Json.148; - let Json.460 : {List U8, List U8} = Struct {Json.462, Json.463}; - jump Json.450 Json.460 Json.143; + let Json.554 : U64 = lowlevel ListLen Json.162; + let Json.555 : U64 = 2i64; + let Json.556 : Int1 = lowlevel NumGte Json.554 Json.555; + if Json.556 then + let Json.547 : U64 = 0i64; + let Json.163 : U8 = lowlevel ListGetUnsafe Json.162 Json.547; + let Json.546 : U64 = 1i64; + let Json.164 : U8 = lowlevel ListGetUnsafe Json.162 Json.546; + let Json.516 : Int1 = CallByName Json.23 Json.163 Json.164; + if Json.516 then + let Json.523 : U64 = 2i64; + let Json.520 : List U8 = CallByName List.29 Json.162 Json.523; + let Json.522 : List U8 = CallByName List.4 Json.161 Json.163; + let Json.521 : List U8 = CallByName List.4 Json.522 Json.164; + let Json.518 : {List U8, List U8} = Struct {Json.520, Json.521}; + jump Json.508 Json.518 Json.159; else - let Json.452 : Int1 = CallByName Json.289 Json.147; - if Json.452 then - let Json.456 : List U8 = CallByName List.38 Json.146; - let Json.457 : List U8 = CallByName List.4 Json.145 Json.147; - let Json.454 : {List U8, List U8} = Struct {Json.456, Json.457}; - jump Json.450 Json.454 Json.143; + let Json.510 : Int1 = CallByName Json.305 Json.163; + if Json.510 then + let Json.514 : List U8 = CallByName List.38 Json.162; + let Json.515 : List U8 = CallByName List.4 Json.161 Json.163; + let Json.512 : {List U8, List U8} = Struct {Json.514, Json.515}; + jump Json.508 Json.512 Json.159; else - let Json.451 : {List U8, List U8} = Struct {Json.146, Json.145}; - ret Json.451; + let Json.509 : {List U8, List U8} = Struct {Json.162, Json.161}; + ret Json.509; else - let Json.493 : U64 = lowlevel ListLen Json.146; - let Json.494 : U64 = 1i64; - let Json.495 : Int1 = lowlevel NumGte Json.493 Json.494; - if Json.495 then - let Json.492 : U64 = 0i64; - let Json.149 : U8 = lowlevel ListGetUnsafe Json.146 Json.492; - joinpoint Json.485 Json.491: - if Json.491 then - let Json.483 : List U8 = CallByName List.38 Json.146; - let Json.484 : List U8 = CallByName List.4 Json.145 Json.149; - let Json.481 : {List U8, List U8} = Struct {Json.483, Json.484}; - jump Json.450 Json.481 Json.143; + let Json.551 : U64 = lowlevel ListLen Json.162; + let Json.552 : U64 = 1i64; + let Json.553 : Int1 = lowlevel NumGte Json.551 Json.552; + if Json.553 then + let Json.550 : U64 = 0i64; + let Json.165 : U8 = lowlevel ListGetUnsafe Json.162 Json.550; + joinpoint Json.543 Json.549: + if Json.549 then + let Json.541 : List U8 = CallByName List.38 Json.162; + let Json.542 : List U8 = CallByName List.4 Json.161 Json.165; + let Json.539 : {List U8, List U8} = Struct {Json.541, Json.542}; + jump Json.508 Json.539 Json.159; else - jump Json.490; + jump Json.548; in - let Json.486 : Int1 = CallByName Json.289 Json.149; - jump Json.485 Json.486; + let Json.544 : Int1 = CallByName Json.305 Json.165; + jump Json.543 Json.544; else - jump Json.490; + jump Json.548; in - jump Json.450 Json.512 Json.513; + jump Json.508 Json.570 Json.571; procedure Json.2 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.22 (Json.139, Json.140): - let Json.466 : {U8, U8} = Struct {Json.139, Json.140}; - joinpoint Json.475: - let Json.474 : Int1 = CallByName Bool.1; - ret Json.474; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.23 (Json.155, Json.156): + let Json.524 : {U8, U8} = Struct {Json.155, Json.156}; + joinpoint Json.533: + let Json.532 : Int1 = CallByName Bool.1; + ret Json.532; in - let Json.477 : U8 = StructAtIndex 0 Json.466; - let Json.478 : U8 = 92i64; - let Json.479 : Int1 = lowlevel Eq Json.478 Json.477; - if Json.479 then - let Json.476 : U8 = StructAtIndex 1 Json.466; - switch Json.476: + let Json.535 : U8 = StructAtIndex 0 Json.524; + let Json.536 : U8 = 92i64; + let Json.537 : Int1 = lowlevel Eq Json.536 Json.535; + if Json.537 then + let Json.534 : U8 = StructAtIndex 1 Json.524; + switch Json.534: case 98: - let Json.467 : Int1 = CallByName Bool.2; - ret Json.467; + let Json.525 : Int1 = CallByName Bool.2; + ret Json.525; case 102: - let Json.468 : Int1 = CallByName Bool.2; - ret Json.468; + let Json.526 : Int1 = CallByName Bool.2; + ret Json.526; case 110: - let Json.469 : Int1 = CallByName Bool.2; - ret Json.469; + let Json.527 : Int1 = CallByName Bool.2; + ret Json.527; case 114: - let Json.470 : Int1 = CallByName Bool.2; - ret Json.470; + let Json.528 : Int1 = CallByName Bool.2; + ret Json.528; case 116: - let Json.471 : Int1 = CallByName Bool.2; - ret Json.471; + let Json.529 : Int1 = CallByName Bool.2; + ret Json.529; case 34: - let Json.472 : Int1 = CallByName Bool.2; - ret Json.472; + let Json.530 : Int1 = CallByName Bool.2; + ret Json.530; case 92: - let Json.473 : Int1 = CallByName Bool.2; - ret Json.473; + let Json.531 : Int1 = CallByName Bool.2; + ret Json.531; default: - jump Json.475; + jump Json.533; else - jump Json.475; - -procedure Json.23 (Json.142, Json.143): - let Json.500 : List U8 = Array []; - let Json.449 : {List U8, List U8} = Struct {Json.142, Json.500}; - let Json.448 : {List U8, List U8} = CallByName Json.144 Json.449 Json.143; - ret Json.448; - -procedure Json.289 (Json.290): - let Json.502 : U8 = 34i64; - let Json.501 : Int1 = CallByName Bool.7 Json.290 Json.502; - ret Json.501; - -procedure Json.299 (Json.300, Json.428): - let Json.429 : {List U8, [C {}, C Str]} = CallByName Json.41 Json.300; - ret Json.429; - -procedure Json.41 (Json.282): - let Json.506 : U64 = 1i64; - inc Json.282; - let Json.505 : {List U8, List U8} = CallByName List.52 Json.282 Json.506; - let Json.283 : List U8 = StructAtIndex 0 Json.505; - inc Json.283; - let Json.285 : List U8 = StructAtIndex 1 Json.505; - inc Json.285; - dec Json.505; - let Json.504 : U8 = 34i64; - let Json.503 : List U8 = Array [Json.504]; - let Json.433 : Int1 = CallByName Bool.11 Json.283 Json.503; - dec Json.503; - dec Json.283; - if Json.433 then - dec Json.282; - let Json.446 : {} = Struct {}; - let Json.445 : {List U8, List U8} = CallByName Json.23 Json.285 Json.446; - let Json.288 : List U8 = StructAtIndex 0 Json.445; - inc Json.288; - let Json.287 : List U8 = StructAtIndex 1 Json.445; - inc Json.287; - dec Json.445; - let Json.434 : [C {U64, U8}, C Str] = CallByName Str.9 Json.287; - let Json.442 : U8 = 1i64; - let Json.443 : U8 = GetTagId Json.434; - let Json.444 : Int1 = lowlevel Eq Json.442 Json.443; - if Json.444 then - let Json.291 : Str = UnionAtIndex (Id 1) (Index 0) Json.434; - inc Json.291; - dec Json.434; - let Json.438 : U64 = 1i64; - let Json.437 : {List U8, List U8} = CallByName List.52 Json.288 Json.438; - let Json.293 : List U8 = StructAtIndex 1 Json.437; - inc Json.293; - dec Json.437; - let Json.436 : [C {}, C Str] = TagId(1) Json.291; - let Json.435 : {List U8, [C {}, C Str]} = Struct {Json.293, Json.436}; - ret Json.435; + jump Json.533; + +procedure Json.24 (Json.158, Json.159): + let Json.558 : List U8 = Array []; + let Json.507 : {List U8, List U8} = Struct {Json.158, Json.558}; + let Json.506 : {List U8, List U8} = CallByName Json.160 Json.507 Json.159; + ret Json.506; + +procedure Json.305 (Json.306): + let Json.560 : U8 = 34i64; + let Json.559 : Int1 = CallByName Bool.7 Json.306 Json.560; + ret Json.559; + +procedure Json.315 (Json.316, Json.486): + let Json.487 : {List U8, [C {}, C Str]} = CallByName Json.42 Json.316; + ret Json.487; + +procedure Json.42 (Json.298): + let Json.564 : U64 = 1i64; + inc Json.298; + let Json.563 : {List U8, List U8} = CallByName List.52 Json.298 Json.564; + let Json.299 : List U8 = StructAtIndex 0 Json.563; + inc Json.299; + let Json.301 : List U8 = StructAtIndex 1 Json.563; + inc Json.301; + dec Json.563; + let Json.562 : U8 = 34i64; + let Json.561 : List U8 = Array [Json.562]; + let Json.491 : Int1 = CallByName Bool.11 Json.299 Json.561; + dec Json.561; + dec Json.299; + if Json.491 then + dec Json.298; + let Json.504 : {} = Struct {}; + let Json.503 : {List U8, List U8} = CallByName Json.24 Json.301 Json.504; + let Json.304 : List U8 = StructAtIndex 0 Json.503; + inc Json.304; + let Json.303 : List U8 = StructAtIndex 1 Json.503; + inc Json.303; + dec Json.503; + let Json.492 : [C {U64, U8}, C Str] = CallByName Str.9 Json.303; + let Json.500 : U8 = 1i64; + let Json.501 : U8 = GetTagId Json.492; + let Json.502 : Int1 = lowlevel Eq Json.500 Json.501; + if Json.502 then + let Json.307 : Str = UnionAtIndex (Id 1) (Index 0) Json.492; + inc Json.307; + dec Json.492; + let Json.496 : U64 = 1i64; + let Json.495 : {List U8, List U8} = CallByName List.52 Json.304 Json.496; + let Json.309 : List U8 = StructAtIndex 1 Json.495; + inc Json.309; + dec Json.495; + let Json.494 : [C {}, C Str] = TagId(1) Json.307; + let Json.493 : {List U8, [C {}, C Str]} = Struct {Json.309, Json.494}; + ret Json.493; else - dec Json.434; - let Json.441 : {} = Struct {}; - let Json.440 : [C {}, C Str] = TagId(0) Json.441; - let Json.439 : {List U8, [C {}, C Str]} = Struct {Json.288, Json.440}; - ret Json.439; + dec Json.492; + let Json.499 : {} = Struct {}; + let Json.498 : [C {}, C Str] = TagId(0) Json.499; + let Json.497 : {List U8, [C {}, C Str]} = Struct {Json.304, Json.498}; + ret Json.497; else - dec Json.285; - let Json.432 : {} = Struct {}; - let Json.431 : [C {}, C Str] = TagId(0) Json.432; - let Json.430 : {List U8, [C {}, C Str]} = Struct {Json.282, Json.431}; - ret Json.430; + dec Json.301; + let Json.490 : {} = Struct {}; + let Json.489 : [C {}, C Str] = TagId(0) Json.490; + let Json.488 : {List U8, [C {}, C Str]} = Struct {Json.298, Json.489}; + ret Json.488; -procedure Json.42 (): - let Json.427 : {} = Struct {}; - let Json.426 : {} = CallByName Decode.23 Json.427; - ret Json.426; +procedure Json.43 (): + let Json.485 : {} = Struct {}; + let Json.484 : {} = CallByName Decode.24 Json.485; + ret Json.484; procedure List.1 (List.95): let List.495 : U64 = CallByName List.6 List.95; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -374,7 +374,7 @@ procedure Test.3 (): let Test.0 : List U8 = Array [82i64, 111i64, 99i64]; let Test.8 : {} = CallByName Json.2; inc Test.0; - let Test.1 : [C [C List U8, C ], C Str] = CallByName Decode.26 Test.0 Test.8; + let Test.1 : [C [C List U8, C ], C Str] = CallByName Decode.27 Test.0 Test.8; let Test.7 : Str = "Roc"; let Test.6 : [C [C List U8, C ], C Str] = TagId(1) Test.7; inc Test.1; diff --git a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt --- a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt +++ b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt @@ -32,199 +32,199 @@ procedure Bool.7 (Bool.19, Bool.20): let Bool.37 : Int1 = CallByName Bool.12 Bool.19 Bool.20; ret Bool.37; -procedure Decode.23 (Decode.94): - ret Decode.94; - -procedure Decode.24 (Decode.95, Decode.114, Decode.97): - let Decode.117 : {List U8, [C {}, C Str]} = CallByName Json.299 Decode.95 Decode.97; - ret Decode.117; - -procedure Decode.25 (Decode.98, Decode.99): - let Decode.116 : {} = CallByName Json.42; - let Decode.115 : {List U8, [C {}, C Str]} = CallByName Decode.24 Decode.98 Decode.116 Decode.99; - ret Decode.115; - -procedure Json.144 (Json.512, Json.513): - joinpoint Json.450 Json.447 Json.143: - let Json.146 : List U8 = StructAtIndex 0 Json.447; - inc Json.146; - let Json.145 : List U8 = StructAtIndex 1 Json.447; - inc Json.145; - dec Json.447; - joinpoint Json.490: - let Json.487 : {List U8, List U8} = Struct {Json.146, Json.145}; - ret Json.487; +procedure Decode.24 (Decode.101): + ret Decode.101; + +procedure Decode.25 (Decode.102, Decode.121, Decode.104): + let Decode.124 : {List U8, [C {}, C Str]} = CallByName Json.315 Decode.102 Decode.104; + ret Decode.124; + +procedure Decode.26 (Decode.105, Decode.106): + let Decode.123 : {} = CallByName Json.43; + let Decode.122 : {List U8, [C {}, C Str]} = CallByName Decode.25 Decode.105 Decode.123 Decode.106; + ret Decode.122; + +procedure Json.160 (Json.570, Json.571): + joinpoint Json.508 Json.505 Json.159: + let Json.162 : List U8 = StructAtIndex 0 Json.505; + inc Json.162; + let Json.161 : List U8 = StructAtIndex 1 Json.505; + inc Json.161; + dec Json.505; + joinpoint Json.548: + let Json.545 : {List U8, List U8} = Struct {Json.162, Json.161}; + ret Json.545; in - let Json.496 : U64 = lowlevel ListLen Json.146; - let Json.497 : U64 = 2i64; - let Json.498 : Int1 = lowlevel NumGte Json.496 Json.497; - if Json.498 then - let Json.489 : U64 = 0i64; - let Json.147 : U8 = lowlevel ListGetUnsafe Json.146 Json.489; - let Json.488 : U64 = 1i64; - let Json.148 : U8 = lowlevel ListGetUnsafe Json.146 Json.488; - let Json.458 : Int1 = CallByName Json.22 Json.147 Json.148; - if Json.458 then - let Json.465 : U64 = 2i64; - let Json.462 : List U8 = CallByName List.29 Json.146 Json.465; - let Json.464 : List U8 = CallByName List.4 Json.145 Json.147; - let Json.463 : List U8 = CallByName List.4 Json.464 Json.148; - let Json.460 : {List U8, List U8} = Struct {Json.462, Json.463}; - jump Json.450 Json.460 Json.143; + let Json.554 : U64 = lowlevel ListLen Json.162; + let Json.555 : U64 = 2i64; + let Json.556 : Int1 = lowlevel NumGte Json.554 Json.555; + if Json.556 then + let Json.547 : U64 = 0i64; + let Json.163 : U8 = lowlevel ListGetUnsafe Json.162 Json.547; + let Json.546 : U64 = 1i64; + let Json.164 : U8 = lowlevel ListGetUnsafe Json.162 Json.546; + let Json.516 : Int1 = CallByName Json.23 Json.163 Json.164; + if Json.516 then + let Json.523 : U64 = 2i64; + let Json.520 : List U8 = CallByName List.29 Json.162 Json.523; + let Json.522 : List U8 = CallByName List.4 Json.161 Json.163; + let Json.521 : List U8 = CallByName List.4 Json.522 Json.164; + let Json.518 : {List U8, List U8} = Struct {Json.520, Json.521}; + jump Json.508 Json.518 Json.159; else - let Json.452 : Int1 = CallByName Json.289 Json.147; - if Json.452 then - let Json.456 : List U8 = CallByName List.38 Json.146; - let Json.457 : List U8 = CallByName List.4 Json.145 Json.147; - let Json.454 : {List U8, List U8} = Struct {Json.456, Json.457}; - jump Json.450 Json.454 Json.143; + let Json.510 : Int1 = CallByName Json.305 Json.163; + if Json.510 then + let Json.514 : List U8 = CallByName List.38 Json.162; + let Json.515 : List U8 = CallByName List.4 Json.161 Json.163; + let Json.512 : {List U8, List U8} = Struct {Json.514, Json.515}; + jump Json.508 Json.512 Json.159; else - let Json.451 : {List U8, List U8} = Struct {Json.146, Json.145}; - ret Json.451; + let Json.509 : {List U8, List U8} = Struct {Json.162, Json.161}; + ret Json.509; else - let Json.493 : U64 = lowlevel ListLen Json.146; - let Json.494 : U64 = 1i64; - let Json.495 : Int1 = lowlevel NumGte Json.493 Json.494; - if Json.495 then - let Json.492 : U64 = 0i64; - let Json.149 : U8 = lowlevel ListGetUnsafe Json.146 Json.492; - joinpoint Json.485 Json.491: - if Json.491 then - let Json.483 : List U8 = CallByName List.38 Json.146; - let Json.484 : List U8 = CallByName List.4 Json.145 Json.149; - let Json.481 : {List U8, List U8} = Struct {Json.483, Json.484}; - jump Json.450 Json.481 Json.143; + let Json.551 : U64 = lowlevel ListLen Json.162; + let Json.552 : U64 = 1i64; + let Json.553 : Int1 = lowlevel NumGte Json.551 Json.552; + if Json.553 then + let Json.550 : U64 = 0i64; + let Json.165 : U8 = lowlevel ListGetUnsafe Json.162 Json.550; + joinpoint Json.543 Json.549: + if Json.549 then + let Json.541 : List U8 = CallByName List.38 Json.162; + let Json.542 : List U8 = CallByName List.4 Json.161 Json.165; + let Json.539 : {List U8, List U8} = Struct {Json.541, Json.542}; + jump Json.508 Json.539 Json.159; else - jump Json.490; + jump Json.548; in - let Json.486 : Int1 = CallByName Json.289 Json.149; - jump Json.485 Json.486; + let Json.544 : Int1 = CallByName Json.305 Json.165; + jump Json.543 Json.544; else - jump Json.490; + jump Json.548; in - jump Json.450 Json.512 Json.513; + jump Json.508 Json.570 Json.571; procedure Json.2 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.22 (Json.139, Json.140): - let Json.466 : {U8, U8} = Struct {Json.139, Json.140}; - joinpoint Json.475: - let Json.474 : Int1 = CallByName Bool.1; - ret Json.474; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.23 (Json.155, Json.156): + let Json.524 : {U8, U8} = Struct {Json.155, Json.156}; + joinpoint Json.533: + let Json.532 : Int1 = CallByName Bool.1; + ret Json.532; in - let Json.477 : U8 = StructAtIndex 0 Json.466; - let Json.478 : U8 = 92i64; - let Json.479 : Int1 = lowlevel Eq Json.478 Json.477; - if Json.479 then - let Json.476 : U8 = StructAtIndex 1 Json.466; - switch Json.476: + let Json.535 : U8 = StructAtIndex 0 Json.524; + let Json.536 : U8 = 92i64; + let Json.537 : Int1 = lowlevel Eq Json.536 Json.535; + if Json.537 then + let Json.534 : U8 = StructAtIndex 1 Json.524; + switch Json.534: case 98: - let Json.467 : Int1 = CallByName Bool.2; - ret Json.467; + let Json.525 : Int1 = CallByName Bool.2; + ret Json.525; case 102: - let Json.468 : Int1 = CallByName Bool.2; - ret Json.468; + let Json.526 : Int1 = CallByName Bool.2; + ret Json.526; case 110: - let Json.469 : Int1 = CallByName Bool.2; - ret Json.469; + let Json.527 : Int1 = CallByName Bool.2; + ret Json.527; case 114: - let Json.470 : Int1 = CallByName Bool.2; - ret Json.470; + let Json.528 : Int1 = CallByName Bool.2; + ret Json.528; case 116: - let Json.471 : Int1 = CallByName Bool.2; - ret Json.471; + let Json.529 : Int1 = CallByName Bool.2; + ret Json.529; case 34: - let Json.472 : Int1 = CallByName Bool.2; - ret Json.472; + let Json.530 : Int1 = CallByName Bool.2; + ret Json.530; case 92: - let Json.473 : Int1 = CallByName Bool.2; - ret Json.473; + let Json.531 : Int1 = CallByName Bool.2; + ret Json.531; default: - jump Json.475; + jump Json.533; else - jump Json.475; - -procedure Json.23 (Json.142, Json.143): - let Json.500 : List U8 = Array []; - let Json.449 : {List U8, List U8} = Struct {Json.142, Json.500}; - let Json.448 : {List U8, List U8} = CallByName Json.144 Json.449 Json.143; - ret Json.448; - -procedure Json.289 (Json.290): - let Json.502 : U8 = 34i64; - let Json.501 : Int1 = CallByName Bool.7 Json.290 Json.502; - ret Json.501; - -procedure Json.299 (Json.300, Json.428): - let Json.429 : {List U8, [C {}, C Str]} = CallByName Json.41 Json.300; - ret Json.429; - -procedure Json.41 (Json.282): - let Json.506 : U64 = 1i64; - inc Json.282; - let Json.505 : {List U8, List U8} = CallByName List.52 Json.282 Json.506; - let Json.283 : List U8 = StructAtIndex 0 Json.505; - inc Json.283; - let Json.285 : List U8 = StructAtIndex 1 Json.505; - inc Json.285; - dec Json.505; - let Json.504 : U8 = 34i64; - let Json.503 : List U8 = Array [Json.504]; - let Json.433 : Int1 = CallByName Bool.11 Json.283 Json.503; - dec Json.503; - dec Json.283; - if Json.433 then - dec Json.282; - let Json.446 : {} = Struct {}; - let Json.445 : {List U8, List U8} = CallByName Json.23 Json.285 Json.446; - let Json.288 : List U8 = StructAtIndex 0 Json.445; - inc Json.288; - let Json.287 : List U8 = StructAtIndex 1 Json.445; - inc Json.287; - dec Json.445; - let Json.434 : [C {U64, U8}, C Str] = CallByName Str.9 Json.287; - let Json.442 : U8 = 1i64; - let Json.443 : U8 = GetTagId Json.434; - let Json.444 : Int1 = lowlevel Eq Json.442 Json.443; - if Json.444 then - let Json.291 : Str = UnionAtIndex (Id 1) (Index 0) Json.434; - inc Json.291; - dec Json.434; - let Json.438 : U64 = 1i64; - let Json.437 : {List U8, List U8} = CallByName List.52 Json.288 Json.438; - let Json.293 : List U8 = StructAtIndex 1 Json.437; - inc Json.293; - dec Json.437; - let Json.436 : [C {}, C Str] = TagId(1) Json.291; - let Json.435 : {List U8, [C {}, C Str]} = Struct {Json.293, Json.436}; - ret Json.435; + jump Json.533; + +procedure Json.24 (Json.158, Json.159): + let Json.558 : List U8 = Array []; + let Json.507 : {List U8, List U8} = Struct {Json.158, Json.558}; + let Json.506 : {List U8, List U8} = CallByName Json.160 Json.507 Json.159; + ret Json.506; + +procedure Json.305 (Json.306): + let Json.560 : U8 = 34i64; + let Json.559 : Int1 = CallByName Bool.7 Json.306 Json.560; + ret Json.559; + +procedure Json.315 (Json.316, Json.486): + let Json.487 : {List U8, [C {}, C Str]} = CallByName Json.42 Json.316; + ret Json.487; + +procedure Json.42 (Json.298): + let Json.564 : U64 = 1i64; + inc Json.298; + let Json.563 : {List U8, List U8} = CallByName List.52 Json.298 Json.564; + let Json.299 : List U8 = StructAtIndex 0 Json.563; + inc Json.299; + let Json.301 : List U8 = StructAtIndex 1 Json.563; + inc Json.301; + dec Json.563; + let Json.562 : U8 = 34i64; + let Json.561 : List U8 = Array [Json.562]; + let Json.491 : Int1 = CallByName Bool.11 Json.299 Json.561; + dec Json.561; + dec Json.299; + if Json.491 then + dec Json.298; + let Json.504 : {} = Struct {}; + let Json.503 : {List U8, List U8} = CallByName Json.24 Json.301 Json.504; + let Json.304 : List U8 = StructAtIndex 0 Json.503; + inc Json.304; + let Json.303 : List U8 = StructAtIndex 1 Json.503; + inc Json.303; + dec Json.503; + let Json.492 : [C {U64, U8}, C Str] = CallByName Str.9 Json.303; + let Json.500 : U8 = 1i64; + let Json.501 : U8 = GetTagId Json.492; + let Json.502 : Int1 = lowlevel Eq Json.500 Json.501; + if Json.502 then + let Json.307 : Str = UnionAtIndex (Id 1) (Index 0) Json.492; + inc Json.307; + dec Json.492; + let Json.496 : U64 = 1i64; + let Json.495 : {List U8, List U8} = CallByName List.52 Json.304 Json.496; + let Json.309 : List U8 = StructAtIndex 1 Json.495; + inc Json.309; + dec Json.495; + let Json.494 : [C {}, C Str] = TagId(1) Json.307; + let Json.493 : {List U8, [C {}, C Str]} = Struct {Json.309, Json.494}; + ret Json.493; else - dec Json.434; - let Json.441 : {} = Struct {}; - let Json.440 : [C {}, C Str] = TagId(0) Json.441; - let Json.439 : {List U8, [C {}, C Str]} = Struct {Json.288, Json.440}; - ret Json.439; + dec Json.492; + let Json.499 : {} = Struct {}; + let Json.498 : [C {}, C Str] = TagId(0) Json.499; + let Json.497 : {List U8, [C {}, C Str]} = Struct {Json.304, Json.498}; + ret Json.497; else - dec Json.285; - let Json.432 : {} = Struct {}; - let Json.431 : [C {}, C Str] = TagId(0) Json.432; - let Json.430 : {List U8, [C {}, C Str]} = Struct {Json.282, Json.431}; - ret Json.430; + dec Json.301; + let Json.490 : {} = Struct {}; + let Json.489 : [C {}, C Str] = TagId(0) Json.490; + let Json.488 : {List U8, [C {}, C Str]} = Struct {Json.298, Json.489}; + ret Json.488; -procedure Json.42 (): - let Json.427 : {} = Struct {}; - let Json.426 : {} = CallByName Decode.23 Json.427; - ret Json.426; +procedure Json.43 (): + let Json.485 : {} = Struct {}; + let Json.484 : {} = CallByName Decode.24 Json.485; + ret Json.484; procedure List.29 (List.298, List.299): let List.543 : U64 = CallByName List.6 List.298; diff --git a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt --- a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt +++ b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt @@ -368,7 +368,7 @@ procedure Test.0 (): let Test.37 : Str = "-1234"; let Test.35 : List U8 = CallByName Str.12 Test.37; let Test.36 : {} = CallByName Json.2; - let Test.34 : {List U8, [C {}, C Str]} = CallByName Decode.25 Test.35 Test.36; + let Test.34 : {List U8, [C {}, C Str]} = CallByName Decode.26 Test.35 Test.36; let Test.2 : List U8 = StructAtIndex 0 Test.34; inc Test.2; let Test.1 : [C {}, C Str] = StructAtIndex 1 Test.34; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -2,121 +2,121 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName Test.5 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName Test.5 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.128 Encode.94 Encode.96 Encode.102; - ret Encode.113; - -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.118 : List U8 = CallByName Json.98 Encode.94 Encode.96 Encode.102; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.144 Encode.99 Encode.101 Encode.107; ret Encode.118; -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : {Str, Str} = CallByName Test.2 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.123 : List U8 = CallByName Json.102 Encode.99 Encode.101 Encode.107; + ret Encode.123; + +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : {Str, Str} = CallByName Test.2 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.128 (Json.129, Json.428, #Attr.12): - let Json.127 : List Str = StructAtIndex 1 #Attr.12; - inc Json.127; - let Json.126 : Str = StructAtIndex 0 #Attr.12; - inc Json.126; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.102 (Json.103, Json.530, Json.101): + let Json.539 : I64 = 34i64; + let Json.538 : U8 = CallByName Num.127 Json.539; + let Json.536 : List U8 = CallByName List.4 Json.103 Json.538; + let Json.537 : List U8 = CallByName Str.12 Json.101; + let Json.533 : List U8 = CallByName List.8 Json.536 Json.537; + let Json.535 : I64 = 34i64; + let Json.534 : U8 = CallByName Num.127 Json.535; + let Json.532 : List U8 = CallByName List.4 Json.533 Json.534; + ret Json.532; + +procedure Json.144 (Json.145, Json.486, #Attr.12): + let Json.143 : List Str = StructAtIndex 1 #Attr.12; + inc Json.143; + let Json.142 : Str = StructAtIndex 0 #Attr.12; + inc Json.142; dec #Attr.12; - let Json.466 : I64 = 123i64; - let Json.465 : U8 = CallByName Num.127 Json.466; - let Json.462 : List U8 = CallByName List.4 Json.129 Json.465; - let Json.464 : I64 = 34i64; - let Json.463 : U8 = CallByName Num.127 Json.464; - let Json.460 : List U8 = CallByName List.4 Json.462 Json.463; - let Json.461 : List U8 = CallByName Str.12 Json.126; - let Json.457 : List U8 = CallByName List.8 Json.460 Json.461; - let Json.459 : I64 = 34i64; - let Json.458 : U8 = CallByName Num.127 Json.459; - let Json.454 : List U8 = CallByName List.4 Json.457 Json.458; - let Json.456 : I64 = 58i64; - let Json.455 : U8 = CallByName Num.127 Json.456; - let Json.451 : List U8 = CallByName List.4 Json.454 Json.455; - let Json.453 : I64 = 91i64; - let Json.452 : U8 = CallByName Num.127 Json.453; - let Json.131 : List U8 = CallByName List.4 Json.451 Json.452; - let Json.450 : U64 = CallByName List.6 Json.127; - let Json.438 : {List U8, U64} = Struct {Json.131, Json.450}; - let Json.439 : {} = Struct {}; - let Json.437 : {List U8, U64} = CallByName List.18 Json.127 Json.438 Json.439; - dec Json.127; - let Json.133 : List U8 = StructAtIndex 0 Json.437; - inc Json.133; - dec Json.437; - let Json.436 : I64 = 93i64; - let Json.435 : U8 = CallByName Num.127 Json.436; - let Json.432 : List U8 = CallByName List.4 Json.133 Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.431 : List U8 = CallByName List.4 Json.432 Json.433; - ret Json.431; - -procedure Json.130 (Json.430, Json.136): - let Json.134 : List U8 = StructAtIndex 0 Json.430; - inc Json.134; - let Json.135 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.449 : {} = Struct {}; - let Json.137 : List U8 = CallByName Encode.23 Json.134 Json.136 Json.449; - joinpoint Json.444 Json.138: - let Json.442 : U64 = 1i64; - let Json.441 : U64 = CallByName Num.20 Json.135 Json.442; - let Json.440 : {List U8, U64} = Struct {Json.138, Json.441}; - ret Json.440; + let Json.524 : I64 = 123i64; + let Json.523 : U8 = CallByName Num.127 Json.524; + let Json.520 : List U8 = CallByName List.4 Json.145 Json.523; + let Json.522 : I64 = 34i64; + let Json.521 : U8 = CallByName Num.127 Json.522; + let Json.518 : List U8 = CallByName List.4 Json.520 Json.521; + let Json.519 : List U8 = CallByName Str.12 Json.142; + let Json.515 : List U8 = CallByName List.8 Json.518 Json.519; + let Json.517 : I64 = 34i64; + let Json.516 : U8 = CallByName Num.127 Json.517; + let Json.512 : List U8 = CallByName List.4 Json.515 Json.516; + let Json.514 : I64 = 58i64; + let Json.513 : U8 = CallByName Num.127 Json.514; + let Json.509 : List U8 = CallByName List.4 Json.512 Json.513; + let Json.511 : I64 = 91i64; + let Json.510 : U8 = CallByName Num.127 Json.511; + let Json.147 : List U8 = CallByName List.4 Json.509 Json.510; + let Json.508 : U64 = CallByName List.6 Json.143; + let Json.496 : {List U8, U64} = Struct {Json.147, Json.508}; + let Json.497 : {} = Struct {}; + let Json.495 : {List U8, U64} = CallByName List.18 Json.143 Json.496 Json.497; + dec Json.143; + let Json.149 : List U8 = StructAtIndex 0 Json.495; + inc Json.149; + dec Json.495; + let Json.494 : I64 = 93i64; + let Json.493 : U8 = CallByName Num.127 Json.494; + let Json.490 : List U8 = CallByName List.4 Json.149 Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.489 : List U8 = CallByName List.4 Json.490 Json.491; + ret Json.489; + +procedure Json.146 (Json.488, Json.152): + let Json.150 : List U8 = StructAtIndex 0 Json.488; + inc Json.150; + let Json.151 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.507 : {} = Struct {}; + let Json.153 : List U8 = CallByName Encode.24 Json.150 Json.152 Json.507; + joinpoint Json.502 Json.154: + let Json.500 : U64 = 1i64; + let Json.499 : U64 = CallByName Num.20 Json.151 Json.500; + let Json.498 : {List U8, U64} = Struct {Json.154, Json.499}; + ret Json.498; in - let Json.448 : U64 = 1i64; - let Json.445 : Int1 = CallByName Num.24 Json.135 Json.448; - if Json.445 then - let Json.447 : I64 = 44i64; - let Json.446 : U8 = CallByName Num.127 Json.447; - let Json.443 : List U8 = CallByName List.4 Json.137 Json.446; - jump Json.444 Json.443; + let Json.506 : U64 = 1i64; + let Json.503 : Int1 = CallByName Num.24 Json.151 Json.506; + if Json.503 then + let Json.505 : I64 = 44i64; + let Json.504 : U8 = CallByName Num.127 Json.505; + let Json.501 : List U8 = CallByName List.4 Json.153 Json.504; + jump Json.502 Json.501; else - jump Json.444 Json.137; - -procedure Json.18 (Json.97): - let Json.482 : Str = CallByName Encode.22 Json.97; - ret Json.482; - -procedure Json.21 (Json.126, Json.127): - let Json.468 : {Str, List Str} = Struct {Json.126, Json.127}; - let Json.467 : {Str, List Str} = CallByName Encode.22 Json.468; - ret Json.467; - -procedure Json.98 (Json.99, Json.472, Json.97): - let Json.481 : I64 = 34i64; - let Json.480 : U8 = CallByName Num.127 Json.481; - let Json.478 : List U8 = CallByName List.4 Json.99 Json.480; - let Json.479 : List U8 = CallByName Str.12 Json.97; - let Json.475 : List U8 = CallByName List.8 Json.478 Json.479; - let Json.477 : I64 = 34i64; - let Json.476 : U8 = CallByName Num.127 Json.477; - let Json.474 : List U8 = CallByName List.4 Json.475 Json.476; - ret Json.474; + jump Json.502 Json.153; + +procedure Json.18 (Json.101): + let Json.540 : Str = CallByName Encode.23 Json.101; + ret Json.540; + +procedure Json.22 (Json.142, Json.143): + let Json.526 : {Str, List Str} = Struct {Json.142, Json.143}; + let Json.525 : {Str, List Str} = CallByName Encode.23 Json.526; + ret Json.525; procedure List.139 (List.140, List.141, List.138): - let List.545 : {List U8, U64} = CallByName Json.130 List.140 List.141; + let List.545 : {List U8, U64} = CallByName Json.146 List.140 List.141; ret List.545; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -194,7 +194,7 @@ procedure Str.12 (#Attr.2): ret Str.267; procedure Test.2 (Test.10): - let Test.15 : {Str, Str} = CallByName Encode.22 Test.10; + let Test.15 : {Str, Str} = CallByName Encode.23 Test.10; ret Test.15; procedure Test.3 (): diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -205,7 +205,7 @@ procedure Test.3 (): procedure Test.5 (Test.6, Test.7, Test.4): joinpoint Test.20 Test.8: - let Test.18 : List U8 = CallByName Encode.23 Test.6 Test.8 Test.7; + let Test.18 : List U8 = CallByName Encode.24 Test.6 Test.8 Test.7; ret Test.18; in let Test.25 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -216,7 +216,7 @@ procedure Test.5 (Test.6, Test.7, Test.4): dec Test.4; let Test.28 : Str = CallByName Json.18 Test.29; let Test.27 : List Str = Array [Test.28]; - let Test.19 : {Str, List Str} = CallByName Json.21 Test.26 Test.27; + let Test.19 : {Str, List Str} = CallByName Json.22 Test.26 Test.27; jump Test.20 Test.19; else let Test.21 : Str = "B"; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -225,11 +225,11 @@ procedure Test.5 (Test.6, Test.7, Test.4): dec Test.4; let Test.23 : Str = CallByName Json.18 Test.24; let Test.22 : List Str = Array [Test.23]; - let Test.19 : {Str, List Str} = CallByName Json.21 Test.21 Test.22; + let Test.19 : {Str, List Str} = CallByName Json.22 Test.21 Test.22; jump Test.20 Test.19; procedure Test.0 (): let Test.12 : {Str, Str} = CallByName Test.3; let Test.13 : {} = CallByName Json.1; - let Test.11 : List U8 = CallByName Encode.25 Test.12 Test.13; + let Test.11 : List U8 = CallByName Encode.26 Test.12 Test.13; ret Test.11; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt @@ -1,230 +1,230 @@ procedure #Derived.0 (#Derived.1): let #Derived_gen.10 : [C {}, C {}] = TagId(0) #Derived.1; - let #Derived_gen.9 : [C {}, C {}] = CallByName Encode.22 #Derived_gen.10; + let #Derived_gen.9 : [C {}, C {}] = CallByName Encode.23 #Derived_gen.10; ret #Derived_gen.9; procedure #Derived.2 (#Derived.3, #Derived.4, #Attr.12): let #Derived.1 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12; joinpoint #Derived_gen.14 #Derived_gen.13: - let #Derived_gen.12 : List U8 = CallByName Encode.23 #Derived.3 #Derived_gen.13 #Derived.4; + let #Derived_gen.12 : List U8 = CallByName Encode.24 #Derived.3 #Derived_gen.13 #Derived.4; ret #Derived_gen.12; in let #Derived_gen.16 : Str = "A"; let #Derived_gen.17 : List [] = Array []; - let #Derived_gen.15 : {Str, List []} = CallByName Json.21 #Derived_gen.16 #Derived_gen.17; + let #Derived_gen.15 : {Str, List []} = CallByName Json.22 #Derived_gen.16 #Derived_gen.17; jump #Derived_gen.14 #Derived_gen.15; procedure #Derived.5 (#Derived.6): let #Derived_gen.1 : [C {}, C {}] = TagId(1) #Derived.6; - let #Derived_gen.0 : [C {}, C {}] = CallByName Encode.22 #Derived_gen.1; + let #Derived_gen.0 : [C {}, C {}] = CallByName Encode.23 #Derived_gen.1; ret #Derived_gen.0; procedure #Derived.7 (#Derived.8, #Derived.9, #Attr.12): let #Derived.6 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12; joinpoint #Derived_gen.5 #Derived_gen.4: - let #Derived_gen.3 : List U8 = CallByName Encode.23 #Derived.8 #Derived_gen.4 #Derived.9; + let #Derived_gen.3 : List U8 = CallByName Encode.24 #Derived.8 #Derived_gen.4 #Derived.9; ret #Derived_gen.3; in let #Derived_gen.7 : Str = "B"; let #Derived_gen.8 : List [] = Array []; - let #Derived_gen.6 : {Str, List []} = CallByName Json.21 #Derived_gen.7 #Derived_gen.8; + let #Derived_gen.6 : {Str, List []} = CallByName Json.22 #Derived_gen.7 #Derived_gen.8; jump #Derived_gen.5 #Derived_gen.6; procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.22 (Encode.93): - ret Encode.93; +procedure Encode.23 (Encode.98): + ret Encode.98; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.106 : List U8 = CallByName Test.5 Encode.94 Encode.96 Encode.102; - ret Encode.106; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.111 : List U8 = CallByName Test.5 Encode.99 Encode.101 Encode.107; + ret Encode.111; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.113 : List U8 = CallByName Json.128 Encode.94 Encode.96 Encode.102; - ret Encode.113; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.118 : List U8 = CallByName Json.144 Encode.99 Encode.101 Encode.107; + ret Encode.118; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.117 : U8 = GetTagId Encode.102; - switch Encode.117: +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.122 : U8 = GetTagId Encode.107; + switch Encode.122: case 0: - let Encode.116 : List U8 = CallByName #Derived.2 Encode.94 Encode.96 Encode.102; - ret Encode.116; + let Encode.121 : List U8 = CallByName #Derived.2 Encode.99 Encode.101 Encode.107; + ret Encode.121; default: - let Encode.116 : List U8 = CallByName #Derived.7 Encode.94 Encode.96 Encode.102; - ret Encode.116; + let Encode.121 : List U8 = CallByName #Derived.7 Encode.99 Encode.101 Encode.107; + ret Encode.121; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.129 : List U8 = CallByName Json.128 Encode.94 Encode.96 Encode.102; - ret Encode.129; +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.134 : List U8 = CallByName Json.144 Encode.99 Encode.101 Encode.107; + ret Encode.134; -procedure Encode.23 (Encode.94, Encode.102, Encode.96): - let Encode.133 : Str = "a Lambda Set is empty. Most likely there is a type error in your program."; - Crash Encode.133 +procedure Encode.24 (Encode.99, Encode.107, Encode.101): + let Encode.138 : Str = "a Lambda Set is empty. Most likely there is a type error in your program."; + Crash Encode.138 -procedure Encode.25 (Encode.100, Encode.101): - let Encode.104 : List U8 = Array []; - let Encode.105 : {{}, {}} = CallByName Test.2 Encode.100; - let Encode.103 : List U8 = CallByName Encode.23 Encode.104 Encode.105 Encode.101; - ret Encode.103; +procedure Encode.26 (Encode.105, Encode.106): + let Encode.109 : List U8 = Array []; + let Encode.110 : {{}, {}} = CallByName Test.2 Encode.105; + let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; + ret Encode.108; procedure Json.1 (): - let Json.425 : {} = Struct {}; - ret Json.425; - -procedure Json.128 (Json.129, Json.428, #Attr.12): - let Json.127 : List [C {}, C {}] = StructAtIndex 1 #Attr.12; - inc Json.127; - let Json.126 : Str = StructAtIndex 0 #Attr.12; - inc Json.126; + let Json.483 : {} = Struct {}; + ret Json.483; + +procedure Json.144 (Json.145, Json.486, #Attr.12): + let Json.143 : List [C {}, C {}] = StructAtIndex 1 #Attr.12; + inc Json.143; + let Json.142 : Str = StructAtIndex 0 #Attr.12; + inc Json.142; dec #Attr.12; - let Json.466 : I64 = 123i64; - let Json.465 : U8 = CallByName Num.127 Json.466; - let Json.462 : List U8 = CallByName List.4 Json.129 Json.465; - let Json.464 : I64 = 34i64; - let Json.463 : U8 = CallByName Num.127 Json.464; - let Json.460 : List U8 = CallByName List.4 Json.462 Json.463; - let Json.461 : List U8 = CallByName Str.12 Json.126; - let Json.457 : List U8 = CallByName List.8 Json.460 Json.461; - let Json.459 : I64 = 34i64; - let Json.458 : U8 = CallByName Num.127 Json.459; - let Json.454 : List U8 = CallByName List.4 Json.457 Json.458; - let Json.456 : I64 = 58i64; - let Json.455 : U8 = CallByName Num.127 Json.456; - let Json.451 : List U8 = CallByName List.4 Json.454 Json.455; - let Json.453 : I64 = 91i64; - let Json.452 : U8 = CallByName Num.127 Json.453; - let Json.131 : List U8 = CallByName List.4 Json.451 Json.452; - let Json.450 : U64 = CallByName List.6 Json.127; - let Json.438 : {List U8, U64} = Struct {Json.131, Json.450}; - let Json.439 : {} = Struct {}; - let Json.437 : {List U8, U64} = CallByName List.18 Json.127 Json.438 Json.439; - dec Json.127; - let Json.133 : List U8 = StructAtIndex 0 Json.437; - inc Json.133; - dec Json.437; - let Json.436 : I64 = 93i64; - let Json.435 : U8 = CallByName Num.127 Json.436; - let Json.432 : List U8 = CallByName List.4 Json.133 Json.435; - let Json.434 : I64 = 125i64; - let Json.433 : U8 = CallByName Num.127 Json.434; - let Json.431 : List U8 = CallByName List.4 Json.432 Json.433; - ret Json.431; - -procedure Json.128 (Json.129, Json.428, #Attr.12): - let Json.127 : List [] = StructAtIndex 1 #Attr.12; - inc Json.127; - let Json.126 : Str = StructAtIndex 0 #Attr.12; - inc Json.126; - dec #Attr.12; - let Json.516 : I64 = 123i64; - let Json.515 : U8 = CallByName Num.127 Json.516; - let Json.512 : List U8 = CallByName List.4 Json.129 Json.515; - let Json.514 : I64 = 34i64; + let Json.524 : I64 = 123i64; + let Json.523 : U8 = CallByName Num.127 Json.524; + let Json.520 : List U8 = CallByName List.4 Json.145 Json.523; + let Json.522 : I64 = 34i64; + let Json.521 : U8 = CallByName Num.127 Json.522; + let Json.518 : List U8 = CallByName List.4 Json.520 Json.521; + let Json.519 : List U8 = CallByName Str.12 Json.142; + let Json.515 : List U8 = CallByName List.8 Json.518 Json.519; + let Json.517 : I64 = 34i64; + let Json.516 : U8 = CallByName Num.127 Json.517; + let Json.512 : List U8 = CallByName List.4 Json.515 Json.516; + let Json.514 : I64 = 58i64; let Json.513 : U8 = CallByName Num.127 Json.514; - let Json.510 : List U8 = CallByName List.4 Json.512 Json.513; - let Json.511 : List U8 = CallByName Str.12 Json.126; - let Json.507 : List U8 = CallByName List.8 Json.510 Json.511; - let Json.509 : I64 = 34i64; - let Json.508 : U8 = CallByName Num.127 Json.509; - let Json.504 : List U8 = CallByName List.4 Json.507 Json.508; - let Json.506 : I64 = 58i64; - let Json.505 : U8 = CallByName Num.127 Json.506; - let Json.501 : List U8 = CallByName List.4 Json.504 Json.505; - let Json.503 : I64 = 91i64; - let Json.502 : U8 = CallByName Num.127 Json.503; - let Json.131 : List U8 = CallByName List.4 Json.501 Json.502; - let Json.500 : U64 = CallByName List.6 Json.127; - let Json.488 : {List U8, U64} = Struct {Json.131, Json.500}; - let Json.489 : {} = Struct {}; - let Json.487 : {List U8, U64} = CallByName List.18 Json.127 Json.488 Json.489; - dec Json.127; - let Json.133 : List U8 = StructAtIndex 0 Json.487; - inc Json.133; - dec Json.487; - let Json.486 : I64 = 93i64; - let Json.485 : U8 = CallByName Num.127 Json.486; - let Json.482 : List U8 = CallByName List.4 Json.133 Json.485; - let Json.484 : I64 = 125i64; - let Json.483 : U8 = CallByName Num.127 Json.484; - let Json.481 : List U8 = CallByName List.4 Json.482 Json.483; - ret Json.481; - -procedure Json.130 (Json.430, Json.136): - let Json.134 : List U8 = StructAtIndex 0 Json.430; - inc Json.134; - let Json.135 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.449 : {} = Struct {}; - let Json.137 : List U8 = CallByName Encode.23 Json.134 Json.136 Json.449; - joinpoint Json.444 Json.138: - let Json.442 : U64 = 1i64; - let Json.441 : U64 = CallByName Num.20 Json.135 Json.442; - let Json.440 : {List U8, U64} = Struct {Json.138, Json.441}; - ret Json.440; + let Json.509 : List U8 = CallByName List.4 Json.512 Json.513; + let Json.511 : I64 = 91i64; + let Json.510 : U8 = CallByName Num.127 Json.511; + let Json.147 : List U8 = CallByName List.4 Json.509 Json.510; + let Json.508 : U64 = CallByName List.6 Json.143; + let Json.496 : {List U8, U64} = Struct {Json.147, Json.508}; + let Json.497 : {} = Struct {}; + let Json.495 : {List U8, U64} = CallByName List.18 Json.143 Json.496 Json.497; + dec Json.143; + let Json.149 : List U8 = StructAtIndex 0 Json.495; + inc Json.149; + dec Json.495; + let Json.494 : I64 = 93i64; + let Json.493 : U8 = CallByName Num.127 Json.494; + let Json.490 : List U8 = CallByName List.4 Json.149 Json.493; + let Json.492 : I64 = 125i64; + let Json.491 : U8 = CallByName Num.127 Json.492; + let Json.489 : List U8 = CallByName List.4 Json.490 Json.491; + ret Json.489; + +procedure Json.144 (Json.145, Json.486, #Attr.12): + let Json.143 : List [] = StructAtIndex 1 #Attr.12; + inc Json.143; + let Json.142 : Str = StructAtIndex 0 #Attr.12; + inc Json.142; + dec #Attr.12; + let Json.574 : I64 = 123i64; + let Json.573 : U8 = CallByName Num.127 Json.574; + let Json.570 : List U8 = CallByName List.4 Json.145 Json.573; + let Json.572 : I64 = 34i64; + let Json.571 : U8 = CallByName Num.127 Json.572; + let Json.568 : List U8 = CallByName List.4 Json.570 Json.571; + let Json.569 : List U8 = CallByName Str.12 Json.142; + let Json.565 : List U8 = CallByName List.8 Json.568 Json.569; + let Json.567 : I64 = 34i64; + let Json.566 : U8 = CallByName Num.127 Json.567; + let Json.562 : List U8 = CallByName List.4 Json.565 Json.566; + let Json.564 : I64 = 58i64; + let Json.563 : U8 = CallByName Num.127 Json.564; + let Json.559 : List U8 = CallByName List.4 Json.562 Json.563; + let Json.561 : I64 = 91i64; + let Json.560 : U8 = CallByName Num.127 Json.561; + let Json.147 : List U8 = CallByName List.4 Json.559 Json.560; + let Json.558 : U64 = CallByName List.6 Json.143; + let Json.546 : {List U8, U64} = Struct {Json.147, Json.558}; + let Json.547 : {} = Struct {}; + let Json.545 : {List U8, U64} = CallByName List.18 Json.143 Json.546 Json.547; + dec Json.143; + let Json.149 : List U8 = StructAtIndex 0 Json.545; + inc Json.149; + dec Json.545; + let Json.544 : I64 = 93i64; + let Json.543 : U8 = CallByName Num.127 Json.544; + let Json.540 : List U8 = CallByName List.4 Json.149 Json.543; + let Json.542 : I64 = 125i64; + let Json.541 : U8 = CallByName Num.127 Json.542; + let Json.539 : List U8 = CallByName List.4 Json.540 Json.541; + ret Json.539; + +procedure Json.146 (Json.488, Json.152): + let Json.150 : List U8 = StructAtIndex 0 Json.488; + inc Json.150; + let Json.151 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.507 : {} = Struct {}; + let Json.153 : List U8 = CallByName Encode.24 Json.150 Json.152 Json.507; + joinpoint Json.502 Json.154: + let Json.500 : U64 = 1i64; + let Json.499 : U64 = CallByName Num.20 Json.151 Json.500; + let Json.498 : {List U8, U64} = Struct {Json.154, Json.499}; + ret Json.498; in - let Json.448 : U64 = 1i64; - let Json.445 : Int1 = CallByName Num.24 Json.135 Json.448; - if Json.445 then - let Json.447 : I64 = 44i64; - let Json.446 : U8 = CallByName Num.127 Json.447; - let Json.443 : List U8 = CallByName List.4 Json.137 Json.446; - jump Json.444 Json.443; + let Json.506 : U64 = 1i64; + let Json.503 : Int1 = CallByName Num.24 Json.151 Json.506; + if Json.503 then + let Json.505 : I64 = 44i64; + let Json.504 : U8 = CallByName Num.127 Json.505; + let Json.501 : List U8 = CallByName List.4 Json.153 Json.504; + jump Json.502 Json.501; else - jump Json.444 Json.137; - -procedure Json.130 (Json.430, Json.136): - let Json.134 : List U8 = StructAtIndex 0 Json.430; - inc Json.134; - let Json.135 : U64 = StructAtIndex 1 Json.430; - dec Json.430; - let Json.499 : {} = Struct {}; - let Json.137 : List U8 = CallByName Encode.23 Json.134 Json.136 Json.499; - dec Json.134; - joinpoint Json.494 Json.138: - let Json.492 : U64 = 1i64; - let Json.491 : U64 = CallByName Num.20 Json.135 Json.492; - let Json.490 : {List U8, U64} = Struct {Json.138, Json.491}; - ret Json.490; + jump Json.502 Json.153; + +procedure Json.146 (Json.488, Json.152): + let Json.150 : List U8 = StructAtIndex 0 Json.488; + inc Json.150; + let Json.151 : U64 = StructAtIndex 1 Json.488; + dec Json.488; + let Json.557 : {} = Struct {}; + let Json.153 : List U8 = CallByName Encode.24 Json.150 Json.152 Json.557; + dec Json.150; + joinpoint Json.552 Json.154: + let Json.550 : U64 = 1i64; + let Json.549 : U64 = CallByName Num.20 Json.151 Json.550; + let Json.548 : {List U8, U64} = Struct {Json.154, Json.549}; + ret Json.548; in - let Json.498 : U64 = 1i64; - let Json.495 : Int1 = CallByName Num.24 Json.135 Json.498; - if Json.495 then - let Json.497 : I64 = 44i64; - let Json.496 : U8 = CallByName Num.127 Json.497; - let Json.493 : List U8 = CallByName List.4 Json.137 Json.496; - jump Json.494 Json.493; + let Json.556 : U64 = 1i64; + let Json.553 : Int1 = CallByName Num.24 Json.151 Json.556; + if Json.553 then + let Json.555 : I64 = 44i64; + let Json.554 : U8 = CallByName Num.127 Json.555; + let Json.551 : List U8 = CallByName List.4 Json.153 Json.554; + jump Json.552 Json.551; else - jump Json.494 Json.137; + jump Json.552 Json.153; -procedure Json.21 (Json.126, Json.127): - let Json.468 : {Str, List [C {}, C {}]} = Struct {Json.126, Json.127}; - let Json.467 : {Str, List [C {}, C {}]} = CallByName Encode.22 Json.468; - ret Json.467; +procedure Json.22 (Json.142, Json.143): + let Json.526 : {Str, List [C {}, C {}]} = Struct {Json.142, Json.143}; + let Json.525 : {Str, List [C {}, C {}]} = CallByName Encode.23 Json.526; + ret Json.525; -procedure Json.21 (Json.126, Json.127): - let Json.518 : {Str, List []} = Struct {Json.126, Json.127}; - let Json.517 : {Str, List []} = CallByName Encode.22 Json.518; - ret Json.517; +procedure Json.22 (Json.142, Json.143): + let Json.576 : {Str, List []} = Struct {Json.142, Json.143}; + let Json.575 : {Str, List []} = CallByName Encode.23 Json.576; + ret Json.575; procedure List.139 (List.140, List.141, List.138): - let List.539 : {List U8, U64} = CallByName Json.130 List.140 List.141; + let List.539 : {List U8, U64} = CallByName Json.146 List.140 List.141; ret List.539; procedure List.139 (List.140, List.141, List.138): - let List.612 : {List U8, U64} = CallByName Json.130 List.140 List.141; + let List.612 : {List U8, U64} = CallByName Json.146 List.140 List.141; ret List.612; procedure List.18 (List.136, List.137, List.138): diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt @@ -334,7 +334,7 @@ procedure Str.12 (#Attr.2): ret Str.268; procedure Test.2 (Test.11): - let Test.18 : {{}, {}} = CallByName Encode.22 Test.11; + let Test.18 : {{}, {}} = CallByName Encode.23 Test.11; ret Test.18; procedure Test.3 (): diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt @@ -345,7 +345,7 @@ procedure Test.3 (): procedure Test.5 (Test.6, Test.7, Test.4): joinpoint Test.23 Test.8: - let Test.21 : List U8 = CallByName Encode.23 Test.6 Test.8 Test.7; + let Test.21 : List U8 = CallByName Encode.24 Test.6 Test.8 Test.7; ret Test.21; in let Test.28 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt @@ -354,18 +354,18 @@ procedure Test.5 (Test.6, Test.7, Test.4): let Test.32 : {} = StructAtIndex 0 Test.4; let Test.31 : [C {}, C {}] = CallByName #Derived.0 Test.32; let Test.30 : List [C {}, C {}] = Array [Test.31]; - let Test.22 : {Str, List [C {}, C {}]} = CallByName Json.21 Test.29 Test.30; + let Test.22 : {Str, List [C {}, C {}]} = CallByName Json.22 Test.29 Test.30; jump Test.23 Test.22; else let Test.24 : Str = "B"; let Test.27 : {} = StructAtIndex 1 Test.4; let Test.26 : [C {}, C {}] = CallByName #Derived.5 Test.27; let Test.25 : List [C {}, C {}] = Array [Test.26]; - let Test.22 : {Str, List [C {}, C {}]} = CallByName Json.21 Test.24 Test.25; + let Test.22 : {Str, List [C {}, C {}]} = CallByName Json.22 Test.24 Test.25; jump Test.23 Test.22; procedure Test.0 (): let Test.13 : {{}, {}} = CallByName Test.3; let Test.14 : {} = CallByName Json.1; - let Test.12 : List U8 = CallByName Encode.25 Test.13 Test.14; + let Test.12 : List U8 = CallByName Encode.26 Test.13 Test.14; ret Test.12; diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -11177,6 +11177,55 @@ I recommend using camelCase. It's the standard style in Roc code! "### ); + test_no_problem!( + derive_hash_for_tuple, + indoc!( + r#" + app "test" provides [main] to "./platform" + + foo : a -> {} | a has Hash + + main = foo ("", 1) + "# + ) + ); + + test_report!( + cannot_hash_tuple_with_non_hash_element, + indoc!( + r#" + app "test" provides [main] to "./platform" + + foo : a -> {} | a has Hash + + main = foo ("", \{} -> {}) + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + This expression has a type that does not implement the abilities it's expected to: + + 5│ main = foo ("", \{} -> {}) + ^^^^^^^^^^^^^^^ + + I can't generate an implementation of the `Hash` ability for + + ( + Str, + {}a -> {}, + )a + + In particular, an implementation for + + {}a -> {} + + cannot be generated. + + Note: `Hash` cannot be generated for functions. + "### + ); + test_report!( shift_by_negative, indoc!( diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -11559,6 +11608,58 @@ I recommend using camelCase. It's the standard style in Roc code! "### ); + test_no_problem!( + derive_eq_for_tuple, + indoc!( + r#" + app "test" provides [main] to "./platform" + + foo : a -> {} | a has Eq + + main = foo ("", 1) + "# + ) + ); + + test_report!( + cannot_eq_tuple_with_non_eq_element, + indoc!( + r#" + app "test" provides [main] to "./platform" + + foo : a -> {} | a has Eq + + main = foo ("", 1.0f64) + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + This expression has a type that does not implement the abilities it's expected to: + + 5│ main = foo ("", 1.0f64) + ^^^^^^^^^^^^ + + I can't generate an implementation of the `Eq` ability for + + ( + Str, + F64, + )a + + In particular, an implementation for + + F64 + + cannot be generated. + + Note: I can't derive `Bool.isEq` for floating-point types. That's + because Roc's floating-point numbers cannot be compared for total + equality - in Roc, `NaN` is never comparable to `NaN`. If a type + doesn't support total equality, it cannot support the `Eq` ability! + "### + ); + test_report!( cannot_import_structural_eq_not_eq, indoc!( diff --git a/crates/reporting/tests/test_reporting.rs b/crates/reporting/tests/test_reporting.rs --- a/crates/reporting/tests/test_reporting.rs +++ b/crates/reporting/tests/test_reporting.rs @@ -13127,6 +13228,90 @@ I recommend using camelCase. It's the standard style in Roc code! "### ); + test_no_problem!( + derive_decoding_for_tuple, + indoc!( + r#" + app "test" imports [Decode.{decoder}] provides [main] to "./platform" + + main = + myDecoder : Decoder (U32, Str) fmt | fmt has DecoderFormatting + myDecoder = decoder + + myDecoder + "# + ) + ); + + test_report!( + cannot_decode_tuple_with_non_decode_element, + indoc!( + r#" + app "test" imports [Decode.{decoder}] provides [main] to "./platform" + + main = + myDecoder : Decoder (U32, {} -> {}) fmt | fmt has DecoderFormatting + myDecoder = decoder + + myDecoder + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + This expression has a type that does not implement the abilities it's expected to: + + 5│ myDecoder = decoder + ^^^^^^^ + + I can't generate an implementation of the `Decoding` ability for + + U32, {} -> {} + + Note: `Decoding` cannot be generated for functions. + "### + ); + + test_no_problem!( + derive_encoding_for_tuple, + indoc!( + r#" + app "test" imports [] provides [main] to "./platform" + + x : (U32, Str) + + main = Encode.toEncoder x + "# + ) + ); + + test_report!( + cannot_encode_tuple_with_non_encode_element, + indoc!( + r#" + app "test" imports [] provides [main] to "./platform" + + x : (U32, {} -> {}) + + main = Encode.toEncoder x + "# + ), + @r###" + ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ + + This expression has a type that does not implement the abilities it's expected to: + + 5│ main = Encode.toEncoder x + ^ + + I can't generate an implementation of the `Encoding` ability for + + U32, {} -> {} + + Note: `Encoding` cannot be generated for functions. + "### + ); + test_report!( exhaustiveness_check_function_or_tag_union_issue_4994, indoc!(
Tuples don't implement `Eq` even if all of their elements do The following code errors, however each of the elements implement the `Eq` abiliity. ```elixir interface Blah exposes [] imports [] expect (0.0, 2, "x") == (0.0, 2, "x") ``` ``` % roc test Blah.roc ── TYPE MISMATCH ──────────────────────────────────────────────────── Blah.roc ─ This expression has a type that does not implement the abilities it's expected to: 5│ expect (0.0, 2, "x") == (0.0, 2, "x") ^^^^^^^^^^^^^ I can't generate an implementation of the Eq ability for ( Frac *, Num *, Str, )c ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "decoding::different_tuple_arities", "decoding::same_tuple", "decoding::same_tuple_fields_diff_types", "encoding::different_tuple_arities", "encoding::same_tuple_fields_diff_types", "encoding::same_tuple", "hash::different_tuple_arities", "hash::same_tuple", "hash::same_tuple_fields_diff_types", "encoding::two_field_tuple", "decoding::tuple_2_fields", "hash::two_element_tuple", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::derive_encoding_for_tuple", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_hash_for_tuple" ]
[ "decoding::derivable_record_ext_flex_able_var", "decoding::derivable_record_ext_flex_var", "decoding::derivable_record_with_record_ext", "decoding::different_record_fields", "decoding::optional_record_field_derive_error", "decoding::same_record_fields_any_order", "decoding::explicit_empty_record_and_implicit_empty_record", "decoding::record_empty_vs_nonempty", "decoding::immediates", "decoding::same_record", "decoding::same_record_fields_diff_types", "decoding::list_list_diff_types", "encoding::explicit_empty_record_and_implicit_empty_record", "encoding::derivable_record_ext_flex_var", "decoding::str_str", "encoding::derivable_record_ext_flex_able_var", "encoding::explicit_empty_tag_union_and_implicit_empty_tag_union", "encoding::derivable_record_with_record_ext", "encoding::dict_dict_diff_types", "encoding::immediates", "encoding::different_record_fields", "encoding::different_tag_union_tags", "encoding::different_recursive_tag_union_tags", "encoding::list_list_diff_types", "encoding::derivable_tag_ext_flex_var", "encoding::derivable_tag_ext_flex_able_var", "encoding::derivable_tag_with_tag_ext", "encoding::opaque_eq_real_type", "encoding::same_record", "encoding::record_empty_vs_nonempty", "encoding::same_record_fields_any_order", "encoding::alias_eq_real_type", "encoding::opaque_real_type_eq_alias_real_type", "encoding::same_recursive_tag_union", "encoding::same_tag_union", "encoding::diff_alias_diff_real_type", "encoding::diff_alias_same_real_type", "encoding::diff_opaque_diff_real_type", "encoding::diff_opaque_same_real_type", "encoding::same_opaque_diff_real_type", "encoding::same_record_fields_required_vs_optional", "encoding::set_set_diff_types", "encoding::same_record_fields_diff_types", "encoding::same_tag_union_tags_any_order", "encoding::tag_union_empty_vs_nonempty", "hash::derivable_record_ext_flex_able_var", "encoding::str_str", "encoding::same_tag_union_and_recursive_tag_union_fields", "encoding::same_alias_diff_real_type", "encoding::same_tag_union_tags_diff_types", "hash::derivable_tag_ext_flex_var", "eq::immediates", "hash::explicit_empty_record_and_implicit_empty_record", "hash::explicit_empty_tag_union_and_implicit_empty_tag_union", "hash::derivable_record_ext_flex_var", "hash::derivable_record_with_record_ext", "hash::derivable_tag_ext_flex_able_var", "hash::immediates", "hash::optional_record_field_derive_error", "hash::record_empty_vs_nonempty", "hash::different_record_fields", "hash::different_recursive_tag_union_tags", "hash::same_record", "hash::different_tag_union_tags", "hash::same_record_fields_any_order", "hash::derivable_tag_with_tag_ext", "hash::same_record_fields_diff_types", "hash::same_tag_union_tags_any_order", "hash::same_tag_union", "hash::same_tag_union_tags_diff_types", "hash::same_recursive_tag_union", "hash::same_tag_union_and_recursive_tag_union_fields", "hash::tag_union_empty_vs_nonempty", "encoding::list", "encoding::zero_field_record", "encoding::one_field_record", "encoding::empty_record", "encoding::tag_two_labels", "encoding::recursive_tag_union", "hash::zero_field_record", "encoding::tag_one_label_two_args", "encoding::two_field_record", "hash::tag_two_labels_no_payloads", "decoding::record_2_fields", "hash::tag_one_label_no_payloads", "hash::two_field_record", "hash::tag_one_label_newtype", "hash::one_field_record", "hash::tag_two_labels", "decoding::list", "hash::recursive_tag_union", "encoding::tag_one_label_zero_args", "hash::empty_record", "test_reporting::ability_demand_value_has_args", "test_reporting::ability_non_signature_expression", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::backpassing_type_error", "test_reporting::always_function", "test_reporting::applied_tag_function", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::bad_rigid_value", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::ability_member_binds_parent_twice", "test_reporting::ability_bad_type_parameter", "test_reporting::bad_rigid_function", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::alias_in_has_clause", "test_reporting::apply_unary_not", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::bad_numeric_literal_suffix", "test_reporting::ability_specialization_is_duplicated", "test_reporting::ability_specialization_is_unused", "test_reporting::ability_not_on_toplevel", "test_reporting::cannot_derive_hash_for_function", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::bool_vs_true_tag", "test_reporting::call_with_underscore_identifier", "test_reporting::bool_vs_false_tag", "test_reporting::cannot_derive_eq_for_function", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::cannot_not_eq_functions", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::boolean_tag", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::comment_with_tab", "test_reporting::alias_using_alias", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::apply_unary_negative", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::annotation_definition_mismatch", "test_reporting::alias_type_diff", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::annotation_newline_body_is_fine", "test_reporting::ability_specialization_is_incomplete", "test_reporting::ability_shadows_ability", "test_reporting::bad_double_rigid", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::argument_without_space", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::closure_underscore_ident", "test_reporting::crash_overapplied", "test_reporting::circular_definition_self", "test_reporting::crash_unapplied", "test_reporting::crash_given_non_string", "test_reporting::compare_unsigned_to_signed", "test_reporting::concat_different_types", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::dbg_without_final_expression", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::cycle_through_non_function", "test_reporting::def_missing_final_expression", "test_reporting::circular_type", "test_reporting::cycle_through_non_function_top_level", "test_reporting::cyclic_opaque", "test_reporting::cannot_eq_functions", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::circular_definition", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_decoding_for_function", "test_reporting::demanded_vs_optional_record_field", "test_reporting::derive_encoding_for_nat", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_eq_for_f64", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::derive_eq_for_record", "test_reporting::derive_eq_for_f32", "test_reporting::double_plus", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::derive_eq_for_tag", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::elm_function_syntax", "test_reporting::derive_hash_for_record", "test_reporting::exposes_identifier", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::empty_or_pattern", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::error_inline_alias_qualified", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::derive_hash_for_tag", "test_reporting::derive_eq_for_function", "test_reporting::derive_hash_for_function", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::expect_without_final_expression", "test_reporting::expression_indentation_end", "test_reporting::dict_type_formatting", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::derive_non_builtin_ability", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::eq_binop_is_transparent", "test_reporting::different_phantom_types", "test_reporting::double_equals_in_def", "test_reporting::elem_in_list", "test_reporting::error_nested_wildcards_are_related", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::error_wildcards_are_related", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::expected_tag_has_too_many_args", "test_reporting::float_malformed", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::float_literal_has_int_suffix", "test_reporting::first_wildcard_is_required", "test_reporting::expect_expr_type_error", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::float_out_of_range", "test_reporting::from_annotation_if", "test_reporting::from_annotation_complex_pattern", "test_reporting::fncall_value", "test_reporting::from_annotation_when", "test_reporting::from_annotation_function", "test_reporting::function_cannot_derive_encoding", "test_reporting::fncall_overapplied", "test_reporting::imports_missing_comma", "test_reporting::fncall_underapplied", "test_reporting::if_outdented_then", "test_reporting::function_does_not_implement_encoding", "test_reporting::geq_binop_is_transparent", "test_reporting::if_missing_else", "test_reporting::if_guard_without_condition", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::has_encoding_for_function", "test_reporting::has_clause_not_on_toplevel", "test_reporting::guard_mismatch_with_annotation", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::gt_binop_is_transparent", "test_reporting::i128_overflow", "test_reporting::i16_overflow", "test_reporting::i32_overflow", "test_reporting::invalid_app_name", "test_reporting::invalid_module_name", "test_reporting::i16_underflow", "test_reporting::i32_underflow", "test_reporting::if_2_branch_mismatch", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::i8_underflow", "test_reporting::i64_underflow", "test_reporting::i64_overflow", "test_reporting::if_condition_not_bool", "test_reporting::inline_hastype", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::if_3_branch_mismatch", "test_reporting::invalid_operator", "test_reporting::incorrect_optional_field", "test_reporting::implements_type_not_ability", "test_reporting::i8_overflow", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::inference_var_in_alias", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::lambda_double_comma", "test_reporting::interpolate_not_identifier", "test_reporting::inference_var_too_many_in_alias", "test_reporting::int_frac", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::int_literal_has_float_suffix", "test_reporting::integer_malformed", "test_reporting::lambda_leading_comma", "test_reporting::integer_empty", "test_reporting::invalid_num_fn", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::invalid_record_extension_type", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::integer_out_of_range", "test_reporting::invalid_record_update", "test_reporting::list_double_comma", "test_reporting::issue_2326", "test_reporting::invalid_tag_extension_type", "test_reporting::issue_1755", "test_reporting::invalid_num", "test_reporting::issue_2380_alias_with_vars", "test_reporting::invalid_toplevel_cycle", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::issue_2380_typed_body", "test_reporting::issue_2458", "test_reporting::keyword_record_field_access", "test_reporting::keyword_qualified_import", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::list_pattern_not_terminated", "test_reporting::leq_binop_is_transparent", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_without_end", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_get_negative_number", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_with_guard", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::malformed_bin_pattern", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::lt_binop_is_transparent", "test_reporting::malformed_int_pattern", "test_reporting::malformed_float_pattern", "test_reporting::malformed_oct_pattern", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::malformed_hex_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::mismatched_record_annotation", "test_reporting::missing_imports", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_suffix_dec", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_suffix_f32", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::multi_insufficient_indent", "test_reporting::multi_no_end", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_u8", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::missing_fields", "test_reporting::module_not_imported", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::mutual_recursion_not_reached", "test_reporting::module_ident_ends_with_dot", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::multiple_wildcards_in_alias", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::negative_u128", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::negative_u16", "test_reporting::nested_datatype_inline", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::nested_datatype", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::negative_u8", "test_reporting::neq_binop_is_transparent", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::negative_u64", "test_reporting::nested_specialization", "test_reporting::negative_u32", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::non_exhaustive_with_guard", "test_reporting::num_too_general_wildcard", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::number_double_dot", "test_reporting::not_enough_cases_for_open_union", "test_reporting::num_too_general_named", "test_reporting::numer_literal_multi_suffix", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::pattern_binds_keyword", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_ability_impl_optional", "test_reporting::opaque_ability_impl_qualified", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::pattern_in_parens_end_comma", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::optional_record_default_type_error", "test_reporting::pattern_in_parens_indent_open", "test_reporting::pattern_in_parens_end", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::platform_requires_rigids", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_type_not_in_scope", "test_reporting::pattern_in_parens_open", "test_reporting::opaque_ref_field_access", "test_reporting::optional_record_invalid_accessor", "test_reporting::optional_record_invalid_function", "test_reporting::optional_record_default_with_signature", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::optional_record_invalid_access", "test_reporting::provides_to_identifier", "test_reporting::optional_record_invalid_when", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::optional_record_invalid_let_binding", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::pattern_let_mismatch", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::pattern_when_condition", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::phantom_type_variable", "test_reporting::patterns_int_redundant", "test_reporting::plus_on_str", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::patterns_when_not_exhaustive", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::patterns_let_not_exhaustive", "test_reporting::pattern_when_pattern", "test_reporting::polymorphic_recursion", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::polymorphic_mutual_recursion", "test_reporting::polymorphic_recursion_forces_ungeneralized_type", "test_reporting::report_module_color", "test_reporting::record_type_keyword_field_name", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::report_region_in_color", "test_reporting::report_value_color", "test_reporting::record_access_ends_with_dot", "test_reporting::record_type_end", "test_reporting::record_type_missing_comma", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::record_type_open", "test_reporting::qualified_opaque_reference", "test_reporting::record_type_tab", "test_reporting::record_type_open_indent", "test_reporting::patterns_record_not_exhaustive", "test_reporting::record_duplicate_field_multiline", "test_reporting::record_duplicate_field_same_type", "test_reporting::qualified_tag", "test_reporting::record_duplicate_field_different_types", "test_reporting::record_type_duplicate_field", "test_reporting::record_field_mismatch", "test_reporting::recursion_var_specialization_error", "test_reporting::record_update_value", "test_reporting::report_precedence_problem_single_line", "test_reporting::single_no_end", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::report_shadowing_in_annotation", "test_reporting::report_unused_def", "test_reporting::report_precedence_problem_multiline", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::report_shadowing", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::single_quote_too_long", "test_reporting::same_phantom_types_unify", "test_reporting::second_wildcard_is_redundant", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::tag_union_end", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::tag_union_open", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::type_annotation_double_colon", "test_reporting::self_recursive_alias", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::shift_by_negative", "test_reporting::self_recursive_not_reached", "test_reporting::type_apply_stray_dot", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::shadowing_top_level_scope", "test_reporting::type_in_parens_end", "test_reporting::type_argument_no_arrow", "test_reporting::type_in_parens_start", "test_reporting::type_double_comma", "test_reporting::type_inline_alias", "test_reporting::stray_dot_expr", "test_reporting::tag_missing", "test_reporting::tag_with_arguments_mismatch", "test_reporting::tag_mismatch", "test_reporting::self_recursive_not_reached_nested", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::too_many_type_arguments", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::tag_union_duplicate_tag", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::too_few_type_arguments", "test_reporting::tuple_exhaustiveness_good", "test_reporting::type_apply_double_dot", "test_reporting::type_apply_start_with_number", "test_reporting::tags_missing", "test_reporting::two_different_cons", "test_reporting::type_apply_trailing_dot", "test_reporting::specialization_for_wrong_type", "test_reporting::unicode_not_hex", "test_reporting::type_apply_start_with_lowercase", "test_reporting::typo_uppercase_ok", "test_reporting::typo_lowercase_ok", "test_reporting::u64_overflow", "test_reporting::u32_overflow", "test_reporting::u8_overflow", "test_reporting::unbound_var_in_alias", "test_reporting::u16_overflow", "test_reporting::weird_escape", "test_reporting::when_missing_arrow", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::unify_alias_other", "test_reporting::unicode_too_large", "test_reporting::when_outdented_branch", "test_reporting::when_over_indented_int", "test_reporting::when_over_indented_underscore", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::unimported_modules_reported", "test_reporting::wild_case_arrow", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::unused_shadow_specialization", "test_reporting::unused_arg_and_unused_def", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::unnecessary_extension_variable", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::unused_argument", "test_reporting::unused_value_import", "test_reporting::unused_def_in_branch_pattern", "test_reporting::update_record", "test_reporting::weird_accessor", "test_reporting::update_empty_record", "test_reporting::unwrap_num_elem_in_list", "test_reporting::update_record_ext", "test_reporting::when_if_guard", "test_reporting::update_record_snippet", "test_reporting::value_not_exposed", "test_reporting::unknown_type", "test_reporting::when_branch_mismatch", "test_reporting::wildcard_in_alias", "test_reporting::wildcard_in_opaque" ]
[]
[]
2023-03-25T20:51:41Z
d66f581eeb21ba7028b2e2f33af9f99974d2c3b6
diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -624,6 +624,22 @@ fn starts_with_newline(expr: &Expr) -> bool { } } +fn fmt_str_body(body: &str, buf: &mut Buf) { + for c in body.chars() { + match c { + // Format blank characters as unicode escapes + '\u{200a}' => buf.push_str("\\u(200a)"), + '\u{200b}' => buf.push_str("\\u(200b)"), + '\u{200c}' => buf.push_str("\\u(200c)"), + '\u{feff}' => buf.push_str("\\u(feff)"), + // Don't change anything else in the string + ' ' => buf.push_str_allow_spaces(" "), + '\n' => buf.push_str_allow_spaces("\n"), + _ => buf.push(c), + } + } +} + fn format_str_segment(seg: &StrSegment, buf: &mut Buf, indent: u16) { use StrSegment::*; diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -633,10 +649,10 @@ fn format_str_segment(seg: &StrSegment, buf: &mut Buf, indent: u16) { // a line break in the input string match string.strip_suffix('\n') { Some(string_without_newline) => { - buf.push_str_allow_spaces(string_without_newline); + fmt_str_body(string_without_newline, buf); buf.newline(); } - None => buf.push_str_allow_spaces(string), + None => fmt_str_body(string, buf), } } Unicode(loc_str) => { diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -696,7 +712,7 @@ pub fn fmt_str_literal(buf: &mut Buf, literal: StrLiteral, indent: u16) { buf.push_newline_literal(); for line in string.split('\n') { buf.indent(indent); - buf.push_str_allow_spaces(line); + fmt_str_body(line, buf); buf.push_newline_literal(); } buf.indent(indent); diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -704,7 +720,7 @@ pub fn fmt_str_literal(buf: &mut Buf, literal: StrLiteral, indent: u16) { } else { buf.indent(indent); buf.push('"'); - buf.push_str_allow_spaces(string); + fmt_str_body(string, buf); buf.push('"'); }; } diff --git a/crates/compiler/parse/src/normalize.rs b/crates/compiler/parse/src/normalize.rs --- a/crates/compiler/parse/src/normalize.rs +++ b/crates/compiler/parse/src/normalize.rs @@ -624,7 +624,7 @@ impl<'a> Normalize<'a> for StrLiteral<'a> { new_segments.push(StrSegment::Plaintext(last_text.into_bump_str())); } - StrLiteral::Line(new_segments.into_bump_slice()) + normalize_str_line(new_segments) } StrLiteral::Block(t) => { let mut new_segments = Vec::new_in(arena); diff --git a/crates/compiler/parse/src/normalize.rs b/crates/compiler/parse/src/normalize.rs --- a/crates/compiler/parse/src/normalize.rs +++ b/crates/compiler/parse/src/normalize.rs @@ -636,12 +636,22 @@ impl<'a> Normalize<'a> for StrLiteral<'a> { new_segments.push(StrSegment::Plaintext(last_text.into_bump_str())); } - StrLiteral::Line(new_segments.into_bump_slice()) + normalize_str_line(new_segments) } } } } +fn normalize_str_line<'a>(new_segments: Vec<'a, StrSegment<'a>>) -> StrLiteral<'a> { + if new_segments.len() == 1 { + if let StrSegment::Plaintext(t) = new_segments[0] { + return StrLiteral::PlainLine(t); + } + } + + StrLiteral::Line(new_segments.into_bump_slice()) +} + fn normalize_str_segments<'a>( arena: &'a Bump, segments: &[StrSegment<'a>],
roc-lang__roc-7004
7,004
@lukewilliamboswell I started looking into this one and I think I have a solution: https://github.com/roc-lang/roc/compare/main...a-lavis:roc:format-invisible-chars However, there's one thing I'm not sure how to deal with - the formatter checks to make sure that the AST before formatting matches the AST after formatting: https://github.com/roc-lang/roc/blob/d4d9f69d0fbefd331172c11e430a5f2ac98ee30b/crates/cli/src/format.rs#L205-L216 Consider this roc program: ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import pf.Stdout main = x = "foobar​" Stdout.line! x ``` With my changes it will format to: ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import pf.Stdout main = x = "foobar\u(200b)" Stdout.line! x ``` I believe this is the result we want. However, these two files parse to different ASTs. Here's the diff: ```diff < PlainLine( < "foobar\u{200b}", --- > Line( > [ > Plaintext( > "foobar", > ), > Unicode( > "200b", > ), > ], ``` I can think of some unsatisfactory options: 1. Disable checking that the ASTs match when reformatting. 2. As the comment says, "fix PartialEq impl on ast types". This seems out of scope for this particular issue - this comment seems to have been introduced by #2082, but I couldn't find a GitHub issue tracking it. Also, I'm not sure if we necessarily want to consider these two ASTs as equal anyway. I'm curious to hear your thoughts on the matter - maybe there's something else I'm missing here, since I'm new to contributing to roc :) I think the right fix here is to update the RemoveSpaces impl (a bit mis-named, for how we actually use it!) to produce a maximally-normalized version of the string. In particular, it should merge all blocks / segments (that are not interpolations), apply all escapes, etc. So in this instance, it would normalize both to `StrLiteral(PlainLine("foobar\u{200b}"))`. @a-lavis I have some time coming up where I could take a look at that, unless you want to. (alternatively, happy to provide more guidance if you're interested in diving more into the parser/formatter!)
[ "6927" ]
0.0
roc-lang/roc
2024-08-17T05:31:53Z
diff --git a/crates/compiler/test_syntax/tests/test_fmt.rs b/crates/compiler/test_syntax/tests/test_fmt.rs --- a/crates/compiler/test_syntax/tests/test_fmt.rs +++ b/crates/compiler/test_syntax/tests/test_fmt.rs @@ -6333,6 +6333,83 @@ mod test_fmt { ); } + #[test] + fn keep_explicit_blank_chars() { + expr_formats_same(indoc!( + r#" + x = "a\u(200a)b\u(200b)c\u(200c)d\u(feff)e" + x + "# + )); + } + + #[test] + fn make_blank_chars_explicit() { + expr_formats_to( + indoc!( + " + x = \"a\u{200A}b\u{200B}c\u{200C}d\u{FEFF}e\" + x + " + ), + indoc!( + r#" + x = "a\u(200a)b\u(200b)c\u(200c)d\u(feff)e" + x + "# + ), + ); + } + + #[test] + fn make_blank_chars_explicit_when_interpolating() { + expr_formats_to( + indoc!( + " + x = \"foo:\u{200B} $(bar).\" + x + " + ), + indoc!( + r#" + x = "foo:\u(200b) $(bar)." + x + "# + ), + ); + } + + #[test] + fn make_blank_chars_explicit_in_multiline_string() { + expr_formats_to( + indoc!( + " + x = + \"\"\" + foo:\u{200B} $(bar). + \"\"\" + x + " + ), + indoc!( + r#" + x = + """ + foo:\u(200b) $(bar). + """ + x + "# + ), + ); + } + + #[test] + fn preserve_multiline_string_trailing_whitespace() { + expr_formats_same(indoc!( + "x =\n \"\"\"\n foo\n bar \n baz\n \"\"\"\nx" + )); + } + // this is a parse error atm // #[test] // fn multiline_apply() {
Format invisible unicode as a literal Have the formatter swap invisible unicode in Str with the literal See [zulip discussion for more context](https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Non-printable.20characters.20in.20.60Str.60/near/454529871) ## example module ```roc module [] # this string has invisible unicode in it... let's have the formatter make this obvious stringWithInivisbleUnicode = "FOO" expect stringWithInivisbleUnicode == "FOO" # false ``` ## REPL ``` » Str.toUtf8 "FOO" [239, 187, 191, 70, 79, 79] : List U8 » Str.toUtf8 "\u(feff)FOO" [239, 187, 191, 70, 79, 79] : List U8 ``` ## after formatting ```roc module [] # this string has invisible unicode in it... let's have the formatter make this obvious stringWithInivisbleUnicode = "\u(feff)FOO" expect stringWithInivisbleUnicode == "FOO" # false, but now it's easier to see what is causing this issue. ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_fmt::make_blank_chars_explicit", "test_fmt::make_blank_chars_explicit_in_multiline_string", "test_fmt::make_blank_chars_explicit_when_interpolating" ]
[ "test_fmt::accessor", "test_fmt::basic_block_string", "test_fmt::apply_lambda", "test_fmt::ability_member_doc_comments", "test_fmt::backpassing_apply_tag", "test_fmt::backpassing_body_on_newline", "test_fmt::basic_string", "test_fmt::binary_op", "test_fmt::binary_op_with_spaces", "test_fmt::backpassing_simple", "test_fmt::binop_if", "test_fmt::body_starts_with_spaces_multiline", "test_fmt::can_format_multiple_record_builders", "test_fmt::closure_multiline_pattern", "test_fmt::clauses_with_multiple_abilities", "test_fmt::comma_prefixed_indented_record", "test_fmt::comments_before_exposes_preserved", "test_fmt::backpassing_parens_body", "test_fmt::comments_with_newlines_in_records", "test_fmt::comment_with_trailing_space", "test_fmt::comments_in_multiline_tag_union_annotation", "test_fmt::def_when", "test_fmt::comment_between_multiline_ann_args", "test_fmt::comment_between_two_defs", "test_fmt::def_with_comment_and_extra_space", "test_fmt::binop_parens", "test_fmt::def_returning_closure", "test_fmt::def_with_comment", "test_fmt::defs_with_trailing_comment", "test_fmt::destructure_tag_closure", "test_fmt::defs_with_defs", "test_fmt::empty_block_string", "test_fmt::doesnt_detect_comment_in_comment", "test_fmt::destructure_nested_tag_closure", "test_fmt::def_with_inline_comment", "test_fmt::empty_list", "test_fmt::empty_record", "test_fmt::empty_string", "test_fmt::escaped_quote_string", "test_fmt::empty_record_patterns", "test_fmt::ending_comments_in_list", "test_fmt::escaped_unicode_string", "test_fmt::excess_parens", "test_fmt::def_closure", "test_fmt::final_comment_record_annotation", "test_fmt::float_with_underscores", "test_fmt::force_space_at_beginning_of_comment", "test_fmt::final_comments_without_comma_in_records", "test_fmt::format_char_pattern", "test_fmt::final_comments_in_records", "test_fmt::format_chars", "test_fmt::expect_multiline", "test_fmt::expect_single_line", "test_fmt::func_def", "test_fmt::format_nested_pipeline", "test_fmt::format_crash", "test_fmt::function_application_package_type", "test_fmt::int_with_underscores", "test_fmt::identity", "test_fmt::func_call_trailing_multiline_lambda", "test_fmt::if_removes_newlines_from_else", "test_fmt::if_removes_newlines_from_then", "test_fmt::integer_when", "test_fmt::if_removes_newlines_from_condition", "test_fmt::integer_when_with_space", "test_fmt::inner_def_with_triple_newline_before", "test_fmt::issue_6197", "test_fmt::format_list_patterns", "test_fmt::leading_comments_preserved", "test_fmt::keep_explicit_blank_chars", "test_fmt::module_exposing_multiline", "test_fmt::module_exposing", "test_fmt::issue_6215", "test_fmt::multi_arg_closure", "test_fmt::format_tui_package_config", "test_fmt::multi_line_application", "test_fmt::module_defs_with_comments", "test_fmt::multi_line_binary_op_1", "test_fmt::list_alias", "test_fmt::multi_line_binary_op_2", "test_fmt::multi_line_binary_op_with_comments", "test_fmt::lambda_returns_record", "test_fmt::multi_line_hosted", "test_fmt::multi_line_if_condition", "test_fmt::multi_line_if", "test_fmt::multi_line_if_condition_with_multi_line_expr_2", "test_fmt::lambda_returns_list", "test_fmt::multi_line_if_condition_with_multi_line_expr_1", "test_fmt::multi_line_if_condition_with_spaces", "test_fmt::multi_line_precedence_conflict_1", "test_fmt::multi_line_precedence_conflict_2", "test_fmt::multi_line_string_literal_in_pattern", "test_fmt::multi_line_string_literal_that_can_be_single_line_in_pattern", "test_fmt::multi_line_when_branch", "test_fmt::multi_line_when_condition_1", "test_fmt::multi_line_list_def", "test_fmt::multiline_basic_block_string", "test_fmt::multiline_binop_if_with_comments", "test_fmt::multi_line_record_def", "test_fmt::multi_line_when_condition_2", "test_fmt::multi_line_when_condition_3", "test_fmt::multi_line_when_condition_4", "test_fmt::multi_line_list", "test_fmt::multiline_binop_when_with_comments", "test_fmt::list_allow_blank_line_before_and_after_comment", "test_fmt::multiline_brace_type", "test_fmt::multiline_empty_record_type_definition", "test_fmt::multiline_opaque_tag_union", "test_fmt::multiline_curly_brace_type", "test_fmt::multiline_binop_with_comments", "test_fmt::multiline_fn_signature", "test_fmt::multiline_tag_union_annotation_beginning_on_same_line", "test_fmt::multiline_tag_union_annotation_with_final_comment", "test_fmt::multiline_type_definition", "test_fmt::multiple_final_comments_with_comma_in_records", "test_fmt::multiple_final_comments_without_comma_in_records", "test_fmt::multiline_record_builder_field", "test_fmt::multiple_blank_lines_collapse_to_one", "test_fmt::newlines_block_string", "test_fmt::nested_when", "test_fmt::old_style_package_header_is_upgraded", "test_fmt::new_line_above_return", "test_fmt::old_style_app_header_is_upgraded", "test_fmt::multiline_higher_order_function", "test_fmt::multiline_tag_union_annotation_no_comments", "test_fmt::one_field", "test_fmt::old_record_builder", "test_fmt::new_record_builder", "test_fmt::one_item_list", "test_fmt::one_unnamed_field", "test_fmt::multiline_list_func_arg", "test_fmt::oneline_empty_block_string", "test_fmt::multiline_record_func_arg", "test_fmt::opaque_implements_clause", "test_fmt::outdentable_record_builders", "test_fmt::partial_multi_line_application", "test_fmt::partial_multi_line_binary_op_1", "test_fmt::opaque_implements_with_impls", "test_fmt::parenthetical_def", "test_fmt::partial_multi_line_binary_op_2", "test_fmt::pipline_apply_lambda_1", "test_fmt::pipline_apply_lambda_2", "test_fmt::precedence_conflict_greater_than", "test_fmt::precedence_conflict_greater_than_and_less_than", "test_fmt::pipline_op_with_apply", "test_fmt::precedence_conflict", "test_fmt::precedence_conflict_functions", "test_fmt::pipeline_apply_lambda_multiline", "test_fmt::preserve_annotated_body", "test_fmt::preserve_annotated_body_blank_comment", "test_fmt::preserve_annotated_body_comment", "test_fmt::preserve_annotated_body_comments", "test_fmt::preserve_annotated_body_comments_without_newlines", "test_fmt::quotes_block_string", "test_fmt::preserve_multiline_string_trailing_whitespace", "test_fmt::preserve_annotated_body_without_newlines", "test_fmt::quotes_block_string_single_segment", "test_fmt::record_field_destructuring", "test_fmt::record_destructuring", "test_fmt::record_pattern_with_apply_guard", "test_fmt::record_pattern_with_record_guard", "test_fmt::record_type", "test_fmt::record_updating", "test_fmt::single_line_hosted", "test_fmt::recursive_tag_union", "test_fmt::reduce_space_between_comments", "test_fmt::single_def", "test_fmt::single_line_app", "test_fmt::single_line_module", "test_fmt::shebang_comment", "test_fmt::space_between_comments", "test_fmt::single_line_platform", "test_fmt::single_line_string_literal_in_pattern", "test_fmt::single_line_if", "test_fmt::tag_union", "test_fmt::single_line_when_patterns", "test_fmt::trailing_comma_in_record_annotation", "test_fmt::two_fields", "test_fmt::two_defs", "test_fmt::test_where_after", "test_fmt::trailing_comma_in_record_annotation_same", "test_fmt::record_allow_blank_line_before_and_after_comment", "test_fmt::two_fields_center_newline", "test_fmt::weird_triple_string", "test_fmt::unary_call_no_parens", "test_fmt::two_item_list", "test_fmt::two_fields_newline", "test_fmt::type_definition_comment_after_colon", "test_fmt::unary_call_parens", "test_fmt::type_definition_add_space_around_optional_record", "test_fmt::unary_op", "test_fmt::when_guard", "test_fmt::when_guard_using_function", "test_fmt::when_with_alternatives_3", "test_fmt::when_with_alternatives_2", "test_fmt::when_with_comments", "test_fmt::when_with_alternatives_4", "test_fmt::when_with_integer_comments", "test_fmt::when_with_alternatives_1", "test_fmt::zero", "test_fmt::zero_point_zero", "test_fmt::wildcard", "test_fmt::when_with_single_quote_char", "test_fmt::type_annotation_allow_blank_line_before_and_after_comment", "test_fmt::test_fmt_builtins" ]
[ "test_fmt::test_fmt_examples" ]
[]
2024-08-19T13:02:19Z
e10448e92caf53e136cf1ab8257cfb5bf0e11ec6
diff --git a/crates/compiler/can/src/def.rs b/crates/compiler/can/src/def.rs --- a/crates/compiler/can/src/def.rs +++ b/crates/compiler/can/src/def.rs @@ -2969,7 +2969,7 @@ fn to_pending_value_def<'a>( AnnotatedBody { ann_pattern, ann_type, - comment: _, + lines_between: _, body_pattern, body_expr, } => { diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -86,13 +86,13 @@ fn desugar_value_def<'a>( AnnotatedBody { ann_pattern, ann_type, - comment, + lines_between, body_pattern, body_expr, } => AnnotatedBody { ann_pattern, ann_type, - comment: *comment, + lines_between, body_pattern: desugar_loc_pattern(arena, body_pattern, src, line_info, module_path), body_expr: desugar_expr(arena, body_expr, src, line_info, module_path), }, diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -170,7 +170,7 @@ fn desugar_value_def<'a>( ext: None, }, )), - comment: None, + lines_between: &[], body_pattern: new_pat, body_expr: desugar_expr(arena, stmt_expr, src, line_info, module_path), } diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -235,7 +235,7 @@ pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>) AnnotatedBody { ann_pattern, ann_type, - comment, + lines_between, body_pattern, body_expr, } => { diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -244,7 +244,7 @@ pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>) Ok(new_expr) => AnnotatedBody { ann_pattern, ann_type, - comment, + lines_between, body_pattern, body_expr: new_expr, }, diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -257,7 +257,7 @@ pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>) AnnotatedBody { ann_pattern, ann_type, - comment, + lines_between, body_pattern, body_expr: apply_task_await( arena, diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -272,7 +272,7 @@ pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>) Err(..) => AnnotatedBody { ann_pattern, ann_type, - comment, + lines_between, body_pattern, body_expr: arena.alloc(Loc::at(body_expr.region, MalformedSuffixed(body_expr))), }, diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -900,7 +900,7 @@ pub fn apply_task_await<'a>( ]), ), )), - comment: None, + lines_between: &[], body_pattern: arena.alloc(Loc::at( loc_pat.region, Pattern::Identifier { ident: new_ident }, diff --git a/crates/compiler/fmt/src/def.rs b/crates/compiler/fmt/src/def.rs --- a/crates/compiler/fmt/src/def.rs +++ b/crates/compiler/fmt/src/def.rs @@ -450,17 +450,13 @@ impl<'a> Formattable for ValueDef<'a> { AnnotatedBody { ann_pattern, ann_type, - comment, + lines_between, body_pattern, body_expr, } => { fmt_general_def(ann_pattern, buf, indent, ":", &ann_type.value, newlines); - if let Some(comment_str) = comment { - buf.push_str(" #"); - buf.spaces(1); - buf.push_str(comment_str.trim()); - } + fmt_annotated_body_comment(buf, indent, lines_between); buf.newline(); fmt_body(buf, &body_pattern.value, &body_expr.value, indent); diff --git a/crates/compiler/fmt/src/def.rs b/crates/compiler/fmt/src/def.rs --- a/crates/compiler/fmt/src/def.rs +++ b/crates/compiler/fmt/src/def.rs @@ -586,6 +582,49 @@ pub fn fmt_defs(buf: &mut Buf, defs: &Defs, indent: u16) { defs.format(buf, indent); } +pub fn fmt_annotated_body_comment<'a>( + buf: &mut Buf, + indent: u16, + lines_between: &'a [roc_parse::ast::CommentOrNewline<'a>], +) { + let mut comment_iter = lines_between.iter(); + if let Some(comment_first) = comment_iter.next() { + match comment_first { + roc_parse::ast::CommentOrNewline::Newline => (), + roc_parse::ast::CommentOrNewline::DocComment(comment_str) => { + buf.push_str(" # #"); + buf.spaces(1); + buf.push_str(comment_str.trim()); + } + roc_parse::ast::CommentOrNewline::LineComment(comment_str) => { + buf.push_str(" #"); + buf.spaces(1); + buf.push_str(comment_str.trim()); + } + } + + for comment_or_newline in comment_iter { + match comment_or_newline { + roc_parse::ast::CommentOrNewline::Newline => (), + roc_parse::ast::CommentOrNewline::DocComment(comment_str) => { + buf.newline(); + buf.indent(indent); + buf.push_str("# #"); + buf.spaces(1); + buf.push_str(comment_str.trim()); + } + roc_parse::ast::CommentOrNewline::LineComment(comment_str) => { + buf.newline(); + buf.indent(indent); + buf.push_str("#"); + buf.spaces(1); + buf.push_str(comment_str.trim()); + } + } + } + } +} + pub fn fmt_body<'a>(buf: &mut Buf, pattern: &'a Pattern<'a>, body: &'a Expr<'a>, indent: u16) { // Check if this is an assignment into the unit value let is_unit_assignment = if let Pattern::RecordDestructure(collection) = pattern { diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -801,7 +801,7 @@ pub enum ValueDef<'a> { AnnotatedBody { ann_pattern: &'a Loc<Pattern<'a>>, ann_type: &'a Loc<TypeAnnotation<'a>>, - comment: Option<&'a str>, + lines_between: &'a [CommentOrNewline<'a>], body_pattern: &'a Loc<Pattern<'a>>, body_expr: &'a Loc<Expr<'a>>, }, diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -1044,7 +1044,7 @@ impl<'a, 'b> Iterator for RecursiveValueDefIter<'a, 'b> { ValueDef::AnnotatedBody { ann_pattern: _, ann_type: _, - comment: _, + lines_between: _, body_pattern: _, body_expr, } => self.push_pending_from_expr(&body_expr.value), diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -2726,7 +2726,7 @@ impl<'a> Malformed for ValueDef<'a> { ValueDef::AnnotatedBody { ann_pattern, ann_type, - comment: _, + lines_between: _, body_pattern, body_expr, } => { diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -3166,9 +3166,7 @@ fn stmts_to_defs<'a>( let value_def = ValueDef::AnnotatedBody { ann_pattern: arena.alloc(ann_pattern), ann_type: arena.alloc(ann_type), - comment: spaces_middle - .first() // TODO: Why do we drop all but the first comment???? - .and_then(crate::ast::CommentOrNewline::comment_str), + lines_between: spaces_middle, body_pattern: loc_pattern, body_expr: loc_def_expr, }; diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -3213,9 +3211,7 @@ pub fn join_alias_to_body<'a>( ValueDef::AnnotatedBody { ann_pattern: arena.alloc(loc_ann_pattern), ann_type: arena.alloc(ann_type), - comment: spaces_middle - .first() // TODO: Why do we drop all but the first comment???? - .and_then(crate::ast::CommentOrNewline::comment_str), + lines_between: spaces_middle, body_pattern, body_expr, } diff --git a/crates/compiler/parse/src/remove_spaces.rs b/crates/compiler/parse/src/remove_spaces.rs --- a/crates/compiler/parse/src/remove_spaces.rs +++ b/crates/compiler/parse/src/remove_spaces.rs @@ -397,13 +397,13 @@ impl<'a> RemoveSpaces<'a> for ValueDef<'a> { AnnotatedBody { ann_pattern, ann_type, - comment: _, + lines_between: _, body_pattern, body_expr, } => AnnotatedBody { ann_pattern: arena.alloc(ann_pattern.remove_spaces(arena)), ann_type: arena.alloc(ann_type.remove_spaces(arena)), - comment: None, + lines_between: &[], body_pattern: arena.alloc(body_pattern.remove_spaces(arena)), body_expr: arena.alloc(body_expr.remove_spaces(arena)), }, diff --git a/crates/language_server/src/analysis/tokens.rs b/crates/language_server/src/analysis/tokens.rs --- a/crates/language_server/src/analysis/tokens.rs +++ b/crates/language_server/src/analysis/tokens.rs @@ -627,7 +627,7 @@ impl IterTokens for ValueDef<'_> { ValueDef::AnnotatedBody { ann_pattern, ann_type, - comment: _, + lines_between: _, body_pattern, body_expr, } => (ann_pattern.iter_tokens(arena).into_iter())
roc-lang__roc-6926
6,926
[ "6896" ]
0.0
roc-lang/roc
2024-07-27T21:32:48Z
diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__basic.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__basic.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__basic.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__basic.snap @@ -62,7 +62,7 @@ Defs { @11-15 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @11-15 Identifier { ident: "#!0_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_simple.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_simple.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_simple.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_simple.snap @@ -89,7 +89,7 @@ Defs { @31-43 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @31-43 Identifier { ident: "#!0_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap @@ -62,7 +62,9 @@ Defs { ], ), ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @35-36 Identifier { ident: "x", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_annotations.snap @@ -111,7 +113,7 @@ Defs { @60-69 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @78-79 Identifier { ident: "#!0_expr", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap @@ -78,7 +78,9 @@ Defs { ], ), ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @50-53 Identifier { ident: "foo", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap @@ -132,7 +134,7 @@ Defs { @76-83 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @76-83 Identifier { ident: "#!1_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__closure_with_defs.snap @@ -201,7 +203,7 @@ Defs { @92-99 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @92-99 Identifier { ident: "#!0_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__defs_suffixed_middle.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__defs_suffixed_middle.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__defs_suffixed_middle.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__defs_suffixed_middle.snap @@ -97,7 +97,7 @@ Defs { @25-39 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @25-39 Identifier { ident: "#!1_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap @@ -114,7 +114,9 @@ Defs { ), ], ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @95-98 Identifier { ident: "msg", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap @@ -192,7 +194,7 @@ Defs { @140-152 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @140-152 Identifier { ident: "#!0_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__if_complex.snap @@ -314,7 +316,7 @@ Defs { @227-239 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @227-239 Identifier { ident: "#!2_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap @@ -62,7 +62,7 @@ Defs { @11-15 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @11-15 Identifier { ident: "#!2_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__last_suffixed_multiple.snap @@ -122,7 +122,7 @@ Defs { @20-24 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @20-24 Identifier { ident: "#!1_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multi_defs_stmts.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multi_defs_stmts.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multi_defs_stmts.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multi_defs_stmts.snap @@ -62,7 +62,7 @@ Defs { @11-23 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @11-23 Identifier { ident: "#!0_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multiple_suffix.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multiple_suffix.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multiple_suffix.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__multiple_suffix.snap @@ -69,7 +69,7 @@ Defs { @11-16 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @11-16 Identifier { ident: "#!1_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__simple_pizza.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__simple_pizza.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__simple_pizza.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__simple_pizza.snap @@ -62,7 +62,7 @@ Defs { @11-57 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @11-57 Identifier { ident: "#!0_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__trailing_binops.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__trailing_binops.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__trailing_binops.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__trailing_binops.snap @@ -71,7 +71,7 @@ Defs { @19-30 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @19-30 Identifier { ident: "#!1_stmt", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__type_annotation.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__type_annotation.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__type_annotation.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__type_annotation.snap @@ -69,7 +69,7 @@ Defs { @18-19 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @24-25 Identifier { ident: "#!0_expr", }, diff --git a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__when_branches.snap b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__when_branches.snap --- a/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__when_branches.snap +++ b/crates/compiler/can/tests/snapshots/test_suffixed__suffixed_tests__when_branches.snap @@ -90,7 +90,7 @@ Defs { @54-65 Inferred, ], ), - comment: None, + lines_between: [], body_pattern: @54-65 Identifier { ident: "#!1_stmt", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/ann_closed_union.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/ann_closed_union.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/ann_closed_union.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/ann_closed_union.expr.result-ast @@ -38,7 +38,9 @@ Defs( }, ], }, - comment: None, + lines_between: [ + Newline, + ], body_pattern: @28-31 Identifier { ident: "foo", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/ann_open_union.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/ann_open_union.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/ann_open_union.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/ann_open_union.expr.result-ast @@ -40,7 +40,9 @@ Defs( }, ], }, - comment: None, + lines_between: [ + Newline, + ], body_pattern: @29-32 Identifier { ident: "foo", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/annotated_record_destructure.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/annotated_record_destructure.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/annotated_record_destructure.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/annotated_record_destructure.expr.result-ast @@ -32,7 +32,9 @@ SpaceAfter( "Foo", [], ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @15-23 RecordDestructure( [ @17-18 Identifier { diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tag_destructure.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tag_destructure.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tag_destructure.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tag_destructure.expr.result-ast @@ -42,7 +42,9 @@ SpaceAfter( }, ], }, - comment: None, + lines_between: [ + Newline, + ], body_pattern: @26-34 Apply( @26-32 Tag( "UserId", diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tuple_destructure.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tuple_destructure.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tuple_destructure.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/annotated_tuple_destructure.expr.result-ast @@ -32,7 +32,9 @@ SpaceAfter( "Foo", [], ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @15-23 Tuple( [ @17-18 Identifier { diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast @@ -62,7 +62,9 @@ Defs { }, ], ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @30-34 Identifier { ident: "html", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast @@ -166,7 +168,9 @@ Defs { ], ext: None, }, - comment: None, + lines_between: [ + Newline, + ], body_pattern: @190-196 Identifier { ident: "actual", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/expect_defs.moduledefs.result-ast @@ -246,7 +250,9 @@ Defs { ], ext: None, }, - comment: None, + lines_between: [ + Newline, + ], body_pattern: @326-334 Identifier { ident: "expected", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/fn_with_record_arg.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/fn_with_record_arg.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/fn_with_record_arg.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/fn_with_record_arg.expr.result-ast @@ -52,7 +52,9 @@ Defs( [], ), ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @45-50 Identifier { ident: "table", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_ext_type.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_ext_type.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_ext_type.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_ext_type.expr.result-ast @@ -52,7 +52,9 @@ SpaceAfter( ), }, ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @21-22 Identifier { ident: "f", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_type.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_type.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_type.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/function_with_tuple_type.expr.result-ast @@ -44,7 +44,9 @@ SpaceAfter( ext: None, }, ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @22-23 Identifier { ident: "f", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/nested_def_annotation.moduledefs.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/nested_def_annotation.moduledefs.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/nested_def_annotation.moduledefs.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/nested_def_annotation.moduledefs.result-ast @@ -57,7 +57,9 @@ Defs { [], ), ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @43-55 Identifier { ident: "wrappedNotEq", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type.expr.result-ast @@ -53,7 +53,9 @@ Defs( ext: None, }, ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @28-29 Identifier { ident: "f", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type_ext.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type_ext.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type_ext.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/tuple_type_ext.expr.result-ast @@ -61,7 +61,9 @@ Defs( ), }, ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @30-31 Identifier { ident: "f", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_def.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_def.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_def.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_def.expr.result-ast @@ -24,7 +24,9 @@ Defs( "Int", [], ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @10-13 Identifier { ident: "foo", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_function_def.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_function_def.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_function_def.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/type_signature_function_def.expr.result-ast @@ -38,7 +38,9 @@ Defs( [], ), ), - comment: None, + lines_between: [ + Newline, + ], body_pattern: @25-28 Identifier { ident: "foo", }, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/where_ident.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/where_ident.expr.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/where_ident.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/where_ident.expr.result-ast @@ -34,7 +34,9 @@ SpaceAfter( ], ext: None, }, - comment: None, + lines_between: [ + Newline, + ], body_pattern: @21-26 Identifier { ident: "where", }, diff --git a/crates/compiler/test_syntax/tests/test_fmt.rs b/crates/compiler/test_syntax/tests/test_fmt.rs --- a/crates/compiler/test_syntax/tests/test_fmt.rs +++ b/crates/compiler/test_syntax/tests/test_fmt.rs @@ -6231,13 +6231,108 @@ mod test_fmt { [first as last] | [first, last] -> first - + _ -> Not " ), ); } + #[test] + fn preserve_annotated_body() { + expr_formats_same(indoc!( + r" + x : i32 + x = 1 + x + " + )); + } + + #[test] + fn preserve_annotated_body_comment() { + expr_formats_same(indoc!( + r" + x : i32 # comment + x = 1 + x + " + )); + } + + #[test] + fn preserve_annotated_body_comments() { + expr_formats_same(indoc!( + r" + x : i32 + # comment + # comment 2 + x = 1 + x + " + )); + } + + #[test] + fn preserve_annotated_body_comments_without_newlines() { + expr_formats_to( + indoc!( + r" + x : i32 + + # comment + + # comment 2 + + x = 1 + x + " + ), + indoc!( + r" + x : i32 + # comment + # comment 2 + x = 1 + x + " + ), + ); + } + + #[test] + fn preserve_annotated_body_blank_comment() { + expr_formats_same(indoc!( + r" + x : i32 + # + x = 1 + x + " + )); + } + + #[test] + fn preserve_annotated_body_without_newlines() { + expr_formats_to( + indoc!( + r" + x : i32 + + x = 1 + x + " + ), + indoc!( + r" + x : i32 + x = 1 + x + " + ), + ); + } + // this is a parse error atm // #[test] // fn multiline_apply() {
Formatter deletes comments between annotation and body Roc formatter deletes comments that are between annotation and body Repro: `Bug.roc` ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import pf.Task exposing [Task] main = x : U64 # comment x = 42 Task.ok x ``` `roc format Bug.roc` ## Actual ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import pf.Task exposing [Task] main = x : U64 x = 42 Task.ok x ``` ## Expected Comments are preserved
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_fmt::preserve_annotated_body_blank_comment", "test_fmt::preserve_annotated_body_comments", "test_fmt::preserve_annotated_body_comments_without_newlines" ]
[ "test_fmt::basic_string", "test_fmt::basic_block_string", "test_fmt::apply_lambda", "test_fmt::backpassing_body_on_newline", "test_fmt::accessor", "test_fmt::binary_op_with_spaces", "test_fmt::backpassing_simple", "test_fmt::ability_member_doc_comments", "test_fmt::binary_op", "test_fmt::closure_multiline_pattern", "test_fmt::can_format_multiple_record_builders", "test_fmt::binop_if", "test_fmt::backpassing_apply_tag", "test_fmt::body_starts_with_spaces_multiline", "test_fmt::comma_prefixed_indented_record", "test_fmt::comments_before_exposes_preserved", "test_fmt::binop_parens", "test_fmt::comments_in_multiline_tag_union_annotation", "test_fmt::comment_with_trailing_space", "test_fmt::clauses_with_multiple_abilities", "test_fmt::def_with_comment_and_extra_space", "test_fmt::comment_between_two_defs", "test_fmt::comment_between_multiline_ann_args", "test_fmt::comments_with_newlines_in_records", "test_fmt::defs_with_trailing_comment", "test_fmt::destructure_nested_tag_closure", "test_fmt::def_returning_closure", "test_fmt::def_with_comment", "test_fmt::def_when", "test_fmt::defs_with_defs", "test_fmt::backpassing_parens_body", "test_fmt::empty_block_string", "test_fmt::doesnt_detect_comment_in_comment", "test_fmt::destructure_tag_closure", "test_fmt::empty_list", "test_fmt::empty_record", "test_fmt::def_with_inline_comment", "test_fmt::empty_string", "test_fmt::ending_comments_in_list", "test_fmt::escaped_quote_string", "test_fmt::escaped_unicode_string", "test_fmt::excess_parens", "test_fmt::float_with_underscores", "test_fmt::final_comments_without_comma_in_records", "test_fmt::final_comment_record_annotation", "test_fmt::empty_record_patterns", "test_fmt::force_space_at_beginning_of_comment", "test_fmt::format_chars", "test_fmt::format_char_pattern", "test_fmt::expect_multiline", "test_fmt::final_comments_in_records", "test_fmt::def_closure", "test_fmt::format_nested_pipeline", "test_fmt::expect_single_line", "test_fmt::format_list_patterns", "test_fmt::func_def", "test_fmt::format_crash", "test_fmt::func_call_trailing_multiline_lambda", "test_fmt::function_application_package_type", "test_fmt::int_with_underscores", "test_fmt::integer_when_with_space", "test_fmt::if_removes_newlines_from_condition", "test_fmt::if_removes_newlines_from_then", "test_fmt::identity", "test_fmt::integer_when", "test_fmt::inner_def_with_triple_newline_before", "test_fmt::if_removes_newlines_from_else", "test_fmt::module_exposing", "test_fmt::issue_6215", "test_fmt::multi_arg_closure", "test_fmt::leading_comments_preserved", "test_fmt::issue_6197", "test_fmt::multi_line_application", "test_fmt::module_defs_with_comments", "test_fmt::multi_line_binary_op_1", "test_fmt::module_exposing_multiline", "test_fmt::multi_line_binary_op_with_comments", "test_fmt::multi_line_hosted", "test_fmt::list_alias", "test_fmt::multi_line_binary_op_2", "test_fmt::multi_line_if_condition", "test_fmt::multi_line_if", "test_fmt::multi_line_if_condition_with_multi_line_expr_2", "test_fmt::lambda_returns_list", "test_fmt::multi_line_if_condition_with_multi_line_expr_1", "test_fmt::multi_line_if_condition_with_spaces", "test_fmt::multi_line_precedence_conflict_1", "test_fmt::format_tui_package_config", "test_fmt::multi_line_string_literal_that_can_be_single_line_in_pattern", "test_fmt::multi_line_precedence_conflict_2", "test_fmt::multi_line_string_literal_in_pattern", "test_fmt::multi_line_when_condition_1", "test_fmt::lambda_returns_record", "test_fmt::multi_line_when_branch", "test_fmt::list_allow_blank_line_before_and_after_comment", "test_fmt::multiline_basic_block_string", "test_fmt::multi_line_when_condition_4", "test_fmt::multiline_binop_if_with_comments", "test_fmt::multi_line_when_condition_3", "test_fmt::multi_line_when_condition_2", "test_fmt::multi_line_list", "test_fmt::multiline_binop_when_with_comments", "test_fmt::multi_line_record_def", "test_fmt::multiline_brace_type", "test_fmt::multiline_empty_record_type_definition", "test_fmt::multi_line_list_def", "test_fmt::multiline_curly_brace_type", "test_fmt::multiline_binop_with_comments", "test_fmt::multiline_fn_signature", "test_fmt::multiline_opaque_tag_union", "test_fmt::multiline_tag_union_annotation_beginning_on_same_line", "test_fmt::multiline_tag_union_annotation_with_final_comment", "test_fmt::multiline_type_definition", "test_fmt::multiline_record_builder_field", "test_fmt::multiple_blank_lines_collapse_to_one", "test_fmt::multiple_final_comments_with_comma_in_records", "test_fmt::multiple_final_comments_without_comma_in_records", "test_fmt::multiline_higher_order_function", "test_fmt::nested_when", "test_fmt::multiline_tag_union_annotation_no_comments", "test_fmt::newlines_block_string", "test_fmt::multiline_record_func_arg", "test_fmt::old_style_app_header_is_upgraded", "test_fmt::multiline_list_func_arg", "test_fmt::new_line_above_return", "test_fmt::new_record_builder", "test_fmt::old_style_package_header_is_upgraded", "test_fmt::one_unnamed_field", "test_fmt::one_item_list", "test_fmt::one_field", "test_fmt::oneline_empty_block_string", "test_fmt::old_record_builder", "test_fmt::partial_multi_line_binary_op_1", "test_fmt::partial_multi_line_application", "test_fmt::opaque_implements_clause", "test_fmt::partial_multi_line_binary_op_2", "test_fmt::parenthetical_def", "test_fmt::outdentable_record_builders", "test_fmt::opaque_implements_with_impls", "test_fmt::pipline_apply_lambda_2", "test_fmt::pipline_apply_lambda_1", "test_fmt::precedence_conflict_greater_than", "test_fmt::precedence_conflict", "test_fmt::precedence_conflict_functions", "test_fmt::pipline_op_with_apply", "test_fmt::precedence_conflict_greater_than_and_less_than", "test_fmt::preserve_annotated_body", "test_fmt::pipeline_apply_lambda_multiline", "test_fmt::preserve_annotated_body_without_newlines", "test_fmt::preserve_annotated_body_comment", "test_fmt::quotes_block_string", "test_fmt::quotes_block_string_single_segment", "test_fmt::record_field_destructuring", "test_fmt::record_destructuring", "test_fmt::record_pattern_with_record_guard", "test_fmt::record_pattern_with_apply_guard", "test_fmt::record_type", "test_fmt::single_def", "test_fmt::record_updating", "test_fmt::recursive_tag_union", "test_fmt::shebang_comment", "test_fmt::single_line_app", "test_fmt::single_line_hosted", "test_fmt::reduce_space_between_comments", "test_fmt::single_line_module", "test_fmt::single_line_string_literal_in_pattern", "test_fmt::single_line_platform", "test_fmt::single_line_if", "test_fmt::space_between_comments", "test_fmt::record_allow_blank_line_before_and_after_comment", "test_fmt::single_line_when_patterns", "test_fmt::tag_union", "test_fmt::trailing_comma_in_record_annotation", "test_fmt::test_where_after", "test_fmt::two_fields", "test_fmt::trailing_comma_in_record_annotation_same", "test_fmt::two_defs", "test_fmt::two_fields_center_newline", "test_fmt::two_fields_newline", "test_fmt::type_definition_add_space_around_optional_record", "test_fmt::type_definition_comment_after_colon", "test_fmt::two_item_list", "test_fmt::unary_call_no_parens", "test_fmt::unary_call_parens", "test_fmt::unary_op", "test_fmt::weird_triple_string", "test_fmt::when_guard", "test_fmt::when_guard_using_function", "test_fmt::when_with_alternatives_1", "test_fmt::when_with_alternatives_2", "test_fmt::when_with_integer_comments", "test_fmt::when_with_alternatives_3", "test_fmt::when_with_single_quote_char", "test_fmt::when_with_comments", "test_fmt::when_with_alternatives_4", "test_fmt::zero", "test_fmt::wildcard", "test_fmt::zero_point_zero", "test_fmt::type_annotation_allow_blank_line_before_and_after_comment", "test_fmt::test_fmt_builtins" ]
[ "test_fmt::test_fmt_examples" ]
[]
2024-07-29T21:14:53Z
05ab0183805907c3042e9f946a08b793ea75c038
diff --git a/crates/compiler/can/src/desugar.rs b/crates/compiler/can/src/desugar.rs --- a/crates/compiler/can/src/desugar.rs +++ b/crates/compiler/can/src/desugar.rs @@ -755,28 +755,6 @@ pub fn desugar_expr<'a>( }) } - // Replace an empty final def with a `Task.ok {}` - EmptyDefsFinal => { - let mut apply_args: Vec<&'a Loc<Expr<'a>>> = Vec::new_in(arena); - apply_args - .push(arena.alloc(Loc::at(loc_expr.region, Expr::Record(Collection::empty())))); - - arena.alloc(Loc::at( - loc_expr.region, - Expr::Apply( - arena.alloc(Loc::at( - loc_expr.region, - Expr::Var { - module_name: ModuleName::TASK, - ident: "ok", - }, - )), - arena.alloc(apply_args), - CalledVia::BangSuffix, - ), - )) - } - // note this only exists after desugaring LowLevelDbg(_, _, _) => loc_expr, } diff --git a/crates/compiler/can/src/expr.rs b/crates/compiler/can/src/expr.rs --- a/crates/compiler/can/src/expr.rs +++ b/crates/compiler/can/src/expr.rs @@ -621,9 +621,6 @@ pub fn canonicalize_expr<'a>( use Expr::*; let (expr, output) = match expr { - &ast::Expr::EmptyDefsFinal => { - internal_error!("EmptyDefsFinal should have been desugared") - } &ast::Expr::Num(str) => { let answer = num_expr_from_result(var_store, finish_parsing_num(str), region, env); diff --git a/crates/compiler/can/src/expr.rs b/crates/compiler/can/src/expr.rs --- a/crates/compiler/can/src/expr.rs +++ b/crates/compiler/can/src/expr.rs @@ -2392,8 +2389,7 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool { | ast::Expr::Backpassing(_, _, _) | ast::Expr::SpaceBefore(_, _) | ast::Expr::Str(StrLiteral::Block(_)) - | ast::Expr::SpaceAfter(_, _) - | ast::Expr::EmptyDefsFinal => false, + | ast::Expr::SpaceAfter(_, _) => false, // These can contain subexpressions, so we need to recursively check those ast::Expr::Str(StrLiteral::Line(segments)) => { segments.iter().all(|segment| match segment { diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -619,7 +619,8 @@ pub fn unwrap_suffixed_expression_defs_help<'a>( let after_empty = split_defs.after.is_empty(); if before_empty && after_empty { // NIL before, NIL after -> SINGLE DEF - let next_expr = match unwrap_suffixed_expression(arena,loc_ret,maybe_def_pat) { + // We pass None as a def pattern here because it's desugaring of the ret expression + let next_expr = match unwrap_suffixed_expression(arena,loc_ret, None) { Ok(next_expr) => next_expr, Err(EUnwrapped::UnwrappedSubExpr { sub_arg, sub_pat, sub_new }) => { // We need to apply Task.ok here as the defs final expression was unwrapped diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -649,7 +650,8 @@ pub fn unwrap_suffixed_expression_defs_help<'a>( return unwrap_suffixed_expression(arena, apply_task_await(arena,def_expr.region,unwrapped_expr,def_pattern,next_expr), maybe_def_pat); } else if after_empty { // SOME before, NIL after -> LAST DEF - match unwrap_suffixed_expression(arena,loc_ret,maybe_def_pat){ + // We pass None as a def pattern here because it's desugaring of the ret expression + match unwrap_suffixed_expression(arena,loc_ret,None){ Ok(new_loc_ret) => { let applied_task_await = apply_task_await(arena, loc_expr.region, unwrapped_expr, def_pattern, new_loc_ret); let new_defs = arena.alloc(Loc::at(loc_expr.region,Defs(arena.alloc(split_defs.before), applied_task_await))); diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -45,7 +45,6 @@ impl<'a> Formattable for Expr<'a> { | MalformedClosure | Tag(_) | OpaqueRef(_) - | EmptyDefsFinal | Crash => false, RecordAccess(inner, _) | TupleAccess(inner, _) | TaskAwaitBang(inner) => { diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -420,9 +419,6 @@ impl<'a> Formattable for Expr<'a> { indent, ); } - EmptyDefsFinal => { - // no need to print anything - } _ => { buf.ensure_ends_with_newline(); buf.indent(indent); diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -439,9 +435,6 @@ impl<'a> Formattable for Expr<'a> { buf.push(')'); } } - EmptyDefsFinal => { - // no need to print anything - } Expect(condition, continuation) => { fmt_expect(buf, condition, continuation, self.is_multiline(), indent); } diff --git a/crates/compiler/fmt/src/spaces.rs b/crates/compiler/fmt/src/spaces.rs --- a/crates/compiler/fmt/src/spaces.rs +++ b/crates/compiler/fmt/src/spaces.rs @@ -768,7 +768,6 @@ impl<'a> RemoveSpaces<'a> for StrSegment<'a> { impl<'a> RemoveSpaces<'a> for Expr<'a> { fn remove_spaces(&self, arena: &'a Bump) -> Self { match *self { - Expr::EmptyDefsFinal => Expr::EmptyDefsFinal, Expr::Float(a) => Expr::Float(a), Expr::Num(a) => Expr::Num(a), Expr::NonBase10Int { diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -462,10 +462,6 @@ pub enum Expr<'a> { /// Multiple defs in a row Defs(&'a Defs<'a>, &'a Loc<Expr<'a>>), - /// Used in place of an expression when the final expression is empty - /// This may happen if the final expression is actually a suffixed statement - EmptyDefsFinal, - Backpassing(&'a [Loc<Pattern<'a>>], &'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>), Expect(&'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>), Dbg(&'a Loc<Expr<'a>>, &'a Loc<Expr<'a>>), diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -536,6 +532,19 @@ pub fn split_loc_exprs_around<'a>( (before, after) } +/// Checks if the bang suffix is applied only at the top level of expression +pub fn is_top_level_suffixed(expr: &Expr) -> bool { + // TODO: should we check BinOps with pizza where the last expression is TaskAwaitBang? + match expr { + Expr::TaskAwaitBang(..) => true, + Expr::Apply(a, _, _) => is_top_level_suffixed(&a.value), + Expr::SpaceBefore(a, _) => is_top_level_suffixed(a), + Expr::SpaceAfter(a, _) => is_top_level_suffixed(a), + _ => false, + } +} + +/// Check if the bang suffix is applied recursevely in expression pub fn is_expr_suffixed(expr: &Expr) -> bool { match expr { // expression without arguments, `read!` diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -613,7 +622,6 @@ pub fn is_expr_suffixed(expr: &Expr) -> bool { Expr::Crash => false, Expr::Tag(_) => false, Expr::OpaqueRef(_) => false, - Expr::EmptyDefsFinal => false, Expr::Backpassing(_, _, _) => false, // TODO: we might want to check this? Expr::Expect(a, b) | Expr::Dbg(a, b) => { is_expr_suffixed(&a.value) || is_expr_suffixed(&b.value) diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -975,8 +983,7 @@ impl<'a, 'b> RecursiveValueDefIter<'a, 'b> { | MalformedIdent(_, _) | MalformedClosure | PrecedenceConflict(_) - | MalformedSuffixed(_) - | EmptyDefsFinal => { /* terminal */ } + | MalformedSuffixed(_) => { /* terminal */ } } } } diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -1183,51 +1190,39 @@ impl<'a> Defs<'a> { }) } - // We could have a type annotation as the last tag, - // this helper ensures we refer to the last value_def - // and that we remove the correct tag - pub fn last_value_suffixed(&self) -> Option<(Self, &'a Loc<Expr<'a>>)> { - let value_indexes = - self.tags - .clone() - .into_iter() - .enumerate() - .filter_map(|(tag_index, tag)| match tag.split() { - Ok(_) => None, - Err(value_index) => Some((tag_index, value_index.index())), - }); - - if let Some((tag_index, value_index)) = value_indexes.last() { - match self.value_defs[value_index] { - ValueDef::Body( - Loc { - value: Pattern::RecordDestructure(collection), - .. - }, - loc_expr, - ) if collection.is_empty() && is_expr_suffixed(&loc_expr.value) => { - let mut new_defs = self.clone(); - new_defs.remove_value_def(tag_index); - - return Some((new_defs, loc_expr)); - } - ValueDef::Stmt(loc_expr) if is_expr_suffixed(&loc_expr.value) => { - let mut new_defs = self.clone(); - new_defs.remove_value_def(tag_index); + pub fn pop_last_value(&mut self) -> Option<&'a Loc<Expr<'a>>> { + let last_value_suffix = self + .tags + .iter() + .enumerate() + .rev() + .find_map(|(tag_index, tag)| match tag.split() { + Ok(_) => None, + Err(value_index) => match self.value_defs[value_index.index()] { + ValueDef::Body( + Loc { + value: Pattern::RecordDestructure(collection), + .. + }, + loc_expr, + ) if collection.is_empty() => Some((tag_index, loc_expr)), + ValueDef::Stmt(loc_expr) => Some((tag_index, loc_expr)), + _ => None, + }, + }); - return Some((new_defs, loc_expr)); - } - _ => {} - } + if let Some((tag_index, loc_expr)) = last_value_suffix { + self.remove_tag(tag_index); + Some(loc_expr) + } else { + None } - - None } - pub fn remove_value_def(&mut self, index: usize) { + pub fn remove_tag(&mut self, tag_index: usize) { match self .tags - .get(index) + .get(tag_index) .expect("got an invalid index for Defs") .split() { diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -1260,10 +1255,10 @@ impl<'a> Defs<'a> { } } } - self.tags.remove(index); - self.regions.remove(index); - self.space_after.remove(index); - self.space_before.remove(index); + self.tags.remove(tag_index); + self.regions.remove(tag_index); + self.space_after.remove(tag_index); + self.space_before.remove(tag_index); } /// NOTE assumes the def itself is pushed already! diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -2394,7 +2389,6 @@ impl<'a> Malformed for Expr<'a> { Tag(_) | OpaqueRef(_) | SingleQuote(_) | // This is just a &str - not a bunch of segments - EmptyDefsFinal | Crash => false, Str(inner) => inner.is_malformed(), diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -1,9 +1,9 @@ use crate::ast::{ - is_expr_suffixed, AssignedField, Collection, CommentOrNewline, Defs, Expr, ExtractSpaces, - Implements, ImplementsAbilities, ImportAlias, ImportAsKeyword, ImportExposingKeyword, - ImportedModuleName, IngestedFileAnnotation, IngestedFileImport, ModuleImport, - ModuleImportParams, Pattern, RecordBuilderField, Spaceable, Spaced, Spaces, TypeAnnotation, - TypeDef, TypeHeader, ValueDef, + is_expr_suffixed, is_top_level_suffixed, AssignedField, Collection, CommentOrNewline, Defs, + Expr, ExtractSpaces, Implements, ImplementsAbilities, ImportAlias, ImportAsKeyword, + ImportExposingKeyword, ImportedModuleName, IngestedFileAnnotation, IngestedFileImport, + ModuleImport, ModuleImportParams, Pattern, RecordBuilderField, Spaceable, Spaced, Spaces, + TypeAnnotation, TypeDef, TypeHeader, ValueDef, }; use crate::blankspace::{ space0_after_e, space0_around_e_no_after_indent_check, space0_around_ee, space0_before_e, diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -384,7 +384,7 @@ fn expr_operator_chain<'a>(options: ExprParseOptions) -> impl Parser<'a, Expr<'a Ok((progress, expr, new_state)) => { // We need to check if we have just parsed a suffixed statement, // if so, this is a defs node. - if is_expr_suffixed(&expr) { + if is_top_level_suffixed(&expr) { let def_region = Region::new(end, new_state.pos()); let value_def = ValueDef::Stmt(arena.alloc(Loc::at(def_region, expr))); diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -1154,13 +1154,13 @@ pub fn parse_single_def_assignment<'a>( // If the expression is actually a suffixed statement, then we need to continue // to parse the rest of the expression - if crate::ast::is_expr_suffixed(&first_loc_expr.value) { + if is_top_level_suffixed(&first_loc_expr.value) { let mut defs = Defs::default(); // Take the suffixed value and make it a e.g. Body(`{}=`, Apply(Var(...))) // we will keep the pattern `def_loc_pattern` for the new Defs defs.push_value_def( ValueDef::Stmt(arena.alloc(first_loc_expr)), - Region::span_across(&def_loc_pattern.region, &first_loc_expr.region), + region, spaces_before_current, &[], ); diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -1169,16 +1169,16 @@ pub fn parse_single_def_assignment<'a>( match parse_defs_expr( options, min_indent, - defs.clone(), + defs, arena, - state_after_first_expression.clone(), + state_after_first_expression, ) { Ok((progress_after_rest_of_def, expr, state_after_rest_of_def)) => { let final_loc_expr = arena.alloc(Loc::at(region, expr)); let value_def = ValueDef::Body(arena.alloc(def_loc_pattern), final_loc_expr); - return Ok(( + Ok(( progress_after_rest_of_def, Some(SingleDef { type_or_value: Either::Second(value_def), diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -1187,45 +1187,24 @@ pub fn parse_single_def_assignment<'a>( spaces_after: &[], }), state_after_rest_of_def, - )); - } - Err(_) => { - // Unable to parse more defs, continue and return the first parsed expression as a stement - let empty_return = - arena.alloc(Loc::at(first_loc_expr.region, Expr::EmptyDefsFinal)); - let value_def = ValueDef::Body( - arena.alloc(def_loc_pattern), - arena.alloc(Loc::at( - first_loc_expr.region, - Expr::Defs(arena.alloc(defs), empty_return), - )), - ); - return Ok(( - progress_after_first, - Some(SingleDef { - type_or_value: Either::Second(value_def), - region, - spaces_before: spaces_before_current, - spaces_after: &[], - }), - state_after_first_expression, - )); + )) } + Err((progress, err)) => Err((progress, err)), } - } - - let value_def = ValueDef::Body(arena.alloc(def_loc_pattern), arena.alloc(first_loc_expr)); + } else { + let value_def = ValueDef::Body(arena.alloc(def_loc_pattern), arena.alloc(first_loc_expr)); - Ok(( - progress_after_first, - Some(SingleDef { - type_or_value: Either::Second(value_def), - region, - spaces_before: spaces_before_current, - spaces_after: &[], - }), - state_after_first_expression, - )) + Ok(( + progress_after_first, + Some(SingleDef { + type_or_value: Either::Second(value_def), + region, + spaces_before: spaces_before_current, + spaces_after: &[], + }), + state_after_first_expression, + )) + } } /// e.g. Things that can be on their own line in a def, e.g. `expect`, `expect-fx`, or `dbg` diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -1460,48 +1439,31 @@ fn parse_defs_expr<'a>( Err(bad) => Err(bad), Ok((_, def_state, state)) => { // this is no def, because there is no `=` or `:`; parse as an expr - let parse_final_expr = space0_before_e(expr_start(options), EExpr::IndentEnd); - - match parse_final_expr.parse(arena, state.clone(), min_indent) { + match space0_before_e(expr_start(options), EExpr::IndentEnd).parse( + arena, + state.clone(), + min_indent, + ) { Err((_, fail)) => { - // If the last def was a suffixed statement, assume this was - // intentional by the application author instead of giving - // an error. - if let Some((new_defs, loc_ret)) = def_state.last_value_suffixed() { - // note we check the tags here and not value_defs, as there may be redundant defs in Defs - - let mut local_defs = new_defs.clone(); - - let last_stmt = ValueDef::Stmt(loc_ret); - local_defs.push_value_def(last_stmt, loc_ret.region, &[], &[]); - - //check the length of the defs we would return, if we only have one - // we can just return the expression - // note we use tags here, as we may have redundant defs in Defs - if local_defs - .tags - .iter() - .filter(|tag| tag.split().is_err()) - .count() - == 1 - { - return Ok((MadeProgress, loc_ret.value, state)); + let mut def_state = def_state; + match def_state.pop_last_value() { + Some(loc_ret) => { + // If the poped value was the only item in defs - just return it as an expression + if def_state.is_empty() { + Ok((MadeProgress, loc_ret.value, state)) + } else { + Ok(( + MadeProgress, + Expr::Defs(arena.alloc(def_state), arena.alloc(loc_ret)), + state, + )) + } } - - return Ok(( + None => Err(( MadeProgress, - Expr::Defs( - arena.alloc(local_defs), - arena.alloc(Loc::at_zero(Expr::EmptyDefsFinal)), - ), - state, - )); + EExpr::DefMissingFinalExpr2(arena.alloc(fail), state.pos()), + )), } - - Err(( - MadeProgress, - EExpr::DefMissingFinalExpr2(arena.alloc(fail), state.pos()), - )) } Ok((_, loc_ret, state)) => Ok(( MadeProgress, diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -2408,8 +2370,7 @@ fn expr_to_pattern_help<'a>(arena: &'a Bump, expr: &Expr<'a>) -> Result<Pattern< Expr::SpaceBefore(..) | Expr::SpaceAfter(..) | Expr::ParensAround(..) - | Expr::RecordBuilder(..) - | Expr::EmptyDefsFinal => unreachable!(), + | Expr::RecordBuilder(..) => unreachable!(), Expr::Record(fields) => { let patterns = fields.map_items_result(arena, |loc_assigned_field| { diff --git a/crates/language_server/src/analysis/tokens.rs b/crates/language_server/src/analysis/tokens.rs --- a/crates/language_server/src/analysis/tokens.rs +++ b/crates/language_server/src/analysis/tokens.rs @@ -732,7 +732,6 @@ impl IterTokens for Loc<Expr<'_>> { Expr::MalformedIdent(_, _) | Expr::MalformedClosure | Expr::PrecedenceConflict(_) - | Expr::EmptyDefsFinal | Expr::MalformedSuffixed(_) => { bumpvec![in arena;] }
roc-lang__roc-6851
6,851
Update - as a workaround in bocci-bird I've pull the closure out into a helper and that has resolved the issue. But this still seems like an interesting edge case. I ran into what I think is this same issue, and came up with a simpler reproduction: ```roc app [main] { cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import cli.Task exposing [Task] main : Task {} _ main = Task.ok {} accepted1 : Task {} _ accepted1 = result = Ok (Task.ok! {}) Task.fromResult result accepted2 : Task {} _ accepted2 = Task.fromResult (Ok (Task.ok! {})) rejected : Task {} _ rejected = x = 42 Task.fromResult (Ok (Task.ok! {})) ``` ``` ── TYPE MISMATCH in weird.roc ────────────────────────────────────────────────── This expression is used in an unexpected way: 23│ Task.fromResult (Ok (Task.ok! {})) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This Task.fromResult call produces: InternalTask.Task a b But you are trying to use it as: {}a Tip: Type comparisons between an opaque type are only ever equal if both types are the same opaque type. Did you mean to create an opaque type by wrapping it? If I have an opaque type Age := U32 I can create an instance of this opaque type by doing @Age 23. ──────────────────────────────────────────────────────────────────────────────── 1 error and 5 warnings found in 14 ms ``` I'm on 794c20956de5f22019fe1bf1cad6bf7b738add52 at the moment. Some further investigation. This looks fine to me. ```roc accepted1 : Task {} _ accepted1 = result = Ok (Task.ok! {}) Task.fromResult result # Unwrapping manually I get accepted1 : Task {} _ accepted1 = Task.await (Task.ok {}) \answer -> result = Ok answer Task.fromResult result # we know answer here is {}, so the fn returns Task {} _ ``` And this also looks fine ```roc accepted2 : Task {} _ accepted2 = Task.fromResult (Ok (Task.ok! {})) # Unwrapping manually I get accepted2 : Task {} _ accepted2 = Task.await (Task.ok {}) \answer -> Task.fromResult (Ok answer) # we know answer here is {}, so the fn returns Task {} _ ``` This one is acting strange...the Defs node must be confusing things. ```roc rejected : Task {} _ rejected = x = 42 Task.fromResult (Ok (Task.ok! {})) # Unwrapping manually I get rejected : Task {} _ rejected = x = 42 Task.await (Task.ok {}) \answer -> Task.fromResult (Ok answer) # we know answer here is {}, so this *should* be good, but it's not ``` @kdziamura - would you be able to have a look at this bug? Yep, I already looked into this issue previously but didn't go too deep. I’ll take a look after fixing bangs in dbg and probably in expect statements
[ "6656" ]
0.0
roc-lang/roc
2024-06-28T23:40:47Z
diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -1,3 +1,6 @@ +#[macro_use] +extern crate indoc; + #[cfg(test)] mod suffixed_tests { diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -375,7 +378,7 @@ mod suffixed_tests { x = foo! msg bar x "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-88], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-88 Defs(Defs { tags: [Index(2147483649)], regions: [@30-37], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@24-27 Identifier { ident: "msg" }, @30-37 Str(PlainLine("hello"))), Body(@24-27 Identifier { ident: "msg" }, @30-37 Str(PlainLine("hello")))] }, @0-88 Apply(@0-88 Var { module_name: "Task", ident: "await" }, [@54-66 Apply(@54-66 Var { module_name: "", ident: "foo" }, [@63-66 Var { module_name: "", ident: "msg" }], Space), @0-88 Closure([@54-55 Identifier { ident: "x" }], @83-88 Apply(@83-86 Var { module_name: "", ident: "bar" }, [@87-88 Var { module_name: "", ident: "x" }], Space))], BangSuffix)))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-88], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @24-88 Defs(Defs { tags: [Index(2147483649)], regions: [@30-37], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@24-27 Identifier { ident: "msg" }, @30-37 Str(PlainLine("hello"))), Body(@24-27 Identifier { ident: "msg" }, @30-37 Str(PlainLine("hello")))] }, @24-88 Apply(@24-88 Var { module_name: "Task", ident: "await" }, [@54-66 Apply(@54-66 Var { module_name: "", ident: "foo" }, [@63-66 Var { module_name: "", ident: "msg" }], Space), @24-88 Closure([@54-55 Identifier { ident: "x" }], @83-88 Apply(@83-86 Var { module_name: "", ident: "bar" }, [@87-88 Var { module_name: "", ident: "x" }], Space))], BangSuffix)))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -416,7 +419,7 @@ mod suffixed_tests { x "foo" "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-187], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-187 Defs(Defs { tags: [Index(2147483650)], regions: [@60-162], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Annotation(@24-25 Identifier { ident: "x" }, @28-43 Function([@28-31 Apply("", "Str", [])], @35-43 Apply("", "Task", [@40-41 Inferred, @42-43 Inferred]))), AnnotatedBody { ann_pattern: @24-25 Identifier { ident: "x" }, ann_type: @28-43 Function([@28-31 Apply("", "Str", [])], @35-43 Apply("", "Task", [@40-41 Inferred, @42-43 Inferred])), comment: None, body_pattern: @60-61 Identifier { ident: "x" }, body_expr: @60-162 Closure([@65-68 Identifier { ident: "msg" }], @93-162 Defs(Defs { tags: [Index(2147483649)], regions: [@93-140], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Annotation(@93-94 Identifier { ident: "y" }, @97-106 Apply("", "Task", [@102-104 Record { fields: [], ext: None }, @105-106 Inferred])), AnnotatedBody { ann_pattern: @93-94 Identifier { ident: "y" }, ann_type: @97-106 Apply("", "Task", [@102-104 Record { fields: [], ext: None }, @105-106 Inferred]), comment: None, body_pattern: @127-128 Identifier { ident: "y" }, body_expr: @127-140 Apply(@131-135 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@137-140 Var { module_name: "", ident: "msg" }], Space) }] }, @161-162 Var { module_name: "", ident: "y" })) }, AnnotatedBody { ann_pattern: @24-25 Identifier { ident: "x" }, ann_type: @28-43 Function([@28-31 Apply("", "Str", [])], @35-43 Apply("", "Task", [@40-41 Inferred, @42-43 Inferred])), comment: None, body_pattern: @60-61 Identifier { ident: "x" }, body_expr: @60-162 Closure([@65-68 Identifier { ident: "msg" }], @127-140 Apply(@127-140 Var { module_name: "Task", ident: "await" }, [@127-140 Apply(@127-140 Var { module_name: "", ident: "line" }, [@137-140 Var { module_name: "", ident: "msg" }], Space), @127-140 Closure([@127-128 Identifier { ident: "y" }], @161-162 Var { module_name: "", ident: "y" })], BangSuffix)) }] }, @180-187 Apply(@180-181 Var { module_name: "", ident: "x" }, [@182-187 Str(PlainLine("foo"))], Space)))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-187], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @24-187 Defs(Defs { tags: [Index(2147483650)], regions: [@64-162], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Annotation(@24-25 Identifier { ident: "x" }, @28-43 Function([@28-31 Apply("", "Str", [])], @35-43 Apply("", "Task", [@40-41 Inferred, @42-43 Inferred]))), AnnotatedBody { ann_pattern: @24-25 Identifier { ident: "x" }, ann_type: @28-43 Function([@28-31 Apply("", "Str", [])], @35-43 Apply("", "Task", [@40-41 Inferred, @42-43 Inferred])), comment: None, body_pattern: @60-61 Identifier { ident: "x" }, body_expr: @64-162 Closure([@65-68 Identifier { ident: "msg" }], @93-162 Defs(Defs { tags: [Index(2147483649)], regions: [@93-140], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Annotation(@93-94 Identifier { ident: "y" }, @97-106 Apply("", "Task", [@102-104 Record { fields: [], ext: None }, @105-106 Inferred])), AnnotatedBody { ann_pattern: @93-94 Identifier { ident: "y" }, ann_type: @97-106 Apply("", "Task", [@102-104 Record { fields: [], ext: None }, @105-106 Inferred]), comment: None, body_pattern: @127-128 Identifier { ident: "y" }, body_expr: @127-140 Apply(@131-135 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@137-140 Var { module_name: "", ident: "msg" }], Space) }] }, @161-162 Var { module_name: "", ident: "y" })) }, AnnotatedBody { ann_pattern: @24-25 Identifier { ident: "x" }, ann_type: @28-43 Function([@28-31 Apply("", "Str", [])], @35-43 Apply("", "Task", [@40-41 Inferred, @42-43 Inferred])), comment: None, body_pattern: @60-61 Identifier { ident: "x" }, body_expr: @64-162 Closure([@65-68 Identifier { ident: "msg" }], @127-140 Apply(@127-140 Var { module_name: "Task", ident: "await" }, [@127-140 Apply(@127-140 Var { module_name: "", ident: "line" }, [@137-140 Var { module_name: "", ident: "msg" }], Space), @127-140 Closure([@127-128 Identifier { ident: "y" }], @161-162 Var { module_name: "", ident: "y" })], BangSuffix)) }] }, @180-187 Apply(@180-181 Var { module_name: "", ident: "x" }, [@182-187 Str(PlainLine("foo"))], Space)))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -610,7 +613,7 @@ mod suffixed_tests { else line "fail" "#, - r##"Defs { tags: [Index(2147483648)], regions: [@0-286], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-286 Defs(Defs { tags: [Index(2147483650), Index(2147483651)], regions: [@32-49, @76-94], space_before: [Slice(start = 0, length = 0), Slice(start = 0, length = 1)], space_after: [Slice(start = 0, length = 0), Slice(start = 1, length = 0)], spaces: [Newline], type_defs: [], value_defs: [Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space)), Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space))] }, @115-123 Apply(@115-123 Var { module_name: "Task", ident: "await" }, [@115-123 Var { module_name: "", ident: "isFalse" }, @115-123 Closure([@115-123 Identifier { ident: "#!a0" }], @112-286 If([(@115-123 Var { module_name: "", ident: "#!a0" }, @149-160 Apply(@149-153 Var { module_name: "", ident: "line" }, [@154-160 Str(PlainLine("fail"))], Space))], @185-192 Apply(@185-192 Var { module_name: "Task", ident: "await" }, [@185-192 Var { module_name: "", ident: "isTrue" }, @185-192 Closure([@185-192 Identifier { ident: "#!a1" }], @112-286 If([(@185-192 Var { module_name: "", ident: "#!a1" }, @219-233 Apply(@219-223 Var { module_name: "", ident: "line" }, [@224-233 Str(PlainLine("success"))], Space))], @275-286 Apply(@275-279 Var { module_name: "", ident: "line" }, [@280-286 Str(PlainLine("fail"))], Space)))], BangSuffix)))], BangSuffix)))] }"##, + r##"Defs { tags: [Index(2147483648)], regions: [@0-286], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-286 Defs(Defs { tags: [Index(2147483650), Index(2147483651)], regions: [@32-49, @76-94], space_before: [Slice(start = 0, length = 0), Slice(start = 0, length = 1)], space_after: [Slice(start = 0, length = 0), Slice(start = 1, length = 0)], spaces: [Newline], type_defs: [], value_defs: [Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space)), Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space))] }, @115-123 Apply(@115-123 Var { module_name: "Task", ident: "await" }, [@115-123 Var { module_name: "", ident: "isFalse" }, @115-123 Closure([@115-123 Identifier { ident: "#!a0" }], @112-286 If([(@115-123 Var { module_name: "", ident: "#!a0" }, @149-160 Apply(@149-153 Var { module_name: "", ident: "line" }, [@154-160 Str(PlainLine("fail"))], Space))], @185-192 Apply(@185-192 Var { module_name: "Task", ident: "await" }, [@185-192 Var { module_name: "", ident: "isTrue" }, @185-192 Closure([@185-192 Identifier { ident: "#!a1" }], @112-286 If([(@185-192 Var { module_name: "", ident: "#!a1" }, @219-233 Apply(@219-223 Var { module_name: "", ident: "line" }, [@224-233 Str(PlainLine("success"))], Space))], @275-286 Apply(@275-279 Var { module_name: "", ident: "line" }, [@280-286 Str(PlainLine("fail"))], Space)))], BangSuffix)))], BangSuffix)))] }"##, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -650,7 +653,7 @@ mod suffixed_tests { msg "#, - r##"Defs { tags: [Index(2147483648)], regions: [@0-466], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-466 Defs(Defs { tags: [Index(2147483652), Index(2147483653), Index(2147483654)], regions: [@32-49, @77-92, @143-445], space_before: [Slice(start = 0, length = 0), Slice(start = 0, length = 1), Slice(start = 1, length = 1)], space_after: [Slice(start = 0, length = 0), Slice(start = 1, length = 0), Slice(start = 2, length = 0)], spaces: [Newline, Newline], type_defs: [], value_defs: [Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-74 Identifier { ident: "isFalsey" }, @77-92 Closure([@78-79 Identifier { ident: "x" }], @83-92 Apply(@83-90 Var { module_name: "Task", ident: "ok" }, [@91-92 Var { module_name: "", ident: "x" }], Space))), Annotation(@109-112 Identifier { ident: "msg" }, @115-126 Apply("", "Task", [@120-122 Record { fields: [], ext: None }, @123-126 Apply("", "I32", [])])), AnnotatedBody { ann_pattern: @109-112 Identifier { ident: "msg" }, ann_type: @115-126 Apply("", "Task", [@120-122 Record { fields: [], ext: None }, @123-126 Apply("", "I32", [])]), comment: None, body_pattern: @143-146 Identifier { ident: "msg" }, body_expr: @143-445 If([(@173-183 Apply(@173-174 Var { module_name: "Bool", ident: "not" }, [@175-182 ParensAround(TaskAwaitBang(Var { module_name: "", ident: "isTrue" }))], UnaryOp(Not)), @213-256 Defs(Defs { tags: [Index(2147483648)], regions: [@218-225], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@218-225 RecordDestructure([]), @218-225 Apply(@213-217 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@219-225 Str(PlainLine("fail"))], Space))] }, @251-256 Apply(@251-254 Var { module_name: "", ident: "err" }, [@255-256 Num("1")], Space))), (@285-307 ParensAround(Apply(@286-294 TaskAwaitBang(Var { module_name: "", ident: "isFalsey" }), [@296-306 Var { module_name: "Bool", ident: "false" }], Space)), @338-380 Defs(Defs { tags: [Index(2147483648)], regions: [@343-350], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@343-350 RecordDestructure([]), @343-350 Apply(@338-342 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@344-350 Str(PlainLine("nope"))], Space))] }, @375-380 Apply(@375-377 Var { module_name: "", ident: "ok" }, [@378-380 Record([])], Space)))], @430-445 Apply(@430-434 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@436-445 Str(PlainLine("success"))], Space)) }, Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-74 Identifier { ident: "isFalsey" }, @77-92 Closure([@78-79 Identifier { ident: "x" }], @83-92 Apply(@83-90 Var { module_name: "Task", ident: "ok" }, [@91-92 Var { module_name: "", ident: "x" }], Space))), AnnotatedBody { ann_pattern: @109-112 Identifier { ident: "msg" }, ann_type: @115-126 Apply("", "Task", [@120-122 Record { fields: [], ext: None }, @123-126 Apply("", "I32", [])]), comment: None, body_pattern: @143-146 Identifier { ident: "msg" }, body_expr: Apply(Var { module_name: "Task", ident: "await" }, [Var { module_name: "", ident: "isTrue" }, Closure([Identifier { ident: "#!a0" }], @143-445 If([(@173-183 Apply(@173-174 Var { module_name: "Bool", ident: "not" }, [@175-182 ParensAround(Var { module_name: "", ident: "#!a0" })], UnaryOp(Not)), @218-225 Apply(@218-225 Var { module_name: "Task", ident: "await" }, [@218-225 Apply(@218-225 Var { module_name: "", ident: "line" }, [@219-225 Str(PlainLine("fail"))], Space), @218-225 Closure([@218-225 RecordDestructure([])], @251-256 Apply(@251-254 Var { module_name: "", ident: "err" }, [@255-256 Num("1")], Space))], BangSuffix))], Apply(Var { module_name: "Task", ident: "await" }, [Apply(Var { module_name: "", ident: "isFalsey" }, [@296-306 Var { module_name: "Bool", ident: "false" }], Space), Closure([Identifier { ident: "#!a1" }], @143-445 If([(@285-307 ParensAround(Var { module_name: "", ident: "#!a1" }), @343-350 Apply(@343-350 Var { module_name: "Task", ident: "await" }, [@343-350 Apply(@343-350 Var { module_name: "", ident: "line" }, [@344-350 Str(PlainLine("nope"))], Space), @343-350 Closure([@343-350 RecordDestructure([])], @375-380 Apply(@375-377 Var { module_name: "", ident: "ok" }, [@378-380 Record([])], Space))], BangSuffix))], @430-445 Apply(@430-445 Var { module_name: "", ident: "line" }, [@436-445 Str(PlainLine("success"))], Space)))], BangSuffix)))], BangSuffix) }] }, @463-466 Var { module_name: "", ident: "msg" }))] }"##, + r##"Defs { tags: [Index(2147483648)], regions: [@0-466], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-466 Defs(Defs { tags: [Index(2147483652), Index(2147483653), Index(2147483654)], regions: [@32-49, @77-92, @170-445], space_before: [Slice(start = 0, length = 0), Slice(start = 0, length = 1), Slice(start = 1, length = 1)], space_after: [Slice(start = 0, length = 0), Slice(start = 1, length = 0), Slice(start = 2, length = 0)], spaces: [Newline, Newline], type_defs: [], value_defs: [Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-74 Identifier { ident: "isFalsey" }, @77-92 Closure([@78-79 Identifier { ident: "x" }], @83-92 Apply(@83-90 Var { module_name: "Task", ident: "ok" }, [@91-92 Var { module_name: "", ident: "x" }], Space))), Annotation(@109-112 Identifier { ident: "msg" }, @115-126 Apply("", "Task", [@120-122 Record { fields: [], ext: None }, @123-126 Apply("", "I32", [])])), AnnotatedBody { ann_pattern: @109-112 Identifier { ident: "msg" }, ann_type: @115-126 Apply("", "Task", [@120-122 Record { fields: [], ext: None }, @123-126 Apply("", "I32", [])]), comment: None, body_pattern: @143-146 Identifier { ident: "msg" }, body_expr: @170-445 If([(@173-183 Apply(@173-174 Var { module_name: "Bool", ident: "not" }, [@175-182 ParensAround(TaskAwaitBang(Var { module_name: "", ident: "isTrue" }))], UnaryOp(Not)), @213-256 Defs(Defs { tags: [Index(2147483648)], regions: [@218-225], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@218-225 RecordDestructure([]), @218-225 Apply(@213-217 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@219-225 Str(PlainLine("fail"))], Space))] }, @251-256 Apply(@251-254 Var { module_name: "", ident: "err" }, [@255-256 Num("1")], Space))), (@285-307 ParensAround(Apply(@286-294 TaskAwaitBang(Var { module_name: "", ident: "isFalsey" }), [@296-306 Var { module_name: "Bool", ident: "false" }], Space)), @338-380 Defs(Defs { tags: [Index(2147483648)], regions: [@343-350], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@343-350 RecordDestructure([]), @343-350 Apply(@338-342 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@344-350 Str(PlainLine("nope"))], Space))] }, @375-380 Apply(@375-377 Var { module_name: "", ident: "ok" }, [@378-380 Record([])], Space)))], @430-445 Apply(@430-434 TaskAwaitBang(Var { module_name: "", ident: "line" }), [@436-445 Str(PlainLine("success"))], Space)) }, Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-74 Identifier { ident: "isFalsey" }, @77-92 Closure([@78-79 Identifier { ident: "x" }], @83-92 Apply(@83-90 Var { module_name: "Task", ident: "ok" }, [@91-92 Var { module_name: "", ident: "x" }], Space))), AnnotatedBody { ann_pattern: @109-112 Identifier { ident: "msg" }, ann_type: @115-126 Apply("", "Task", [@120-122 Record { fields: [], ext: None }, @123-126 Apply("", "I32", [])]), comment: None, body_pattern: @143-146 Identifier { ident: "msg" }, body_expr: Apply(Var { module_name: "Task", ident: "await" }, [Var { module_name: "", ident: "isTrue" }, Closure([Identifier { ident: "#!a0" }], @170-445 If([(@173-183 Apply(@173-174 Var { module_name: "Bool", ident: "not" }, [@175-182 ParensAround(Var { module_name: "", ident: "#!a0" })], UnaryOp(Not)), @218-225 Apply(@218-225 Var { module_name: "Task", ident: "await" }, [@218-225 Apply(@218-225 Var { module_name: "", ident: "line" }, [@219-225 Str(PlainLine("fail"))], Space), @218-225 Closure([@218-225 RecordDestructure([])], @251-256 Apply(@251-254 Var { module_name: "", ident: "err" }, [@255-256 Num("1")], Space))], BangSuffix))], Apply(Var { module_name: "Task", ident: "await" }, [Apply(Var { module_name: "", ident: "isFalsey" }, [@296-306 Var { module_name: "Bool", ident: "false" }], Space), Closure([Identifier { ident: "#!a1" }], @170-445 If([(@285-307 ParensAround(Var { module_name: "", ident: "#!a1" }), @343-350 Apply(@343-350 Var { module_name: "Task", ident: "await" }, [@343-350 Apply(@343-350 Var { module_name: "", ident: "line" }, [@344-350 Str(PlainLine("nope"))], Space), @343-350 Closure([@343-350 RecordDestructure([])], @375-380 Apply(@375-377 Var { module_name: "", ident: "ok" }, [@378-380 Record([])], Space))], BangSuffix))], @430-445 Apply(@430-445 Var { module_name: "", ident: "line" }, [@436-445 Str(PlainLine("success"))], Space)))], BangSuffix)))], BangSuffix) }] }, @463-466 Var { module_name: "", ident: "msg" }))] }"##, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -681,7 +684,7 @@ mod suffixed_tests { CMD.new "cp" |> mapErr! ERR "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-103], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "copy" }, @0-103 Closure([@8-9 Identifier { ident: "a" }, @10-11 Identifier { ident: "b" }], @36-42 Apply(@36-42 Var { module_name: "Task", ident: "await" }, [@36-42 Apply(@36-42 Var { module_name: "", ident: "line" }, [@37-42 Str(PlainLine("FOO"))], Space), @36-42 Closure([@36-42 RecordDestructure([])], @60-103 Apply(@60-103 Var { module_name: "", ident: "mapErr" }, [@60-72 Apply(@60-67 Var { module_name: "CMD", ident: "new" }, [@68-72 Str(PlainLine("cp"))], Space), @100-103 Tag("ERR")], BinOp(Pizza)))], BangSuffix)))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-103], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "copy" }, @7-103 Closure([@8-9 Identifier { ident: "a" }, @10-11 Identifier { ident: "b" }], @36-42 Apply(@36-42 Var { module_name: "Task", ident: "await" }, [@36-42 Apply(@36-42 Var { module_name: "", ident: "line" }, [@37-42 Str(PlainLine("FOO"))], Space), @36-42 Closure([@36-42 RecordDestructure([])], @60-103 Apply(@60-103 Var { module_name: "", ident: "mapErr" }, [@60-72 Apply(@60-67 Var { module_name: "CMD", ident: "new" }, [@68-72 Str(PlainLine("cp"))], Space), @100-103 Tag("ERR")], BinOp(Pizza)))], BangSuffix)))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -709,7 +712,7 @@ mod suffixed_tests { [] -> "empty" _ -> "non-empty" "#, - r##"Defs { tags: [Index(2147483648)], regions: [@0-111], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "list" }, @0-111 Apply(@0-111 Var { module_name: "Task", ident: "await" }, [@29-37 Var { module_name: "", ident: "getList" }, @0-111 Closure([@29-37 Identifier { ident: "#!a0" }], @0-111 When(@29-37 Var { module_name: "", ident: "#!a0" }, [WhenBranch { patterns: [@61-63 List([])], value: @67-74 Str(PlainLine("empty")), guard: None }, WhenBranch { patterns: [@95-96 Underscore("")], value: @100-111 Str(PlainLine("non-empty")), guard: None }]))], BangSuffix))] }"##, + r##"Defs { tags: [Index(2147483648)], regions: [@0-111], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "list" }, @24-111 Apply(@24-111 Var { module_name: "Task", ident: "await" }, [@29-37 Var { module_name: "", ident: "getList" }, @24-111 Closure([@29-37 Identifier { ident: "#!a0" }], @24-111 When(@29-37 Var { module_name: "", ident: "#!a0" }, [WhenBranch { patterns: [@61-63 List([])], value: @67-74 Str(PlainLine("empty")), guard: None }, WhenBranch { patterns: [@95-96 Underscore("")], value: @100-111 Str(PlainLine("non-empty")), guard: None }]))], BangSuffix))] }"##, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -754,7 +757,7 @@ mod suffixed_tests { _ -> ok {} "#, - r##"Defs { tags: [Index(2147483648)], regions: [@0-195], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "list" }, @0-195 Apply(@0-195 Var { module_name: "Task", ident: "await" }, [@29-37 Var { module_name: "", ident: "getList" }, @0-195 Closure([@29-37 Identifier { ident: "#!a0" }], @0-195 When(@29-37 Var { module_name: "", ident: "#!a0" }, [WhenBranch { patterns: [@61-63 List([])], value: @97-103 Apply(@97-103 Var { module_name: "Task", ident: "await" }, [@97-103 Apply(@97-103 Var { module_name: "", ident: "line" }, [@98-103 Str(PlainLine("foo"))], Space), @97-103 Closure([@97-103 RecordDestructure([])], @128-139 Apply(@128-139 Var { module_name: "", ident: "line" }, [@134-139 Str(PlainLine("bar"))], Space))], BangSuffix), guard: None }, WhenBranch { patterns: [@160-161 Underscore("")], value: @190-195 Apply(@190-192 Var { module_name: "", ident: "ok" }, [@193-195 Record([])], Space), guard: None }]))], BangSuffix))] }"##, + r##"Defs { tags: [Index(2147483648)], regions: [@0-195], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "list" }, @24-195 Apply(@24-195 Var { module_name: "Task", ident: "await" }, [@29-37 Var { module_name: "", ident: "getList" }, @24-195 Closure([@29-37 Identifier { ident: "#!a1" }], @24-195 When(@29-37 Var { module_name: "", ident: "#!a1" }, [WhenBranch { patterns: [@61-63 List([])], value: @97-103 Apply(@97-103 Var { module_name: "Task", ident: "await" }, [@97-103 Apply(@97-103 Var { module_name: "", ident: "line" }, [@98-103 Str(PlainLine("foo"))], Space), @97-103 Closure([@97-103 RecordDestructure([])], @128-139 Apply(@128-139 Var { module_name: "", ident: "line" }, [@134-139 Str(PlainLine("bar"))], Space))], BangSuffix), guard: None }, WhenBranch { patterns: [@160-161 Underscore("")], value: @190-195 Apply(@190-192 Var { module_name: "", ident: "ok" }, [@193-195 Record([])], Space), guard: None }]))], BangSuffix))] }"##, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -862,7 +865,7 @@ mod suffixed_tests { expect 1 == 2 x! "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-55], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-55 Expect(@30-36 Apply(@32-34 Var { module_name: "Bool", ident: "isEq" }, [@30-31 Num("1"), @35-36 Num("2")], BinOp(Equals)), @53-55 Var { module_name: "", ident: "x" }))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-55], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-55 Expect(@30-36 Apply(@32-34 Var { module_name: "Bool", ident: "isEq" }, [@30-31 Num("1"), @35-36 Num("2")], BinOp(Equals)), @53-55 Var { module_name: "", ident: "x" }))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -877,7 +880,7 @@ mod suffixed_tests { 1 -> c! "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-159], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-159 When(@28-29 Var { module_name: "", ident: "a" }, [WhenBranch { patterns: [@53-54 NumLiteral("0")], value: @82-159 When(@87-88 Var { module_name: "", ident: "b" }, [WhenBranch { patterns: [@120-121 NumLiteral("1")], value: @157-159 Var { module_name: "", ident: "c" }, guard: None }]), guard: None }]))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-159], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-159 When(@28-29 Var { module_name: "", ident: "a" }, [WhenBranch { patterns: [@53-54 NumLiteral("0")], value: @82-159 When(@87-88 Var { module_name: "", ident: "b" }, [WhenBranch { patterns: [@120-121 NumLiteral("1")], value: @157-159 Var { module_name: "", ident: "c" }, guard: None }]), guard: None }]))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -897,7 +900,7 @@ mod suffixed_tests { B -> d! "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-266], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-266 When(@28-29 Var { module_name: "", ident: "x" }, [WhenBranch { patterns: [@53-54 Tag("A")], value: @82-214 Defs(Defs { tags: [Index(2147483649)], regions: [@86-88], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42")), Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42"))] }, @114-214 If([(@117-118 Var { module_name: "", ident: "a" }, @152-154 Var { module_name: "", ident: "b" })], @212-214 Var { module_name: "", ident: "c" })), guard: None }, WhenBranch { patterns: [@235-236 Tag("B")], value: @264-266 Var { module_name: "", ident: "d" }, guard: None }]))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-266], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-266 When(@28-29 Var { module_name: "", ident: "x" }, [WhenBranch { patterns: [@53-54 Tag("A")], value: @82-214 Defs(Defs { tags: [Index(2147483649)], regions: [@86-88], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42")), Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42"))] }, @114-214 If([(@117-118 Var { module_name: "", ident: "a" }, @152-154 Var { module_name: "", ident: "b" })], @212-214 Var { module_name: "", ident: "c" })), guard: None }, WhenBranch { patterns: [@235-236 Tag("B")], value: @264-266 Var { module_name: "", ident: "d" }, guard: None }]))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -910,9 +913,38 @@ mod suffixed_tests { b "#, - r##"Defs { tags: [Index(2147483648)], regions: [@0-48], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-48 Apply(@0-48 Var { module_name: "Task", ident: "await" }, [@27-29 Var { module_name: "", ident: "a" }, @0-48 Closure([@27-29 Identifier { ident: "#!a0" }], @0-48 LowLevelDbg(("test.roc:3", " "), @27-29 Apply(@27-29 Var { module_name: "Inspect", ident: "toStr" }, [@27-29 Var { module_name: "", ident: "#!a0" }], Space), @47-48 Var { module_name: "", ident: "b" }))], BangSuffix))] }"##, + r##"Defs { tags: [Index(2147483648)], regions: [@0-48], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-48 Apply(@23-48 Var { module_name: "Task", ident: "await" }, [@27-29 Var { module_name: "", ident: "a" }, @23-48 Closure([@27-29 Identifier { ident: "#!a0" }], @23-48 LowLevelDbg(("test.roc:3", " "), @27-29 Apply(@27-29 Var { module_name: "Inspect", ident: "toStr" }, [@27-29 Var { module_name: "", ident: "#!a0" }], Space), @47-48 Var { module_name: "", ident: "b" }))], BangSuffix))] }"##, ) } + + #[test] + fn last_stmt_not_top_level_suffixed() { + run_test( + r#" + main = + x = 42 + a b! + "#, + r##"Defs { tags: [Index(2147483648)], regions: [@0-50], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-50 Defs(Defs { tags: [Index(2147483650)], regions: [@27-29], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@23-24 Identifier { ident: "x" }, @27-29 Num("42")), Body(@23-24 Identifier { ident: "x" }, @27-29 Num("42")), Body(@23-24 Identifier { ident: "x" }, @27-29 Num("42"))] }, @23-50 Apply(@23-50 Var { module_name: "Task", ident: "await" }, [@48-49 Var { module_name: "", ident: "b" }, @23-50 Closure([@48-49 Identifier { ident: "#!a0" }], @46-50 Apply(@46-47 Var { module_name: "", ident: "a" }, [@48-49 Var { module_name: "", ident: "#!a0" }], Space))], BangSuffix)))] }"##, + ); + } + + #[test] + fn nested_defs() { + run_test( + indoc!( + r##" + main = + x = + a = b! + c! a + + x + "##, + ), + r##"Defs { tags: [Index(2147483648)], regions: [@0-49], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @11-49 Defs(Defs { tags: [Index(2147483649)], regions: [@23-42], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@11-12 Identifier { ident: "x" }, @23-42 Defs(Defs { tags: [Index(2147483648)], regions: [@23-29], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@23-24 Identifier { ident: "a" }, @27-29 TaskAwaitBang(Var { module_name: "", ident: "b" }))] }, @38-42 Apply(@38-39 TaskAwaitBang(Var { module_name: "", ident: "c" }), [@41-42 Var { module_name: "", ident: "a" }], Space))), Body(@11-12 Identifier { ident: "x" }, @27-29 Apply(@27-29 Var { module_name: "Task", ident: "await" }, [@27-29 Var { module_name: "", ident: "b" }, @27-29 Closure([@23-24 Identifier { ident: "a" }], @38-42 Apply(@38-42 Var { module_name: "", ident: "c" }, [@41-42 Var { module_name: "", ident: "a" }], Space))], BangSuffix))] }, @48-49 Var { module_name: "", ident: "x" }))] }"##, + ); + } } #[cfg(test)] diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.formatted.roc b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.formatted.roc --- a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.formatted.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.formatted.roc @@ -1,4 +1,5 @@ main = a! "Bar" x = B.b! "Foo" + c! x diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast @@ -18,28 +18,24 @@ Defs { @0-4 Identifier { ident: "main", }, - @0-49 SpaceBefore( + @12-49 SpaceBefore( Defs( Defs { tags: [ Index(2147483648), Index(2147483649), - Index(2147483650), ], regions: [ @14-21, @26-39, - @45-49, ], space_before: [ Slice(start = 0, length = 0), Slice(start = 0, length = 1), - Slice(start = 1, length = 0), ], space_after: [ Slice(start = 0, length = 0), Slice(start = 1, length = 0), - Slice(start = 1, length = 0), ], spaces: [ Newline, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_multiple_defs.moduledefs.result-ast @@ -85,32 +81,29 @@ Defs { Space, ), ), - Stmt( - @45-49 SpaceBefore( - Apply( - @45-46 TaskAwaitBang( - Var { - module_name: "", - ident: "c", - }, - ), - [ - @48-49 Var { - module_name: "", - ident: "x", - }, - ], - Space, - ), - [ - Newline, - Newline, - ], - ), - ), ], }, - EmptyDefsFinal, + @45-49 SpaceBefore( + Apply( + @45-46 TaskAwaitBang( + Var { + module_name: "", + ident: "c", + }, + ), + [ + @48-49 Var { + module_name: "", + ident: "x", + }, + ], + Space, + ), + [ + Newline, + Newline, + ], + ), ), [ Newline, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_optional_last.full.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_optional_last.full.result-ast --- a/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_optional_last.full.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/suffixed_optional_last.full.result-ast @@ -64,7 +64,7 @@ Full { @88-92 Identifier { ident: "main", }, - @88-202 SpaceBefore( + @100-202 SpaceBefore( BinOps( [ (
Investigate `Task.await` behaviour in rocci-bird Investigate why the two below are not equal. The only change is the line `collided <- collidedTask |> Task.await` to `Task.await collidedTask \collided ->` ```roc List.walk collisionPoints (Task.ok Bool.false) \collidedTask, { x, y } -> collided <- collidedTask |> Task.await if collided then Task.ok Bool.true else point = { x: Num.toU8 (playerX + x), y: Num.toU8 (playerY + y), } color = W4.getPixel! point Task.ok (color != Color1) List.walk collisionPoints (Task.ok Bool.false) \collidedTask, { x, y } -> Task.await collidedTask \collided -> if collided then Task.ok Bool.true else point = { x: Num.toU8 (playerX + x), y: Num.toU8 (playerY + y), } color = W4.getPixel! point Task.ok (color != Color1) ``` ``` ── TYPE MISMATCH in examples/rocci-bird.roc ──────────────────────────────────── This expression is used in an unexpected way: 407│> List.walk collisionPoints (Task.ok Bool.false) \collidedTask, { x, y } -> 408│> Task.await collidedTask \collided -> 409│> if collided then 410│> Task.ok Bool.true 411│> else 412│> point = { 413│> x: Num.toU8 (playerX + x), 414│> y: Num.toU8 (playerY + y), 415│> } 416│> color = W4.getPixel! point 417│> Task.ok (color != Color1) This walk call produces: InternalTask.Task Bool * But you are trying to use it as: {}a Tip: Type comparisons between an opaque type are only ever equal if both types are the same opaque type. Did you mean to create an opaque type by wrapping it? If I have an opaque type Age := U32 I can create an instance of this opaque type by doing @Age 23. ── TYPE MISMATCH in examples/rocci-bird.roc ──────────────────────────────────── Something is off with the body of the onScreenCollided definition: This Task.ok call produces: Task {} [] But the type annotation on onScreenCollided says it should be: Task Bool [] ──────────────────────────────────────────────────────────────────────────────── ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "suffixed_tests::dbg_stmt_arg", "suffixed_tests::deep_when", "suffixed_tests::closure_with_annotations", "suffixed_tests::last_stmt_not_top_level_suffixed", "suffixed_tests::if_simple", "suffixed_tests::expect_then_bang", "suffixed_tests::deps_final_expr", "suffixed_tests::multiple_def_first_suffixed", "suffixed_tests::if_complex", "suffixed_tests::nested_defs", "suffixed_tests::trailing_binops", "suffixed_tests::when_simple", "suffixed_tests::when_branches" ]
[ "suffixed_tests::apply_argument_single", "suffixed_tests::basic", "suffixed_tests::apply_argument_multiple", "suffixed_tests::bang_in_pipe_root", "suffixed_tests::apply_argument_suffixed", "suffixed_tests::apply_function_suffixed", "suffixed_tests::body_parens_apply", "suffixed_tests::closure_simple", "suffixed_tests::dbg_simple", "suffixed_tests::last_suffixed_multiple", "suffixed_tests::defs_suffixed_middle", "suffixed_tests::closure_with_defs", "suffixed_tests::last_suffixed_single", "suffixed_tests::multi_defs_stmts", "suffixed_tests::multiple_suffix", "suffixed_tests::nested_simple", "suffixed_tests::nested_complex", "suffixed_tests::simple_pizza", "suffixed_tests::var_suffixes", "test_suffixed_helpers::test_matching_answer_task_ok", "test_suffixed_helpers::test_matching_answer", "suffixed_tests::trailing_suffix_inside_when" ]
[]
[]
2024-07-02T02:11:23Z
44d76d78a13e6b6b4adea075a93b3b46989704f2
diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -129,46 +129,7 @@ pub fn unwrap_suffixed_expression<'a>( internal_error!("BinOps should have been desugared in desugar_expr"); } - Expr::LowLevelDbg(dbg_src, arg, rest) => { - if is_expr_suffixed(&arg.value) { - // we cannot unwrap a suffixed expression within dbg - // e.g. dbg (foo! "bar") - return Err(EUnwrapped::Malformed); - } - - match unwrap_suffixed_expression(arena, rest, maybe_def_pat) { - Ok(unwrapped_expr) => { - let new_dbg = arena.alloc(Loc::at( - loc_expr.region, - LowLevelDbg(dbg_src, arg, unwrapped_expr), - )); - return Ok(new_dbg); - } - Err(EUnwrapped::UnwrappedDefExpr(unwrapped_expr)) => { - let new_dbg = arena.alloc(Loc::at( - loc_expr.region, - LowLevelDbg(dbg_src, arg, unwrapped_expr), - )); - Err(EUnwrapped::UnwrappedDefExpr(new_dbg)) - } - Err(EUnwrapped::UnwrappedSubExpr { - sub_arg: unwrapped_expr, - sub_pat, - sub_new, - }) => { - let new_dbg = arena.alloc(Loc::at( - loc_expr.region, - LowLevelDbg(dbg_src, arg, unwrapped_expr), - )); - Err(EUnwrapped::UnwrappedSubExpr { - sub_arg: new_dbg, - sub_pat, - sub_new, - }) - } - Err(EUnwrapped::Malformed) => Err(EUnwrapped::Malformed), - } - } + Expr::LowLevelDbg(..) => unwrap_low_level_dbg(arena, loc_expr, maybe_def_pat), Expr::Expect(condition, continuation) => { if is_expr_suffixed(&condition.value) { diff --git a/crates/compiler/can/src/suffixed.rs b/crates/compiler/can/src/suffixed.rs --- a/crates/compiler/can/src/suffixed.rs +++ b/crates/compiler/can/src/suffixed.rs @@ -767,6 +728,87 @@ pub fn unwrap_suffixed_expression_defs_help<'a>( } } +fn unwrap_low_level_dbg<'a>( + arena: &'a Bump, + loc_expr: &'a Loc<Expr<'a>>, + maybe_def_pat: Option<&'a Loc<Pattern<'a>>>, +) -> Result<&'a Loc<Expr<'a>>, EUnwrapped<'a>> { + match loc_expr.value { + LowLevelDbg(dbg_src, arg, rest) => { + if is_expr_suffixed(&arg.value) { + return match unwrap_suffixed_expression(arena, arg, maybe_def_pat) { + Ok(unwrapped_expr) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(dbg_src, unwrapped_expr, rest), + )); + + unwrap_low_level_dbg(arena, new_dbg, maybe_def_pat) + } + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg, + sub_pat, + sub_new, + }) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(dbg_src, sub_new, rest), + )); + + unwrap_suffixed_expression( + arena, + apply_task_await(arena, new_dbg.region, sub_arg, sub_pat, new_dbg), + maybe_def_pat, + ) + } + Err(EUnwrapped::UnwrappedDefExpr(..)) => { + internal_error!( + "unreachable, arg of LowLevelDbg should generate UnwrappedSubExpr instead" + ); + } + Err(EUnwrapped::Malformed) => Err(EUnwrapped::Malformed), + }; + } + + match unwrap_suffixed_expression(arena, rest, maybe_def_pat) { + Ok(unwrapped_expr) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(dbg_src, arg, unwrapped_expr), + )); + Ok(&*new_dbg) + } + Err(EUnwrapped::UnwrappedDefExpr(unwrapped_expr)) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(dbg_src, arg, unwrapped_expr), + )); + Err(EUnwrapped::UnwrappedDefExpr(new_dbg)) + } + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg: unwrapped_expr, + sub_pat, + sub_new, + }) => { + let new_dbg = arena.alloc(Loc::at( + loc_expr.region, + LowLevelDbg(dbg_src, arg, unwrapped_expr), + )); + Err(EUnwrapped::UnwrappedSubExpr { + sub_arg: new_dbg, + sub_pat, + sub_new, + }) + } + Err(EUnwrapped::Malformed) => Err(EUnwrapped::Malformed), + } + } + _ => internal_error!( + "unreachable, expected a LowLevelDbg node to be passed into unwrap_low_level_dbg" + ), + } +} + /// Helper for `Task.await (loc_arg) \loc_pat -> loc_new` pub fn apply_task_await<'a>( arena: &'a Bump,
roc-lang__roc-6847
6,847
Thanks for reporting this @fwgreen! In case it may help, this is a workaround: ```roc dbg List.len results end = Utc.toMillisSinceEpoch Utc.now! dbg end - start ``` Minimal reproduction for future debugging: ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br" } import pf.Stdout import pf.Task import pf.Utc main = dbg Utc.now! Stdout.line! "Done" ``` The corresponding place in compiler: https://github.com/roc-lang/roc/blob/7e609bfdbf37b51dd8ae576462a99b7ff404ca63/crates/compiler/can/src/suffixed.rs#L133-L137 It was probably done to not mess with control flow, but I can't say precisely. @lukewilliamboswell any insights? Should we add better logging here or make dbg work with the bang? It's an error. Dbg shouldn't be used with a bang suffix. We should improve the error message. I think we just left it as something basic like MalformedSuffix and haven't added any actual error reports yet. > Dbg shouldn't be used with a bang suffix. Can you expand on that @lukewilliamboswell? It seems like we can make it work and I think it's a feature users would like to have. I think I need to defer to @rtfeldman here. It may be possible to unwrap it, but I think it also may be a deliberate design choice. For example ```roc # this could in theory main = dbg Utc.now! Stdout.line! "Done" # unwrap to main = Task.await Utc.now \answer -> dbg answer Stdout.line! "Done" ``` But do we want this? Yeah, as I mentioned, it leads to control flow change. I think it makes sense that `dbg` is expected to be transparent for control flow. But `dbg` with bang requires the change only to make `dbg` work. Upd. However, the alternative is to introduce the await manually > But do we want this? I think we want it! 👍 Ok, I'll add the fix
[ "6838" ]
0.0
roc-lang/roc
2024-06-28T11:09:13Z
diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -900,6 +900,19 @@ mod suffixed_tests { r#"Defs { tags: [Index(2147483648)], regions: [@0-266], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-266 When(@28-29 Var { module_name: "", ident: "x" }, [WhenBranch { patterns: [@53-54 Tag("A")], value: @82-214 Defs(Defs { tags: [Index(2147483649)], regions: [@86-88], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42")), Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42"))] }, @114-214 If([(@117-118 Var { module_name: "", ident: "a" }, @152-154 Var { module_name: "", ident: "b" })], @212-214 Var { module_name: "", ident: "c" })), guard: None }, WhenBranch { patterns: [@235-236 Tag("B")], value: @264-266 Var { module_name: "", ident: "d" }, guard: None }]))] }"#, ); } + + #[test] + fn dbg_stmt_arg() { + run_test( + r#" + main = + dbg a! + + b + "#, + r##"Defs { tags: [Index(2147483648)], regions: [@0-48], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-48 Apply(@0-48 Var { module_name: "Task", ident: "await" }, [@27-29 Var { module_name: "", ident: "a" }, @0-48 Closure([@27-29 Identifier { ident: "#!a0" }], @0-48 LowLevelDbg(("test.roc:3", " "), @27-29 Apply(@27-29 Var { module_name: "Inspect", ident: "toStr" }, [@27-29 Var { module_name: "", ident: "#!a0" }], Space), @47-48 Var { module_name: "", ident: "b" }))], BangSuffix))] }"##, + ) + } } #[cfg(test)]
Crashed with Malformed Suffix ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import pf.Stdout import pf.Task import pf.Utc Option a : [Some a, None] main = start = Utc.toMillisSinceEpoch Utc.now! list = List.range { start: At 0i64, end: At 1_000_000i64 } results = List.map list \i -> binarySearch list i dbg List.len results dbg (Utc.toMillisSinceEpoch Utc.now!) - start Stdout.line! "Done" binarySearch : List I64, I64 -> Option I64 binarySearch = \list, value -> find : I64, I64 -> Option I64 find = \lowerBound, upperBound -> if lowerBound < upperBound then None else midPoint = (upperBound + lowerBound) // 2 when List.get list (Num.toU64 midPoint) is Ok x -> when Num.compare x value is LT -> find lowerBound (midPoint - 1) GT -> find (midPoint + 1) upperBound EQ -> Some midPoint _ -> None find 0 (Num.toI64 (List.len list) - 1) ``` ``` ── UNUSED DEFINITION in main.roc ─────────────────────────────────────────────── binarySearch is not used anywhere in your code. 27│ binarySearch = \list, value -> ^^^^^^^^^^^^ If you didn't intend on using binarySearch then remove it so future readers of your code don't wonder why it is there. ── UNUSED IMPORT in main.roc ─────────────────────────────────────────────────── Stdout is imported but not used. 6│ import pf.Stdout ^^^^^^^^^^^^^^^^ Since Stdout isn't used, you don't need to import it. ── UNUSED IMPORT in main.roc ─────────────────────────────────────────────────── Utc is imported but not used. 8│ import pf.Utc ^^^^^^^^^^^^^ Since Utc isn't used, you don't need to import it. ──────────────────────────────────────────────────────────────────────────────── 0 errors and 3 warnings found in 254 ms . Running program… ──────────────────────────────────────────────────────────────────────────────── Roc crashed with: MalformedSuffixed(@309-585) Here is the call stack that led to the crash: roc.panic app.main .mainForHost rust.main Optimizations can make this list inaccurate! If it looks wrong, try running without `--optimize` and with `--linker=legacy` ``` `roc nightly pre-release, built from commit d47a073634e on Tue Jun 25 09:12:30 UTC 2024` on macOs 14.5
e819c954d393eb3223dd5961556d07ce21b29831
[ "suffixed_tests::dbg_stmt_arg" ]
[ "suffixed_tests::apply_argument_suffixed", "suffixed_tests::apply_function_suffixed", "suffixed_tests::apply_argument_single", "suffixed_tests::basic", "suffixed_tests::bang_in_pipe_root", "suffixed_tests::apply_argument_multiple", "suffixed_tests::closure_simple", "suffixed_tests::defs_suffixed_middle", "suffixed_tests::body_parens_apply", "suffixed_tests::dbg_simple", "suffixed_tests::deep_when", "suffixed_tests::expect_then_bang", "suffixed_tests::deps_final_expr", "suffixed_tests::last_suffixed_single", "suffixed_tests::closure_with_annotations", "suffixed_tests::closure_with_defs", "suffixed_tests::multiple_suffix", "suffixed_tests::if_simple", "suffixed_tests::last_suffixed_multiple", "suffixed_tests::multiple_def_first_suffixed", "suffixed_tests::multi_defs_stmts", "suffixed_tests::nested_simple", "suffixed_tests::trailing_binops", "suffixed_tests::simple_pizza", "suffixed_tests::nested_complex", "suffixed_tests::var_suffixes", "test_suffixed_helpers::test_matching_answer_task_ok", "suffixed_tests::trailing_suffix_inside_when", "test_suffixed_helpers::test_matching_answer", "suffixed_tests::if_complex", "suffixed_tests::when_simple", "suffixed_tests::when_branches" ]
[]
[]
2024-06-28T14:59:13Z
1b10772bcbbdb91f6b1b67d986c392caae7732b9
diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -575,8 +575,7 @@ pub fn is_expr_suffixed(expr: &Expr) -> bool { Expr::Closure(_, sub_loc_expr) => is_expr_suffixed(&sub_loc_expr.value), // expressions inside a Defs - // note we ignore the final expression as it should not be suffixed - Expr::Defs(defs, _) => { + Expr::Defs(defs, expr) => { let any_defs_suffixed = defs.tags.iter().any(|tag| match tag.split() { Ok(_) => false, Err(value_index) => match defs.value_defs[value_index.index()] { diff --git a/crates/compiler/parse/src/ast.rs b/crates/compiler/parse/src/ast.rs --- a/crates/compiler/parse/src/ast.rs +++ b/crates/compiler/parse/src/ast.rs @@ -586,7 +585,7 @@ pub fn is_expr_suffixed(expr: &Expr) -> bool { }, }); - any_defs_suffixed + any_defs_suffixed || is_expr_suffixed(&expr.value) } Expr::Float(_) => false, Expr::Num(_) => false,
roc-lang__roc-6837
6,837
@Anton-4 please assign to me Done, thanks for helping out @kdziamura :heart:
[ "6800" ]
0.0
roc-lang/roc
2024-06-25T12:57:37Z
diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -610,7 +610,7 @@ mod suffixed_tests { else line "fail" "#, - r##"Defs { tags: [Index(2147483648)], regions: [@0-286], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @23-286 Defs(Defs { tags: [Index(2147483650), Index(2147483651)], regions: [@32-49, @76-94], space_before: [Slice(start = 0, length = 0), Slice(start = 0, length = 1)], space_after: [Slice(start = 0, length = 0), Slice(start = 1, length = 0)], spaces: [Newline], type_defs: [], value_defs: [Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space)), Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space))] }, @115-123 Apply(@115-123 Var { module_name: "Task", ident: "await" }, [@115-123 Var { module_name: "", ident: "isFalse" }, @115-123 Closure([@115-123 Identifier { ident: "#!a0" }], @112-286 If([(@115-123 Var { module_name: "", ident: "#!a0" }, @149-160 Apply(@149-153 Var { module_name: "", ident: "line" }, [@154-160 Str(PlainLine("fail"))], Space))], @185-192 Apply(@185-192 Var { module_name: "Task", ident: "await" }, [@185-192 Var { module_name: "", ident: "isTrue" }, @185-192 Closure([@185-192 Identifier { ident: "#!a1" }], @112-286 If([(@185-192 Var { module_name: "", ident: "#!a1" }, @219-233 Apply(@219-223 Var { module_name: "", ident: "line" }, [@224-233 Str(PlainLine("success"))], Space))], @275-286 Apply(@275-279 Var { module_name: "", ident: "line" }, [@280-286 Str(PlainLine("fail"))], Space)))], BangSuffix)))], BangSuffix)))] }"##, + r##"Defs { tags: [Index(2147483648)], regions: [@0-286], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-286 Defs(Defs { tags: [Index(2147483650), Index(2147483651)], regions: [@32-49, @76-94], space_before: [Slice(start = 0, length = 0), Slice(start = 0, length = 1)], space_after: [Slice(start = 0, length = 0), Slice(start = 1, length = 0)], spaces: [Newline], type_defs: [], value_defs: [Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space)), Body(@23-29 Identifier { ident: "isTrue" }, @32-49 Apply(@32-39 Var { module_name: "Task", ident: "ok" }, [@40-49 Var { module_name: "Bool", ident: "true" }], Space)), Body(@66-73 Identifier { ident: "isFalse" }, @76-94 Apply(@76-83 Var { module_name: "Task", ident: "ok" }, [@84-94 Var { module_name: "Bool", ident: "false" }], Space))] }, @115-123 Apply(@115-123 Var { module_name: "Task", ident: "await" }, [@115-123 Var { module_name: "", ident: "isFalse" }, @115-123 Closure([@115-123 Identifier { ident: "#!a0" }], @112-286 If([(@115-123 Var { module_name: "", ident: "#!a0" }, @149-160 Apply(@149-153 Var { module_name: "", ident: "line" }, [@154-160 Str(PlainLine("fail"))], Space))], @185-192 Apply(@185-192 Var { module_name: "Task", ident: "await" }, [@185-192 Var { module_name: "", ident: "isTrue" }, @185-192 Closure([@185-192 Identifier { ident: "#!a1" }], @112-286 If([(@185-192 Var { module_name: "", ident: "#!a1" }, @219-233 Apply(@219-223 Var { module_name: "", ident: "line" }, [@224-233 Str(PlainLine("success"))], Space))], @275-286 Apply(@275-279 Var { module_name: "", ident: "line" }, [@280-286 Str(PlainLine("fail"))], Space)))], BangSuffix)))], BangSuffix)))] }"##, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -681,7 +681,7 @@ mod suffixed_tests { CMD.new "cp" |> mapErr! ERR "#, - r#"Defs { tags: [Index(2147483648)], regions: [@0-103], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "copy" }, @7-103 Closure([@8-9 Identifier { ident: "a" }, @10-11 Identifier { ident: "b" }], @36-42 Apply(@36-42 Var { module_name: "Task", ident: "await" }, [@36-42 Apply(@36-42 Var { module_name: "", ident: "line" }, [@37-42 Str(PlainLine("FOO"))], Space), @36-42 Closure([@36-42 RecordDestructure([])], @60-103 Apply(@60-103 Var { module_name: "", ident: "mapErr" }, [@60-72 Apply(@60-67 Var { module_name: "CMD", ident: "new" }, [@68-72 Str(PlainLine("cp"))], Space), @100-103 Tag("ERR")], BinOp(Pizza)))], BangSuffix)))] }"#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-103], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "copy" }, @0-103 Closure([@8-9 Identifier { ident: "a" }, @10-11 Identifier { ident: "b" }], @36-42 Apply(@36-42 Var { module_name: "Task", ident: "await" }, [@36-42 Apply(@36-42 Var { module_name: "", ident: "line" }, [@37-42 Str(PlainLine("FOO"))], Space), @36-42 Closure([@36-42 RecordDestructure([])], @60-103 Apply(@60-103 Var { module_name: "", ident: "mapErr" }, [@60-72 Apply(@60-67 Var { module_name: "CMD", ident: "new" }, [@68-72 Str(PlainLine("cp"))], Space), @100-103 Tag("ERR")], BinOp(Pizza)))], BangSuffix)))] }"#, ); } diff --git a/crates/compiler/can/tests/test_suffixed.rs b/crates/compiler/can/tests/test_suffixed.rs --- a/crates/compiler/can/tests/test_suffixed.rs +++ b/crates/compiler/can/tests/test_suffixed.rs @@ -880,6 +880,26 @@ mod suffixed_tests { r#"Defs { tags: [Index(2147483648)], regions: [@0-159], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-159 When(@28-29 Var { module_name: "", ident: "a" }, [WhenBranch { patterns: [@53-54 NumLiteral("0")], value: @82-159 When(@87-88 Var { module_name: "", ident: "b" }, [WhenBranch { patterns: [@120-121 NumLiteral("1")], value: @157-159 Var { module_name: "", ident: "c" }, guard: None }]), guard: None }]))] }"#, ); } + + #[test] + fn deps_final_expr() { + run_test( + r#" + main = + when x is + A -> + y = 42 + + if a then + b! + else + c! + B -> + d! + "#, + r#"Defs { tags: [Index(2147483648)], regions: [@0-266], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@0-4 Identifier { ident: "main" }, @0-266 When(@28-29 Var { module_name: "", ident: "x" }, [WhenBranch { patterns: [@53-54 Tag("A")], value: @82-214 Defs(Defs { tags: [Index(2147483649)], regions: [@86-88], space_before: [Slice(start = 0, length = 0)], space_after: [Slice(start = 0, length = 0)], spaces: [], type_defs: [], value_defs: [Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42")), Body(@82-83 Identifier { ident: "y" }, @86-88 Num("42"))] }, @114-214 If([(@117-118 Var { module_name: "", ident: "a" }, @152-154 Var { module_name: "", ident: "b" })], @212-214 Var { module_name: "", ident: "c" })), guard: None }, WhenBranch { patterns: [@235-236 Tag("B")], value: @264-266 Var { module_name: "", ident: "d" }, guard: None }]))] }"#, + ); + } } #[cfg(test)]
Compiler panic from `Expr::TaskAwaitBang` desugaring ...or something like that. I built Roc from source with Nix at db94b555ab1946ad6bfdb5314a11ba67d9b1d1da. ```roc app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br", } import pf.Stdout import pf.Task exposing [Task] main : Task {} _ main = when Err "welp" is Ok {} -> evil = "comment this binding out and it compiles fine" if Bool.false then Stdout.line! "True" else Stdout.line! "False" Err error -> Task.err (Exit 1 "") ``` ```ShellSession $ roc build main.roc An internal compiler expectation was broken. This is definitely a compiler bug. Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose thread '<unnamed>' panicked at crates/compiler/can/src/expr.rs:1130:41: a Expr::TaskAwaitBang expression was not completely removed in desugar_value_def_suffixed note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace There was an unrecoverable error in the Roc compiler. The `roc check` command can sometimes give a more helpful error report than other commands. ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "suffixed_tests::deps_final_expr", "suffixed_tests::if_simple", "suffixed_tests::trailing_binops" ]
[ "suffixed_tests::basic", "suffixed_tests::bang_in_pipe_root", "suffixed_tests::apply_argument_multiple", "suffixed_tests::apply_argument_single", "suffixed_tests::body_parens_apply", "suffixed_tests::closure_simple", "suffixed_tests::apply_argument_suffixed", "suffixed_tests::dbg_simple", "suffixed_tests::apply_function_suffixed", "suffixed_tests::closure_with_annotations", "suffixed_tests::expect_then_bang", "suffixed_tests::deep_when", "suffixed_tests::closure_with_defs", "suffixed_tests::defs_suffixed_middle", "suffixed_tests::last_suffixed_single", "suffixed_tests::multiple_def_first_suffixed", "suffixed_tests::last_suffixed_multiple", "suffixed_tests::nested_simple", "suffixed_tests::multiple_suffix", "suffixed_tests::multi_defs_stmts", "suffixed_tests::simple_pizza", "suffixed_tests::if_complex", "test_suffixed_helpers::test_matching_answer_task_ok", "suffixed_tests::nested_complex", "test_suffixed_helpers::test_matching_answer", "suffixed_tests::when_simple", "suffixed_tests::var_suffixes", "suffixed_tests::trailing_suffix_inside_when", "suffixed_tests::when_branches" ]
[]
[]
2024-06-25T18:08:21Z
31b62e929c879a9c8b2b775642545a707a09bd0d
diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1177,7 +1177,7 @@ fn to_bad_ident_expr_report<'b>( let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); alloc.stack([ - alloc.reflow(r"I trying to parse a record field access here:"), + alloc.reflow(r"I am trying to parse a record field access here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ alloc.reflow("So I expect to see a lowercase letter next, like "), diff --git a/crates/reporting/src/error/canonicalize.rs b/crates/reporting/src/error/canonicalize.rs --- a/crates/reporting/src/error/canonicalize.rs +++ b/crates/reporting/src/error/canonicalize.rs @@ -1377,7 +1377,7 @@ fn to_bad_ident_pattern_report<'b>( let region = LineColumnRegion::from_pos(lines.convert_pos(pos)); alloc.stack([ - alloc.reflow(r"I trying to parse a record field accessor here:"), + alloc.reflow(r"I am trying to parse a record field accessor here:"), alloc.region_with_subregion(lines.convert_region(surroundings), region), alloc.concat([ alloc.reflow("Something like "),
roc-lang__roc-6057
6,057
[ "6056" ]
0.0
roc-lang/roc
2023-11-21T22:38:50Z
diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -4269,7 +4269,7 @@ mod test_reporting { @r###" ── SYNTAX PROBLEM ──────────────────────────────────────── /code/proj/Main.roc ─ - I trying to parse a record field access here: + I am trying to parse a record field access here: 4│ foo.bar. ^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -5667,7 +5667,7 @@ All branches in an `if` must have the same type! @r###" ── SYNTAX PROBLEM ──────────────────────────────────────── /code/proj/Main.roc ─ - I trying to parse a record field access here: + I am trying to parse a record field access here: 4│ Num.add . 23 ^
Error message: SYNTAX PROBLEM trying to parse record error typo There is a typo in the error message when a record name is expected but not found, example: ```shell $ roc repl The rockin' roc repl ──────────────────────── Enter an expression, or :help, or :q to quit. » y. ── SYNTAX PROBLEM ────────────────────────────────────────────────────────────── I trying to parse a record field access here: 4│ y. ^ So I expect to see a lowercase letter next, like .name or .height. ``` Should be 'I am trying to parse a record field access here'
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::record_access_ends_with_dot", "test_reporting::stray_dot_expr" ]
[ "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::argument_without_space", "test_reporting::annotation_newline_body_is_fine", "test_reporting::ability_shadows_ability", "test_reporting::ability_not_on_toplevel", "test_reporting::alias_using_alias", "test_reporting::ability_specialization_is_unused", "test_reporting::alias_in_implements_clause", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_non_signature_expression", "test_reporting::annotation_definition_mismatch", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::applied_tag_function", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::apply_unary_not", "test_reporting::ability_member_binds_parent_twice", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::alias_type_diff", "test_reporting::always_function", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::ability_specialization_is_duplicated", "test_reporting::bad_double_rigid", "test_reporting::apply_opaque_as_function", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::backpassing_type_error", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::ability_demand_value_has_args", "test_reporting::ability_specialization_is_incomplete", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::apply_unary_negative", "test_reporting::comment_with_tab", "test_reporting::comment_with_control_character", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::bad_rigid_value", "test_reporting::boolean_tag", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::circular_definition_self", "test_reporting::cannot_eq_functions", "test_reporting::bool_vs_false_tag", "test_reporting::cannot_derive_hash_for_function", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::call_with_declared_identifier_starting_with_underscore", "test_reporting::closure_underscore_ident", "test_reporting::cannot_derive_eq_for_function", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::call_with_underscore_identifier", "test_reporting::circular_type", "test_reporting::bool_vs_true_tag", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::compare_unsigned_to_signed", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::cannot_not_eq_functions", "test_reporting::bad_rigid_function", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::circular_definition", "test_reporting::bad_numeric_literal_suffix", "test_reporting::call_with_undeclared_identifier_starting_with_underscore", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::crash_given_non_string", "test_reporting::concat_different_types", "test_reporting::dbg_without_final_expression", "test_reporting::def_missing_final_expression", "test_reporting::crash_overapplied", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::crash_unapplied", "test_reporting::cycle_through_non_function_top_level", "test_reporting::cycle_through_non_function", "test_reporting::cyclic_opaque", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_eq_for_f32", "test_reporting::derive_encoding_for_tuple", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::demanded_vs_optional_record_field", "test_reporting::double_plus", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_encoding_for_nat", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::derive_eq_for_f64", "test_reporting::derive_hash_for_function", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_hash_for_record", "test_reporting::derive_eq_for_record", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::derive_eq_for_function", "test_reporting::derive_eq_for_tag", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::derive_decoding_for_function", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::exposes_identifier", "test_reporting::derive_hash_for_tag", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::elm_function_syntax", "test_reporting::empty_or_pattern", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::error_inline_alias_qualified", "test_reporting::expect_without_final_expression", "test_reporting::dict_type_formatting", "test_reporting::expression_indentation_end", "test_reporting::derive_hash_for_tuple", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::derive_non_builtin_ability", "test_reporting::double_equals_in_def", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::different_phantom_types", "test_reporting::eq_binop_is_transparent", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::error_nested_wildcards_are_related", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::error_wildcards_are_related", "test_reporting::elem_in_list", "test_reporting::expect_expr_type_error", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::fncall_overapplied", "test_reporting::float_out_of_range", "test_reporting::first_wildcard_is_required", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::float_malformed", "test_reporting::expected_tag_has_too_many_args", "test_reporting::fncall_underapplied", "test_reporting::float_literal_has_int_suffix", "test_reporting::from_annotation_function", "test_reporting::fncall_value", "test_reporting::from_annotation_complex_pattern", "test_reporting::forgot_to_remove_underscore", "test_reporting::from_annotation_if", "test_reporting::function_arity_mismatch_nested_too_few", "test_reporting::function_arity_mismatch_nested_too_many", "test_reporting::function_arity_mismatch_too_few", "test_reporting::from_annotation_when", "test_reporting::imports_missing_comma", "test_reporting::function_cannot_derive_encoding", "test_reporting::if_guard_without_condition", "test_reporting::function_does_not_implement_encoding", "test_reporting::function_arity_mismatch_too_many", "test_reporting::if_missing_else", "test_reporting::if_outdented_then", "test_reporting::geq_binop_is_transparent", "test_reporting::gt_binop_is_transparent", "test_reporting::has_encoding_for_function", "test_reporting::inline_hastype", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::has_clause_not_on_toplevel", "test_reporting::i64_underflow", "test_reporting::i128_overflow", "test_reporting::invalid_app_name", "test_reporting::invalid_module_name", "test_reporting::i16_overflow", "test_reporting::i16_underflow", "test_reporting::guard_mismatch_with_annotation", "test_reporting::i32_overflow", "test_reporting::i8_overflow", "test_reporting::i64_overflow", "test_reporting::i32_underflow", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::if_3_branch_mismatch", "test_reporting::if_condition_not_bool", "test_reporting::implements_type_not_ability", "test_reporting::i8_underflow", "test_reporting::if_2_branch_mismatch", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::invalid_operator", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::incorrect_optional_field", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::inference_var_in_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::int_frac", "test_reporting::inference_var_too_many_in_alias", "test_reporting::lambda_double_comma", "test_reporting::lambda_leading_comma", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::int_literal_has_float_suffix", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::integer_malformed", "test_reporting::integer_empty", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::invalid_record_extension_type", "test_reporting::invalid_tag_extension_type", "test_reporting::integer_out_of_range", "test_reporting::invalid_num", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::invalid_toplevel_cycle", "test_reporting::invalid_num_fn", "test_reporting::list_double_comma", "test_reporting::issue_2326", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_2380_typed_body", "test_reporting::issue_1755", "test_reporting::issue_2380_alias_with_vars", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::issue_2458", "test_reporting::invalid_record_update", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::keyword_record_field_access", "test_reporting::keyword_qualified_import", "test_reporting::leq_binop_is_transparent", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_get_negative_number", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::list_pattern_not_terminated", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::list_without_end", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_spread_as", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_spread_redundant_front_back", "test_reporting::list_match_spread_required_front_back", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_with_guard", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::malformed_bin_pattern", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::malformed_hex_pattern", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_record_annotation", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_f32", "test_reporting::malformed_float_pattern", "test_reporting::lt_binop_is_transparent", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_dec", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::malformed_int_pattern", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::malformed_oct_pattern", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::missing_imports", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::missing_provides_in_app_header", "test_reporting::multi_no_end", "test_reporting::multi_insufficient_indent", "test_reporting::negative_u32", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::negative_u64", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::mismatched_suffix_u8", "test_reporting::negative_u16", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::module_ident_ends_with_dot", "test_reporting::module_not_imported", "test_reporting::negative_u128", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::neq_binop_is_transparent", "test_reporting::missing_fields", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_u64", "test_reporting::mutual_recursion_not_reached", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::negative_u8", "test_reporting::nested_datatype", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::multiple_wildcards_in_alias", "test_reporting::multiple_record_builders", "test_reporting::nested_datatype_inline", "test_reporting::nested_specialization", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::optional_field_in_record_builder", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::optional_record_default_with_signature", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::num_too_general_named", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::num_too_general_wildcard", "test_reporting::number_double_dot", "test_reporting::optional_record_default_type_error", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::not_enough_cases_for_open_union", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_type_not_in_scope", "test_reporting::optional_record_invalid_access", "test_reporting::numer_literal_multi_suffix", "test_reporting::opaque_ability_impl_optional", "test_reporting::non_exhaustive_with_guard", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_ref_field_access", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::opaque_ability_impl_qualified", "test_reporting::platform_requires_rigids", "test_reporting::pattern_in_parens_end", "test_reporting::pattern_in_parens_end_comma", "test_reporting::pattern_in_parens_indent_open", "test_reporting::pattern_in_parens_open", "test_reporting::pattern_binds_keyword", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::optional_record_invalid_when", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::optional_record_invalid_accessor", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::pattern_when_condition", "test_reporting::pizza_parens_middle", "test_reporting::plus_on_str", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::patterns_record_not_exhaustive", "test_reporting::patterns_let_not_exhaustive", "test_reporting::provides_to_identifier", "test_reporting::pattern_when_pattern", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::patterns_when_not_exhaustive", "test_reporting::patterns_int_redundant", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::phantom_type_variable", "test_reporting::optional_record_invalid_let_binding", "test_reporting::pizza_parens_right", "test_reporting::pattern_let_mismatch", "test_reporting::optional_record_invalid_function", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::record_type_tab", "test_reporting::record_type_end", "test_reporting::record_type_open_indent", "test_reporting::report_module_color", "test_reporting::record_type_carriage_return", "test_reporting::record_type_open", "test_reporting::report_region_in_color", "test_reporting::record_update_builder", "test_reporting::record_type_missing_comma", "test_reporting::report_value_color", "test_reporting::record_type_keyword_field_name", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::record_duplicate_field_same_type", "test_reporting::polymorphic_recursion", "test_reporting::record_duplicate_field_different_types", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::recursion_var_specialization_error", "test_reporting::qualified_opaque_reference", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::record_builder_apply_non_function", "test_reporting::qualified_tag", "test_reporting::record_update_value", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::record_field_mismatch", "test_reporting::record_duplicate_field_multiline", "test_reporting::report_precedence_problem_multiline", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::report_unused_def", "test_reporting::record_type_duplicate_field", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::report_shadowing", "test_reporting::report_shadowing_in_annotation", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::report_precedence_problem_single_line", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::single_no_end", "test_reporting::single_quote_too_long", "test_reporting::tag_union_end", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::second_wildcard_is_redundant", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::tag_union_open", "test_reporting::self_recursive_not_reached", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::specialization_for_wrong_type", "test_reporting::self_recursive_alias", "test_reporting::shift_by_negative", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::polymorphic_mutual_recursion", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::shadowing_top_level_scope", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::self_recursive_not_reached_nested", "test_reporting::same_phantom_types_unify", "test_reporting::tag_mismatch", "test_reporting::type_apply_stray_dot", "test_reporting::type_in_parens_end", "test_reporting::type_argument_no_arrow", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::type_inline_alias", "test_reporting::type_in_parens_start", "test_reporting::type_double_comma", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::unicode_not_hex", "test_reporting::type_apply_start_with_lowercase", "test_reporting::type_apply_start_with_number", "test_reporting::unapplied_record_builder", "test_reporting::u32_overflow", "test_reporting::u16_overflow", "test_reporting::typo_lowercase_ok", "test_reporting::u64_overflow", "test_reporting::underscore_in_middle_of_identifier", "test_reporting::type_apply_trailing_dot", "test_reporting::u8_overflow", "test_reporting::typo_uppercase_ok", "test_reporting::unbound_var_in_alias", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::unicode_too_large", "test_reporting::unify_alias_other", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::unimported_modules_reported", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::weird_escape", "test_reporting::when_missing_arrow", "test_reporting::when_outdented_branch", "test_reporting::unused_arg_and_unused_def", "test_reporting::unknown_type", "test_reporting::wild_case_arrow", "test_reporting::when_over_indented_int", "test_reporting::type_annotation_double_colon", "test_reporting::too_many_type_arguments", "test_reporting::tuple_exhaustiveness_good", "test_reporting::too_few_type_arguments", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::type_apply_double_dot", "test_reporting::when_over_indented_underscore", "test_reporting::two_different_cons", "test_reporting::unnecessary_extension_variable", "test_reporting::unused_value_import", "test_reporting::unused_shadow_specialization", "test_reporting::unused_argument", "test_reporting::unused_def_in_branch_pattern", "test_reporting::update_record_ext", "test_reporting::unwrap_num_elem_in_list", "test_reporting::weird_accessor", "test_reporting::update_record", "test_reporting::update_record_snippet", "test_reporting::wildcard_in_opaque", "test_reporting::update_empty_record", "test_reporting::when_branch_mismatch", "test_reporting::when_if_guard", "test_reporting::wildcard_in_alias", "test_reporting::value_not_exposed", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::tags_missing", "test_reporting::tag_missing", "test_reporting::tag_with_arguments_mismatch", "test_reporting::tag_union_duplicate_tag" ]
[]
[]
2023-11-22T21:03:35Z
31b62e929c879a9c8b2b775642545a707a09bd0d
diff --git a/crates/compiler/parse/src/expr.rs b/crates/compiler/parse/src/expr.rs --- a/crates/compiler/parse/src/expr.rs +++ b/crates/compiler/parse/src/expr.rs @@ -549,6 +549,9 @@ pub fn parse_single_def<'a>( let spaces_before_current_start = state.pos(); let state = match space0_e(EExpr::IndentStart).parse(arena, state, min_indent) { + Err((MadeProgress, bad_input @ EExpr::Space(_, _))) => { + return Err((MadeProgress, bad_input)); + } Err((MadeProgress, _)) => { return Err((MadeProgress, EExpr::DefMissingFinalExpr(initial.pos()))); } diff --git a/crates/reporting/src/error/parse.rs b/crates/reporting/src/error/parse.rs --- a/crates/reporting/src/error/parse.rs +++ b/crates/reporting/src/error/parse.rs @@ -3893,7 +3893,7 @@ fn to_space_report<'a>( Report { filename, doc, - title: "ASII CONTROL CHARACTER".to_string(), + title: "ASCII CONTROL CHARACTER".to_string(), severity: Severity::RuntimeError, } }
roc-lang__roc-6054
6,054
[ "5939" ]
0.0
roc-lang/roc
2023-11-21T21:16:43Z
diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -4563,7 +4563,7 @@ mod test_reporting { comment_with_control_character, "# comment with a \x07\n", @r###" - ── ASII CONTROL CHARACTER ──────── tmp/comment_with_control_character/Test.roc ─ + ── ASCII CONTROL CHARACTER ─────── tmp/comment_with_control_character/Test.roc ─ I encountered an ASCII control character:
Parser bug with unicode characters in comment The code sample below will give a `MISSING FINAL EXPRESSION` error which is not correct. This is a bug in the parser which is caused by the presence of unicode characters in a comment somehow. ``` % roc test Broken.roc ── MISSING FINAL EXPRESSION ─────────────────────────────── package/Broken.roc ─ I am partway through parsing a definition, but I got stuck here: 1│ interface Broken 2│ exposes [] 3│ imports [] 4│ 5│ expect 1 == 1 ^ This definition is missing a final expression. A nested definition must be followed by either another definition, or an expression x = 4 y = 2 x + y% ``` ``` interface Broken exposes [] imports [] expect 1 == 1 # REMOVE THE BELOW LINE TO RUN `roc test` # "÷ 0020 ÷ 0020 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] SPACE (Other) ÷ [0.3]" ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::comment_with_control_character" ]
[ "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::ability_demand_value_has_args", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_non_signature_expression", "test_reporting::applied_tag_function", "test_reporting::argument_without_space", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::apply_opaque_as_function", "test_reporting::ability_member_binds_parent_twice", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::always_function", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::alias_using_alias", "test_reporting::backpassing_type_error", "test_reporting::ability_specialization_is_unused", "test_reporting::ability_not_on_toplevel", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::apply_unary_negative", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::annotation_newline_body_is_fine", "test_reporting::alias_type_diff", "test_reporting::apply_unary_not", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::bad_double_rigid", "test_reporting::ability_shadows_ability", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::ability_specialization_is_incomplete", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::alias_in_implements_clause", "test_reporting::annotation_definition_mismatch", "test_reporting::ability_specialization_is_duplicated", "test_reporting::comment_with_tab", "test_reporting::concat_different_types", "test_reporting::crash_given_non_string", "test_reporting::crash_overapplied", "test_reporting::crash_unapplied", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::bool_vs_false_tag", "test_reporting::call_with_undeclared_identifier_starting_with_underscore", "test_reporting::call_with_declared_identifier_starting_with_underscore", "test_reporting::call_with_underscore_identifier", "test_reporting::boolean_tag", "test_reporting::cannot_derive_hash_for_function", "test_reporting::cannot_not_eq_functions", "test_reporting::circular_definition_self", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::cannot_derive_eq_for_function", "test_reporting::bool_vs_true_tag", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::closure_underscore_ident", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::circular_type", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::cannot_eq_functions", "test_reporting::circular_definition", "test_reporting::compare_unsigned_to_signed", "test_reporting::dbg_without_final_expression", "test_reporting::def_missing_final_expression", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::derive_eq_for_tag", "test_reporting::cyclic_opaque", "test_reporting::derive_hash_for_function", "test_reporting::derive_encoding_for_tuple", "test_reporting::cycle_through_non_function_top_level", "test_reporting::cycle_through_non_function", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_decoding_for_function", "test_reporting::derive_encoding_for_nat", "test_reporting::demanded_vs_optional_record_field", "test_reporting::elm_function_syntax", "test_reporting::empty_or_pattern", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::double_plus", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::derive_eq_for_record", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::error_inline_alias_qualified", "test_reporting::derive_eq_for_f32", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::derive_eq_for_function", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_eq_for_f64", "test_reporting::exposes_identifier", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::derive_hash_for_tuple", "test_reporting::derive_hash_for_record", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::derive_hash_for_tag", "test_reporting::derive_non_builtin_ability", "test_reporting::expect_without_final_expression", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::double_equals_in_def", "test_reporting::dict_type_formatting", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::different_phantom_types", "test_reporting::elem_in_list", "test_reporting::eq_binop_is_transparent", "test_reporting::expression_indentation_end", "test_reporting::error_nested_wildcards_are_related", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::error_wildcards_are_related", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::expect_expr_type_error", "test_reporting::float_literal_has_int_suffix", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::fncall_overapplied", "test_reporting::expected_tag_has_too_many_args", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::first_wildcard_is_required", "test_reporting::float_out_of_range", "test_reporting::float_malformed", "test_reporting::from_annotation_if", "test_reporting::fncall_value", "test_reporting::fncall_underapplied", "test_reporting::function_arity_mismatch_nested_too_few", "test_reporting::from_annotation_function", "test_reporting::from_annotation_when", "test_reporting::function_cannot_derive_encoding", "test_reporting::from_annotation_complex_pattern", "test_reporting::function_arity_mismatch_nested_too_many", "test_reporting::function_arity_mismatch_too_many", "test_reporting::forgot_to_remove_underscore", "test_reporting::function_arity_mismatch_too_few", "test_reporting::function_does_not_implement_encoding", "test_reporting::has_clause_not_on_toplevel", "test_reporting::if_outdented_then", "test_reporting::if_guard_without_condition", "test_reporting::imports_missing_comma", "test_reporting::if_missing_else", "test_reporting::guard_mismatch_with_annotation", "test_reporting::gt_binop_is_transparent", "test_reporting::geq_binop_is_transparent", "test_reporting::has_encoding_for_function", "test_reporting::inline_hastype", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::i128_overflow", "test_reporting::i16_overflow", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::i16_underflow", "test_reporting::i64_overflow", "test_reporting::invalid_app_name", "test_reporting::i64_underflow", "test_reporting::i32_underflow", "test_reporting::invalid_module_name", "test_reporting::i32_overflow", "test_reporting::if_condition_not_bool", "test_reporting::i8_overflow", "test_reporting::if_2_branch_mismatch", "test_reporting::i8_underflow", "test_reporting::if_3_branch_mismatch", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::implements_type_not_ability", "test_reporting::invalid_operator", "test_reporting::inference_var_in_alias", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::incorrect_optional_field", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::inference_var_too_many_in_alias", "test_reporting::lambda_double_comma", "test_reporting::lambda_leading_comma", "test_reporting::int_frac", "test_reporting::int_literal_has_float_suffix", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::integer_empty", "test_reporting::integer_out_of_range", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::integer_malformed", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::invalid_num", "test_reporting::invalid_record_update", "test_reporting::invalid_toplevel_cycle", "test_reporting::list_double_comma", "test_reporting::issue_2326", "test_reporting::invalid_num_fn", "test_reporting::invalid_tag_extension_type", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::issue_2380_typed_body", "test_reporting::issue_2380_alias_with_vars", "test_reporting::invalid_record_extension_type", "test_reporting::issue_1755", "test_reporting::issue_2458", "test_reporting::issue_2380_annotations_only", "test_reporting::keyword_record_field_access", "test_reporting::keyword_qualified_import", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::leq_binop_is_transparent", "test_reporting::list_get_negative_number", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_pattern_not_terminated", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_without_end", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::list_match_spread_redundant_front_back", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_spread_as", "test_reporting::list_match_with_guard", "test_reporting::malformed_bin_pattern", "test_reporting::list_match_spread_required_front_back", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::malformed_float_pattern", "test_reporting::lt_binop_is_transparent", "test_reporting::malformed_int_pattern", "test_reporting::malformed_oct_pattern", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::malformed_hex_pattern", "test_reporting::mismatched_record_annotation", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::mismatched_suffix_i128", "test_reporting::mismatched_suffix_dec", "test_reporting::missing_imports", "test_reporting::missing_provides_in_app_header", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::mismatched_suffix_f32", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::multi_no_end", "test_reporting::multi_insufficient_indent", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::module_ident_ends_with_dot", "test_reporting::missing_fields", "test_reporting::module_not_imported", "test_reporting::multiple_record_builders", "test_reporting::mismatched_suffix_u8", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::multiple_wildcards_in_alias", "test_reporting::mutual_recursion_not_reached", "test_reporting::negative_u128", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::negative_u32", "test_reporting::negative_u64", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::negative_u16", "test_reporting::negative_u8", "test_reporting::nested_datatype_inline", "test_reporting::neq_binop_is_transparent", "test_reporting::nested_datatype", "test_reporting::nested_specialization", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::num_too_general_wildcard", "test_reporting::num_too_general_named", "test_reporting::number_double_dot", "test_reporting::non_exhaustive_with_guard", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_ability_impl_optional", "test_reporting::numer_literal_multi_suffix", "test_reporting::not_enough_cases_for_open_union", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::opaque_ability_impl_qualified", "test_reporting::optional_field_in_record_builder", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::pattern_in_parens_end", "test_reporting::pattern_binds_keyword", "test_reporting::pattern_in_parens_end_comma", "test_reporting::opaque_ref_field_access", "test_reporting::pattern_in_parens_indent_open", "test_reporting::pattern_in_parens_open", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::opaque_type_not_in_scope", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::optional_record_default_with_signature", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::optional_record_default_type_error", "test_reporting::platform_requires_rigids", "test_reporting::optional_record_invalid_accessor", "test_reporting::optional_record_invalid_let_binding", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::optional_record_invalid_function", "test_reporting::optional_record_invalid_access", "test_reporting::optional_record_invalid_when", "test_reporting::provides_to_identifier", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::pattern_let_mismatch", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::pattern_when_pattern", "test_reporting::pattern_when_condition", "test_reporting::patterns_let_not_exhaustive", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::patterns_int_redundant", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::patterns_record_not_exhaustive", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::phantom_type_variable", "test_reporting::record_type_keyword_field_name", "test_reporting::record_type_open", "test_reporting::record_type_carriage_return", "test_reporting::record_type_tab", "test_reporting::record_type_missing_comma", "test_reporting::record_update_builder", "test_reporting::record_type_end", "test_reporting::record_type_open_indent", "test_reporting::pizza_parens_middle", "test_reporting::patterns_when_not_exhaustive", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::plus_on_str", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::polymorphic_mutual_recursion", "test_reporting::pizza_parens_right", "test_reporting::polymorphic_recursion", "test_reporting::qualified_opaque_reference", "test_reporting::report_module_color", "test_reporting::report_value_color", "test_reporting::report_region_in_color", "test_reporting::record_access_ends_with_dot", "test_reporting::record_builder_apply_non_function", "test_reporting::qualified_tag", "test_reporting::record_duplicate_field_multiline", "test_reporting::record_duplicate_field_different_types", "test_reporting::record_field_mismatch", "test_reporting::record_duplicate_field_same_type", "test_reporting::record_type_duplicate_field", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::record_update_value", "test_reporting::report_precedence_problem_multiline", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::recursion_var_specialization_error", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::report_precedence_problem_single_line", "test_reporting::report_shadowing", "test_reporting::report_unused_def", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::report_shadowing_in_annotation", "test_reporting::same_phantom_types_unify", "test_reporting::self_recursive_alias", "test_reporting::single_no_end", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::self_recursive_not_reached", "test_reporting::single_quote_too_long", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::second_wildcard_is_redundant", "test_reporting::tag_union_end", "test_reporting::tag_union_open", "test_reporting::self_recursive_not_reached_nested", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::type_annotation_double_colon", "test_reporting::type_apply_stray_dot", "test_reporting::type_in_parens_start", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::type_double_comma", "test_reporting::type_in_parens_end", "test_reporting::type_argument_no_arrow", "test_reporting::type_inline_alias", "test_reporting::shadowing_top_level_scope", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::shift_by_negative", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::specialization_for_wrong_type", "test_reporting::tag_missing", "test_reporting::tag_mismatch", "test_reporting::stray_dot_expr", "test_reporting::tag_union_duplicate_tag", "test_reporting::tag_with_arguments_mismatch", "test_reporting::too_many_type_arguments", "test_reporting::too_few_type_arguments", "test_reporting::tags_missing", "test_reporting::tuple_exhaustiveness_good", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::two_different_cons", "test_reporting::type_apply_double_dot", "test_reporting::type_apply_start_with_number", "test_reporting::unicode_not_hex", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::type_apply_start_with_lowercase", "test_reporting::type_apply_trailing_dot", "test_reporting::typo_lowercase_ok", "test_reporting::typo_uppercase_ok", "test_reporting::u32_overflow", "test_reporting::u8_overflow", "test_reporting::u16_overflow", "test_reporting::unbound_var_in_alias", "test_reporting::u64_overflow", "test_reporting::unapplied_record_builder", "test_reporting::underscore_in_middle_of_identifier", "test_reporting::unicode_too_large", "test_reporting::weird_escape", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::unimported_modules_reported", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::when_missing_arrow", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::unused_arg_and_unused_def", "test_reporting::unify_alias_other", "test_reporting::when_over_indented_underscore", "test_reporting::unused_argument", "test_reporting::unnecessary_extension_variable", "test_reporting::unused_def_in_branch_pattern", "test_reporting::unused_shadow_specialization", "test_reporting::when_outdented_branch", "test_reporting::update_empty_record", "test_reporting::unwrap_num_elem_in_list", "test_reporting::unused_value_import", "test_reporting::when_over_indented_int", "test_reporting::wild_case_arrow", "test_reporting::unknown_type", "test_reporting::update_record", "test_reporting::update_record_ext", "test_reporting::when_branch_mismatch", "test_reporting::update_record_snippet", "test_reporting::value_not_exposed", "test_reporting::weird_accessor", "test_reporting::when_if_guard", "test_reporting::wildcard_in_opaque", "test_reporting::wildcard_in_alias", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::bad_rigid_value", "test_reporting::bad_numeric_literal_suffix", "test_reporting::bad_rigid_function" ]
[]
[]
2023-11-22T13:21:15Z
a3e9f06241f397a907c8a2c81f0ad2800fcaedc5
diff --git a/crates/compiler/constrain/src/expr.rs b/crates/compiler/constrain/src/expr.rs --- a/crates/compiler/constrain/src/expr.rs +++ b/crates/compiler/constrain/src/expr.rs @@ -502,6 +502,7 @@ pub fn constrain_expr( let reason = Reason::FnArg { name: opt_symbol, arg_index: HumanIndex::zero_based(index), + called_via: *called_via, }; let expected_arg = constraints.push_expected_type(ForReason(reason, arg_type_index, region)); diff --git a/crates/compiler/module/src/called_via.rs b/crates/compiler/module/src/called_via.rs --- a/crates/compiler/module/src/called_via.rs +++ b/crates/compiler/module/src/called_via.rs @@ -102,6 +102,15 @@ pub enum UnaryOp { Not, } +impl std::fmt::Display for UnaryOp { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + UnaryOp::Negate => write!(f, "-"), + UnaryOp::Not => write!(f, "!"), + } + } +} + #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum BinOp { // highest precedence diff --git a/crates/compiler/types/src/types.rs b/crates/compiler/types/src/types.rs --- a/crates/compiler/types/src/types.rs +++ b/crates/compiler/types/src/types.rs @@ -3370,6 +3370,7 @@ pub enum Reason { FnArg { name: Option<Symbol>, arg_index: HumanIndex, + called_via: CalledVia, }, TypedArg { name: Option<Symbol>, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1273,12 +1273,24 @@ fn to_expr_report<'b>( } } }, - Reason::FnArg { name, arg_index } => { + Reason::FnArg { + name, + arg_index, + called_via, + } => { let ith = arg_index.ordinal(); - let this_function = match name { - None => alloc.text("this function"), - Some(symbol) => alloc.symbol_unqualified(symbol), + let this_function = match (called_via, name) { + (CalledVia::Space, Some(symbole)) => alloc.symbol_unqualified(symbole), + (CalledVia::BinOp(op), _) => alloc.binop(op), + (CalledVia::UnaryOp(op), _) => alloc.unop(op), + (CalledVia::StringInterpolation, _) => alloc.text("this string interpolation"), + _ => alloc.text("this function"), + }; + + let argument = match called_via { + CalledVia::StringInterpolation => "argument".to_string(), + _ => format!("{ith} argument"), }; report_mismatch( diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1292,7 +1304,7 @@ fn to_expr_report<'b>( region, Some(expr_region), alloc.concat([ - alloc.string(format!("This {ith} argument to ")), + alloc.string(format!("This {argument} to ")), this_function.clone(), alloc.text(" has an unexpected type:"), ]), diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -1300,7 +1312,7 @@ fn to_expr_report<'b>( alloc.concat([ alloc.text("But "), this_function, - alloc.string(format!(" needs its {ith} argument to be:")), + alloc.string(format!(" needs its {argument} to be:")), ]), None, ) diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -490,6 +490,13 @@ impl<'a> RocDocAllocator<'a> { self.text(content.to_string()).annotate(Annotation::BinOp) } + pub fn unop( + &'a self, + content: roc_module::called_via::UnaryOp, + ) -> DocBuilder<'a, Self, Annotation> { + self.text(content.to_string()).annotate(Annotation::UnaryOp) + } + /// Turns off backticks/colors in a block pub fn type_block( &'a self, diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -843,6 +850,7 @@ pub enum Annotation { Structure, Symbol, BinOp, + UnaryOp, Error, GutterBar, LineNumber, diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -1027,6 +1035,9 @@ where BinOp => { self.write_str(self.palette.alias)?; } + UnaryOp => { + self.write_str(self.palette.alias)?; + } Symbol => { self.write_str(self.palette.variable)?; } diff --git a/crates/reporting/src/report.rs b/crates/reporting/src/report.rs --- a/crates/reporting/src/report.rs +++ b/crates/reporting/src/report.rs @@ -1075,9 +1086,9 @@ where match self.style_stack.pop() { None => {} Some(annotation) => match annotation { - Emphasized | Url | TypeVariable | Alias | Symbol | BinOp | Error | GutterBar - | Ellipsis | Typo | TypoSuggestion | ParserSuggestion | Structure | CodeBlock - | PlainText | LineNumber | Tip | Module | Header | Keyword => { + Emphasized | Url | TypeVariable | Alias | Symbol | BinOp | UnaryOp | Error + | GutterBar | Ellipsis | Typo | TypoSuggestion | ParserSuggestion | Structure + | CodeBlock | PlainText | LineNumber | Tip | Module | Header | Keyword => { self.write_str(self.palette.reset)?; }
roc-lang__roc-5994
5,994
We now have the infrastructure in place to make this a relatively straightforward change! If you are interested and want some guidance, lmk smaller repro: ``` » A == A "" ── TYPE MISMATCH ─────────────────────────────────────────────────────────────── This 2nd argument to isEq has an unexpected type: 4│ A == A "" ^^^^ This A tag application has the type: [A Str]a But isEq needs its 2nd argument to be: [A]a ```
[ "1668" ]
0.0
roc-lang/roc
2023-11-16T16:06:08Z
diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -2447,7 +2447,7 @@ mod test_reporting { @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `add` has an unexpected type: + This 2nd argument to + has an unexpected type: 4│ 0x4 + "foo" ^^^^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -2456,7 +2456,7 @@ mod test_reporting { Str - But `add` needs its 2nd argument to be: + But + needs its 2nd argument to be: Int * "### diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -2472,7 +2472,7 @@ mod test_reporting { @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `add` has an unexpected type: + This 2nd argument to + has an unexpected type: 4│ 0x4 + 3.14 ^^^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -2481,7 +2481,7 @@ mod test_reporting { Frac * - But `add` needs its 2nd argument to be: + But + needs its 2nd argument to be: Int * diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -2500,7 +2500,7 @@ mod test_reporting { @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `add` has an unexpected type: + This 2nd argument to + has an unexpected type: 4│ 42 + True ^^^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -2509,7 +2509,7 @@ mod test_reporting { [True] - But `add` needs its 2nd argument to be: + But + needs its 2nd argument to be: Num * "### diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -3556,7 +3556,7 @@ mod test_reporting { ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `add` has an unexpected type: + This 2nd argument to + has an unexpected type: 14│ x + y + h + l + minlit + maxlit ^^^^^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -3565,7 +3565,7 @@ mod test_reporting { U128 - But `add` needs its 2nd argument to be: + But + needs its 2nd argument to be: I128 or Dec "### diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -3843,7 +3843,7 @@ mod test_reporting { @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `add` has an unexpected type: + This 2nd argument to + has an unexpected type: 4│ \{ x, y ? True } -> x + y ^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -3852,7 +3852,7 @@ mod test_reporting { [True] - But `add` needs its 2nd argument to be: + But + needs its 2nd argument to be: Num a "### diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -6377,7 +6377,7 @@ In roc, functions are always written as a lambda, like{} @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `mul` has an unexpected type: + This 2nd argument to * has an unexpected type: 5│ mult = \a, b -> a * b ^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -6386,7 +6386,7 @@ In roc, functions are always written as a lambda, like{} F64 - But `mul` needs its 2nd argument to be: + But * needs its 2nd argument to be: Num * diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -6421,7 +6421,7 @@ In roc, functions are always written as a lambda, like{} @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `mul` has an unexpected type: + This 2nd argument to * has an unexpected type: 5│ mult = \a, b -> a * b ^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -6430,7 +6430,7 @@ In roc, functions are always written as a lambda, like{} F64 - But `mul` needs its 2nd argument to be: + But * needs its 2nd argument to be: Num a diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -9234,7 +9234,7 @@ In roc, functions are always written as a lambda, like{} @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `isEq` has an unexpected type: + This 2nd argument to == has an unexpected type: 9│ Job lst -> lst == "" ^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -9243,7 +9243,7 @@ In roc, functions are always written as a lambda, like{} Str - But `isEq` needs its 2nd argument to be: + But == needs its 2nd argument to be: List [Job ∞] as ∞ "### diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -10013,7 +10013,7 @@ In roc, functions are always written as a lambda, like{} @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `isEq` has an unexpected type: + This 2nd argument to == has an unexpected type: 4│ 0x80000000000000000000000000000000 == -0x80000000000000000000000000000000 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -10022,7 +10022,7 @@ In roc, functions are always written as a lambda, like{} I128 - But `isEq` needs its 2nd argument to be: + But == needs its 2nd argument to be: U128 "### diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -10038,7 +10038,7 @@ In roc, functions are always written as a lambda, like{} @r###" ── TYPE MISMATCH ───────────────────────────────────────── /code/proj/Main.roc ─ - This 2nd argument to `isEq` has an unexpected type: + This 2nd argument to == has an unexpected type: 4│ 170141183460469231731687303715884105728 == -170141183460469231731687303715884105728 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -10047,7 +10047,7 @@ In roc, functions are always written as a lambda, like{} I128 or Dec - But `isEq` needs its 2nd argument to be: + But == needs its 2nd argument to be: U128 "### diff --git a/crates/repl_test/src/tests.rs b/crates/repl_test/src/tests.rs --- a/crates/repl_test/src/tests.rs +++ b/crates/repl_test/src/tests.rs @@ -658,15 +658,41 @@ fn too_few_args() { #[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes! #[test] -fn type_problem() { +fn type_problem_function() { expect_failure( - "1 + \"\"", + "Num.add 1 \"not a num\"", indoc!( r#" ── TYPE MISMATCH ─────────────────────────────────────────────────────────────── This 2nd argument to add has an unexpected type: + 4│ Num.add 1 "not a num" + ^^^^^^^^^^^ + + The argument is a string of type: + + Str + + But add needs its 2nd argument to be: + + Num * + "# + ), + ); +} + +#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes! +#[test] +fn type_problem_binary_operator() { + expect_failure( + "1 + \"\"", + indoc!( + r#" + ── TYPE MISMATCH ─────────────────────────────────────────────────────────────── + + This 2nd argument to + has an unexpected type: + 4│ 1 + "" ^^ diff --git a/crates/repl_test/src/tests.rs b/crates/repl_test/src/tests.rs --- a/crates/repl_test/src/tests.rs +++ b/crates/repl_test/src/tests.rs @@ -674,9 +700,61 @@ fn type_problem() { Str - But add needs its 2nd argument to be: + But + needs its 2nd argument to be: + + Num * + "# + ), + ); +} + +#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes! +#[test] +fn type_problem_unary_operator() { + expect_failure( + "!\"not a bool\"", + indoc!( + r#" + ── TYPE MISMATCH ─────────────────────────────────────────────────────────────── + + This 1st argument to ! has an unexpected type: + + 4│ !"not a bool" + ^^^^^^^^^^^^ + + The argument is a string of type: + + Str + + But ! needs its 1st argument to be: + + Bool + "# + ), + ); +} + +#[cfg(not(feature = "wasm"))] // TODO: mismatch is due to terminal control codes! +#[test] +fn type_problem_string_interpolation() { + expect_failure( + "\"This is not a string -> \\(1)\"", + indoc!( + r#" + ── TYPE MISMATCH ─────────────────────────────────────────────────────────────── + + This argument to this string interpolation has an unexpected type: + + 4│ "This is not a string -> \(1)" + ^ + + The argument is a number of type: Num * + + But this string interpolation needs its argument to be: + + Str "# ), );
Mismatch involving == reported as "isEq" ``` ── TYPE MISMATCH ─────────────────────────────────────────────────────────────── The 2nd argument to isEq is not what I expect: 416│ if kristy.rightHand == Ok (Jan (@JanId (@EntityId entityId))) then ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
e819c954d393eb3223dd5961556d07ce21b29831
[ "test_reporting::boolean_tag", "test_reporting::int_frac", "test_reporting::int_literals_cannot_fit_in_same_type", "test_reporting::integer_out_of_range", "test_reporting::num_literals_cannot_fit_in_same_type", "test_reporting::num_too_general_wildcard", "test_reporting::num_too_general_named", "test_reporting::optional_record_default_type_error", "test_reporting::plus_on_str", "test_reporting::recursion_var_specialization_error" ]
[ "test_reporting::ability_non_signature_expression", "test_reporting::ability_demand_value_has_args", "test_reporting::ability_first_demand_not_indented_enough", "test_reporting::ability_demands_not_indented_with_first", "test_reporting::ability_member_binds_parent_twice", "test_reporting::argument_without_space", "test_reporting::ability_specialization_is_unused", "test_reporting::apply_unary_negative", "test_reporting::applied_tag_function", "test_reporting::ability_bad_type_parameter", "test_reporting::ability_value_annotations_are_an_error", "test_reporting::ability_specialization_checked_against_annotation", "test_reporting::ability_not_on_toplevel", "test_reporting::ability_specialization_called_with_non_specializing", "test_reporting::alias_using_alias", "test_reporting::ability_specialization_conflicting_specialization_types", "test_reporting::ability_member_does_not_bind_ability", "test_reporting::ability_shadows_ability", "test_reporting::alias_in_implements_clause", "test_reporting::ability_specialization_is_duplicated", "test_reporting::ability_specialization_does_not_match_type", "test_reporting::alias_type_diff", "test_reporting::annotation_newline_body_is_fine", "test_reporting::bad_double_rigid", "test_reporting::ability_specialization_is_incomplete", "test_reporting::backpassing_type_error", "test_reporting::always_function", "test_reporting::apply_opaque_as_function", "test_reporting::annotation_definition_mismatch", "test_reporting::apply_unary_not", "test_reporting::ability_specialization_is_duplicated_with_type_mismatch", "test_reporting::anonymous_function_does_not_use_param", "test_reporting::comment_with_control_character", "test_reporting::comment_with_tab", "test_reporting::bad_rigid_value", "test_reporting::bool_vs_false_tag", "test_reporting::bool_vs_true_tag", "test_reporting::big_char_does_not_fit_in_u8_pattern", "test_reporting::branches_have_more_cases_than_condition", "test_reporting::call_with_declared_identifier_starting_with_underscore", "test_reporting::call_with_underscore_identifier", "test_reporting::cannot_decode_tuple_with_non_decode_element", "test_reporting::cannot_not_eq_functions", "test_reporting::cannot_derive_eq_for_function", "test_reporting::cannot_derive_eq_for_structure_containing_function", "test_reporting::cannot_eq_tuple_with_non_eq_element", "test_reporting::closure_underscore_ident", "test_reporting::bad_numeric_literal_suffix", "test_reporting::branch_patterns_missing_nested_case_with_trivially_exhausted_variant", "test_reporting::cannot_derive_hash_for_function", "test_reporting::bad_rigid_function", "test_reporting::branch_patterns_missing_nested_case", "test_reporting::call_with_undeclared_identifier_starting_with_underscore", "test_reporting::cannot_hash_tuple_with_non_hash_element", "test_reporting::cannot_encode_tuple_with_non_encode_element", "test_reporting::cannot_derive_hash_for_structure_containing_function", "test_reporting::circular_definition", "test_reporting::compare_unsigned_to_signed", "test_reporting::circular_definition_self", "test_reporting::big_char_does_not_fit_in_u8", "test_reporting::cannot_import_structural_eq_not_eq", "test_reporting::cannot_eq_functions", "test_reporting::circular_type", "test_reporting::concat_different_types", "test_reporting::crash_given_non_string", "test_reporting::dbg_without_final_expression", "test_reporting::def_missing_final_expression", "test_reporting::create_value_with_optional_record_field_type", "test_reporting::crash_unapplied", "test_reporting::crash_overapplied", "test_reporting::create_value_with_conditionally_optional_record_field_type", "test_reporting::cycle_through_non_function", "test_reporting::custom_type_conflicts_with_builtin", "test_reporting::cycle_through_non_function_top_level", "test_reporting::cyclic_opaque", "test_reporting::derive_decoding_for_nat", "test_reporting::derive_decoding_for_non_decoding_opaque", "test_reporting::derive_eq_for_tuple", "test_reporting::derive_encoding_for_tuple", "test_reporting::derive_decoding_for_recursive_deriving", "test_reporting::derive_eq_for_f64", "test_reporting::derive_encoding_for_nat", "test_reporting::derive_eq_for_record", "test_reporting::demanded_vs_optional_record_field", "test_reporting::derive_eq_for_recursive_deriving", "test_reporting::derive_eq_for_tag", "test_reporting::derive_decoding_for_tuple", "test_reporting::derive_eq_for_function", "test_reporting::derive_eq_for_f32", "test_reporting::derive_eq_for_other_has_eq", "test_reporting::derive_decoding_for_function", "test_reporting::derive_eq_for_non_eq_opaque", "test_reporting::derive_hash_for_function", "test_reporting::derive_hash_for_non_hash_opaque", "test_reporting::derive_hash_for_other_has_hash", "test_reporting::exposes_identifier", "test_reporting::double_plus", "test_reporting::elm_function_syntax", "test_reporting::empty_or_pattern", "test_reporting::error_inline_alias_not_an_alias", "test_reporting::error_inline_alias_qualified", "test_reporting::error_inline_alias_argument_uppercase", "test_reporting::derive_hash_for_tuple", "test_reporting::derive_decoding_for_other_has_decoding", "test_reporting::derive_hash_for_record", "test_reporting::derive_hash_for_recursive_deriving", "test_reporting::derive_hash_for_tag", "test_reporting::derive_non_builtin_ability", "test_reporting::dict_type_formatting", "test_reporting::different_phantom_types", "test_reporting::double_equals_in_def", "test_reporting::duplicate_ability_in_has_clause", "test_reporting::elem_in_list", "test_reporting::destructure_assignment_introduces_no_variables_nested_toplevel", "test_reporting::eq_binop_is_transparent", "test_reporting::destructure_assignment_introduces_no_variables_nested", "test_reporting::error_nested_wildcards_are_related", "test_reporting::expect_without_final_expression", "test_reporting::expression_indentation_end", "test_reporting::float_literal_has_int_suffix", "test_reporting::flip_flop_catch_all_branches_not_exhaustive", "test_reporting::expected_tag_has_too_many_args", "test_reporting::error_wildcards_are_related", "test_reporting::first_wildcard_is_required", "test_reporting::expand_ability_from_type_alias_mismatch", "test_reporting::fncall_overapplied", "test_reporting::expect_expr_type_error", "test_reporting::function_does_not_implement_encoding", "test_reporting::error_wildcards_are_related_in_nested_defs", "test_reporting::float_out_of_range", "test_reporting::fncall_underapplied", "test_reporting::function_arity_mismatch_too_many", "test_reporting::float_malformed", "test_reporting::from_annotation_if", "test_reporting::function_arity_mismatch_nested_too_many", "test_reporting::geq_binop_is_transparent", "test_reporting::expression_generalization_to_ability_is_an_error", "test_reporting::fncall_value", "test_reporting::gt_binop_is_transparent", "test_reporting::explicit_inferred_open_in_output_position_can_grow", "test_reporting::exhaustiveness_check_function_or_tag_union_issue_4994", "test_reporting::function_arity_mismatch_nested_too_few", "test_reporting::function_arity_mismatch_too_few", "test_reporting::from_annotation_complex_pattern", "test_reporting::from_annotation_when", "test_reporting::from_annotation_function", "test_reporting::forgot_to_remove_underscore", "test_reporting::imports_missing_comma", "test_reporting::has_clause_not_on_toplevel", "test_reporting::function_cannot_derive_encoding", "test_reporting::guard_mismatch_with_annotation", "test_reporting::has_encoding_for_function", "test_reporting::if_guard_without_condition", "test_reporting::if_missing_else", "test_reporting::if_outdented_then", "test_reporting::inline_hastype", "test_reporting::i32_underflow", "test_reporting::i8_overflow", "test_reporting::i64_underflow", "test_reporting::has_encoding_for_non_encoding_alias", "test_reporting::invalid_app_name", "test_reporting::i16_underflow", "test_reporting::i32_overflow", "test_reporting::invalid_module_name", "test_reporting::i64_overflow", "test_reporting::i8_underflow", "test_reporting::has_encoding_for_recursive_deriving", "test_reporting::if_2_branch_mismatch", "test_reporting::i16_overflow", "test_reporting::if_condition_not_bool", "test_reporting::has_encoding_for_other_has_encoding", "test_reporting::i128_overflow", "test_reporting::inference_var_conflict_in_rigid_links", "test_reporting::if_3_branch_mismatch", "test_reporting::incorrect_optional_field", "test_reporting::inference_var_in_alias", "test_reporting::inference_var_too_many_in_alias", "test_reporting::inference_var_not_enough_in_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_nested_alias", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow_alias", "test_reporting::int_literal_has_float_suffix", "test_reporting::implicit_inferred_open_in_output_position_cannot_grow", "test_reporting::implements_type_not_ability", "test_reporting::invalid_operator", "test_reporting::integer_empty", "test_reporting::integer_malformed", "test_reporting::lambda_leading_comma", "test_reporting::lambda_double_comma", "test_reporting::list_double_comma", "test_reporting::interpolate_concat_is_transparent_1714", "test_reporting::invalid_num_fn", "test_reporting::invalid_num", "test_reporting::invalid_alias_rigid_var_pattern", "test_reporting::invalid_opaque_rigid_var_pattern", "test_reporting::invalid_tag_extension_type", "test_reporting::issue_1755", "test_reporting::invalid_toplevel_cycle", "test_reporting::issue_2380_annotations_only", "test_reporting::issue_2167_record_field_optional_and_required_mismatch", "test_reporting::invalid_record_extension_type", "test_reporting::invalid_record_update", "test_reporting::issue_2326", "test_reporting::issue_2380_alias_with_vars", "test_reporting::issue_2380_typed_body", "test_reporting::issue_2778_specialization_is_not_a_redundant_pattern", "test_reporting::leq_binop_is_transparent", "test_reporting::issue_2458", "test_reporting::let_polymorphism_with_scoped_type_variables", "test_reporting::keyword_qualified_import", "test_reporting::keyword_record_field_access", "test_reporting::list_match_exhaustive_big_sizes_but_not_small_sizes", "test_reporting::list_get_negative_number_indirect", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head", "test_reporting::list_get_negative_number_double_indirect", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_head_and_tail", "test_reporting::list_get_negative_number", "test_reporting::list_pattern_weird_rest_pattern", "test_reporting::list_without_end", "test_reporting::list_pattern_not_terminated", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head_and_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_head", "test_reporting::infer_decoded_record_error_with_function_field", "test_reporting::list_match_exhaustive_empty_and_rest_with_nonexhaustive_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_exhausted_tail", "test_reporting::list_match_exhaustive_empty_and_rest_with_unary_head", "test_reporting::list_match_nested_list_not_exhaustive", "test_reporting::list_match_nested_list_exhaustive", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_head_and_tail", "test_reporting::list_match_no_small_sizes_and_non_exhaustive_tail", "test_reporting::list_match_redundant_exact_size", "test_reporting::list_match_redundant_any_slice", "test_reporting::list_match_non_exhaustive_infinite", "test_reporting::list_match_spread_exhaustive", "test_reporting::list_match_redundant_suffix_slice_with_sized_prefix", "test_reporting::list_match_non_exhaustive_only_empty", "test_reporting::list_match_with_guard", "test_reporting::malformed_float_pattern", "test_reporting::malformed_bin_pattern", "test_reporting::lt_binop_is_transparent", "test_reporting::malformed_hex_pattern", "test_reporting::list_match_redundant_based_on_ctors", "test_reporting::lowercase_primitive_tag_bool", "test_reporting::malformed_oct_pattern", "test_reporting::malformed_int_pattern", "test_reporting::mismatch_within_list_pattern", "test_reporting::mismatched_suffix_dec_pattern", "test_reporting::missing_imports", "test_reporting::missing_provides_in_app_header", "test_reporting::mismatch_list_pattern_vs_condition", "test_reporting::mismatched_suffix_dec", "test_reporting::mismatched_single_tag_arg", "test_reporting::mismatched_record_annotation", "test_reporting::mismatched_suffix_f32", "test_reporting::mismatched_suffix_f32_pattern", "test_reporting::mismatched_suffix_f64", "test_reporting::mismatched_suffix_f64_pattern", "test_reporting::mismatched_suffix_i128", "test_reporting::multi_insufficient_indent", "test_reporting::mismatched_suffix_i128_pattern", "test_reporting::multi_no_end", "test_reporting::mismatched_suffix_i16", "test_reporting::mismatched_suffix_i16_pattern", "test_reporting::mismatched_suffix_i32", "test_reporting::mismatched_suffix_i8_pattern", "test_reporting::mismatched_suffix_nat", "test_reporting::mismatched_suffix_i64", "test_reporting::mismatched_suffix_nat_pattern", "test_reporting::mismatched_suffix_u128", "test_reporting::mismatched_suffix_u128_pattern", "test_reporting::mismatched_suffix_i64_pattern", "test_reporting::mismatched_suffix_i32_pattern", "test_reporting::mismatched_suffix_i8", "test_reporting::mismatched_suffix_u16_pattern", "test_reporting::mismatched_suffix_u32", "test_reporting::mismatched_suffix_u32_pattern", "test_reporting::mismatched_suffix_u64", "test_reporting::mismatched_suffix_u64_pattern", "test_reporting::mismatched_suffix_u16", "test_reporting::mismatched_suffix_u8", "test_reporting::mismatched_suffix_u8_pattern", "test_reporting::module_ident_ends_with_dot", "test_reporting::module_not_imported", "test_reporting::multiple_list_patterns_in_a_row", "test_reporting::missing_fields", "test_reporting::multiple_record_builders", "test_reporting::multiple_wildcards_in_alias", "test_reporting::multiple_list_patterns_start_and_end", "test_reporting::mutual_polymorphic_recursion_with_inference_var_second", "test_reporting::mutual_polymorphic_recursion_with_inference_var", "test_reporting::mutual_recursion_not_reached_but_exposed", "test_reporting::mutual_recursion_not_reached_nested", "test_reporting::mutual_recursion_not_reached_but_exposed_nested", "test_reporting::mutually_recursive_types_with_type_error", "test_reporting::negative_u128", "test_reporting::negative_u16", "test_reporting::negative_u32", "test_reporting::negative_u8", "test_reporting::negative_u64", "test_reporting::neq_binop_is_transparent", "test_reporting::mutual_recursion_not_reached", "test_reporting::nested_datatype", "test_reporting::nested_opaque_does_not_implement_encoding", "test_reporting::nested_specialization", "test_reporting::nested_datatype_inline", "test_reporting::nested_opaque_cannot_derive_encoding", "test_reporting::non_exhaustive_with_guard", "test_reporting::not_enough_cases_for_open_union", "test_reporting::numer_literal_multi_suffix", "test_reporting::number_double_dot", "test_reporting::optional_field_in_record_builder", "test_reporting::opaque_ability_impl_not_identifier", "test_reporting::opaque_ability_impl_not_found", "test_reporting::opaque_ability_impl_duplicate", "test_reporting::opaque_ability_impl_not_found_shorthand_syntax", "test_reporting::opaque_ability_impl_qualified", "test_reporting::opaque_ability_impl_optional", "test_reporting::pattern_binds_keyword", "test_reporting::opaque_builtin_ability_impl_optional", "test_reporting::opaque_mismatch_check", "test_reporting::opaque_creation_is_not_wrapped", "test_reporting::opaque_mismatch_infer", "test_reporting::opaque_mismatch_pattern_infer", "test_reporting::pattern_in_parens_end", "test_reporting::opaque_mismatch_pattern_check", "test_reporting::opaque_pattern_match_not_exhaustive_int", "test_reporting::opaque_ref_field_access", "test_reporting::pattern_in_parens_indent_open", "test_reporting::pattern_in_parens_end_comma", "test_reporting::opaque_pattern_match_not_exhaustive_tag", "test_reporting::opaque_reference_not_opaque_type", "test_reporting::pattern_in_parens_open", "test_reporting::opaque_type_not_in_scope", "test_reporting::opaque_wrap_function_mismatch", "test_reporting::optional_record_invalid_accessor", "test_reporting::platform_requires_rigids", "test_reporting::openness_constraint_opens_under_tuple", "test_reporting::optional_field_mismatch_with_annotation", "test_reporting::optional_record_default_with_signature", "test_reporting::opaque_used_outside_declaration_scope", "test_reporting::optional_record_invalid_function", "test_reporting::optional_record_invalid_when", "test_reporting::provides_to_identifier", "test_reporting::optional_record_invalid_access", "test_reporting::optional_record_invalid_let_binding", "test_reporting::pattern_guard_can_be_shadowed_below", "test_reporting::pattern_guard_can_be_shadowed_above", "test_reporting::pattern_guard_does_not_bind_label", "test_reporting::pattern_guard_mismatch_alias", "test_reporting::pattern_guard_mismatch", "test_reporting::pattern_let_mismatch", "test_reporting::pattern_when_condition", "test_reporting::patterns_bool_not_exhaustive", "test_reporting::pattern_when_pattern", "test_reporting::pattern_or_pattern_mismatch", "test_reporting::patterns_fn_not_exhaustive", "test_reporting::patterns_let_not_exhaustive", "test_reporting::patterns_int_redundant", "test_reporting::patterns_nested_tag_not_exhaustive", "test_reporting::patterns_record_not_exhaustive", "test_reporting::patterns_remote_data_not_exhaustive", "test_reporting::patterns_enum_not_exhaustive", "test_reporting::patterns_when_not_exhaustive", "test_reporting::patterns_record_guard_not_exhaustive", "test_reporting::phantom_type_variable", "test_reporting::pizza_parens_middle", "test_reporting::polymorphic_mutual_recursion", "test_reporting::polymorphic_recursion_inference_var", "test_reporting::pizza_parens_right", "test_reporting::report_module_color", "test_reporting::record_type_keyword_field_name", "test_reporting::record_type_carriage_return", "test_reporting::record_type_missing_comma", "test_reporting::record_type_end", "test_reporting::report_region_in_color", "test_reporting::report_value_color", "test_reporting::polymorphic_mutual_recursion_annotated", "test_reporting::polymorphic_recursion", "test_reporting::polymorphic_mutual_recursion_dually_annotated_lie", "test_reporting::record_type_open_indent", "test_reporting::polymorphic_recursion_with_deep_inference_var", "test_reporting::record_type_open", "test_reporting::record_type_tab", "test_reporting::qualified_opaque_reference", "test_reporting::qualified_tag", "test_reporting::record_access_ends_with_dot", "test_reporting::record_update_builder", "test_reporting::record_builder_apply_non_function", "test_reporting::record_duplicate_field_different_types", "test_reporting::record_field_mismatch", "test_reporting::record_duplicate_field_same_type", "test_reporting::record_duplicate_field_multiline", "test_reporting::record_type_duplicate_field", "test_reporting::single_no_end", "test_reporting::record_update_duplicate_field_multiline", "test_reporting::record_update_value", "test_reporting::recursive_body_and_annotation_with_inference_disagree", "test_reporting::report_precedence_problem_multiline", "test_reporting::recursive_type_alias_is_newtype", "test_reporting::recursive_type_alias_is_newtype_deep", "test_reporting::report_precedence_problem_single_line", "test_reporting::recursive_type_alias_is_newtype_mutual", "test_reporting::report_shadowing_in_annotation", "test_reporting::single_quote_too_long", "test_reporting::record_with_optional_field_types_cannot_derive_decoding", "test_reporting::resolve_eq_for_unbound_num", "test_reporting::resolve_hash_for_unbound_num", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_with_indirection", "test_reporting::recursive_alias_cannot_leak_into_recursive_opaque", "test_reporting::report_shadowing", "test_reporting::self_recursive_alias", "test_reporting::rigid_able_bounds_must_be_a_superset_of_flex_bounds_multiple", "test_reporting::second_wildcard_is_redundant", "test_reporting::report_unused_def", "test_reporting::self_recursive_not_reached_but_exposed_nested", "test_reporting::resolve_eq_for_unbound_num_float", "test_reporting::same_phantom_types_unify", "test_reporting::self_recursive_not_reached_but_exposed", "test_reporting::self_recursive_not_reached", "test_reporting::tag_union_lowercase_tag_name", "test_reporting::tag_union_end", "test_reporting::tag_union_second_lowercase_tag_name", "test_reporting::tag_union_open", "test_reporting::type_annotation_double_colon", "test_reporting::shadowing_top_level_scope", "test_reporting::shift_by_negative", "test_reporting::shadowed_type_variable_in_has_clause", "test_reporting::type_apply_stray_dot", "test_reporting::type_argument_arrow_then_nothing", "test_reporting::self_recursive_not_reached_nested", "test_reporting::type_double_comma", "test_reporting::type_in_parens_end", "test_reporting::type_argument_no_arrow", "test_reporting::type_in_parens_start", "test_reporting::type_inline_alias", "test_reporting::stray_dot_expr", "test_reporting::symbols_not_bound_in_all_patterns", "test_reporting::tag_mismatch", "test_reporting::tag_missing", "test_reporting::unfinished_closure_pattern_in_parens", "test_reporting::specialization_for_wrong_type", "test_reporting::suggest_binding_rigid_var_to_ability", "test_reporting::unicode_not_hex", "test_reporting::too_many_type_arguments", "test_reporting::tag_with_arguments_mismatch", "test_reporting::too_few_type_arguments", "test_reporting::tags_missing", "test_reporting::tag_union_duplicate_tag", "test_reporting::two_different_cons", "test_reporting::tuple_exhaustiveness_bad", "test_reporting::tuple_exhaustiveness_good", "test_reporting::type_apply_start_with_number", "test_reporting::type_apply_trailing_dot", "test_reporting::type_apply_start_with_lowercase", "test_reporting::type_apply_double_dot", "test_reporting::typo_uppercase_ok", "test_reporting::typo_lowercase_ok", "test_reporting::u16_overflow", "test_reporting::u64_overflow", "test_reporting::u8_overflow", "test_reporting::underscore_in_middle_of_identifier", "test_reporting::unapplied_record_builder", "test_reporting::underivable_opaque_doesnt_error_for_derived_bodies", "test_reporting::u32_overflow", "test_reporting::unbound_var_in_alias", "test_reporting::unicode_too_large", "test_reporting::unify_alias_other", "test_reporting::when_missing_arrow", "test_reporting::weird_escape", "test_reporting::unify_recursive_with_nonrecursive", "test_reporting::when_outdented_branch", "test_reporting::when_over_indented_underscore", "test_reporting::wild_case_arrow", "test_reporting::when_over_indented_int", "test_reporting::unimported_modules_reported", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched_nested", "test_reporting::uninhabited_type_is_trivially_exhaustive_nested", "test_reporting::unnecessary_extension_variable", "test_reporting::uninhabited_type_is_trivially_exhaustive", "test_reporting::unused_arg_and_unused_def", "test_reporting::uninhabited_err_branch_is_redundant_when_err_is_matched", "test_reporting::unused_shadow_specialization", "test_reporting::unused_argument", "test_reporting::unwrap_num_elem_in_list", "test_reporting::update_empty_record", "test_reporting::unused_value_import", "test_reporting::update_record", "test_reporting::unused_def_in_branch_pattern", "test_reporting::weird_accessor", "test_reporting::update_record_ext", "test_reporting::update_record_snippet", "test_reporting::unknown_type", "test_reporting::value_not_exposed", "test_reporting::when_branch_mismatch", "test_reporting::when_if_guard", "test_reporting::wildcard_in_alias", "test_reporting::wildcard_in_opaque" ]
[]
[]
2023-11-18T14:51:48Z
73909f2e201824d730aa088e7e96820f6e951f0b
diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -1,5 +1,6 @@ +use actix_http::header::Quality; use actix_http::ContentEncoding; -use actix_web::error::{ErrorBadRequest, ErrorNotFound}; +use actix_web::error::{ErrorBadRequest, ErrorNotAcceptable, ErrorNotFound}; use actix_web::http::header::{ AcceptEncoding, Encoding as HeaderEnc, Preference, CONTENT_ENCODING, }; diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -21,13 +22,7 @@ use crate::utils::{ }; use crate::{Tile, TileCoord, TileData}; -static PREFER_BROTLI_ENC: &[HeaderEnc] = &[ - HeaderEnc::brotli(), - HeaderEnc::gzip(), - HeaderEnc::identity(), -]; - -static PREFER_GZIP_ENC: &[HeaderEnc] = &[ +static SUPPORTED_ENC: &[HeaderEnc] = &[ HeaderEnc::gzip(), HeaderEnc::brotli(), HeaderEnc::identity(), diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -180,6 +175,49 @@ impl<'a> DynTileSource<'a> { self.recompress(data) } + /// Decide which encoding to use for the uncompressed tile data, based on the client's Accept-Encoding header + fn decide_encoding(&self, accept_enc: &AcceptEncoding) -> ActixResult<Option<ContentEncoding>> { + let mut q_gzip = None; + let mut q_brotli = None; + for enc in accept_enc.iter() { + if let Preference::Specific(HeaderEnc::Known(e)) = enc.item { + match e { + ContentEncoding::Gzip => q_gzip = Some(enc.quality), + ContentEncoding::Brotli => q_brotli = Some(enc.quality), + _ => {} + } + } else if let Preference::Any = enc.item { + q_gzip.get_or_insert(enc.quality); + q_brotli.get_or_insert(enc.quality); + } + } + Ok(match (q_gzip, q_brotli) { + (Some(q_gzip), Some(q_brotli)) if q_gzip == q_brotli => { + if q_gzip > Quality::ZERO { + Some(self.get_preferred_enc()) + } else { + None + } + } + (Some(q_gzip), Some(q_brotli)) if q_brotli > q_gzip => Some(ContentEncoding::Brotli), + (Some(_), Some(_)) => Some(ContentEncoding::Gzip), + _ => { + if let Some(HeaderEnc::Known(enc)) = accept_enc.negotiate(SUPPORTED_ENC.iter()) { + Some(enc) + } else { + return Err(ErrorNotAcceptable("No supported encoding found")); + } + } + }) + } + + fn get_preferred_enc(&self) -> ContentEncoding { + match self.preferred_enc { + None | Some(PreferredEncoding::Gzip) => ContentEncoding::Gzip, + Some(PreferredEncoding::Brotli) => ContentEncoding::Brotli, + } + } + fn recompress(&self, tile: TileData) -> ActixResult<Tile> { let mut tile = Tile::new(tile, self.info); if let Some(accept_enc) = &self.accept_enc { diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -198,18 +236,12 @@ impl<'a> DynTileSource<'a> { } if tile.info.encoding == Encoding::Uncompressed { - let ordered_encodings = match self.preferred_enc { - Some(PreferredEncoding::Gzip) | None => PREFER_GZIP_ENC, - Some(PreferredEncoding::Brotli) => PREFER_BROTLI_ENC, - }; - - // only apply compression if the content supports it - if let Some(HeaderEnc::Known(enc)) = accept_enc.negotiate(ordered_encodings.iter()) - { + if let Some(enc) = self.decide_encoding(accept_enc)? { // (re-)compress the tile into the preferred encoding tile = encode(tile, enc)?; } } + Ok(tile) } else { // no accepted-encoding header, decode the tile if compressed
maplibre__martin-1355
1,355
Hi @pcace Have you run the `select query_tile(10,544,339)` (without explain) directly? How many seconds it takes? Hi @sharkAndshark, I am in a similar situation. In my case running the query directly (without _EXPLAIN ANALYZE_) from postgres takes **~400ms**: ` select tiles(14,8176,6234)` <img width="413" alt="image" src="https://github.com/maplibre/martin/assets/66483123/53004e93-63e8-4bb2-a814-d8b084366794"> And martin takes **~6 seconds**: ` [2024-05-16T12:51:04Z INFO actix_web::middleware::logger] 172.19.0.1 "GET /tiles/14/8176/6234 HTTP/1.1" 200 739124 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" 6.002455 ` <img width="574" alt="image" src="https://github.com/maplibre/martin/assets/66483123/4ccfc86d-24f6-4380-bb16-dfdde9c09320"> thanks for reporting! This is very concerning. Would it be possible to check if the issue is the same if an older martin version is used? I did a quick test on different versions of martin. It seems to work pretty well from versions **0.9.0** to **0.11.6**. I can see a noticeable regression when I use **v0.12.0**. @jahermosilla thank you!!! I will have to dig deeper into what has happened at that point. One thing that MIGHT help figure it out: would it be possible for you to run some sort of a stress test, e.g. request a tile in a loop using something like [Oha](https://github.com/hatoo/oha), but make sure to use `martin --cache-size 0 --pool-size 5` or even smaller pool size). While stress test is running, run this query from psql or other DB tool to see what your DB is doing (from [stackoverflow](https://stackoverflow.com/a/44211767/177275)): ``` SELECT datname, pid, state, query, age(clock_timestamp(), query_start) AS age FROM pg_stat_activity WHERE state <> 'idle' AND query NOT LIKE '% FROM pg_stat_activity %' ORDER BY age; ``` Ensure that there are no running queries in-between running different Martin versions. This way we can: * see if any other slow running queries are still around, possibly slowing down the whole system * see if the tile generation query is the same between Martin versions, and if that query really does take many seconds to execute @nyurik, here are the results: <details> <summary>Martin config</summary> ```yaml keep_alive: 75 listen_addresses: "0.0.0.0:3000" worker_processes: 8 cache_size_mb: 0 preferred_encoding: gzip postgres: connection_string: "postgresql://postgres:postgres@db:5432/db" default_srid: 4326 pool_size: 4 disable_bounds: false functions: tiles: schema: geo function: tiles source_id_format: "{function}" buffer: 64 minzoom: 14 maxzoom: 25 ``` </details> <details> <summary>v0.11.6</summary> ```sh ❯ oha -z 120s http://localhost:5000/tiles/14/8176/6234 Summary: Success rate: 100.00% Total: 120.0008 secs Slowest: 5.7591 secs Fastest: 0.4354 secs Average: 5.2303 secs Requests/sec: 9.7666 Total data: 1000.03 MiB Size/request: 912.68 KiB Size/sec: 8.33 MiB Response time histogram: 0.435 [1] | 0.968 [6] | 1.500 [5] | 2.033 [7] | 2.565 [5] | 3.097 [4] | 3.630 [5] | 4.162 [6] | 4.694 [4] | 5.227 [173] |■■■■■■ 5.759 [906] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ Response time distribution: 10.00% in 5.1610 secs 25.00% in 5.2564 secs 50.00% in 5.3421 secs 75.00% in 5.4183 secs 90.00% in 5.4833 secs 95.00% in 5.5236 secs 99.00% in 5.5984 secs 99.90% in 5.7440 secs 99.99% in 5.7591 secs Details (average, fastest, slowest): DNS+dialup: 0.0070 secs, 0.0008 secs, 0.1211 secs DNS-lookup: 0.0017 secs, 0.0000 secs, 0.0129 secs Status code distribution: [200] 1122 responses Error distribution: [50] aborted due to deadline ``` </details> <details> <summary>v0.12.0</summary> ```sh ❯ oha -z 120s http://localhost:5000/tiles/14/8176/6234 Summary: Success rate: 100.00% Total: 120.0021 secs Slowest: 89.4509 secs Fastest: 6.0141 secs Average: 50.6991 secs Requests/sec: 1.0916 Total data: 63.30 MiB Size/request: 800.22 KiB Size/sec: 540.14 KiB Response time histogram: 6.014 [1] |■ 14.358 [7] |■■■■■■■■■■■ 22.701 [8] |■■■■■■■■■■■■ 31.045 [4] |■■■■■■ 39.389 [4] |■■■■■■ 47.733 [5] |■■■■■■■■ 56.076 [9] |■■■■■■■■■■■■■■ 64.420 [12] |■■■■■■■■■■■■■■■■■■■ 72.764 [20] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 81.107 [10] |■■■■■■■■■■■■■■■■ 89.451 [1] |■ Response time distribution: 10.00% in 16.0105 secs 25.00% in 31.0666 secs 50.00% in 60.8164 secs 75.00% in 69.5884 secs 90.00% in 74.7607 secs 95.00% in 77.9642 secs 99.00% in 89.4509 secs 99.90% in 89.4509 secs 99.99% in 89.4509 secs Details (average, fastest, slowest): DNS+dialup: 0.0046 secs, 0.0000 secs, 0.0778 secs DNS-lookup: 0.0016 secs, 0.0000 secs, 0.0105 secs Status code distribution: [200] 81 responses Error distribution: [50] aborted due to deadline ``` </details> <details> <summary>Running queries during test on v.0.11.6 (every second)</summary> ```sh datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.004907 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.195591 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.196385 db | 1616 | active | SELECT ST_AsMVT(tile, 'tiles', 4096, 'geometry') FROM (\r +| 00:00:00.246769 | | | select\r +| | | | [OMITED], +| | | | ST_AsMVTGeom(\r +| | | | ST_Transform(ST_CurveToLine(x.geometry), 3857),\r +| | | | ST_TileEnvelope(z, x, y),\r +| | | | 4096, 64, true\r +| | | | ) AS geometry\r +| | | | FROM [OMITED] xx\r | | | WHERE xx.geometry && ST_TileEnvelope(z, x, y)\r +| | | | ) as tile WHERE geometry IS NOT NULL | db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.24677 (5 rows) Fri May 17 14:00:41 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.054727 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.113057 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.328635 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.371165 (4 rows) Fri May 17 14:00:42 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.002267 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.13379 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.231671 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.294789 (4 rows) Fri May 17 14:00:43 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.04163 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.114376 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.203973 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.246527 (4 rows) Fri May 17 14:00:44 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.136439 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.185399 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.294084 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.294088 (4 rows) Fri May 17 14:00:45 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.162713 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.187907 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.272371 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.353877 (4 rows) Fri May 17 14:00:46 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.274781 (1 row) Fri May 17 14:00:47 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.081421 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.114244 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.168092 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.37592 (4 rows) Fri May 17 14:00:48 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.136693 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.209694 db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.326173 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.386165 (4 rows) Fri May 17 14:00:49 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.134637 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.349381 (2 rows) Fri May 17 14:00:50 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.05008 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.15786 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.177105 (3 rows) Fri May 17 14:00:51 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.019662 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.021038 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.278052 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.283921 (4 rows) Fri May 17 14:00:52 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.0795 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.100143 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.377697 (3 rows) Fri May 17 14:00:53 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1596 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.128012 db | 1595 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.164013 db | 1589 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.259666 db | 1590 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.313145 (4 rows) ``` </details> <details> <summary>Running queries during test on v.0.12.0(every second)</summary> ```sh db=# SELECT datname, pid, state, query, age(clock_timestamp(), query_start) AS age FROM pg_stat_activity WHERE state <> 'idle' AND query NOT LIKE '% FROM pg_stat_activity %' ORDER BY age; datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) db=# \watch 1 Fri May 17 13:57:40 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:57:41 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:57:42 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:57:43 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:57:44 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) ^C db=# \watch 1 Fri May 17 13:58:04 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:05 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1374 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.020556 db | 1388 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.020561 (2 rows) Fri May 17 13:58:06 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:07 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:08 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:09 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:10 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:11 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1373 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.000724 db | 1389 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.096582 db | 1388 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.096583 (3 rows) Fri May 17 13:58:12 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:13 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:14 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:15 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:16 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:17 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+----------------- db | 1389 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.121798 db | 1373 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.128111 db | 1374 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.165167 (3 rows) Fri May 17 13:58:18 2024 (every 1s) datname | pid | state | query | age ---------+------+--------+------------------------------------------------------------------------------------------------+---------------- db | 1373 | active | SELECT "geo"."tiles"($1::integer, $2::integer, $3::integer) AS tile | 00:00:00.33792 (1 row) Fri May 17 13:58:19 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:20 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) Fri May 17 13:58:21 2024 (every 1s) datname | pid | state | query | age ---------+-----+-------+-------+----- (0 rows) ``` </details> From what I can see from the results it seems martin is doing something when processing a tile that is blocking/enqueueing other request? I wish more users would do as much testing to help as you! There's clearly a hiccup somewhere in Martin. The next step is to use something like `perf` to do sampling profiling of Martin, and see if we can get some stats on the most common stack traces. Of course, it could be some issue related to an upstream lib being updated. Thank you for your helpful guidance @nyurik ! I'll try it! What steps should I take? I'm not very familiar with Rust but if you guide me a little bit, I'll take some time and come back with the results. Running a quick perf test seems to indicate the culprit is Brotli :( I ran a few minute perf test using [cargo flamegraph](https://github.com/flamegraph-rs/flamegraph) and `oha` as described above. The two biggest time takers - aprox 80% between the two. I have been working with @danielrh to slowly clean up and reduce the machine generated C++ -> Rust Brotli code and try to speed it up. The flamegraph below can be examined interactively [here](https://github.com/maplibre/martin/assets/1641515/4a681de2-0797-46d3-967a-7a3f6b7ea751). ![image](https://github.com/maplibre/martin/assets/1641515/34e95938-7d84-45bb-b30e-495cc457259c) ![image](https://github.com/maplibre/martin/assets/1641515/ab19034d-e8f1-4945-97ec-49b13f24d401) ![flame](https://github.com/maplibre/martin/assets/1641515/4a681de2-0797-46d3-967a-7a3f6b7ea751) Another confirmation for this is that when I run `oha -z 1h http://localhost:3000/points1/0/0/0 --disable-compression` I see 10x performance improvement. Sadly, OHA does not yet allow specific accept header param (I created an [issue](https://github.com/hatoo/oha/issues/505) for that) - so cannot do direct gzip vs brotli comparison.
[ "1315" ]
0.2
maplibre/martin
2024-05-29T00:24:10Z
diff --git a/martin/src/srv/tiles.rs b/martin/src/srv/tiles.rs --- a/martin/src/srv/tiles.rs +++ b/martin/src/srv/tiles.rs @@ -270,6 +302,11 @@ mod tests { use super::*; use crate::srv::server::tests::TestSource; + #[actix_rt::test] + async fn test_deleteme() { + test_enc_preference(&["gzip", "deflate", "br", "zstd"], None, Encoding::Gzip).await; + } + #[rstest] #[trace] #[case(&["gzip", "deflate", "br", "zstd"], None, Encoding::Gzip)] diff --git a/martin/tests/mb_server_test.rs b/martin/tests/mb_server_test.rs --- a/martin/tests/mb_server_test.rs +++ b/martin/tests/mb_server_test.rs @@ -3,8 +3,8 @@ use actix_web::test::{call_service, read_body, read_body_json, TestRequest}; use ctor::ctor; use indoc::indoc; use insta::assert_yaml_snapshot; -use martin::decode_gzip; use martin::srv::SrvConfig; +use martin::{decode_brotli, decode_gzip}; use tilejson::TileJSON; pub mod utils; diff --git a/martin/tests/mb_server_test.rs b/martin/tests/mb_server_test.rs --- a/martin/tests/mb_server_test.rs +++ b/martin/tests/mb_server_test.rs @@ -211,7 +211,7 @@ async fn mbt_get_mvt_brotli() { assert_eq!(response.headers().get(CONTENT_ENCODING).unwrap(), "br"); let body = read_body(response).await; assert_eq!(body.len(), 871); // this number could change if compression gets more optimized - let body = martin::decode_brotli(&body).unwrap(); + let body = decode_brotli(&body).unwrap(); assert_eq!(body.len(), 1828); } diff --git a/martin/tests/mb_server_test.rs b/martin/tests/mb_server_test.rs --- a/martin/tests/mb_server_test.rs +++ b/martin/tests/mb_server_test.rs @@ -267,10 +267,10 @@ async fn mbt_get_raw_mvt_gzip_br() { response.headers().get(CONTENT_TYPE).unwrap(), "application/x-protobuf" ); - assert_eq!(response.headers().get(CONTENT_ENCODING).unwrap(), "br"); + assert_eq!(response.headers().get(CONTENT_ENCODING).unwrap(), "gzip"); let body = read_body(response).await; - assert_eq!(body.len(), 871); // this number could change if compression gets more optimized - let body = martin::decode_brotli(&body).unwrap(); + assert_eq!(body.len(), 1107); // this number could change if compression gets more optimized + let body = decode_gzip(&body).unwrap(); assert_eq!(body.len(), 1828); }
very slow queries through martin Hi there, i am trying to find out why martin is so much slower then a direct query to the db. this: http://localhost:3000/query_tile/10/544/339 takes >13s to get the tile from the server via martin. the martin log looks like this: ``` [2024-04-24T07:43:12Z DEBUG martin::pg::pg_source] SQL: SELECT "public"."query_tile"($1::integer, $2::integer, $3::integer) AS tile [10,544,339] [2024-04-24T07:43:12Z DEBUG tokio_postgres::query] executing statement s7 with parameters: [10, 544, 339] [2024-04-24T07:43:25Z INFO actix_web::middleware::logger] 127.0.0.1 "GET /query_tile/10/544/339 HTTP/1.1" 200 440578 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36" 13.798128 ``` using the function directly: `EXPLAIN (ANALYZE,VERBOSE) select query_tile(10,544,339) ` results in: ``` "Planning Time: 328.475 ms" "Execution Time: 0.023 ms" ``` so there is a gap of 13s where something happens. i thought it might be the compression, but compressing the mvt tile from the db cannot take 13s. for comparison, the attached file takes 0.05s to compress using gzip. (is this comparable?) ``` time gzip -c 339 > 339.gz real 0m0,056s user 0m0,056s sys 0m0,000s ``` how can i narrow down what the issue is? i have attached the resulting tile here. All rows have spacial indices and are clustered. [339.zip](https://github.com/maplibre/martin/files/15090583/339.zip) PS.: this is the martin config (changing from brotli to gzip does not make a huge difference): ``` yaml keep_alive: 75 listen_addresses: "0.0.0.0:3000" worker_processes: 8 cache_size_mb: 0 preferred_encoding: brotli postgres: connection_string: "postgresql://postgres:postgrespw@localhost:5432/tilesDBtest" default_srid: 4326 pool_size: 20 max_feature_count: 100000 auto_bounds: calc functions: query_tile: schema: public function: query_tile minzoom: 4 maxzoom: 20 bounds: [-180.0, -90.0, 180.0, 90.0] ```
09535cf917708d2d8e60099c516f6ff45f9efdd8
[ "srv::tiles::tests::test_deleteme", "srv::tiles::tests::test_enc_preference::case_3", "srv::tiles::tests::test_enc_preference::case_4", "srv::tiles::tests::test_enc_preference::case_1", "mbt_get_raster", "mbt_get_raw_mvt", "mbt_get_tilejson", "mbt_get_mvt_gzip", "mbt_get_tilejson_gzip", "mbt_get_mvt", "mbt_get_json", "mbt_get_raw_mvt_gzip_br", "mbt_get_raw_mvt_gzip", "mbt_get_raster_gzip", "mbt_get_json_gzip", "mbt_get_catalog_gzip", "mbt_get_catalog", "mbt_get_mvt_brotli" ]
[ "args::pg::tests::test_extract_conn_strings", "args::pg::tests::test_merge_into_config", "args::pg::tests::test_extract_conn_strings_from_env", "args::pg::tests::test_merge_into_config2", "args::pg::tests::test_merge_into_config3", "args::root::tests::cli_bad_parsed_arguments", "args::root::tests::cli_no_args", "args::root::tests::cli_bad_arguments", "args::root::tests::cli_unknown_con_str", "mbtiles::tests::parse", "args::root::tests::cli_encoding_arguments", "pg::config::tests::parse_pg_one", "pg::config::tests::parse_pg_two", "pg::config::tests::parse_pg_config", "args::root::tests::cli_with_config", "source::tests::xyz_format", "srv::config::tests::parse_config", "test_utils::tests::test_bad_os_str", "srv::tiles_info::tests::test_merge_tilejson", "utils::cfg_containers::tests::test_one_or_many", "utils::rectangle::tests::test_append_single", "utils::rectangle::tests::test_append_multiple", "test_utils::tests::test_get_env_str", "utils::rectangle::tests::test_tile_range_is_overlapping", "utils::utilities::tests::test_parse_base_path", "utils::rectangle::tests::test_len", "srv::tiles::tests::test_tile_content", "utils::id_resolver::tests::id_resolve", "srv::tiles::tests::test_enc_preference::case_6", "srv::tiles::tests::test_enc_preference::case_2", "pg::builder::tests::test_auto_publish_no_auto", "srv::tiles::tests::test_enc_preference::case_5", "pg::tls::tests::test_parse_conn_str", "sprites::tests::test_sprites", "tests::test_compute_tile_ranges", "utils::test_utils::tests::test_bad_os_str", "utils::test_utils::tests::test_get_env_str", "pmt_get_tilejson", "pmt_get_raster_gzip", "pmt_get_raster", "pmt_get_tilejson_gzip", "pmt_get_catalog_gzip", "pmt_get_catalog" ]
[ "function_source_schemas", "function_source_tilejson", "function_source_tile", "pg_get_composite_source_tile_minmax_zoom_ok", "pg_get_function_source_tile_ok", "pg_get_function_source_tile_minmax_zoom_ok", "pg_get_function_source_ok", "pg_get_function_source_query_params_ok", "pg_get_function_source_ok_rewrite", "pg_get_function_tiles", "pg_get_catalog", "pg_get_table_source_ok", "pg_get_health_returns_ok", "pg_get_table_source_tile_minmax_zoom_ok", "pg_get_composite_source_ok", "pg_get_composite_source_tile_ok", "pg_get_table_source_multiple_geom_tile_ok", "pg_null_functions", "pg_get_table_source_rewrite", "pg_tables_feature_id", "pg_get_table_source_tile_ok", "table_source", "tables_srid_ok", "tables_tilejson", "tables_tile_ok", "tables_multiple_geom_ok", "table_source_schemas" ]
[]
2024-05-29T06:29:54Z
2391bc915b556c7dd4230dc1e61585220d2d2075
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -2,6 +2,7 @@ use std::borrow::Cow; use std::default::Default; use std::mem; + use tuikit::prelude::*; use vte::Perform; diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -69,60 +70,88 @@ impl Perform for ANSIParser { } let mut attr = self.last_attr; - match params.len() { - // CSI m, reset - 0 => attr = Attr::default(), - // CSI <num> m - 1 => match params[0] { + let mut iter = params.into_iter(); + + while let Some(&code) = iter.next() { + match code { 0 => attr = Attr::default(), 1 => attr.effect |= Effect::BOLD, + 2 => attr.effect |= !Effect::BOLD, 4 => attr.effect |= Effect::UNDERLINE, 5 => attr.effect |= Effect::BLINK, 7 => attr.effect |= Effect::REVERSE, num if num >= 30 && num <= 37 => { attr.fg = Color::AnsiValue((num - 30) as u8); } + 38 => match iter.next() { + Some(2) => { + // ESC[ 38;2;<r>;<g>;<b> m Select RGB foreground color + let or = iter.next(); + let og = iter.next(); + let ob = iter.next(); + if ob.is_none() { + trace!("ignore CSI {:?} m", params); + continue; + } + + let r = *or.unwrap() as u8; + let g = *og.unwrap() as u8; + let b = *ob.unwrap() as u8; + + attr.fg = Color::Rgb(r, g, b); + } + Some(5) => { + // ESC[ 38;5;<n> m Select foreground color + let color = iter.next(); + if color.is_none() { + trace!("ignore CSI {:?} m", params); + continue; + } + attr.fg = Color::AnsiValue(*color.unwrap() as u8); + } + _ => { + trace!("error on parsing CSI {:?} m", params); + } + }, + 39 => attr.fg = Color::Default, num if num >= 40 && num <= 47 => { attr.bg = Color::AnsiValue((num - 40) as u8); } - 39 => attr.fg = Color::Default, + 48 => match iter.next() { + Some(2) => { + // ESC[ 48;2;<r>;<g>;<b> m Select RGB background color + let or = iter.next(); + let og = iter.next(); + let ob = iter.next(); + if ob.is_none() { + trace!("ignore CSI {:?} m", params); + continue; + } + + let r = *or.unwrap() as u8; + let g = *og.unwrap() as u8; + let b = *ob.unwrap() as u8; + + attr.bg = Color::Rgb(r, g, b); + } + Some(5) => { + // ESC[ 48;5;<n> m Select background color + let color = iter.next(); + if color.is_none() { + trace!("ignore CSI {:?} m", params); + continue; + } + attr.bg = Color::AnsiValue(*color.unwrap() as u8); + } + _ => { + trace!("ignore CSI {:?} m", params); + } + }, 49 => attr.bg = Color::Default, _ => { trace!("ignore CSI {:?} m", params); } - }, - // ESC[ 38;5;<n> m Select foreground color - // ESC[ 48;5;<n> m Select background color - 3 => { - if params[1] != 5 { - trace!("ignore CSI {:?} m", params); - } else { - let color = Color::AnsiValue(params[2] as u8); - if params[0] == 38 { - attr.fg = color; - } else if params[0] == 48 { - attr.bg = color; - } - } } - // ESC[ 38;2;<r>;<g>;<b> m Select RGB foreground color - // ESC[ 48;2;<r>;<g>;<b> m Select RGB background color - 5 => { - if params[1] != 2 { - trace!("ignore CSI {:?} m", params); - } else { - let r = params[2] as u8; - let g = params[3] as u8; - let b = params[4] as u8; - let color = Color::Rgb(r, g, b); - if params[0] == 38 { - attr.fg = color; - } else if params[0] == 48 { - attr.bg = color; - } - } - } - _ => trace!("ignore CSI {:?} m", params), } self.attr_change(attr);
skim-rs__skim-198
198
Confirmed. Will fix when I got time.
[ "194" ]
0.6
skim-rs/skim
2019-07-14T00:11:14Z
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -301,4 +330,20 @@ mod tests { assert_eq!("ab", ansistring.into_inner()) } + + #[test] + fn test_multiple_attributes() { + let input = "\x1B[1;31mhi"; + let ansistring = ANSIParser::default().parse_ansi(input); + let mut it = ansistring.iter(); + let attr = Attr { + fg: Color::AnsiValue(1), + effect: Effect::BOLD, + ..Attr::default() + }; + + assert_eq!(Some(('h', attr)), it.next()); + assert_eq!(Some(('i', attr)), it.next()); + assert_eq!(None, it.next()); + } }
Color not working with `ag` When using silver searcher, coloring of file path and line numbers aren't working. Used the following command: ``` $ sk --ansi -i -c 'ag --color "{}"' ```
11c80768e0664878fc6fada1a31e7c9d0dfa8590
[ "ansi::tests::test_multiple_attributes" ]
[ "ansi::tests::test_normal_string", "ansi::tests::test_ansi_iterator", "field::test::test_parse_field_range", "field::test::test_parse_matching_fields", "field::test::test_parse_transform_fields", "field::test::test_get_string_by_field", "query::test::test_add_char", "query::test::test_backward_delete_char", "query::test::test_new_query", "field::test::test_parse_range", "spinlock::tests::test_mutex_unsized", "spinlock::tests::smoke", "engine::test::test_engine_factory", "util::tests::test_accumulate_text_width", "spinlock::tests::lots_and_lots", "util::tests::test_reshape_string", "input::test::action_chain_should_be_parsed", "util::tests::test_inject_command", "input::test::execute_should_be_parsed_correctly" ]
[]
[]
2019-07-14T00:11:30Z
817b75c09663bf57888bee1ae08bd820dc4d7414
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -58,7 +58,7 @@ __skim_history__() ( shopt -u nocaseglob nocasematch line=$( HISTTIMEFORMAT= history | - SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS --tac --sync -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS -m" $(__skimcmd) | + SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS --tac --sync -n2..,.. --tiebreak=index $SKIM_CTRL_R_OPTS -m" $(__skimcmd) | command grep '^ *[0-9]') && if [[ $- =~ H ]]; then sed 's/^ *\([0-9]*\)\** .*/!\1/' <<< "$line" diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -70,7 +70,7 @@ skim-history-widget() { local selected num setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null selected=( $(fc -rl 1 | - SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} -m" $(__skimcmd)) ) + SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS -n2..,.. --tiebreak=index $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} -m" $(__skimcmd)) ) local ret=$? if [ -n "$selected" ]; then num=$selected[1] diff --git a/src/field.rs b/src/field.rs --- a/src/field.rs +++ b/src/field.rs @@ -103,10 +103,9 @@ impl FieldRange { } } - -// e.g. delimiter = Regex::new(",").unwrap() -// Note that this is differnt with `to_index_pair`, it uses delimiters like ".*?," -pub fn get_string_by_field<'a>(delimiter: &Regex, text: &'a str, field: &FieldRange) -> Option<&'a str> { +// ("|", "a|b||c") -> [(0, 2), (2, 4), (4, 5), (5, 6)] +// explain: split to ["a|", "b|", "|", "c"] +fn get_ranges_by_delimiter(delimiter: &Regex, text: &str) -> Vec<(usize, usize)> { let mut ranges = Vec::new(); let mut last = 0; for mat in delimiter.find_iter(text) { diff --git a/src/field.rs b/src/field.rs --- a/src/field.rs +++ b/src/field.rs @@ -114,6 +113,14 @@ pub fn get_string_by_field<'a>(delimiter: &Regex, text: &'a str, field: &FieldRa last = mat.end(); } ranges.push((last, text.len())); + ranges +} + + +// e.g. delimiter = Regex::new(",").unwrap() +// Note that this is differnt with `to_index_pair`, it uses delimiters like ".*?," +pub fn get_string_by_field<'a>(delimiter: &Regex, text: &'a str, field: &FieldRange) -> Option<&'a str> { + let ranges = get_ranges_by_delimiter(delimiter, text); if let Some((start, stop)) = field.to_index_pair(ranges.len()) { let &(begin, _) = &ranges[start]; diff --git a/src/field.rs b/src/field.rs --- a/src/field.rs +++ b/src/field.rs @@ -130,12 +137,7 @@ pub fn get_string_by_range<'a>(delimiter: &Regex, text: &'a str, range: &str) -> // -> a vector of the matching fields. pub fn parse_matching_fields(delimiter: &Regex, text: &str, fields: &[FieldRange]) -> Vec<(usize, usize)> { - let mut ranges = delimiter - .find_iter(text) - .map(|m| (m.start(), m.end())) - .collect::<Vec<(usize, usize)>>(); - let &(_, end) = ranges.last().unwrap_or(&(0, 0)); - ranges.push((end, text.len())); + let ranges = get_ranges_by_delimiter(delimiter, text); let mut ret = Vec::new(); for field in fields { diff --git a/src/field.rs b/src/field.rs --- a/src/field.rs +++ b/src/field.rs @@ -150,17 +152,8 @@ pub fn parse_matching_fields(delimiter: &Regex, text: &str, fields: &[FieldRange ret } - - - - pub fn parse_transform_fields(delimiter: &Regex, text: &str, fields: &[FieldRange]) -> String { - let mut ranges = delimiter - .find_iter(text) - .map(|m| (m.start(), m.end())) - .collect::<Vec<(usize, usize)>>(); - let &(_, end) = ranges.last().unwrap_or(&(0, 0)); - ranges.push((end, text.len())); + let ranges = get_ranges_by_delimiter(delimiter, text); let mut ret = String::new(); for field in fields { diff --git a/src/model.rs b/src/model.rs --- a/src/model.rs +++ b/src/model.rs @@ -24,6 +24,7 @@ pub type ClosureType = Box<Fn(&mut Window) + Send>; const SPINNER_DURATION: u32 = 200; const SPINNERS: [char; 8] = ['-', '\\', '|', '/', '-', '\\', '|', '/']; +const DELIMITER_STR: &'static str = r"[\t\n ]+"; lazy_static! { static ref RE_FILEDS: Regex = Regex::new(r"\\?(\{-?[0-9.,q]*?})").unwrap(); diff --git a/src/model.rs b/src/model.rs --- a/src/model.rs +++ b/src/model.rs @@ -94,7 +95,7 @@ impl Model { multi_selection: false, reverse: false, preview_cmd: None, - delimiter: Regex::new(r"[ \t\n]+").unwrap(), + delimiter: Regex::new(DELIMITER_STR).unwrap(), output_ending: "\n", print_query: false, print_cmd: false, diff --git a/src/model.rs b/src/model.rs --- a/src/model.rs +++ b/src/model.rs @@ -121,7 +122,7 @@ impl Model { } if let Some(delimiter) = options.delimiter { - self.delimiter = Regex::new(delimiter).unwrap_or_else(|_| Regex::new(r"[ \t\n]+").unwrap()); + self.delimiter = Regex::new(delimiter).unwrap_or_else(|_| Regex::new(DELIMITER_STR).unwrap()); } if options.print0 { diff --git a/src/reader.rs b/src/reader.rs --- a/src/reader.rs +++ b/src/reader.rs @@ -18,6 +18,8 @@ use regex::Regex; use sender::CachedSender; use std::env; +const DELIMITER_STR: &'static str = r"[\t\n ]+"; + struct ReaderOption { pub use_ansi_color: bool, pub default_arg: String, diff --git a/src/reader.rs b/src/reader.rs --- a/src/reader.rs +++ b/src/reader.rs @@ -35,7 +37,7 @@ impl ReaderOption { default_arg: String::new(), transform_fields: Vec::new(), matching_fields: Vec::new(), - delimiter: Regex::new(r".*?\t").unwrap(), + delimiter: Regex::new(DELIMITER_STR).unwrap(), replace_str: "{}".to_string(), line_ending: b'\n', } diff --git a/src/reader.rs b/src/reader.rs --- a/src/reader.rs +++ b/src/reader.rs @@ -48,7 +50,7 @@ impl ReaderOption { if let Some(delimiter) = options.delimiter { self.delimiter = - Regex::new(&(".*?".to_string() + delimiter)).unwrap_or_else(|_| Regex::new(r".*?[\t ]").unwrap()); + Regex::new(delimiter).unwrap_or_else(|_| Regex::new(DELIMITER_STR).unwrap()); } if let Some(transform_fields) = options.with_nth {
skim-rs__skim-105
105
[ "104" ]
0.5
skim-rs/skim
2018-11-10T09:56:39Z
diff --git a/src/field.rs b/src/field.rs --- a/src/field.rs +++ b/src/field.rs @@ -251,7 +244,7 @@ mod test { #[test] fn test_parse_transform_fields() { // delimiter is "," - let re = Regex::new(".*?,").unwrap(); + let re = Regex::new(",").unwrap(); assert_eq!( super::parse_transform_fields(&re, &"A,B,C,D,E,F", &vec![Single(2), Single(4), Single(-1), Single(-7)]), diff --git a/src/field.rs b/src/field.rs --- a/src/field.rs +++ b/src/field.rs @@ -285,7 +278,7 @@ mod test { #[test] fn test_parse_matching_fields() { // delimiter is "," - let re = Regex::new(".*?,").unwrap(); + let re = Regex::new(",").unwrap(); assert_eq!( super::parse_matching_fields(
zsh history binding malfunctional? Perhaps I am missing something, but when using the zsh history binding, it doesn't work as before. A couple things I've tried that don't work: `^r` doesn't rotate the mode and `prefix-exact-match`. The search syntax isn't completely broken, as at least the `exact-match` type works. Said features do work with `sk --ansi -c 'rg --color=always --line-number "{}"'`. `export SKIM_DEFAULT_COMMAND='fd --type f'`
a33fe3635b080be7ccfcd7468a457db01fec05bb
[ "field::test::test_parse_transform_fields", "field::test::test_parse_matching_fields" ]
[ "field::test::test_parse_field_range", "model::tests::test_reshape_string", "model::tests::test_accumulate_text_width", "orderedvec::test::test_push_get", "query::test::test_add_char", "query::test::test_backward_delete_char", "field::test::test_get_string_by_field", "query::test::test_new_query", "field::test::test_parse_range", "matcher::test::test_engine_factory" ]
[]
[]
2019-02-24T14:22:45Z
1f723d31d965824fb50aea12a346bdceb032db7b
diff --git a/src/engine.rs b/src/engine.rs --- a/src/engine.rs +++ b/src/engine.rs @@ -10,15 +10,6 @@ lazy_static! { static ref RE_OR: Regex = Regex::new(r" +\| +").unwrap(); } -#[derive(Clone, Copy, Debug)] -enum Algorithm { - PrefixExact, - SuffixExact, - Exact, - InverseExact, - InverseSuffixExact, -} - #[derive(Clone, Copy, PartialEq)] pub enum MatcherMode { Regex, diff --git a/src/engine.rs b/src/engine.rs --- a/src/engine.rs +++ b/src/engine.rs @@ -169,21 +160,59 @@ impl MatchEngine for FuzzyEngine { } } +//------------------------------------------------------------------------------ +#[derive(Debug)] +struct MatchAllEngine {} + +impl MatchAllEngine { + pub fn builder() -> Self { + Self {} + } + + pub fn build(self) -> Self { + self + } +} + +impl MatchEngine for MatchAllEngine { + fn match_item(&self, item: Arc<Item>) -> Option<MatchedItem> { + let rank = build_rank(0, item.get_index() as i64, 0, 0); + + Some( + MatchedItem::builder(item) + .rank(rank) + .matched_range(MatchedRange::ByteRange(0, 0)) + .build(), + ) + } + + fn display(&self) -> String { + "Noop".to_string() + } +} + //------------------------------------------------------------------------------ // Exact engine +#[derive(Debug, Copy, Clone, Default)] +struct ExactMatchingParam { + prefix: bool, + postfix: bool, + inverse: bool, +} + #[derive(Debug)] struct ExactEngine { query: String, query_chars: Vec<char>, - algorithm: Algorithm, + param: ExactMatchingParam, } impl ExactEngine { - pub fn builder(query: &str, algo: Algorithm) -> Self { + pub fn builder(query: &str, param: ExactMatchingParam) -> Self { ExactEngine { query: query.to_string(), query_chars: query.chars().collect(), - algorithm: algo, + param, } } diff --git a/src/engine.rs b/src/engine.rs --- a/src/engine.rs +++ b/src/engine.rs @@ -191,7 +220,12 @@ impl ExactEngine { self } - fn match_item_exact(&self, item: Arc<Item>, filter: ExactFilter) -> Option<MatchedItem> { + fn match_item_exact( + &self, + item: Arc<Item>, + // filter: <Option<(start, end), (start, end)>, item_length> -> Option<(start, end)> + filter: impl Fn(&Option<((usize, usize), (usize, usize))>, usize) -> Option<(usize, usize)>, + ) -> Option<MatchedItem> { let mut matched_result = None; let mut range_start = 0; let mut range_end = 0; diff --git a/src/engine.rs b/src/engine.rs --- a/src/engine.rs +++ b/src/engine.rs @@ -225,54 +259,56 @@ impl ExactEngine { } } -// <Option<(start, end), (start, end)>, item_length> -> Option<(start, end)> -type ExactFilter = Box<dyn Fn(&Option<((usize, usize), (usize, usize))>, usize) -> Option<(usize, usize)>>; - impl MatchEngine for ExactEngine { fn match_item(&self, item: Arc<Item>) -> Option<MatchedItem> { - match self.algorithm { - Algorithm::Exact => self.match_item_exact( - item, - Box::new(|matched_result, _| matched_result.map(|(first, _)| first)), - ), - Algorithm::InverseExact => self.match_item_exact( - item, - Box::new( - |matched_result, _| { - if matched_result.is_none() { - Some((0, 0)) + self.match_item_exact(item, |match_result, len| { + let match_range = match *match_result { + Some(((s1, e1), (s2, e2))) => { + if self.param.prefix && self.param.postfix { + if s1 == 0 && e2 == len { + Some((s1, e1)) } else { None } - }, - ), - ), - Algorithm::PrefixExact => self.match_item_exact( - item, - Box::new(|matched_result, _| match *matched_result { - Some(((s, e), _)) if s == 0 => Some((s, e)), - _ => None, - }), - ), - Algorithm::SuffixExact => self.match_item_exact( - item, - Box::new(|matched_result, len| match *matched_result { - Some((_, (s, e))) if e == len => Some((s, e)), - _ => None, - }), - ), - Algorithm::InverseSuffixExact => self.match_item_exact( - item, - Box::new(|matched_result, len| match *matched_result { - Some((_, (_, e))) if e != len => None, - _ => Some((0, 0)), - }), - ), - } + } else if self.param.prefix { + if s1 == 0 { + Some((s1, e1)) + } else { + None + } + } else if self.param.postfix { + if e2 == len { + Some((s2, e2)) + } else { + None + } + } else { + Some((s1, e1)) + } + } + None => None, + }; + + if self.param.inverse { + if match_range.is_some() { + None + } else { + Some((0, 0)) + } + } else { + match_range + } + }) } fn display(&self) -> String { - format!("({:?}: {})", self.algorithm, self.query) + format!( + "(Exact|{}{}{}: {})", + if self.param.inverse { "!" } else { "" }, + if self.param.prefix { "^" } else { "" }, + if self.param.postfix { "$" } else { "" }, + self.query + ) } } diff --git a/src/engine.rs b/src/engine.rs --- a/src/engine.rs +++ b/src/engine.rs @@ -422,24 +458,55 @@ impl EngineFactory { } fn build_single(query: &str, mode: MatcherMode, fuzzy_algorithm: FuzzyAlgorithm) -> Box<dyn MatchEngine> { + // 'abc => match exact "abc" + // ^abc => starts with "abc" + // abc$ => ends with "abc" + // ^abc$ => match exact "abc" + // !^abc => items not starting with "abc" + // !abc$ => items not ending with "abc" + // !^abc$ => not "abc" + + let mut query = query; + let mut exact = false; + let mut param = ExactMatchingParam::default(); + if query.starts_with('\'') { if mode == MatcherMode::Exact { - Box::new(FuzzyEngine::builder(&query[1..]).algorithm(fuzzy_algorithm).build()) - } else { - Box::new(ExactEngine::builder(&query[1..], Algorithm::Exact).build()) - } - } else if query.starts_with('^') { - Box::new(ExactEngine::builder(&query[1..], Algorithm::PrefixExact).build()) - } else if query.starts_with('!') { - if query.ends_with('$') { - Box::new(ExactEngine::builder(&query[1..(query.len() - 1)], Algorithm::InverseSuffixExact).build()) + return Box::new(FuzzyEngine::builder(&query[1..]).algorithm(fuzzy_algorithm).build()); } else { - Box::new(ExactEngine::builder(&query[1..], Algorithm::InverseExact).build()) + return Box::new(ExactEngine::builder(&query[1..], param).build()); } - } else if query.ends_with('$') { - Box::new(ExactEngine::builder(&query[..(query.len() - 1)], Algorithm::SuffixExact).build()) - } else if mode == MatcherMode::Exact { - Box::new(ExactEngine::builder(query, Algorithm::Exact).build()) + } + + if query.starts_with('!') { + query = &query[1..]; + exact = true; + param.inverse = true; + } + + if query.is_empty() { + // if only "!" was provided, will still show all items + return Box::new(MatchAllEngine::builder().build()); + } + + if query.starts_with('^') { + query = &query[1..]; + exact = true; + param.prefix = true; + } + + if query.ends_with('$') { + query = &query[..(query.len() - 1)]; + exact = true; + param.postfix = true; + } + + if mode == MatcherMode::Exact { + exact = true; + } + + if exact { + Box::new(ExactEngine::builder(query, param).build()) } else { Box::new(FuzzyEngine::builder(query).algorithm(fuzzy_algorithm).build()) } diff --git a/src/previewer.rs b/src/previewer.rs --- a/src/previewer.rs +++ b/src/previewer.rs @@ -120,7 +120,7 @@ impl Previewer { let selected_items_changed = self.prev_num_selected != num_selected; - if !item_changed && !query_changed && !cmd_query_changed && ! selected_items_changed { + if !item_changed && !query_changed && !cmd_query_changed && !selected_items_changed { return; } diff --git a/src/score.rs b/src/score.rs --- a/src/score.rs +++ b/src/score.rs @@ -61,7 +61,7 @@ pub fn regex_match(choice: &str, pattern: &Option<Regex>) -> Option<(usize, usiz } } -// Pattern may appear in sevearl places, return the first and last occurrence +// Pattern may appear in several places, return the first and last occurrence pub fn exact_match(choice: &str, pattern: &str) -> Option<((usize, usize), (usize, usize))> { // search from the start let start_pos = choice.find(pattern)?;
skim-rs__skim-264
264
[ "226" ]
0.7
skim-rs/skim
2020-02-03T12:33:27Z
diff --git a/src/engine.rs b/src/engine.rs --- a/src/engine.rs +++ b/src/engine.rs @@ -453,22 +520,47 @@ mod test { #[test] fn test_engine_factory() { - let x1 = EngineFactory::build( + let x = EngineFactory::build("'abc", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|: abc)"); + + let x = EngineFactory::build("^abc", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|^: abc)"); + + let x = EngineFactory::build("abc$", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|$: abc)"); + + let x = EngineFactory::build("^abc$", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|^$: abc)"); + + let x = EngineFactory::build("!abc", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|!: abc)"); + + let x = EngineFactory::build("!^abc", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|!^: abc)"); + + let x = EngineFactory::build("!abc$", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|!$: abc)"); + + let x = EngineFactory::build("!^abc$", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); + assert_eq!(x.display(), "(Exact|!^$: abc)"); + + let x = EngineFactory::build( "'abc | def ^gh ij | kl mn", MatcherMode::Fuzzy, FuzzyAlgorithm::default(), ); + assert_eq!( - x1.display(), - "(And: (Or: (Exact: abc), (Fuzzy: def)), (PrefixExact: gh), (Or: (Fuzzy: ij), (Fuzzy: kl)), (Fuzzy: mn))" + x.display(), + "(And: (Or: (Exact|: abc), (Fuzzy: def)), (Exact|^: gh), (Or: (Fuzzy: ij), (Fuzzy: kl)), (Fuzzy: mn))" ); - let x3 = EngineFactory::build( + let x = EngineFactory::build( "'abc | def ^gh ij | kl mn", MatcherMode::Regex, FuzzyAlgorithm::default(), ); - assert_eq!(x3.display(), "(Regex: 'abc | def ^gh ij | kl mn)"); + assert_eq!(x.display(), "(Regex: 'abc | def ^gh ij | kl mn)"); let x = EngineFactory::build("abc ", MatcherMode::Fuzzy, FuzzyAlgorithm::default()); assert_eq!(x.display(), "(And: (Fuzzy: abc))");
Exact exact match When matching a short string, the exact match can get lost in results. For example, I use `skim` to select packages to install on Arch. If the name is extremely short (`lf`), the wanted result gets lost beneath results which contain the searched string. `^` nor `$` were able to narrow the search to what I wanted. I tried `^lf$`, which worked in `fzf` but yielded no results in `skim`. This could be solved by giving perfect match priority (like `fzf` does), or support the combination of `^` and `$` operators (like `fzf` does).
29239ba9276d5bd39bc84740374d66c1fe180981
[ "engine::test::test_engine_factory" ]
[ "ansi::tests::test_multiple_attributes", "ansi::tests::test_ansi_iterator", "ansi::tests::test_normal_string", "ansi::tests::test_reset", "field::test::test_parse_field_range", "field::test::test_get_string_by_field", "field::test::test_parse_matching_fields", "query::test::test_add_char", "field::test::test_parse_transform_fields", "query::test::test_backward_delete_char", "query::test::test_new_query", "spinlock::tests::test_mutex_unsized", "spinlock::tests::smoke", "util::tests::test_accumulate_text_width", "field::test::test_parse_range", "util::tests::test_reshape_string", "spinlock::tests::lots_and_lots", "util::tests::test_inject_command", "input::test::action_chain_should_be_parsed", "input::test::execute_should_be_parsed_correctly" ]
[]
[]
2020-02-03T12:42:29Z
8a579837daaeb71938c635aa5352cbde9669d5f8
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -75,7 +75,7 @@ impl Perform for ANSIParser { match code[0] { 0 => attr = Attr::default(), 1 => attr.effect |= Effect::BOLD, - 2 => attr.effect |= !Effect::BOLD, + 2 => attr.effect |= Effect::DIM, 4 => attr.effect |= Effect::UNDERLINE, 5 => attr.effect |= Effect::BLINK, 7 => attr.effect |= Effect::REVERSE,
skim-rs__skim-563
563
Confirmed. Will fix when I got time.
[ "194", "495" ]
0.10
skim-rs/skim
2024-04-03T00:37:59Z
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -606,4 +606,21 @@ mod tests { assert_eq!(Some(('a', highlight)), it.next()); assert_eq!(None, it.next()); } + + #[test] + fn test_ansi_dim() { + // https://github.com/lotabout/skim/issues/495 + let input = "\x1B[2mhi\x1b[0m"; + let ansistring = ANSIParser::default().parse_ansi(input); + let mut it = ansistring.iter(); + let attr = Attr { + effect: Effect::DIM, + ..Attr::default() + }; + + assert_eq!(Some(('h', attr)), it.next()); + assert_eq!(Some(('i', attr)), it.next()); + assert_eq!(None, it.next()); + assert_eq!(ansistring.stripped(), "hi"); + } }
Color not working with `ag` When using silver searcher, coloring of file path and line numbers aren't working. Used the following command: ``` $ sk --ansi -i -c 'ag --color "{}"' ``` Dimmed colors not properly displayed Whenever an item in the list of entries passed to `skim` is _dimmed_, `skim` does not properly understand this and translate it rather as _dimmed/underlined/reversed/blinking_. Example: ```sh echo -e "\x1b[2;33mDIM\x1b[0m\nnormal\nnormal2" | sk --ansi ``` In other words, `skim` understands `2;33` as `2;4;5;7;33`. Tested on 0.9.4 and 0.10.1.
8a579837daaeb71938c635aa5352cbde9669d5f8
[ "ansi::tests::test_ansi_dim" ]
[ "ansi::tests::test_multi_bytes", "ansi::tests::test_ansi_iterator", "ansi::tests::test_highlight_indices", "ansi::tests::test_merge_fragments", "ansi::tests::test_multi_byte_359", "ansi::tests::test_multiple_attributes", "ansi::tests::test_normal_string", "ansi::tests::test_reset", "field::test::test_parse_field_range", "helper::selector::tests::test_first_n", "global::tests::test", "helper::selector::tests::test_preset", "field::test::test_parse_matching_fields", "orderedvec::tests::test_nosort", "orderedvec::tests::test_equals", "field::test::test_parse_transform_fields", "orderedvec::tests::test", "field::test::test_get_string_by_field", "helper::selector::tests::test_regex", "orderedvec::tests::test_nosort_and_tac", "helper::selector::tests::test_all_together", "query::test::test_add_char", "orderedvec::tests::test_tac", "query::test::test_backward_delete_char", "query::test::test_new_query", "spinlock::tests::smoke", "spinlock::tests::test_mutex_unsized", "util::tests::test_accumulate_text_width", "util::tests::test_reshape_string", "util::tests::test_escape_single_quote", "field::test::test_parse_range", "util::tests::test_atoi", "util::tests::test_inject_command", "input::test::action_chain_should_be_parsed", "engine::factory::test::test_engine_factory", "spinlock::tests::lots_and_lots", "input::test::execute_should_be_parsed_correctly", "src/lib.rs - SkimItem (line 70)" ]
[]
[]
2024-11-15T12:44:53Z
dade97c7247eb971d7e4dda8d8f648d8c143aa7f
diff --git a/src/util.rs b/src/util.rs --- a/src/util.rs +++ b/src/util.rs @@ -10,8 +10,18 @@ use crate::field::get_string_by_range; use crate::item::ItemWrapper; use crate::SkimItem; +lazy_static! { + static ref RE_ESCAPE: Regex = Regex::new(r"['\U{00}]").unwrap(); +} + pub fn escape_single_quote(text: &str) -> String { - text.replace("'", "'\\''") + RE_ESCAPE + .replace_all(text, |x: &Captures| match x.get(0).unwrap().as_str() { + "'" => "'\\''".to_string(), + "\0" => "\\0".to_string(), + _ => "".to_string(), + }) + .to_string() } /// use to print a single line, properly handle the tabsteop and shift of a string
skim-rs__skim-282
282
[ "278" ]
0.8
skim-rs/skim
2020-03-01T14:58:58Z
diff --git a/src/util.rs b/src/util.rs --- a/src/util.rs +++ b/src/util.rs @@ -413,4 +423,9 @@ mod tests { assert_eq!("'cmd_query'", inject_command("{cq}", default_context)); assert_eq!("'a,b,c' 'x,y,z'", inject_command("{+}", default_context)); } + + #[test] + fn test_escape_single_quote() { + assert_eq!("'\\''a'\\''\\0", escape_single_quote("'a'\0")); + } } diff --git a/test/test_skim.py b/test/test_skim.py --- a/test/test_skim.py +++ b/test/test_skim.py @@ -70,9 +70,10 @@ def __repr__(self): class TmuxOutput(list): """A list that contains the output of tmux""" # match the status line - # normal: `| 10/219 [2] 8.` - # inline: `> query < 10/219 [2] 8.` - RE = re.compile(r'(?:^|[^<-]*). ([0-9]+)/([0-9]+)(?: \[([0-9]+)\])? *([0-9]+)(\.)?$') + # normal: `| 10/219 [2] 8.` + # inline: `> query < 10/219 [2] 8.` + # preview: `> query < 10/219 [2] 8.│...` + RE = re.compile(r'(?:^|[^<-]*). ([0-9]+)/([0-9]+)(?: \[([0-9]+)\])? *([0-9]+)(\.)?(?: │)? *$') def __init__(self, iteratable=[]): super(TmuxOutput, self).__init__(iteratable) self._counts = None diff --git a/test/test_skim.py b/test/test_skim.py --- a/test/test_skim.py +++ b/test/test_skim.py @@ -876,6 +877,12 @@ def test_if_non_matched(self): self.tmux.send_keys(Key('Enter')) # not triggered anymore self.tmux.until(lambda lines: lines.ready_with_matches(1)) + def test_nul_in_execute(self): + """NUL should work in preview command see #278""" + self.tmux.send_keys(f"""echo -ne 'a\\0b' | {self.sk("--preview='echo -en {} | xxd'")}""", Key('Enter')) + self.tmux.until(lambda lines: lines.ready_with_lines(1)) + self.tmux.until(lambda lines: lines.any_include('6100 62')) + def find_prompt(lines, interactive=False, reverse=False): linen = -1 prompt = ">"
Can't preview string with nul byte ```zsh > sk --preview-window=down --preview='echo {}' <<<$'abc\0cba' ``` Got an error: ![图片](https://user-images.githubusercontent.com/17017672/75601906-e8a9fe00-5afa-11ea-9fdb-9e6e7e45c9fe.png)
da913fb9de587a75158fe67b3756574dbd5e5efb
[ "util::tests::test_escape_single_quote" ]
[ "ansi::tests::test_normal_string", "ansi::tests::test_reset", "ansi::tests::test_ansi_iterator", "ansi::tests::test_multiple_attributes", "field::test::test_parse_field_range", "field::test::test_get_string_by_field", "field::test::test_parse_matching_fields", "spinlock::tests::smoke", "query::test::test_add_char", "query::test::test_new_query", "query::test::test_backward_delete_char", "field::test::test_parse_transform_fields", "spinlock::tests::test_mutex_unsized", "util::tests::test_accumulate_text_width", "util::tests::test_reshape_string", "field::test::test_parse_range", "util::tests::test_inject_command", "spinlock::tests::lots_and_lots", "input::test::action_chain_should_be_parsed", "engine::factory::test::test_engine_factory", "input::test::execute_should_be_parsed_correctly", "src/lib.rs - SkimItem (line 70)" ]
[]
[]
2020-03-01T09:02:10Z
bedadf1a37d50a56a2cf279b7289cbef5b3ca206
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -337,7 +337,7 @@ impl<'a> From<(&'a str, &'a [usize], Attr)> for AnsiString<'a> { pub struct AnsiStringIterator<'a> { fragments: &'a [(Attr, (u32, u32))], fragment_idx: usize, - chars_iter: std::str::CharIndices<'a>, + chars_iter: std::iter::Enumerate<std::str::Chars<'a>>, } impl<'a> AnsiStringIterator<'a> { diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -345,7 +345,7 @@ impl<'a> AnsiStringIterator<'a> { Self { fragments, fragment_idx: 0, - chars_iter: stripped.char_indices(), + chars_iter: stripped.chars().enumerate(), } } } diff --git a/src/helper/item.rs b/src/helper/item.rs --- a/src/helper/item.rs +++ b/src/helper/item.rs @@ -119,9 +119,9 @@ impl SkimItem for DefaultSkimItem { .collect(), Matches::CharRange(start, end) => vec![(context.highlight_attr, (start as u32, end as u32))], Matches::ByteRange(start, end) => { - let start = context.text[..start].chars().count(); - let end = start + context.text[start..end].chars().count(); - vec![(context.highlight_attr, (start as u32, end as u32))] + let ch_start = context.text[..start].chars().count(); + let ch_end = ch_start + context.text[start..end].chars().count(); + vec![(context.highlight_attr, (ch_start as u32, ch_end as u32))] } Matches::None => vec![], }; diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -164,9 +164,12 @@ impl<'a> From<DisplayContext<'a>> for AnsiString<'a> { AnsiString::new_str(context.text, vec![(context.highlight_attr, (start as u32, end as u32))]) } Matches::ByteRange(start, end) => { - let start = context.text[..start].chars().count(); - let end = start + context.text[start..end].chars().count(); - AnsiString::new_str(context.text, vec![(context.highlight_attr, (start as u32, end as u32))]) + let ch_start = context.text[..start].chars().count(); + let ch_end = ch_start + context.text[start..end].chars().count(); + AnsiString::new_str( + context.text, + vec![(context.highlight_attr, (ch_start as u32, ch_end as u32))], + ) } Matches::None => AnsiString::new_str(context.text, vec![]), }
skim-rs__skim-362
362
[ "359" ]
0.9
skim-rs/skim
2020-10-21T22:25:28Z
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -581,4 +581,16 @@ mod tests { vec![(ao, (1, 2)), (an, (2, 6)), (ao, (6, 7)), (ao, (9, 11))] ); } + + #[test] + fn test_multi_byte_359() { + // https://github.com/lotabout/skim/issues/359 + let highlight = Attr::default().effect(Effect::BOLD); + let ansistring = AnsiString::new_str("ああa", vec![(highlight, (2, 3))]); + let mut it = ansistring.iter(); + assert_eq!(Some(('あ', Attr::default())), it.next()); + assert_eq!(Some(('あ', Attr::default())), it.next()); + assert_eq!(Some(('a', highlight)), it.next()); + assert_eq!(None, it.next()); + } } diff --git a/test/test_skim.py b/test/test_skim.py --- a/test/test_skim.py +++ b/test/test_skim.py @@ -1063,6 +1063,10 @@ def test_preview_scroll_and_offset(self): self.tmux.until(lambda lines: re.match(r'121.*121/1000', lines[0])) self.tmux.send_keys(Key('Enter')) + def test_issue_359_multi_byte_and_regex(self): + self.tmux.send_keys(f"""echo 'ああa' | {self.sk("--regex -q 'a'")}""", Key('Enter')) + self.tmux.until(lambda lines: lines[-3].startswith('> ああa')) + def find_prompt(lines, interactive=False, reverse=False): linen = -1 prompt = ">"
Crashes with multi-byte characters input and --regex After update to 0.9.1, I'm having trouble with sk. ```shell-session $ sk --version 0.9.1 $ echo $SKIM_DEFAULT_OPTIONS $ echo $LANG ja_JP.UTF-8 $ od -tx1z <<< 'ああa' 0000000 e3 81 82 e3 81 82 61 0a >......a.< 0000010 $ echo 'ああa' | sk --regex ``` After inputting 'a', sk crashes with the following message: ``` thread 'main' panicked at 'byte index 2 is not a char boundary; it is inside 'あ' (bytes 0..3) of `ああa`', src/lib.rs:168:35 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` What should I do next? My environment is as follows: OS: Arch Linux on Windows 10 x86_64 Kernel: 4.19.128-microsoft-standard CPU: Intel i7-7700 (8) @ 3.600GHz Shell: zsh 5.8
2ad92dfc3d0f9f6b172e1c6659a235ff13fe0f64
[ "ansi::tests::test_multi_byte_359" ]
[ "ansi::tests::test_highlight_indices", "ansi::tests::test_ansi_iterator", "ansi::tests::test_merge_fragments", "ansi::tests::test_normal_string", "ansi::tests::test_multiple_attributes", "ansi::tests::test_reset", "field::test::test_parse_field_range", "global::tests::test", "helper::selector::tests::test_first_n", "field::test::test_get_string_by_field", "helper::selector::tests::test_preset", "orderedvec::tests::test_equals", "orderedvec::tests::test_nosort_and_tac", "query::test::test_add_char", "orderedvec::tests::test_nosort", "orderedvec::tests::test", "orderedvec::tests::test_tac", "helper::selector::tests::test_regex", "field::test::test_parse_transform_fields", "query::test::test_backward_delete_char", "query::test::test_new_query", "field::test::test_parse_matching_fields", "field::test::test_parse_range", "spinlock::tests::lots_and_lots", "spinlock::tests::test_mutex_unsized", "util::tests::test_accumulate_text_width", "util::tests::test_escape_single_quote", "util::tests::test_reshape_string", "util::tests::test_atoi", "spinlock::tests::smoke", "input::test::action_chain_should_be_parsed", "util::tests::test_inject_command", "engine::factory::test::test_engine_factory", "helper::selector::tests::test_all_together", "input::test::execute_should_be_parsed_correctly", "src/lib.rs - SkimItem (line 70)" ]
[]
[]
2020-10-21T15:04:56Z
11c80768e0664878fc6fada1a31e7c9d0dfa8590
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -69,9 +69,14 @@ impl Perform for ANSIParser { return; } - let mut attr = self.last_attr; - let mut iter = params.into_iter(); + // \[[m => means reset + let mut attr = if params.is_empty() { + Attr::default() + } else { + self.last_attr + }; + let mut iter = params.into_iter(); while let Some(&code) = iter.next() { match code { 0 => attr = Attr::default(), diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -245,7 +250,8 @@ impl AnsiString { } pub fn has_attrs(&self) -> bool { - self.fragments.len() > 1 + // more than 1 fragments or is not default attr + self.fragments.len() > 1 || (!self.fragments.is_empty() && self.fragments[0].0 != Attr::default()) } pub fn from_str(raw: &str) -> AnsiString {
skim-rs__skim-239
239
Should be fixed? Tested on MacOS + current master. ![image](https://user-images.githubusercontent.com/1527040/70593585-91417380-1c18-11ea-8e81-22106a753304.png)
[ "231", "220" ]
0.6
skim-rs/skim
2019-12-11T23:58:55Z
diff --git a/src/ansi.rs b/src/ansi.rs --- a/src/ansi.rs +++ b/src/ansi.rs @@ -349,4 +355,11 @@ mod tests { assert_eq!(Some(('i', attr)), it.next()); assert_eq!(None, it.next()); } + + #[test] + fn test_reset() { + let input = "\x1B[35mA\x1B[mB"; + let ansistring = ANSIParser::default().parse_ansi(input); + assert_eq!(ansistring.fragments.len(), 2); + } }
ANSI colors are ignored in some cases I can reproduce it by: ```sh /usr/bin/ls -1 --color | sk --ansi ``` Or... ```sh e=$(echo -ne '\e') sk --ansi <<EOF $e[34mno $e[36mno$e[0m $e[36mno$e[0m ABC$e[34myes $e[36myes$e[39mABC ABC$e[36myes$e[0m ABC$e[36myes$e[0mABC EOF ``` bat highlight-line not working properly As it can be seen in the image, if I run `sk --preview 'bat --color always --style numbers --highlight-line 5 {1}'`, the (5th) line is only partially highlighted in the preview window: ![image](https://user-images.githubusercontent.com/2583971/64490842-91a42a00-d237-11e9-99f8-f59336ec5434.png) It seems to be a problem with skim since bat line highlighting works just fine: ![image](https://user-images.githubusercontent.com/2583971/64490860-d6c85c00-d237-11e9-950c-2d1dee961255.png)
11c80768e0664878fc6fada1a31e7c9d0dfa8590
[ "ansi::tests::test_reset" ]
[ "ansi::tests::test_ansi_iterator", "ansi::tests::test_multiple_attributes", "ansi::tests::test_normal_string", "field::test::test_parse_field_range", "query::test::test_add_char", "field::test::test_parse_matching_fields", "query::test::test_new_query", "query::test::test_backward_delete_char", "field::test::test_get_string_by_field", "spinlock::tests::smoke", "field::test::test_parse_transform_fields", "spinlock::tests::test_mutex_unsized", "util::tests::test_accumulate_text_width", "util::tests::test_reshape_string", "field::test::test_parse_range", "engine::test::test_engine_factory", "spinlock::tests::lots_and_lots", "util::tests::test_inject_command", "input::test::action_chain_should_be_parsed", "input::test::execute_should_be_parsed_correctly" ]
[]
[]
2019-12-11T18:50:12Z
65aad287f5a2e96fd1bdec63a8cd4bf301112d2e
diff --git a/src/input.rs b/src/input.rs --- a/src/input.rs +++ b/src/input.rs @@ -82,7 +82,9 @@ impl Input { // key_action is comma separated: 'ctrl-j:accept,ctrl-k:kill-line' pub fn parse_keymap(&mut self, key_action: &str) { + debug!("got key_action: {:?}", key_action); for (key, action_chain) in parse_key_action(key_action).into_iter() { + debug!("parsed key_action: {:?}: {:?}", key, action_chain); let action_chain = action_chain .into_iter() .filter_map(|(action, arg)| { diff --git a/src/input.rs b/src/input.rs --- a/src/input.rs +++ b/src/input.rs @@ -112,18 +114,28 @@ pub fn parse_key_action(key_action: &str) -> Vec<(&str, Vec<(&str, Option<String Regex::new(r#"(?si)([^:]+?):((?:\+?[a-z-]+?(?:"[^"]*?"|'[^']*?'|\([^\)]*?\)|\[[^\]]*?\]|:[^:]*?)?\s*)+)(?:,|$)"#) .unwrap(); // grab key, action and arg out. - static ref RE_BIND: Regex = Regex::new(r#"(?si)([a-z-]+)(?:[:\(\["'](.+?)[\)"'\]]?)?(?:\+|$)"#).unwrap(); + static ref RE_BIND: Regex = Regex::new(r#"(?si)([a-z-]+)("[^"]+?"|'[^']+?'|\([^\)]+?\)|\[[^\]]+?\]|:[^:]+?)?(?:\+|$)"#).unwrap(); } RE.captures_iter(&key_action) .map(|caps| { + debug!("RE: caps: {:?}", caps); let key = caps.get(1).unwrap().as_str(); let actions = RE_BIND .captures_iter(caps.get(2).unwrap().as_str()) .map(|caps| { + debug!("RE_BIND: caps: {:?}", caps); ( caps.get(1).unwrap().as_str(), - caps.get(2).map(|s| s.as_str().to_string()), + caps.get(2).map(|s| { + // (arg) => arg, :end_arg => arg + let action = s.as_str(); + if action.starts_with(":") { + return action[1..].to_string(); + } else { + return action[1..action.len() - 1].to_string(); + } + }), ) }) .collect();
skim-rs__skim-199
199
I tried escaping with `\` with no success
[ "196" ]
0.6
skim-rs/skim
2019-07-14T00:59:12Z
diff --git a/src/input.rs b/src/input.rs --- a/src/input.rs +++ b/src/input.rs @@ -224,6 +236,14 @@ mod test { ("ctrl-y", vec![("execute-silent", Some("echo {} | pbcopy".to_string()))]), key_action[1] ); + + // #196 + let key_action_str = "enter:execute($EDITOR +{2} {1})"; + let key_action = parse_key_action(key_action_str); + assert_eq!( + ("enter", vec![("execute", Some("$EDITOR +{2} {1}".to_string()))]), + key_action[0] + ); } #[test]
Passing an explicit + to execute() I'm trying to pass line number and filename to vim with: `sk --ansi -i -c 'rg --color=always --line-number "{}"' --preview 'preview.sh {}' -d':' --bind 'enter:execute($EDITOR +{2} {1})'` but the `+` gets swallowed by the skim parser instead of getting passed the command.
11c80768e0664878fc6fada1a31e7c9d0dfa8590
[ "input::test::execute_should_be_parsed_correctly" ]
[ "ansi::tests::test_ansi_iterator", "ansi::tests::test_multiple_attributes", "ansi::tests::test_normal_string", "field::test::test_parse_field_range", "field::test::test_get_string_by_field", "field::test::test_parse_matching_fields", "field::test::test_parse_transform_fields", "query::test::test_add_char", "query::test::test_backward_delete_char", "query::test::test_new_query", "field::test::test_parse_range", "spinlock::tests::smoke", "engine::test::test_engine_factory", "util::tests::test_accumulate_text_width", "spinlock::tests::test_mutex_unsized", "util::tests::test_reshape_string", "spinlock::tests::lots_and_lots", "util::tests::test_inject_command", "input::test::action_chain_should_be_parsed" ]
[]
[]
2019-07-14T02:27:31Z
42b8ef23ee00ffdfdd01ce774e96033fea90c2f1
diff --git a/quadratic-core/src/formulas/functions/lookup.rs b/quadratic-core/src/formulas/functions/lookup.rs --- a/quadratic-core/src/formulas/functions/lookup.rs +++ b/quadratic-core/src/formulas/functions/lookup.rs @@ -461,21 +461,24 @@ fn lookup<V: ToString + AsRef<CellValue>>( LookupMatchMode::Exact => std::cmp::Ordering::Equal, LookupMatchMode::NextSmaller => std::cmp::Ordering::Less, LookupMatchMode::NextLarger => std::cmp::Ordering::Greater, - LookupMatchMode::Wildcard => { - let regex = crate::formulas::wildcard_pattern_to_regex(&needle.to_string())?; - return Ok(match search_mode { - LookupSearchMode::LinearForward => lookup_regex(regex, haystack), - LookupSearchMode::LinearReverse => { - lookup_regex(regex, haystack.iter().rev()).map(fix_rev_index) - } - LookupSearchMode::BinaryAscending | LookupSearchMode::BinaryDescending => { - internal_error!( - "invalid match_mode+search_mode combination \ - should have been caught earlier in XLOOKUP", - ); - } - }); - } + LookupMatchMode::Wildcard => match needle { + CellValue::Text(needle_string) => { + let regex = crate::formulas::wildcard_pattern_to_regex(needle_string)?; + return Ok(match search_mode { + LookupSearchMode::LinearForward => lookup_regex(regex, haystack), + LookupSearchMode::LinearReverse => { + lookup_regex(regex, haystack.iter().rev()).map(fix_rev_index) + } + LookupSearchMode::BinaryAscending | LookupSearchMode::BinaryDescending => { + internal_error!( + "invalid match_mode+search_mode combination \ + should have been caught earlier in XLOOKUP", + ); + } + }); + } + _ => std::cmp::Ordering::Equal, + }, }; Ok(match search_mode { diff --git a/quadratic-core/src/values/convert.rs b/quadratic-core/src/values/convert.rs --- a/quadratic-core/src/values/convert.rs +++ b/quadratic-core/src/values/convert.rs @@ -6,7 +6,7 @@ use crate::{CodeResult, CodeResultExt, RunErrorMsg, Span, Spanned, Unspan}; const CURRENCY_PREFIXES: &[char] = &['$', '¥', '£', '€']; -const F64_DECIMAL_PRECISION: u64 = 16; // just enough to not lose information +const F64_DECIMAL_PRECISION: u64 = 14; // just enough to not lose information /* * CONVERSIONS (specific type -> Value)
quadratichq__quadratic-1939
1,939
[ "1916" ]
0.5
quadratichq/quadratic
2024-10-01T20:58:11Z
diff --git a/quadratic-core/src/formulas/functions/lookup.rs b/quadratic-core/src/formulas/functions/lookup.rs --- a/quadratic-core/src/formulas/functions/lookup.rs +++ b/quadratic-core/src/formulas/functions/lookup.rs @@ -1297,6 +1300,15 @@ mod tests { ); assert_eq!("1", eval_to_string(&g, &make_match_formula_str("*U"))); assert_eq!("2", eval_to_string(&g, &make_match_formula_str("Na?pa"))); + + // with `MAX` (horizontal) + let source_array = + array![65373.84, 41042.03, 29910.73, 31197.02, 67365.77, 31496.82, 78505.27, 38149.34]; + let g = Grid::from_array(pos![C1], &source_array); + assert_eq!(eval_to_string(&g, "=MATCH(MAX(C1:J1), C1:J1, 0)"), "7"); + // with `MAX` (vertical) + let g = Grid::from_array(pos![C1], &source_array.transpose()); + assert_eq!(eval_to_string(&g, "=MATCH(MAX(C1:C8), C1:C8, 0)"), "7"); } #[test]
Match formula not working Not sure cause, but replicating in other sheets returns results correctly. See sheet in Slack for recreation.
ba07e0c13859c2f461ee2d528c59e58773df4f6c
[ "formulas::functions::lookup::tests::test_match" ]
[ "color::tests::new", "color::tests::test_from_str", "color::tests::test_size", "color::tests::test_from_css_str", "controller::active_transactions::pending_transaction::tests::is_user", "controller::active_transactions::pending_transaction::tests::test_add_html_cell", "controller::active_transactions::pending_transaction::tests::test_add_code_cell", "controller::active_transactions::pending_transaction::tests::test_add_image_cell", "controller::active_transactions::pending_transaction::tests::test_add_from_code_run", "controller::active_transactions::pending_transaction::tests::test_to_transaction", "controller::active_transactions::unsaved_transactions::test::test_unsaved_transactions", "controller::active_transactions::unsaved_transactions::test::from_str", "compression::test::roundtrip_compression_bincode", "controller::dependencies::test::test_graph", "compression::test::roundtrip_compression_json", "controller::execution::control_transaction::tests::test_transactions_cell_hash", "controller::execution::execute_operation::execute_col_rows::tests::adjust_formulas_nothing", "controller::execution::execute_operation::execute_cursor::test::test_execute_set_cursor", "controller::execution::control_transaction::tests::test_transactions_updated_bounds_in_transaction", "controller::execution::control_transaction::tests::test_connection_complete", "controller::execution::control_transaction::tests::test_transactions_finalize_transaction", "controller::execution::execute_operation::execute_borders::tests::test_old_borders_operation", "controller::execution::control_transaction::tests::test_js_calculation_complete", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_validation", "controller::execution::execute_operation::execute_col_rows::tests::insert_row_validation", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_validation", "controller::execution::control_transaction::tests::test_transactions_undo_redo", "controller::execution::execute_operation::execute_col_rows::tests::insert_column_validation", "controller::execution::execute_operation::execute_col_rows::tests::execute_insert_column", "controller::execution::execute_operation::execute_col_rows::tests::execute_insert_row", "controller::execution::execute_operation::execute_col_rows::tests::delete_row", "controller::execution::execute_operation::execute_col_rows::tests::delete_columns", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_undo", "controller::execution::execute_operation::execute_values::tests::test_set_cell_value", "controller::execution::execute_operation::execute_values::tests::test_set_cell_values_no_sheet", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_code_cell_remove", "controller::execution::execute_operation::execute_col_rows::tests::adjust_formulas", "controller::execution::receive_multiplayer::tests::ensure_code_run_ordering_is_maintained_for_undo", "controller::dependencies::test::dependencies_near_input", "controller::execution::execute_operation::execute_values::test::dependencies_properly_trigger_on_set_cell_values", "controller::execution::receive_multiplayer::tests::python_multiple_calculations_receive_back_afterwards", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_formula", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions", "controller::execution::execute_operation::execute_code::tests::test_spilled_output_over_normal_cell", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_formula", "controller::execution::receive_multiplayer::tests::test_apply_multiplayer_before_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_out_of_order_transactions", "controller::execution::receive_multiplayer::tests::receive_our_transactions_out_of_order", "controller::execution::receive_multiplayer::tests::test_multiplayer_hello_world", "controller::execution::receive_multiplayer::tests::test_receive_offline_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_server_apply_transaction", "controller::execution::receive_multiplayer::tests::test_python_multiple_calculations_receive_back_between", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_bad_transaction_id", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_no_transaction", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions_and_out_of_order_transactions", "controller::execution::run_code::get_cells::test::test_calculation_get_cells", "controller::execution::receive_multiplayer::tests::test_receive_multiplayer_while_waiting_for_async", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_transaction_but_no_current_sheet_pos", "controller::execution::receive_multiplayer::tests::test_receive_overlapping_multiplayer_while_waiting_for_async", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_self_reference", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_sheet_name_not_found", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_array", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_single", "controller::execution::run_code::run_formula::test::test_execute_operation_set_cell_values_formula", "controller::execution::run_code::get_cells::test::calculation_get_cells_with_no_y1", "controller::execution::run_code::run_javascript::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_javascript::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_formula::test::test_deleting_to_trigger_compute", "controller::execution::run_code::run_javascript::tests::test_python_cancellation", "controller::execution::run_code::run_formula::test::test_formula_error", "controller::execution::run_code::run_javascript::tests::test_python_hello_world", "controller::execution::run_code::run_javascript::tests::test_run_python", "controller::execution::run_code::run_formula::test::test_multiple_formula", "controller::execution::run_code::run_javascript::tests::test_python_cell_reference_change", "controller::execution::run_code::run_javascript::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_python::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_javascript::tests::test_python_multiple_calculations", "controller::execution::run_code::run_python::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_python::tests::test_python_cancellation", "controller::execution::run_code::run_python::tests::test_python_hello_world", "controller::execution::run_code::run_python::tests::test_run_python", "controller::execution::run_code::test::test_finalize_code_cell", "controller::execution::spills::tests::test_check_deleted_code_runs", "controller::execution::run_code::run_python::tests::test_python_cell_reference_change", "controller::execution::run_code::run_python::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_formula::test::test_undo_redo_spill_change", "controller::execution::run_code::run_python::tests::test_python_multiple_calculations", "controller::export::tests::exports_a_csv", "controller::formula::tests::example_parse_formula_output", "controller::formula::tests::text_parse_formula_output", "controller::execution::spills::tests::test_check_spills", "controller::operations::borders::tests::borders_operations_all", "controller::operations::borders::tests::borders_operations_columns", "controller::operations::borders::tests::borders_operations_rects", "controller::operations::borders::tests::borders_operations_rows", "controller::operations::borders::tests::check_sheet", "controller::operations::cell_value::test::boolean_to_cell_value", "controller::execution::spills::tests::test_check_spills_by_code_run", "controller::operations::cell_value::test::formula_to_cell_value", "controller::operations::cell_value::test::number_to_cell_value", "controller::operations::cell_value::test::problematic_number", "controller::operations::cell_value::test::delete_cells_operations", "controller::execution::spills::tests::test_check_spills_over_code", "controller::operations::clipboard::test::move_cell_operations", "controller::execution::spills::tests::test_check_spills_over_code_array", "controller::operations::cell_value::test::delete_columns", "controller::operations::cell_value::test::test", "controller::operations::clipboard::test::set_clipboard_validations", "controller::operations::clipboard::test::paste_clipboard_cells_all", "controller::operations::clipboard::test::paste_clipboard_cells_rows", "controller::operations::clipboard::test::paste_clipboard_cells_columns", "controller::operations::clipboard::test::sheet_formats_operations_column_rows", "controller::operations::code_cell::test::test_set_code_cell_operations", "controller::operations::formats::tests::clear_format_selection_operations", "controller::operations::clipboard::test::paste_clipboard_with_formula", "controller::operations::import::test::import_csv_date_time", "controller::operations::import::test::import_excel_invalid", "controller::operations::code_cell::test::rerun_all_code_cells_one", "controller::operations::import::test::import_excel", "controller::operations::import::test::import_parquet_date_time", "controller::operations::import::test::transmute_u8_to_u16", "controller::operations::import::test::imports_a_simple_csv", "controller::operations::import::test::import_excel_date_time", "controller::operations::sheets::test::sheet_names", "controller::operations::sheets::test::get_sheet_next_name", "controller::operations::sheets::test::test_move_sheet_operation", "controller::operations::code_cell::test::rerun_all_code_cells_operations", "controller::operations::import::test::imports_a_long_csv", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_offset_resize", "controller::execution::run_code::test::code_run_image", "controller::execution::execute_operation::execute_validation::tests::execute_set_validation", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_user_transaction_only", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_formula", "controller::execution::auto_resize_row_heights::tests::test_transaction_save_when_auto_resize_row_heights_when_not_executed", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_python", "controller::execution::execute_operation::execute_validation::tests::execute_remove_validation", "controller::execution::execute_operation::execute_col_rows::tests::insert_row_offsets", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_value", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_offsets", "controller::execution::execute_operation::execute_code::tests::execute_code", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_offsets", "controller::execution::execute_operation::execute_sheets::tests::test_set_sheet_color", "controller::execution::execute_operation::execute_sheets::tests::test_sheet_reorder", "controller::send_render::test::send_fill_cells", "controller::execution::receive_multiplayer::tests::test_send_request_transactions", "controller::send_render::test::send_html_output_rect", "controller::execution::execute_operation::execute_col_rows::tests::insert_column_offsets", "controller::send_render::test::send_html_output_rect_after_resize", "controller::execution::spills::tests::test_check_all_spills", "controller::execution::execute_operation::execute_sheets::tests::test_add_sheet", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_column", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_row", "controller::execution::execute_operation::execute_sheets::tests::duplicate_sheet", "controller::execution::execute_operation::execute_sheets::tests::test_delete_sheet", "controller::execution::execute_operation::execute_formats::test::execute_set_formats_render_size", "controller::execution::execute_operation::execute_sheets::tests::test_execute_operation_set_sheet_name", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_format", "controller::execution::execute_operation::execute_sheets::tests::test_undo_delete_sheet_code_rerun", "controller::send_render::test::send_render_cells", "controller::send_render::test::send_render_cells_from_rects", "controller::send_render::test::send_render_cells_selection", "controller::sheet_offsets::tests::test_commit_offsets_resize", "controller::sheet_offsets::tests::test_commit_single_resize", "controller::sheets::test::test_sheet_ids", "controller::sheets::test::test_try_sheet_from_id", "controller::sheets::test::test_try_sheet_from_name", "controller::sheets::test::test_try_sheet_from_string_id", "controller::sheets::test::test_try_sheet_mut_from_id", "controller::sheets::test::test_try_sheet_mut_from_name", "controller::thumbnail::test::test_thumbnail_dirty_pos", "controller::thumbnail::test::test_thumbnail_dirty_rect", "controller::thumbnail::test::thumbnail_dirty_selection_all", "controller::thumbnail::test::thumbnail_dirty_selection_columns", "controller::thumbnail::test::thumbnail_dirty_selection_rects", "controller::thumbnail::test::thumbnail_dirty_selection_rows", "controller::user_actions::cells::test::test_unpack_currency", "controller::user_actions::cells::test::clear_formatting", "controller::user_actions::auto_complete::tests::test_expand_vertical_series_down_and_right", "controller::transaction::tests::serialize_and_compress_borders_selection", "controller::user_actions::auto_complete::tests::expand_down_borders", "controller::user_actions::cells::test::delete_values_and_formatting", "controller::user_actions::cells::test::test_set_cell_value", "controller::user_actions::clipboard::test::copy_part_of_code_run", "controller::user_actions::clipboard::test::copy_cell_formats", "controller::user_actions::clipboard::test::move_cells", "controller::user_actions::auto_complete::tests::expand_up_borders", "controller::user_actions::auto_complete::tests::expand_right_borders", "controller::user_actions::cells::test::test_set_cell_value_undo_redo", "controller::user_actions::clipboard::test::paste_special_values", "controller::user_actions::clipboard::test::test_copy_borders_to_clipboard", "controller::user_actions::clipboard::test::test_copy_borders_inside", "controller::user_actions::auto_complete::tests::expand_left_borders", "controller::user_actions::auto_complete::tests::test_expand_up_only", "controller::user_actions::auto_complete::tests::test_autocomplete_sheet_id_not_found", "controller::user_actions::col_row::tests::column_insert_formatting_before", "controller::user_actions::formats::test::change_decimal_places_selection", "controller::user_actions::clipboard::test::paste_special_formats", "controller::user_actions::col_row::tests::delete_row_undo_values_code", "controller::user_actions::auto_complete::tests::test_expand_up_and_right", "controller::user_actions::auto_complete::tests::test_shrink_height", "controller::user_actions::col_row::tests::row_insert_formatting_after", "controller::user_actions::auto_complete::tests::test_expand_right_only", "controller::user_actions::auto_complete::tests::test_cell_values_in_rect", "controller::user_actions::col_row::tests::column_insert_formatting_after", "controller::user_actions::formats::test::set_align_selection", "controller::user_actions::auto_complete::tests::test_shrink_width", "controller::user_actions::formats::test::clear_format_column", "controller::user_actions::auto_complete::tests::test_expand_up_and_left", "controller::user_actions::formats::test::set_bold_selection", "controller::user_actions::formats::test::set_strike_through_selection", "controller::user_actions::formats::test::set_italic_selection", "controller::user_actions::formats::test::set_numeric_format_exponential", "controller::user_actions::formats::test::set_format_column_row", "controller::user_actions::code::tests::test_grid_formula_results", "controller::user_actions::formats::test::set_date_time_format", "controller::user_actions::clipboard::test::test_copy_to_clipboard", "controller::user_actions::formats::test::set_numeric_format_currency", "controller::user_actions::formats::test::set_cell_wrap_selection", "controller::user_actions::col_row::tests::row_insert_formatting_before", "controller::user_actions::formats::test::clear_format", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard", "controller::user_actions::clipboard::test::test_paste_from_quadratic_clipboard", "controller::user_actions::col_row::tests::delete_row_undo_code", "controller::user_actions::formats::test::set_text_color_selection", "controller::user_actions::import::tests::errors_on_an_empty_csv", "controller::user_actions::auto_complete::tests::test_shrink_width_and_height", "controller::user_actions::import::tests::import_problematic_line", "controller::user_actions::formats::test::set_fill_color_selection", "controller::user_actions::formats::test::toggle_commas_selection", "controller::user_actions::auto_complete::tests::test_expand_left_only", "controller::user_actions::import::tests::should_import_utf16_with_invalid_characters", "controller::user_actions::formats::test::set_numeric_format_percentage", "controller::user_actions::formatting::test::test_set_output_size", "controller::user_actions::formats::test::set_underline_selection", "controller::user_actions::formatting::test::test_set_cell_text_color_undo_redo", "controller::user_actions::formatting::test::test_change_decimal_places", "controller::user_actions::validations::tests::get_validation_from_pos", "controller::user_actions::formats::test::set_vertical_align_selection", "controller::user_actions::formatting::test::test_number_formatting", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard_with_array_output", "controller::user_actions::sheets::test::test_delete_last_sheet", "controller::user_actions::validations::tests::validate_input", "controller::user_actions::validations::tests::validation_list_cells", "controller::user_actions::formatting::test::test_set_cell_render_size", "controller::user_actions::validations::tests::validation_list_strings", "controller::user_actions::validations::tests::validations", "controller::user_actions::sheets::test::test_delete_sheet", "controller::user_actions::sheets::test::test_move_sheet_sheet_does_not_exist", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_left", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_down_and_right", "controller::user_actions::validations::tests::validate_input_logical", "controller::viewport::tests::test_add_dirty_hashes_from_sheet_cell_positions", "controller::viewport::tests::test_add_dirty_hashes_from_sheet_rect", "date_time::tests::format_date_opposite_order", "controller::user_actions::formatting::test::test_set_currency", "date_time::tests::format_time", "date_time::tests::format_date_with_bad_ordering", "date_time::tests::format_date", "controller::user_actions::sheets::test::test_set_sheet_name", "date_time::tests::format_time_wrong_order", "date_time::tests::naive_date_i64", "date_time::tests::test_parse_time", "date_time::tests::naive_time_i32", "date_time::tests::parse_simple_times", "date_time::tests::test_parse_date", "date_time::tests::time", "controller::user_actions::clipboard::test::test_paste_relative_code_from_quadratic_clipboard", "controller::user_actions::sheets::test::test_set_sheet_color", "formulas::criteria::tests::test_formula_comparison_criteria", "formulas::cell_ref::tests::test_a1_sheet_parsing", "formulas::cell_ref::tests::test_a1_parsing", "controller::user_actions::auto_complete::tests::test_expand_down_only", "controller::user_actions::auto_complete::tests::test_expand_down_and_right", "formulas::functions::lookup::tests::test_formula_indirect", "formulas::functions::lookup::tests::test_vlookup_ignore_errors", "formulas::functions::logic::tests::test_formula_if", "formulas::functions::lookup::tests::test_xlookup", "formulas::functions::mathematics::tests::test_abs", "formulas::functions::logic::tests::test_formula_iferror", "formulas::functions::mathematics::tests::test_ceiling", "controller::user_actions::auto_complete::tests::test_expand_down_and_left", "formulas::functions::lookup::tests::test_xlookup_zip_map", "formulas::functions::mathematics::tests::test_int", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_right", "formulas::functions::mathematics::tests::test_floor", "formulas::functions::mathematics::tests::test_pi", "formulas::functions::mathematics::tests::test_pow_0_0", "formulas::functions::mathematics::tests::test_mod", "formulas::functions::lookup::tests::test_xlookup_validation", "formulas::functions::lookup::tests::test_hlookup_errors", "formulas::functions::mathematics::tests::test_sqrt", "formulas::functions::mathematics::tests::test_negative_pow", "formulas::functions::mathematics::tests::test_product", "formulas::functions::mathematics::tests::test_tau", "formulas::functions::mathematics::tests::test_sumif", "formulas::functions::mathematics::tests::test_sum_with_tuples", "formulas::functions::mathematics::tests::test_log_errors", "formulas::functions::lookup::tests::test_vlookup_errors", "formulas::functions::lookup::tests::test_index", "formulas::functions::mathematics::tests::test_sum", "formulas::functions::mathematics::tests::test_sumifs", "formulas::functions::operators::tests::test_formula_datetime_add", "controller::user_actions::sheets::test::test_add_delete_reorder_sheets", "formulas::functions::mathematics::tests::test_floor_math_and_ceiling_math", "formulas::criteria::tests::test_formula_wildcards", "formulas::functions::operators::tests::test_formula_math_operators_on_empty_string", "formulas::functions::operators::tests::test_formula_datetime_divide", "controller::user_actions::import::tests::should_import_with_title_header_and_empty_first_row", "formulas::functions::operators::tests::test_formula_math_operators", "formulas::functions::operators::tests::test_formula_datetime_multiply", "formulas::functions::operators::tests::test_formula_comparison_ops", "formulas::functions::statistics::tests::test_countif", "formulas::functions::lookup::tests::test_hlookup", "controller::user_actions::import::tests::imports_a_simple_csv", "formulas::functions::lookup::tests::test_vlookup", "formulas::functions::statistics::tests::test_min", "formulas::functions::statistics::tests::test_count", "formulas::functions::string::tests::test_formula_array_to_text", "formulas::functions::operators::tests::test_formula_datetime_subtract", "formulas::functions::lookup::tests::test_xlookup_match_modes", "controller::user_actions::import::tests::imports_a_simple_excel_file", "formulas::functions::statistics::tests::test_averageif", "formulas::functions::statistics::tests::test_max", "formulas::functions::statistics::tests::test_counta", "formulas::functions::string::tests::test_formula_clean", "formulas::functions::string::tests::test_formula_t", "formulas::functions::statistics::tests::test_formula_average", "formulas::functions::test_autocomplete_snippet", "formulas::functions::string::tests::test_formula_left_right_mid", "formulas::functions::lookup::tests::test_xlookup_search_modes", "formulas::functions::statistics::tests::test_countblank", "formulas::functions::string::tests::test_formula_trim", "formulas::functions::string::tests::test_formula_code", "formulas::functions::string::tests::test_formula_concat", "formulas::functions::string::tests::test_formula_char", "formulas::functions::statistics::tests::test_countifs", "formulas::functions::string::tests::test_formula_exact", "formulas::functions::string::tests::test_formula_casing", "formulas::functions::tests::test_convert_to_cell_value", "formulas::functions::string::tests::test_formula_numbervalue", "formulas::parser::tests::test_replace_a1_notation", "formulas::parser::tests::test_replace_internal_cell_references", "formulas::functions::string::tests::test_formula_len_and_lenb", "formulas::functions::tests::test_convert_to_array", "formulas::parser::tests::test_replace_xy_shift", "formulas::tests::test_formula_blank_array_parsing", "formulas::tests::test_array_parsing", "formulas::lexer::tests::test_lex_block_comment", "formulas::tests::test_currency_string", "formulas::functions::tests::test_convert_to_tuple", "formulas::tests::test_find_cell_references", "formulas::tests::test_formula_circular_array_ref", "formulas::tests::test_formula_blank_to_string", "formulas::tests::test_formula_cell_ref", "formulas::parser::tests::test_formula_empty_expressions", "formulas::tests::test_formula_array_op", "formulas::functions::trigonometry::tests::test_atan2", "formulas::functions::trigonometry::tests::test_formula_radian_degree_conversion", "formulas::tests::test_bool_parsing", "grid::block::test_blocks::contiguous_singles", "grid::bounds::test::test_bounds_rect_extend_x", "grid::block::test_blocks::idk", "formulas::parser::tests::check_formula", "grid::bounds::test::test_bounds_rect", "grid::bounds::test::test_bounds_rect_empty", "grid::bounds::test::test_bounds_rect_extend_y", "grid::code_run::test::test_output_sheet_rect_spill_error", "grid::column::test::column_data_set_range", "grid::column::test::format", "formulas::tests::test_formula_omit_required_argument", "grid::column::test::insert_and_shift_right_end", "grid::column::test::insert_and_shift_right_middle", "grid::column::test::insert_and_shift_right_simple", "grid::code_run::test::test_output_size", "grid::column::test::has_blocks_in_range", "grid::column::test::has_format_in_row", "formulas::tests::test_formula_range_operator", "grid::column::test::insert_block", "grid::column::test::is_empty", "grid::column::test::format_range", "grid::column::test::remove_and_shift_left_end", "grid::column::test::remove_and_shift_left_middle", "grid::column::test::remove_and_shift_left_start", "grid::column::test::insert_and_shift_right_start", "formulas::tests::test_leading_equals", "grid::file::serialize::selection::tests::import_export_selection", "grid::file::serialize::validations::tests::import_export_validation_date_time", "grid::file::serialize::validations::tests::import_export_validation_numbers", "grid::file::serialize::validations::tests::import_export_validation_text", "grid::column::test::min_max", "formulas::tests::test_hyphen_after_cell_ref", "formulas::tests::test_sheet_references", "grid::file::serialize::validations::tests::import_export_validations", "grid::file::sheet_schema::test::test_export_sheet", "controller::user_actions::auto_complete::tests::test_expand_formatting_only", "formulas::tests::test_cell_range_op_errors", "formulas::tests::test_syntax_check_ok", "grid::file::tests::process_a_blank_v1_4_file", "grid::file::tests::process_a_simple_v1_4_borders_file", "grid::file::tests::process_a_v1_3_borders_file", "grid::file::serialize::borders::tests::import_export_borders", "grid::file::tests::imports_and_exports_a_v1_5_grid", "grid::file::tests::imports_and_exports_v1_5_update_code_runs_file", "controller::user_actions::auto_complete::tests::test_expand_code_cell", "grid::file::tests::process_a_v1_3_npm_downloads_file", "grid::file::serialize::cell_value::tests::import_and_export_date_time", "grid::file::v1_3::file::tests::import_export_and_upgrade_a_v1_3_file", "grid::formats::format::test::clear", "grid::formats::format::test::combine", "grid::file::v1_4::file::tests::import_and_export_a_v1_4_file", "grid::formats::format::test::format_to_format_update", "grid::formats::format::test::is_default", "grid::file::tests::process_a_number_v1_3_file", "grid::formats::format::test::format_to_format_update_ref", "grid::file::v1_5::file::tests::import_and_export_a_v1_5_file", "grid::formats::format::test::merge_update_into", "grid::formats::format::test::needs_to_clear_cell_format_for_parent", "grid::formats::format::test::to_replace", "grid::formats::format_update::tests::clear_update", "grid::formats::format_update::tests::combine", "grid::formats::format_update::tests::fill_changed", "grid::formats::format_update::tests::cleared", "grid::formats::format_update::tests::format_update_to_format", "grid::formats::format_update::tests::html_changed", "grid::formats::format_update::tests::is_default", "grid::formats::format_update::tests::serialize_format_update", "grid::formats::tests::repeat", "grid::formats::format_update::tests::render_cells_changed", "grid::js_types::test::to_js_number", "grid::resize::tests::test_default_behavior", "grid::resize::tests::test_iter_resize", "grid::resize::tests::test_reset", "grid::resize::tests::test_serde", "grid::file::tests::imports_and_exports_a_v1_6_grid", "grid::resize::tests::test_set_to_default", "grid::search::test::search", "grid::resize::tests::test_set_and_get_resize", "grid::series::date_series::tests::find_date_series_day_by_2", "grid::search::test::search_multiple_sheets", "grid::series::date_series::tests::find_date_series_months", "grid::series::date_series::tests::find_date_series_months_by_2", "grid::series::date_series::tests::find_date_series_day", "grid::series::date_series::tests::find_date_series_one", "grid::series::date_series::tests::find_date_series_years", "grid::series::date_series::tests::find_date_series_years_by_2", "grid::series::date_time_series::tests::date_time_series_days", "grid::series::date_time_series::tests::date_time_series_minutes", "grid::series::date_time_series::tests::date_time_series_months", "grid::series::date_time_series::tests::date_time_series_hours", "grid::series::date_time_series::tests::date_time_series_years", "grid::series::date_time_series::tests::date_time_series_of_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_one_negative", "grid::series::date_time_series::tests::date_time_series_seconds", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one_negative", "grid::file::tests::process_a_v1_3_single_formula_file", "grid::file::tests::imports_and_exports_v1_4_default", "grid::file::v1_6::file::tests::import_and_export_a_v1_5_file", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_two", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication_negative", "grid::series::string_series::tests::find_a_text_series_lowercase_letters", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication", "grid::series::string_series::tests::find_a_text_series_uppercase_letters", "grid::series::string_series::tests::find_a_text_series_full_month", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication_negative", "grid::series::string_series::tests::find_a_text_series_short_month", "grid::series::string_series::tests::find_a_text_series_uppercase_full_month_negative_wrap", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap_negative", "grid::series::tests::copies_a_non_series", "grid::series::tests::copies_a_non_series_negative", "grid::series::string_series::tests::find_a_text_series_uppercase_short_month_negative", "grid::series::time_series::test::time_series_hours", "grid::series::time_series::test::time_series_minutes", "grid::series::time_series::test::time_series_one", "grid::series::tests::copies_a_series", "grid::series::time_series::test::time_series_seconds", "grid::series::time_series::test::time_diff_overflow_underflow", "grid::sheet::borders::borders_bounds::tests::bounds_column_bottom", "grid::sheet::borders::borders_bounds::tests::bounds_column_all", "grid::sheet::borders::borders_bounds::tests::bounds_column_top", "grid::sheet::borders::borders_bounds::tests::bounds_column_left", "grid::file::tests::process_a_v1_4_file", "grid::file::v1_6::file::tests::import_and_export_a_v1_6_borders_file", "grid::file::tests::process_a_v1_4_borders_file", "grid::file::tests::process_a_v1_3_file", "grid::sheet::borders::borders_bounds::tests::bounds_column_right", "grid::sheet::borders::borders_bounds::tests::bounds_single", "grid::sheet::borders::borders_bounds::tests::bounds_right", "grid::file::tests::process_a_v1_3_python_text_only_file", "grid::sheet::borders::borders_bounds::tests::bounds_bottom", "grid::sheet::borders::borders_bounds::tests::bounds_row_left", "grid::sheet::borders::borders_bounds::tests::bounds_row_right", "grid::sheet::borders::borders_bounds::tests::bounds_inner", "grid::sheet::borders::borders_bounds::tests::bounds_top", "grid::sheet::borders::borders_bounds::tests::bounds_horizontal", "grid::sheet::borders::borders_clear::tests::clear_all_cells", "grid::sheet::borders::borders_bounds::tests::bounds_left", "grid::sheet::borders::borders_bounds::tests::bounds_vertical", "grid::sheet::borders::borders_bounds::tests::bounds_outer", "grid::sheet::borders::borders_clear::tests::clear_row_top", "grid::sheet::borders::borders_clear::tests::clear_row_all", "grid::sheet::borders::borders_clear::tests::clear_column_neighbors", "grid::sheet::borders::borders_col_row::tests::insert_column_empty", "grid::sheet::borders::borders_col_row::tests::delete_column_empty", "grid::sheet::borders::borders_col_row::tests::insert_row_empty", "grid::sheet::borders::borders_clipboard::tests::simple_clipboard", "grid::sheet::borders::borders_clear::tests::clear_row_bottom", "grid::sheet::borders::borders_col_row::tests::get_column_ops", "grid::sheet::borders::borders_col_row::tests::get_row_ops", "grid::sheet::borders::borders_clear::tests::set_column_right", "grid::sheet::borders::borders_clear::tests::clear_column_only_column", "grid::sheet::borders::borders_clear::tests::set_column_left", "grid::sheet::borders::borders_clipboard::tests::to_clipboard", "grid::sheet::borders::borders_col_row::tests::remove_row_empty", "grid::sheet::borders::borders_col_row::tests::to_clipboard", "grid::sheet::borders::borders_col_row::tests::delete_row_undo_code", "grid::sheet::borders::borders_col_row::tests::insert_row_middle", "grid::sheet::borders::borders_col_row::tests::insert_column_start", "grid::sheet::borders::borders_get::tests::get_update_override", "grid::sheet::borders::borders_col_row::tests::insert_row_start", "grid::sheet::borders::borders_col_row::tests::insert_row_end", "grid::sheet::borders::borders_get::tests::one_cell_get", "grid::sheet::borders::borders_col_row::tests::insert_column_end", "grid::sheet::borders::borders_get::tests::get", "grid::sheet::borders::borders_col_row::tests::remove_row_start", "grid::sheet::borders::borders_col_row::tests::remove_row_middle", "grid::sheet::borders::borders_col_row::tests::remove_column_start", "grid::sheet::borders::borders_col_row::tests::remove_column_end", "grid::sheet::borders::borders_col_row::tests::remove_column_middle", "grid::sheet::borders::borders_col_row::tests::remove_row_end", "grid::sheet::borders::borders_get::tests::try_get", "grid::sheet::borders::borders_set::tests::set_borders_erase", "grid::sheet::borders::borders_col_row::tests::insert_column_middle", "grid::sheet::borders::borders_set::tests::set_borders", "grid::sheet::borders::borders_style::tests::clear", "grid::sheet::borders::borders_style::tests::apply_update", "grid::sheet::borders::borders_style::tests::js_border_horizontal_new", "grid::sheet::borders::borders_col_row::tests::insert_row_undo_code", "grid::sheet::borders::borders_style::tests::cell_is_equal_ignore_timestamp", "grid::sheet::borders::borders_style::tests::convert_to_clear", "grid::sheet::borders::borders_style::tests::remove_clear", "grid::sheet::borders::borders_style::tests::js_border_vertical_new", "grid::sheet::borders::borders_style::tests::is_empty", "grid::sheet::borders::borders_style::tests::timestamp_is_equal_ignore_timestamp", "grid::sheet::borders::borders_style::tests::override_border", "grid::file::tests::imports_and_exports_v1_5_javascript_getting_started_example", "grid::sheet::borders::borders_style::tests::replace_clear_with_none", "grid::sheet::bounds::test::column_bounds", "grid::sheet::bounds::test::column_bounds_code", "grid::sheet::borders::borders_render::tests::all_single", "grid::sheet::borders::borders_render::tests::top", "grid::sheet::borders::borders_render::tests::columns", "grid::sheet::borders::borders_test::tests::print_borders", "grid::sheet::borders::borders_render::tests::vertical_borders_in_rect", "grid::sheet::borders::borders_render::tests::horizontal_borders_in_rect", "grid::sheet::borders::borders_render::tests::rows", "grid::sheet::borders::borders_render::tests::right", "grid::sheet::bounds::test::code_run_rows_bounds", "grid::sheet::bounds::test::code_run_column_bounds", "grid::sheet::bounds::test::row_bounds_formats", "grid::sheet::bounds::test::empty_bounds_with_borders", "grid::sheet::bounds::test::code_run_columns_bounds", "grid::sheet::borders::borders_render::tests::horizontal_vertical", "grid::sheet::bounds::test::row_bounds_code", "grid::sheet::bounds::test::test_find_next_column", "grid::sheet::bounds::test::test_columns_bounds", "grid::sheet::bounds::test::test_find_next_row_code", "grid::sheet::bounds::test::test_is_empty", "grid::sheet::bounds::test::test_find_next_row", "grid::sheet::bounds::test::test_find_next_column_code", "grid::sheet::bounds::test::test_row_bounds", "grid::sheet::bounds::test::test_bounds", "grid::sheet::cell_array::tests::get_cells_response", "grid::sheet::bounds::test::find_last_data_row", "grid::sheet::cell_array::tests::test_has_cell_values_in_rect", "grid::sheet::cell_values::test::merge_cell_values", "grid::sheet::cell_values::test::rendered_value", "grid::sheet::cell_array::tests::set_cell_values", "grid::sheet::code::test::code_row_bounds", "grid::sheet::code::test::code_columns_bounds", "grid::sheet::code::test::test_get_code_run", "grid::sheet::code::test::test_edit_code_value", "grid::sheet::bounds::test::recalculate_bounds_validations", "grid::sheet::bounds::test::test_read_write", "grid::sheet::col_row::column::tests::delete_column_offset", "grid::sheet::col_row::column::tests::insert_column_end", "grid::sheet::code::test::test_set_code_run", "grid::sheet::bounds::test::test_rows_bounds", "grid::sheet::col_row::column::tests::delete_column", "grid::sheet::col_row::column::tests::insert_column_middle", "grid::sheet::col_row::column::tests::values_ops_for_column", "grid::file::tests::process_a_v1_3_python_file", "grid::sheet::col_row::column::tests::insert_column_offset", "grid::sheet::bounds::test::code_run_row_bounds", "grid::sheet::col_row::column::tests::insert_column_start", "grid::sheet::col_row::row::test::delete_column_offset", "grid::sheet::bounds::test::send_updated_bounds_rect", "grid::sheet::col_row::row::test::insert_row_end", "grid::sheet::col_row::row::test::insert_row_middle", "grid::sheet::col_row::row::test::delete_row_values", "grid::sheet::formats::format_all::tests::find_overlapping_format_cells", "grid::sheet::col_row::row::test::delete_row", "grid::sheet::col_row::row::test::insert_row_start", "grid::sheet::col_row::row::test::test_values_ops_for_column", "grid::sheet::formats::format_all::tests::find_overlapping_format_columns", "grid::sheet::formats::format_all::tests::find_overlapping_format_rows", "grid::sheet::formats::format_all::tests::format_all", "grid::sheet::col_row::row::test::insert_row_offset", "grid::sheet::formats::format_cell::tests::decimal_places", "formulas::functions::mathematics::tests::proptest_int_mod_invariant", "grid::sheet::formats::format_all::tests::set_format_all", "grid::sheet::formats::format_all::tests::set_format_all_remove_cell", "grid::sheet::formats::format_cell::tests::format_cell", "grid::sheet::formats::format_columns::tests::format_column", "grid::sheet::formats::format_all::tests::set_format_all_remove_columns_rows", "grid::sheet::formats::format_columns::tests::cleared", "grid::sheet::clipboard::tests::copy_to_clipboard_exclude", "grid::sheet::formats::format_columns::tests::set_format_columns_remove_cell_formatting", "grid::sheet::formats::format_columns::tests::timestamp", "grid::sheet::formats::format_rects::test::set_format_rects_none", "grid::sheet::formats::format_columns::tests::try_format_column", "grid::sheet::formats::format_columns::tests::set_format_columns", "grid::sheet::formats::format_rows::tests::format_row", "grid::sheet::formats::format_rows::tests::timestamp", "grid::sheet::code::test::test_render_size", "grid::sheet::bounds::test::single_row_bounds", "grid::sheet::formats::format_rects::test::set_formats_rects", "grid::sheet::formats::format_rows::tests::set_format_rows", "grid::sheet::formats::format_rows::tests::set_format_rows_remove_cell_formatting", "grid::sheet::formats::tests::sheet_formats", "grid::sheet::formatting::tests::override_cell_formats", "grid::sheet::rendering::tests::get_sheet_fills", "grid::sheet::rendering::tests::render_code_cell", "grid::sheet::cell_array::tests::test_find_spill_error_reasons", "grid::sheet::rendering::tests::test_get_code_cells", "grid::sheet::code::test::edit_code_value_spill", "grid::sheet::rendering::tests::has_render_cells", "grid::sheet::rendering::tests::test_get_render_cells", "grid::sheet::rendering::tests::validation_list", "grid::sheet::rendering_date_time::tests::cell_date_time_error", "grid::sheet::rendering_date_time::tests::value_date_time", "grid::sheet::rendering_date_time::tests::render_cell_date_time", "grid::sheet::rendering::tests::test_get_render_cells_code", "grid::sheet::bounds::test::row_bounds", "grid::sheet::rendering::tests::test_get_html_output", "grid::sheet::row_resize::tests::test_get_auto_resize_rows", "grid::sheet::row_resize::tests::test_get_row_resize_custom", "grid::sheet::row_resize::tests::test_get_row_resize_default", "grid::sheet::row_resize::tests::test_get_row_resize_multiple", "grid::sheet::row_resize::tests::test_iter_row_resize_empty", "grid::sheet::clipboard::tests::clipboard_borders", "grid::sheet::row_resize::tests::test_iter_row_resize_multiple", "grid::sheet::row_resize::tests::test_set_and_reset_row_resize", "grid::sheet::row_resize::tests::test_set_row_resize", "grid::sheet::row_resize::tests::test_convert_to_auto_resize_on_commit_single_resize", "grid::sheet::row_resize::tests::test_convert_to_manual_resize_on_commit_offsets_resize", "grid::sheet::row_resize::tests::test_set_row_resize_interaction_with_other_methods", "grid::sheet::search::test::case_sensitive_search", "grid::sheet::search::test::search_code_runs", "grid::sheet::row_resize::tests::test_update_row_resize", "grid::sheet::search::test::search_numbers", "grid::sheet::search::test::simple_search", "grid::sheet::search::test::search_within_code_runs", "grid::sheet::search::test::whole_cell_search", "grid::sheet::search::test::whole_cell_search_case_sensitive", "grid::sheet::selection::tests::selection_blanks", "grid::sheet::rendering::tests::render_cells_boolean", "grid::sheet::selection::tests::format_selection", "grid::sheet::selection::tests::selection_columns", "grid::sheet::selection::tests::selection", "grid::sheet::selection::tests::selection_bounds", "grid::sheet::selection::tests::selection_rects_code", "grid::sheet::selection::tests::selection_all", "grid::sheet::selection::tests::selection_rows", "grid::sheet::selection::tests::selection_rects_values", "grid::sheet::rendering::tests::render_cells_duration", "grid::sheet::selection::tests::test_selection_rects_values", "grid::sheet::sheet_test::tests::test_set_cell_number_empty", "grid::sheet::sheet_test::tests::test_set_code_run_array_2d", "grid::sheet::sheet_test::tests::test_set_code_run_array_horizontal", "grid::sheet::sheet_test::tests::test_set_code_run_array_vertical", "grid::sheet::sheet_test::tests::test_set_code_run_empty", "grid::sheet::sheet_test::tests::test_set_value", "grid::sheet::sheet_test::tests::test_set_values", "grid::sheet::summarize::tests::summarize_columns", "grid::sheet::summarize::tests::summarize_all", "grid::sheet::summarize::tests::summarize_rounding", "grid::sheet::search::test::search_display_numbers", "grid::sheet::summarize::tests::summarize_rects", "grid::sheet::summarize::tests::summarize_trailing_zeros", "grid::sheet::summarize::tests::summarize_rows", "grid::sheet::test::decimal_places", "grid::sheet::test::delete_cell_values", "grid::sheet::test::delete_cell_values_code", "grid::sheet::test::display_value_blanks", "grid::sheet::test::js_cell_value", "grid::sheet::test::test_cell_numeric_format_kind", "grid::sheet::test::test_check_if_wrap_in_cell", "grid::sheet::test::test_check_if_wrap_in_row", "grid::sheet::test::cell_format_summary", "grid::sheet::test::test_current_decimal_places_float", "grid::sheet::test::test_current_decimal_places_text", "grid::sheet::test::test_current_decimal_places_value", "grid::sheet::test::test_columns", "grid::sheet::test::test_get_rows_with_wrap_in_column", "grid::sheet::test::test_get_rows_with_wrap_in_rect", "grid::sheet::test::test_get_rows_with_wrap_in_selection", "grid::sheet::test::test_get_cell_value", "formulas::functions::mathematics::tests::test_pow_log_invariant", "grid::sheet::validations::tests::get_validation_from_pos", "grid::sheet::validations::tests::remove", "grid::sheet::validations::tests::render_special_pos", "grid::sheet::validations::tests::validation", "grid::sheet::validations::tests::validation_all", "grid::sheet::test::test_set_cell_values", "grid::sheet::validations::tests::validation_columns", "grid::sheet::validations::tests::validation_rows", "grid::sheet::validations::tests::validation_rect", "grid::sheet::validations::validation::tests::validation_display_is_default", "grid::sheet::validations::validation::tests::validation_display_sheet_is_default", "grid::sheet::validations::validation::tests::validation_render_special", "grid::sheet::validations::validation_col_row::tests::inserted_column", "grid::sheet::test::test_get_set_formatting_value", "grid::sheet::validations::validation_col_row::tests::inserted_row", "grid::sheet::validations::validation_col_row::tests::remove_column", "grid::sheet::validations::validation_col_row::tests::remove_row", "grid::sheet::validations::validation_rules::tests::is_list", "grid::sheet::validations::validation_rules::tests::is_checkbox", "grid::sheet::validations::validation_rules::tests::validate_list_selection", "grid::sheet::validations::validation_rules::tests::validate_none", "grid::sheet::validations::validation_rules::tests::validate_list_strings", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_end", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_multiple", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_single", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_end", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_ignore_blank", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_types", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_strings", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_values", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_strings", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_selection", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical_ignore_blank", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_equal_to", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_greater_than", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_ignore_blank", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_less_than", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_not_equal_to", "grid::sheet::validations::validation_rules::validation_number::tests::validate_ranges", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains_not_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_exactly", "grid::sheet::validations::validation_rules::validation_text::tests::validate_not_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_text_length", "grid::sheet::validations::validation_warnings::tests::has_warning", "grid::sheet::validations::validation_warnings::tests::warnings", "grid::sheet::validations::validations_clipboard::tests::to_clipboard", "grid::sheets::test::add_sheet_adds_suffix_if_name_already_in_use", "grid::sheets::test::test_first_sheet", "grid::sheets::test::test_first_sheet_id", "grid::sheets::test::test_move_sheet", "grid::sheets::test::test_next_sheet", "grid::sheets::test::test_order_add_sheet", "grid::sheets::test::test_order_move_sheet", "grid::sheets::test::test_previous_sheet_order", "grid::sheets::test::test_sort_sheets", "grid::sheets::test::test_try_sheet_from_id", "grid::sheets::test::test_try_sheet_mut_from_id", "pos::test::pos_new", "pos::test::test_a1_string", "pos::test::sheet_pos_from_str", "pos::test::test_pos_into", "pos::test::test_quadrant_size", "pos::test::test_sheet_rect_new_pos_span", "pos::test::test_to_sheet_pos", "pos::test::to_quadrant", "rect::test::can_merge", "rect::test::count", "rect::test::extend_y", "rect::test::extend_x", "rect::test::rect_from_pos", "rect::test::rect_from_positions", "rect::test::rect_intersection", "rect::test::rect_new", "rect::test::test_contains", "rect::test::test_extend_to", "rect::test::test_from_numbers", "rect::test::test_from_pos_and_size", "rect::test::test_from_ranges", "rect::test::test_height", "rect::test::test_intersects", "rect::test::test_iter", "rect::test::test_is_empty", "rect::test::test_len", "rect::test::test_rect_combine", "rect::test::test_rect_new_span", "rect::test::test_single_pos", "rect::test::test_size", "rect::test::test_to_sheet_rect", "rect::test::test_translate", "rect::test::test_width", "rect::test::test_x_range", "rect::test::test_y_range", "rle::tests::is_empty", "rle::tests::push_n", "rle::tests::size", "selection::test::contains_column", "selection::test::count", "selection::test::count_parts", "selection::test::contains_row", "selection::test::in_rect", "selection::test::inserted_column", "selection::test::inserted_row", "selection::test::intersection", "selection::test::is_empty", "selection::test::largest_rect", "selection::test::new", "selection::test::new_sheet_pos", "selection::test::origin", "selection::test::pos_in_selection", "selection::test::rects_to_hashes", "selection::test::removed_column", "selection::test::removed_row", "selection::test::selection_columns", "selection::test::selection_from_pos", "selection::test::selection_from_rect", "selection::test::selection_from_sheet_rect", "selection::test::selection_from_str_all", "selection::test::selection_from_str_columns", "selection::test::selection_from_str_rects", "selection::test::selection_rows", "selection::test::selection_from_str_rows", "selection::test::selection_sheet_pos", "selection::test::translate", "selection::test::translate_in_place", "sheet_offsets::offsets::tests::test_changes", "sheet_offsets::offsets::tests::test_delete", "sheet_offsets::offsets::tests::test_find_offsets_changed", "sheet_offsets::offsets::tests::test_insert", "sheet_offsets::offsets::tests::test_find_offsets_default", "sheet_offsets::offsets::tests::test_offsets_move", "sheet_offsets::offsets::tests::test_offsets_structure", "sheet_offsets::test::rect_cell_offsets", "sheet_offsets::test::screen_rect_cell_offsets", "sheet_rect::test::from_sheet_rect_to_pos", "sheet_rect::test::from_sheet_rect_to_sheet_pos", "sheet_rect::test::test_sheet_rect_from_numbers", "sheet_rect::test::test_sheet_rect_union", "sheet_rect::test::test_top_left", "small_timestamp::tests::ensure_different", "small_timestamp::tests::new", "small_timestamp::tests::test_range", "test_util::test::print_table_sheet_format", "util::tests::test_a1_notation_macros", "util::tests::test_column_names", "util::tests::test_date_string", "util::tests::test_from_column_names", "util::tests::test_round", "util::tests::test_unused_name", "values::array::test::from_string_list_empty", "sheet_rect::test::test_sheet_rect_union_different_sheets - should panic", "values::cell_values::test::cell_values_w_grows", "values::cell_values::test::from_cell_value", "values::cell_values::test::from_cell_value_single", "values::cell_values::test::from_flat_array", "values::cell_values::test::from_str", "values::cell_values::test::get_except_blank", "values::cell_values::test::get_set_remove", "values::cell_values::test::into_iter", "values::cell_values::test::new", "values::cell_values::test::size", "values::cellvalue::test::test_cell_value_to_display_currency", "values::cellvalue::test::test_cell_value_to_display_number", "values::cellvalue::test::test_cell_value_to_display_percentage", "values::cellvalue::test::test_cell_value_to_display_text", "values::cellvalue::test::test_exponential_display", "values::cellvalue::test::test_is_image", "values::cellvalue::test::test_unpack_currency", "values::cellvalue::test::test_unpack_percentage", "values::cellvalue::test::to_get_cells", "values::cellvalue::test::to_number_display_scientific", "values::convert::test::test_convert_from_str_to_cell_value", "values::date_time::tests::unpack_date", "values::date_time::tests::unpack_date_time", "values::date_time::tests::unpack_time", "values::from_js::tests::from_js_date", "values::from_js::tests::test_image", "values::isblank::tests::test_is_blank", "grid::sheet::summarize::tests::summary_too_large", "values::tests::test_value_into_non_tuple", "values::tests::test_value_repr", "values::time::tests::test_duration_construction", "values::time::tests::test_duration_parsing", "grid::file::tests::process_a_v1_4_airports_distance_file", "formulas::functions::trigonometry::tests::test_formula_inverse_trigonometry", "controller::user_actions::import::tests::imports_a_simple_parquet", "grid::file::tests::imports_and_exports_v1_5_qawolf_test_file", "small_timestamp::tests::ensure_ordering", "formulas::functions::trigonometry::tests::test_formula_trigonometry", "controller::user_actions::import::tests::import_all_excel_functions", "controller::user_actions::import::tests::should_import_with_title_header", "values::parquet::test::test_parquet_to_vec", "grid::sheet::bounds::test::proptest_sheet_writes", "controller::user_actions::validations::tests::remove_validations", "grid::sheet::formats::format_columns::tests::set_format_columns_fills", "grid::sheet::cell_values::test::merge_cell_values_validations", "grid::sheet::formats::format_cell::tests::set_format_cell", "grid::sheet::formats::format_rows::tests::set_format_rows_fills", "grid::sheet::rendering::tests::render_bool_on_code_run", "grid::sheet::rendering::tests::send_all_validation_warnings", "values::cell_values::test::cell_values_serialize_large", "controller::user_actions::sheets::test::test_duplicate_sheet_code_rerun", "grid::sheet::send_render::test::send_sheet_fills", "grid::sheet::rendering::tests::send_all_validations", "grid::sheet::send_render::test::send_all_render_cells", "controller::user_actions::validations::tests::update_validation", "grid::sheet::send_render::test::send_render_cells", "controller::user_actions::import::tests::import_large_csv", "controller::user_actions::sheets::test::duplicate_sheet", "grid::sheet::send_render::test::send_column_render_cells", "grid::sheet::rendering::tests::render_images", "controller::viewport::tests::test_process_remaining_dirty_hashes", "grid::sheet::formats::format_rects::test::set_formats_selection_rect_html", "grid::sheet::send_render::test::send_row_render_cells", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_a1_notation (line 84)", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_internal_cell_references (line 68)" ]
[]
[]
2025-03-06T19:15:27Z
13b8f4201b41e1566bba1ec0e13c7c90d3da757a
diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -1,4 +1,3 @@ -import { colors } from '@/app/theme/colors'; import { newFileDialogAtom } from '@/dashboard/atoms/newFileDialogAtom'; import { TeamSwitcher } from '@/dashboard/components/TeamSwitcher'; import { useDashboardRouteLoaderData } from '@/routes/_dashboard'; diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -49,11 +48,11 @@ export function DashboardSidebar({ isLoading }: { isLoading: boolean }) { const classNameIcons = `mx-0.5 text-muted-foreground`; return ( - <nav className={`flex h-full flex-col gap-4 overflow-auto`}> - <div className="sticky top-0 z-10 flex flex-col bg-background px-4 pt-4"> + <nav className={`flex h-full flex-col gap-4 overflow-auto bg-accent`}> + <div className="sticky top-0 z-10 flex flex-col bg-accent px-3 pt-3"> <TeamSwitcher appIsLoading={isLoading} /> </div> - <div className={`flex flex-col px-4`}> + <div className={`flex flex-col px-3`}> <Type as="h3" variant="overline" diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -129,7 +128,7 @@ export function DashboardSidebar({ isLoading }: { isLoading: boolean }) { </SidebarNavLink> </div> </div> - <div className="mt-auto flex flex-col gap-1 bg-background px-4 pb-2"> + <div className="mt-auto flex flex-col gap-1 bg-accent px-3 pb-2"> {eduStatus === 'ENROLLED' && ( <SidebarNavLink to={`./?${SEARCH_PARAMS.DIALOG.KEY}=${SEARCH_PARAMS.DIALOG.VALUES.EDUCATION}`} diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -155,18 +154,12 @@ export function DashboardSidebar({ isLoading }: { isLoading: boolean }) { <LabsIcon className={classNameIcons} /> Labs </SidebarNavLink> - <SidebarNavLink to={ROUTES.ACCOUNT}> - <Avatar - src={user?.picture} - alt={user?.name} - style={{ - backgroundColor: colors.quadraticSecondary, - }} - > + <SidebarNavLink to="/account"> + <Avatar src={user?.picture} alt={user?.name}> {user?.name} </Avatar> - <div className={`flex flex-col overflow-hidden`}> + <div className={`flex flex-col overflow-hidden text-left`}> {user?.name || 'You'} {user?.email && <p className={`truncate ${TYPE.caption} text-muted-foreground`}>{user?.email}</p>} </div> diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -184,7 +177,7 @@ function SidebarNavLinkCreateButton({ children, isPrivate }: { children: ReactNo <Button variant="ghost" size="icon-sm" - className="absolute right-2 top-1 ml-auto opacity-30 hover:opacity-100" + className="absolute right-2 top-1 ml-auto !bg-transparent opacity-30 hover:opacity-100" onClick={() => setNewFileDialogState({ show: true, isPrivate })} > <AddIcon /> diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -195,6 +188,12 @@ function SidebarNavLinkCreateButton({ children, isPrivate }: { children: ReactNo ); } +export const sidebarItemClasses = { + base: `dark:hover:brightness-125 hover:brightness-95 hover:saturate-150 dark:hover:saturate-100 bg-accent relative flex items-center gap-2 p-2 no-underline rounded`, + active: `bg-accent dark:brightness-125 brightness-95 saturate-150 dark:saturate-100`, + dragging: `bg-primary text-primary-foreground`, +}; + function SidebarNavLink({ to, children, diff --git a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx --- a/quadratic-client/src/dashboard/components/DashboardSidebar.tsx +++ b/quadratic-client/src/dashboard/components/DashboardSidebar.tsx @@ -256,11 +255,10 @@ function SidebarNavLink({ : {}; const classes = cn( - isActive && !isLogo && 'bg-muted', - !isLogo && 'hover:bg-accent', - isDraggingOver && 'bg-primary text-primary-foreground', + sidebarItemClasses.base, + isActive && sidebarItemClasses.active, + isDraggingOver && sidebarItemClasses.dragging, TYPE.body2, - `relative flex items-center gap-2 p-2 no-underline rounded`, className ); diff --git a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx --- a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx +++ b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx @@ -1,29 +1,26 @@ +import { sidebarItemClasses } from '@/dashboard/components/DashboardSidebar'; import { useDashboardRouteLoaderData } from '@/routes/_dashboard'; -import { useRootRouteLoaderData } from '@/routes/_root'; import { TeamAction } from '@/routes/teams.$teamUuid'; -import { AddIcon, ArrowDropDownIcon, CheckIcon, LogoutIcon, RefreshIcon } from '@/shared/components/Icons'; +import { AddIcon, ArrowDropDownIcon, CheckIcon, RefreshIcon } from '@/shared/components/Icons'; import { Type } from '@/shared/components/Type'; import { ROUTES } from '@/shared/constants/routes'; -import { Button } from '@/shared/shadcn/ui/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, - DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/shared/shadcn/ui/dropdown-menu'; +import { cn } from '@/shared/shadcn/utils'; import { isJsonObject } from '@/shared/utils/isJsonObject'; import { ReactNode } from 'react'; -import { Link, useFetcher, useNavigate, useSubmit } from 'react-router-dom'; +import { Link, useFetcher, useNavigate } from 'react-router-dom'; type Props = { appIsLoading: boolean; }; export function TeamSwitcher({ appIsLoading }: Props) { - const submit = useSubmit(); - const { loggedInUser } = useRootRouteLoaderData(); const { teams } = useDashboardRouteLoaderData(); const { activeTeam: { diff --git a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx --- a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx +++ b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx @@ -40,22 +37,21 @@ export function TeamSwitcher({ appIsLoading }: Props) { return ( <DropdownMenu> - <DropdownMenuTrigger asChild> - <Button variant="outline" className="flex justify-between px-3 font-semibold"> - <div className="select-none truncate">{optimisticActiveTeamName}</div> - <div className="relative flex items-center"> - <ArrowDropDownIcon /> - <RefreshIcon - className={`absolute left-0 top-0 ml-auto animate-spin bg-background text-primary transition-opacity ${ - appIsLoading ? '' : ' opacity-0' - }`} - /> - </div> - </Button> + <DropdownMenuTrigger className={cn(`gap-2 py-1 text-sm font-semibold`, sidebarItemClasses.base)}> + <div className="mx-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded bg-foreground capitalize text-background"> + {activeTeamName.slice(0, 1)} + </div> + <div className="select-none truncate">{optimisticActiveTeamName}</div> + <div className="relative ml-auto mr-0.5 flex items-center"> + <ArrowDropDownIcon /> + <RefreshIcon + className={`absolute left-0 top-0 ml-auto animate-spin bg-accent text-primary transition-opacity ${ + appIsLoading ? '' : ' opacity-0' + }`} + /> + </div> </DropdownMenuTrigger> - <DropdownMenuContent align="start" className="min-w-72"> - <DropdownMenuLabel className="text-xs text-muted-foreground">{loggedInUser?.email}</DropdownMenuLabel> - + <DropdownMenuContent className="min-w-72" align="start" alignOffset={-4}> {teams.map(({ team: { uuid, name }, users }) => { const isActive = activeTeamUuid === uuid; return ( diff --git a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx --- a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx +++ b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx @@ -76,16 +72,21 @@ export function TeamSwitcher({ appIsLoading }: Props) { {isPaid ? <DotFilledIcon className="text-success" /> : <DotIcon className="text-warning" />} </IconWrapper> */} - <IconWrapper>{isActive && <CheckIcon />}</IconWrapper> + <IconWrapper + className={cn( + 'h-5 w-5 rounded border border-border capitalize', + isActive && 'border-foreground bg-foreground text-background' + )} + > + {name.slice(0, 1)} + </IconWrapper> <div className="flex flex-col"> <div>{name}</div> <Type variant="caption"> {users} member{users === 1 ? '' : 's'} </Type> </div> - {/* <div className="ml-auto flex h-6 w-6 items-center justify-center"> - {isActive && <CheckCircledIcon />} - </div> */} + <div className="ml-auto flex h-6 w-6 items-center justify-center">{isActive && <CheckIcon />}</div> </Link> </DropdownMenuItem> ); diff --git a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx --- a/quadratic-client/src/dashboard/components/TeamSwitcher.tsx +++ b/quadratic-client/src/dashboard/components/TeamSwitcher.tsx @@ -104,23 +105,11 @@ export function TeamSwitcher({ appIsLoading }: Props) { </IconWrapper> Create team </DropdownMenuItem> - - <DropdownMenuItem - className="flex gap-3 text-muted-foreground" - onClick={() => { - submit('', { method: 'POST', action: ROUTES.LOGOUT }); - }} - > - <IconWrapper> - <LogoutIcon /> - </IconWrapper> - Log out - </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> ); } -function IconWrapper({ children }: { children: ReactNode }) { - return <div className="flex h-6 w-6 items-center justify-center">{children}</div>; +function IconWrapper({ children, className }: { children: ReactNode; className?: string }) { + return <div className={cn('flex h-6 w-6 items-center justify-center', className)}>{children}</div>; } diff --git a/quadratic-client/src/shared/components/Icons.tsx b/quadratic-client/src/shared/components/Icons.tsx --- a/quadratic-client/src/shared/components/Icons.tsx +++ b/quadratic-client/src/shared/components/Icons.tsx @@ -32,6 +32,10 @@ const Icon = (props: BaseIconProps) => { type IconProps = Omit<BaseIconProps, 'children'>; export type IconComponent = React.FC<IconProps>; +export const AccountIcon: IconComponent = (props) => { + return <Icon {...props}>account_circle</Icon>; +}; + export const AddIcon: IconComponent = (props) => { return <Icon {...props}>add</Icon>; }; diff --git a/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx b/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx --- a/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx +++ b/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx @@ -1,5 +1,6 @@ import { useFeatureFlag } from '@/shared/hooks/useFeatureFlag'; import useLocalStorage from '@/shared/hooks/useLocalStorage'; +import { getCSSVariableAsHexColor } from '@/shared/utils/colors'; import { useEffect } from 'react'; const DEFAULT_APPEARANCE_MODE = 'light'; diff --git a/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx b/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx --- a/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx +++ b/quadratic-client/src/shared/hooks/useThemeAppearanceMode.tsx @@ -53,6 +54,20 @@ export const ThemeAppearanceModeEffects = () => { }; }, [appearanceMode, userPrefesDarkMode]); + useEffect(() => { + const metaTag = document.querySelector('meta[name="theme-color"]'); + const hexColor = getCSSVariableAsHexColor('background'); + + if (metaTag) { + metaTag.setAttribute('content', hexColor); + } else { + const meta = document.createElement('meta'); + meta.name = 'theme-color'; + meta.content = hexColor; + document.head.appendChild(meta); + } + }, [appearanceMode, userPrefesDarkMode]); + return null; }; diff --git /dev/null b/quadratic-client/src/shared/utils/colors.ts new file mode 100644 --- /dev/null +++ b/quadratic-client/src/shared/utils/colors.ts @@ -0,0 +1,15 @@ +import Color from 'color'; + +export function getCSSVariableAsHexColor(cssVariableName: string) { + if (cssVariableName.startsWith('--')) { + console.warn( + '`getCSSVariableTint` expects a CSS variable name without the `--` prefix. Are you sure you meant: `%s`', + cssVariableName + ); + } + + const hslColorString = getComputedStyle(document.documentElement).getPropertyValue(`--${cssVariableName}`).trim(); + const parsed = Color.hsl(hslColorString.split(' ').map(parseFloat)); + const out = parsed.hex(); + return out; +} diff --git a/quadratic-core/src/date_time.rs b/quadratic-core/src/date_time.rs --- a/quadratic-core/src/date_time.rs +++ b/quadratic-core/src/date_time.rs @@ -225,7 +225,7 @@ pub fn parse_date(value: &str) -> Option<NaiveDate> { "%d.%m.%Y", "%Y %m %d", "%m %d %Y", - "%d %m %Y", + "%d %m %G", "%Y %b %d", "%b %d %Y", "%d %b %Y",
quadratichq__quadratic-1923
1,923
[ "1924" ]
0.5
quadratichq/quadratic
2024-09-26T16:10:30Z
diff --git a/quadratic-core/src/date_time.rs b/quadratic-core/src/date_time.rs --- a/quadratic-core/src/date_time.rs +++ b/quadratic-core/src/date_time.rs @@ -319,8 +319,7 @@ mod tests { #[test] #[parallel] fn test_parse_date() { - let date = "12/23/2024".to_string(); - let parsed_date = parse_date(&date).unwrap(); + let parsed_date = parse_date("12/23/2024").unwrap(); assert_eq!(parsed_date, NaiveDate::from_ymd_opt(2024, 12, 23).unwrap()); assert_eq!( parse_date("12/23/2024"), diff --git a/quadratic-core/src/date_time.rs b/quadratic-core/src/date_time.rs --- a/quadratic-core/src/date_time.rs +++ b/quadratic-core/src/date_time.rs @@ -414,4 +413,11 @@ mod tests { let formatted_date = date_to_date_string(date.unwrap(), Some(format.to_string())); assert_eq!(formatted_date, "2024 December 23 Monday".to_string()); } + + #[test] + #[parallel] + fn test_parse_date_time() { + assert_eq!(parse_date("1893-01"), None); + assert_eq!(parse_date("1902-01"), None); + } }
Spill error auto fix Being worked on in #1725
ba07e0c13859c2f461ee2d528c59e58773df4f6c
[ "date_time::tests::test_parse_date_time" ]
[ "color::tests::new", "color::tests::test_size", "color::tests::test_from_str", "controller::active_transactions::pending_transaction::tests::is_user", "color::tests::test_from_css_str", "controller::active_transactions::pending_transaction::tests::test_add_code_cell", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_cell_positions", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_rect", "controller::active_transactions::pending_transaction::tests::test_add_image_cell", "controller::active_transactions::pending_transaction::tests::test_offsets_modified", "controller::active_transactions::pending_transaction::tests::test_add_from_code_run", "controller::active_transactions::pending_transaction::tests::test_add_html_cell", "controller::active_transactions::pending_transaction::tests::test_to_transaction", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_columns", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_rows", "controller::active_transactions::unsaved_transactions::test::test_unsaved_transactions", "controller::active_transactions::unsaved_transactions::test::from_str", "controller::dependencies::test::test_graph", "compression::test::roundtrip_compression_bincode", "compression::test::roundtrip_compression_json", "controller::execution::control_transaction::tests::test_transactions_cell_hash", "controller::execution::execute_operation::execute_col_rows::tests::adjust_formulas_nothing", "controller::execution::execute_operation::execute_cursor::test::test_execute_set_cursor", "controller::execution::control_transaction::tests::test_connection_complete", "controller::execution::control_transaction::tests::test_js_calculation_complete", "controller::execution::control_transaction::tests::test_transactions_updated_bounds_in_transaction", "controller::execution::execute_operation::execute_col_rows::tests::insert_column_validation", "controller::execution::execute_operation::execute_borders::tests::test_old_borders_operation", "controller::execution::control_transaction::tests::test_transactions_finalize_transaction", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_validation", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_validation", "controller::execution::execute_operation::execute_col_rows::tests::insert_row_validation", "controller::execution::control_transaction::tests::test_transactions_undo_redo", "controller::execution::execute_operation::execute_col_rows::tests::execute_insert_row", "controller::execution::execute_operation::execute_col_rows::tests::execute_insert_column", "controller::execution::execute_operation::execute_col_rows::tests::delete_row", "controller::execution::execute_operation::execute_col_rows::tests::delete_columns", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_undo", "controller::execution::execute_operation::execute_values::tests::test_set_cell_value", "controller::execution::execute_operation::execute_values::tests::test_set_cell_values_no_sheet", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_code_cell_remove", "controller::execution::execute_operation::execute_col_rows::tests::adjust_formulas", "controller::dependencies::test::dependencies_near_input", "controller::execution::receive_multiplayer::tests::ensure_code_run_ordering_is_maintained_for_undo", "controller::execution::execute_operation::execute_values::test::dependencies_properly_trigger_on_set_cell_values", "controller::execution::execute_operation::execute_code::tests::test_spilled_output_over_normal_cell", "controller::execution::receive_multiplayer::tests::python_multiple_calculations_receive_back_afterwards", "controller::execution::receive_multiplayer::tests::receive_our_transactions_out_of_order", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_formula", "controller::execution::receive_multiplayer::tests::test_apply_multiplayer_before_unsaved_transaction", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_formula", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions", "controller::execution::receive_multiplayer::tests::test_multiplayer_hello_world", "controller::execution::receive_multiplayer::tests::test_server_apply_transaction", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_out_of_order_transactions", "controller::execution::receive_multiplayer::tests::test_receive_offline_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_python_multiple_calculations_receive_back_between", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_bad_transaction_id", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_no_transaction", "controller::execution::run_code::get_cells::test::test_calculation_get_cells", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions_and_out_of_order_transactions", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_transaction_but_no_current_sheet_pos", "controller::execution::receive_multiplayer::tests::test_receive_multiplayer_while_waiting_for_async", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_self_reference", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_sheet_name_not_found", "controller::execution::receive_multiplayer::tests::test_receive_overlapping_multiplayer_while_waiting_for_async", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_single", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_array", "controller::execution::run_code::run_formula::test::test_execute_operation_set_cell_values_formula", "controller::execution::run_code::get_cells::test::calculation_get_cells_with_no_y1", "controller::execution::run_code::run_javascript::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_javascript::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_javascript::tests::test_python_cancellation", "controller::execution::run_code::run_formula::test::test_formula_error", "controller::execution::run_code::run_javascript::tests::test_python_hello_world", "controller::execution::run_code::run_formula::test::test_multiple_formula", "controller::execution::run_code::run_formula::test::test_deleting_to_trigger_compute", "controller::execution::run_code::run_javascript::tests::test_run_python", "controller::execution::run_code::run_javascript::tests::test_python_cell_reference_change", "controller::execution::run_code::run_python::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_javascript::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_python::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_python::tests::test_python_cancellation", "controller::execution::run_code::run_javascript::tests::test_python_multiple_calculations", "controller::execution::run_code::run_python::tests::test_python_hello_world", "controller::execution::run_code::test::test_finalize_code_cell", "controller::execution::run_code::run_formula::test::test_undo_redo_spill_change", "controller::execution::run_code::run_python::tests::test_run_python", "controller::execution::spills::tests::test_check_deleted_code_runs", "controller::execution::run_code::run_python::tests::test_python_cell_reference_change", "controller::execution::run_code::run_python::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_python::tests::test_python_multiple_calculations", "controller::export::tests::exports_a_csv", "controller::formula::tests::example_parse_formula_output", "controller::formula::tests::text_parse_formula_output", "controller::execution::spills::tests::test_check_spills", "controller::operations::borders::tests::borders_operations_columns", "controller::operations::borders::tests::borders_operations_rects", "controller::operations::borders::tests::borders_operations_rows", "controller::operations::borders::tests::check_sheet", "controller::operations::borders::tests::test_borders_operations_all", "controller::operations::cell_value::test::boolean_to_cell_value", "controller::execution::spills::tests::test_check_spills_by_code_run", "controller::operations::cell_value::test::formula_to_cell_value", "controller::operations::cell_value::test::number_to_cell_value", "controller::execution::spills::tests::test_check_spills_over_code", "controller::operations::cell_value::test::problematic_number", "controller::operations::clipboard::test::move_cell_operations", "controller::operations::cell_value::test::delete_cells_operations", "controller::operations::cell_value::test::test", "controller::operations::cell_value::test::delete_columns", "controller::execution::spills::tests::test_check_spills_over_code_array", "controller::operations::clipboard::test::set_clipboard_validations", "controller::operations::clipboard::test::paste_clipboard_cells_columns", "controller::operations::clipboard::test::paste_clipboard_cells_all", "controller::operations::clipboard::test::paste_clipboard_cells_rows", "controller::operations::code_cell::test::test_set_code_cell_operations", "controller::operations::formats::tests::clear_format_selection_operations", "controller::operations::clipboard::test::sheet_formats_operations_column_rows", "controller::operations::import::test::import_csv_date_time", "controller::operations::code_cell::test::rerun_all_code_cells_one", "controller::operations::clipboard::test::paste_clipboard_with_formula", "controller::operations::import::test::import_excel_invalid", "controller::operations::import::test::import_excel", "controller::operations::import::test::import_parquet_date_time", "controller::operations::import::test::imports_a_simple_csv", "controller::operations::import::test::transmute_u8_to_u16", "controller::operations::import::test::import_excel_date_time", "controller::operations::sheets::test::sheet_names", "controller::operations::sheets::test::get_sheet_next_name", "controller::operations::sheets::test::test_move_sheet_operation", "controller::operations::code_cell::test::rerun_all_code_cells_operations", "controller::operations::import::test::imports_a_long_csv", "controller::execution::execute_operation::execute_sheets::tests::test_undo_delete_sheet_code_rerun", "controller::execution::execute_operation::execute_validation::tests::execute_remove_validation", "controller::execution::execute_operation::execute_validation::tests::execute_set_validation", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_offsets", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_offset_resize", "controller::execution::auto_resize_row_heights::tests::test_transaction_save_when_auto_resize_row_heights_when_not_executed", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_value", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_user_transaction_only", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_row", "controller::execution::execute_operation::execute_formats::test::execute_set_formats_render_size", "controller::execution::spills::tests::test_check_all_spills", "controller::execution::execute_operation::execute_sheets::tests::test_add_sheet", "controller::execution::execute_operation::execute_sheets::tests::test_delete_sheet", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_format", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_python", "controller::execution::execute_operation::execute_sheets::tests::test_execute_operation_set_sheet_name", "controller::execution::execute_operation::execute_sheets::tests::duplicate_sheet", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_offsets", "controller::execution::execute_operation::execute_code::tests::execute_code", "controller::transaction::tests::serialize_and_compress_borders_selection", "controller::user_actions::auto_complete::tests::expand_down_borders", "controller::user_actions::auto_complete::tests::expand_left_borders", "controller::user_actions::auto_complete::tests::expand_right_borders", "controller::user_actions::auto_complete::tests::expand_up_borders", "controller::user_actions::auto_complete::tests::test_autocomplete_sheet_id_not_found", "controller::user_actions::auto_complete::tests::test_cell_values_in_rect", "controller::user_actions::auto_complete::tests::test_expand_code_cell", "controller::user_actions::auto_complete::tests::test_expand_down_and_left", "controller::user_actions::auto_complete::tests::test_expand_down_only", "controller::user_actions::auto_complete::tests::test_expand_down_and_right", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_down_and_right", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_left", "controller::user_actions::auto_complete::tests::test_expand_formatting_only", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_right", "controller::user_actions::auto_complete::tests::test_expand_left_only", "controller::sheet_offsets::tests::test_commit_offsets_resize", "controller::sheet_offsets::tests::test_commit_single_resize", "controller::user_actions::auto_complete::tests::test_expand_right_only", "controller::sheets::test::test_sheet_ids", "controller::user_actions::auto_complete::tests::test_expand_up_and_left", "controller::sheets::test::test_try_sheet_from_string_id", "controller::sheets::test::test_try_sheet_from_id", "controller::sheets::test::test_try_sheet_from_name", "controller::thumbnail::test::test_thumbnail_dirty_pos", "controller::thumbnail::test::test_thumbnail_dirty_rect", "controller::thumbnail::test::thumbnail_dirty_selection_all", "controller::thumbnail::test::thumbnail_dirty_selection_columns", "controller::thumbnail::test::thumbnail_dirty_selection_rects", "controller::thumbnail::test::thumbnail_dirty_selection_rows", "controller::user_actions::cells::test::test_unpack_currency", "controller::sheets::test::test_try_sheet_mut_from_id", "controller::sheets::test::test_try_sheet_mut_from_name", "controller::user_actions::auto_complete::tests::test_expand_up_only", "controller::user_actions::auto_complete::tests::test_expand_vertical_series_down_and_right", "controller::user_actions::cells::test::delete_values_and_formatting", "controller::user_actions::cells::test::clear_formatting", "controller::user_actions::cells::test::test_set_cell_value", "controller::user_actions::clipboard::test::copy_cell_formats", "controller::user_actions::clipboard::test::test_copy_borders_to_clipboard", "controller::user_actions::clipboard::test::paste_special_values", "controller::user_actions::clipboard::test::copy_part_of_code_run", "controller::user_actions::clipboard::test::test_copy_borders_inside", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard_with_array_output", "controller::user_actions::clipboard::test::paste_special_formats", "controller::user_actions::col_row::tests::column_insert_formatting_after", "controller::user_actions::auto_complete::tests::test_expand_up_and_right", "controller::user_actions::clipboard::test::move_cells", "controller::user_actions::col_row::tests::column_insert_formatting_before", "controller::user_actions::formats::test::change_decimal_places_selection", "controller::user_actions::cells::test::test_set_cell_value_undo_redo", "controller::user_actions::code::tests::test_grid_formula_results", "controller::user_actions::col_row::tests::row_insert_formatting_after", "controller::user_actions::col_row::tests::delete_row_undo_code", "controller::user_actions::col_row::tests::row_insert_formatting_before", "controller::user_actions::col_row::tests::delete_row_undo_values_code", "controller::user_actions::formats::test::set_align_selection", "controller::user_actions::formats::test::clear_format", "controller::user_actions::formats::test::set_bold_selection", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard", "controller::user_actions::formats::test::clear_format_column", "controller::user_actions::formats::test::set_cell_wrap_selection", "controller::user_actions::formats::test::set_date_time_format", "controller::user_actions::formats::test::set_fill_color_selection", "controller::user_actions::clipboard::test::test_paste_from_quadratic_clipboard", "controller::user_actions::auto_complete::tests::test_shrink_width", "controller::user_actions::auto_complete::tests::test_shrink_height", "controller::user_actions::formats::test::set_format_column_row", "controller::user_actions::formats::test::set_numeric_format_currency", "controller::user_actions::formats::test::set_italic_selection", "controller::user_actions::formats::test::set_strike_through_selection", "controller::user_actions::auto_complete::tests::test_shrink_width_and_height", "controller::user_actions::formats::test::set_numeric_format_exponential", "controller::user_actions::formats::test::set_text_color_selection", "controller::user_actions::formats::test::set_numeric_format_percentage", "controller::user_actions::formats::test::set_underline_selection", "controller::user_actions::clipboard::test::test_paste_relative_code_from_quadratic_clipboard", "controller::user_actions::import::tests::errors_on_an_empty_csv", "controller::user_actions::import::tests::import_problematic_line", "controller::user_actions::formats::test::set_vertical_align_selection", "controller::user_actions::formatting::test::test_number_formatting", "controller::user_actions::formatting::test::test_set_output_size", "controller::user_actions::formatting::test::test_set_cell_render_size", "controller::user_actions::formats::test::toggle_commas_selection", "controller::user_actions::clipboard::test::test_copy_to_clipboard", "controller::user_actions::formatting::test::test_set_currency", "controller::user_actions::formatting::test::test_change_decimal_places", "controller::user_actions::import::tests::should_import_utf16_with_invalid_characters", "controller::user_actions::formatting::test::test_set_cell_text_color_undo_redo", "controller::user_actions::sheets::test::test_delete_last_sheet", "controller::user_actions::sheets::test::test_delete_sheet", "controller::user_actions::sheets::test::test_move_sheet_sheet_does_not_exist", "controller::user_actions::validations::tests::get_validation_from_pos", "controller::user_actions::sheets::test::test_set_sheet_name", "controller::user_actions::validations::tests::validate_input", "controller::user_actions::sheets::test::test_set_sheet_color", "controller::user_actions::validations::tests::validate_input_logical", "controller::user_actions::validations::tests::validation_list_cells", "controller::user_actions::validations::tests::validation_list_strings", "controller::user_actions::validations::tests::validations", "date_time::tests::format_date", "date_time::tests::format_date_with_bad_ordering", "date_time::tests::format_date_opposite_order", "date_time::tests::format_time", "date_time::tests::format_time_wrong_order", "date_time::tests::naive_date_i64", "date_time::tests::naive_time_i32", "date_time::tests::parse_simple_times", "date_time::tests::test_parse_date", "date_time::tests::test_parse_time", "date_time::tests::time", "formulas::cell_ref::tests::test_a1_sheet_parsing", "formulas::criteria::tests::test_formula_comparison_criteria", "formulas::cell_ref::tests::test_a1_parsing", "formulas::functions::array::tests::test_formula_filter", "formulas::functions::array::tests::test_formula_sort", "formulas::functions::array::tests::test_formula_sort_types", "controller::user_actions::sheets::test::test_add_delete_reorder_sheets", "controller::user_actions::clipboard::test::test_move_code_cell_vertically", "controller::user_actions::clipboard::test::test_move_code_cell_horizontally", "formulas::functions::array::tests::test_formula_unique", "formulas::functions::datetime::tests::test_formula_date", "formulas::functions::datetime::tests::test_formula_duration_hms", "formulas::functions::datetime::tests::test_formula_duration_ymd", "formulas::functions::datetime::tests::test_formula_day", "formulas::functions::datetime::tests::test_formula_hour", "formulas::functions::datetime::tests::test_formula_month", "formulas::functions::datetime::tests::test_formula_minute", "formulas::functions::datetime::tests::test_formula_time", "formulas::functions::datetime::tests::test_formula_year", "formulas::functions::datetime::tests::test_formula_second", "formulas::functions::logic::tests::test_formula_if", "formulas::functions::lookup::tests::test_formula_indirect", "formulas::criteria::tests::test_formula_wildcards", "formulas::functions::logic::tests::test_formula_iferror", "formulas::functions::datetime::tests::test_formula_now_today", "formulas::functions::lookup::tests::test_index", "formulas::functions::lookup::tests::test_hlookup_errors", "formulas::functions::lookup::tests::test_vlookup_ignore_errors", "formulas::functions::lookup::tests::test_match", "formulas::functions::lookup::tests::test_xlookup", "formulas::functions::lookup::tests::test_vlookup_errors", "formulas::functions::lookup::tests::test_xlookup_validation", "formulas::functions::lookup::tests::test_xlookup_zip_map", "formulas::functions::lookup::tests::test_vlookup", "formulas::functions::mathematics::tests::test_abs", "formulas::functions::lookup::tests::test_hlookup", "formulas::functions::mathematics::tests::test_ceiling", "formulas::functions::mathematics::tests::test_floor", "formulas::functions::mathematics::tests::test_int", "formulas::functions::mathematics::tests::test_floor_math_and_ceiling_math", "formulas::functions::mathematics::tests::test_log_errors", "formulas::functions::mathematics::tests::test_mod", "formulas::functions::mathematics::tests::test_negative_pow", "formulas::functions::mathematics::tests::test_pi", "formulas::functions::mathematics::tests::test_pow_0_0", "formulas::functions::mathematics::tests::test_product", "formulas::functions::mathematics::tests::test_sqrt", "formulas::functions::mathematics::tests::test_sum", "formulas::functions::mathematics::tests::test_sum_with_tuples", "formulas::functions::lookup::tests::test_xlookup_match_modes", "formulas::functions::mathematics::tests::test_sumif", "formulas::functions::mathematics::tests::test_tau", "formulas::functions::mathematics::tests::test_sumifs", "formulas::functions::operators::tests::test_formula_datetime_add", "formulas::functions::operators::tests::test_formula_datetime_divide", "formulas::functions::operators::tests::test_formula_datetime_multiply", "formulas::functions::operators::tests::test_formula_datetime_subtract", "formulas::functions::operators::tests::test_formula_math_operators", "formulas::functions::operators::tests::test_formula_math_operators_on_empty_string", "formulas::functions::statistics::tests::test_averageif", "formulas::functions::operators::tests::test_formula_comparison_ops", "formulas::functions::statistics::tests::test_count", "formulas::functions::statistics::tests::test_counta", "formulas::functions::statistics::tests::test_countif", "formulas::functions::statistics::tests::test_countblank", "formulas::functions::statistics::tests::test_formula_average", "formulas::functions::statistics::tests::test_max", "formulas::functions::statistics::tests::test_min", "formulas::functions::statistics::tests::test_countifs", "formulas::functions::string::tests::test_formula_array_to_text", "formulas::functions::string::tests::test_formula_casing", "formulas::functions::string::tests::test_formula_clean", "formulas::functions::string::tests::test_formula_char", "formulas::functions::string::tests::test_formula_code", "formulas::functions::string::tests::test_formula_exact", "formulas::functions::string::tests::test_formula_concat", "formulas::functions::string::tests::test_formula_len_and_lenb", "formulas::functions::string::tests::test_formula_left_right_mid", "formulas::functions::string::tests::test_formula_t", "formulas::functions::string::tests::test_formula_trim", "formulas::functions::test_autocomplete_snippet", "formulas::functions::tests::test_convert_to_array", "formulas::functions::tests::test_convert_to_cell_value", "formulas::functions::string::tests::test_formula_numbervalue", "formulas::functions::tests::test_convert_to_tuple", "formulas::functions::trigonometry::tests::test_atan2", "formulas::functions::trigonometry::tests::test_formula_radian_degree_conversion", "formulas::functions::trigonometry::tests::test_formula_inverse_trigonometry", "formulas::lexer::tests::test_lex_block_comment", "formulas::parser::tests::check_formula", "formulas::parser::tests::test_formula_empty_expressions", "formulas::parser::tests::test_replace_a1_notation", "formulas::functions::mathematics::tests::proptest_int_mod_invariant", "formulas::parser::tests::test_replace_internal_cell_references", "formulas::parser::tests::test_replace_xy_shift", "formulas::tests::test_array_parsing", "formulas::functions::trigonometry::tests::test_formula_trigonometry", "formulas::tests::test_currency_string", "formulas::tests::test_bool_parsing", "formulas::tests::test_cell_range_op_errors", "formulas::tests::test_formula_array_op", "formulas::tests::test_formula_blank_array_parsing", "formulas::tests::test_find_cell_references", "formulas::tests::test_formula_blank_to_string", "formulas::tests::test_formula_circular_array_ref", "formulas::tests::test_formula_cell_ref", "formulas::tests::test_formula_omit_required_argument", "formulas::tests::test_hyphen_after_cell_ref", "formulas::tests::test_leading_equals", "formulas::tests::test_formula_range_operator", "grid::block::test_blocks::contiguous_singles", "formulas::tests::test_sheet_references", "grid::block::test_blocks::idk", "formulas::tests::test_syntax_check_ok", "grid::bounds::test::test_bounds_rect", "grid::bounds::test::test_bounds_rect_empty", "grid::bounds::test::test_bounds_rect_extend_x", "grid::bounds::test::test_bounds_rect_extend_y", "grid::bounds::test::test_first_column", "grid::bounds::test::test_first_row", "grid::bounds::test::test_last_column", "grid::bounds::test::test_last_row", "grid::code_run::test::test_output_sheet_rect_spill_error", "grid::code_run::test::test_output_size", "grid::column::test::column_data_set_range", "grid::column::test::has_blocks_in_range", "grid::column::test::format", "grid::column::test::format_range", "grid::column::test::has_format_in_row", "grid::column::test::insert_and_shift_right_end", "grid::column::test::insert_and_shift_right_middle", "grid::column::test::insert_and_shift_right_simple", "grid::column::test::insert_and_shift_right_start", "grid::column::test::insert_block", "grid::column::test::is_empty", "grid::column::test::min_max", "grid::column::test::remove_and_shift_left_end", "grid::column::test::remove_and_shift_left_middle", "grid::column::test::remove_and_shift_left_start", "grid::file::serialize::selection::tests::import_export_selection", "grid::file::serialize::validations::tests::import_export_validation_date_time", "grid::file::serialize::validations::tests::import_export_validation_numbers", "grid::file::serialize::validations::tests::import_export_validation_text", "grid::file::serialize::validations::tests::import_export_validations", "grid::file::sheet_schema::test::test_export_sheet", "grid::file::serialize::borders::tests::import_export_borders", "grid::file::serialize::cell_value::tests::import_and_export_date_time", "grid::file::tests::imports_and_exports_a_v1_5_grid", "grid::file::tests::imports_and_exports_a_v1_6_grid", "grid::file::tests::imports_and_exports_v1_4_default", "grid::file::tests::imports_and_exports_v1_5_update_code_runs_file", "grid::file::tests::process_a_blank_v1_4_file", "grid::file::tests::process_a_number_v1_3_file", "grid::file::tests::process_a_simple_v1_4_borders_file", "formulas::functions::lookup::tests::test_xlookup_search_modes", "grid::file::tests::process_a_v1_3_borders_file", "grid::file::tests::process_a_v1_3_npm_downloads_file", "grid::file::tests::process_a_v1_3_file", "grid::file::tests::process_a_v1_3_python_text_only_file", "grid::file::tests::process_a_v1_3_single_formula_file", "grid::file::tests::imports_and_exports_v1_5_javascript_getting_started_example", "formulas::functions::mathematics::tests::test_pow_log_invariant", "grid::file::tests::process_a_v1_4_borders_file", "grid::file::tests::process_a_v1_4_file", "grid::file::tests::process_a_v1_3_python_file", "grid::file::v1_4::file::tests::import_and_export_a_v1_4_file", "grid::file::v1_3::file::tests::import_export_and_upgrade_a_v1_3_file", "grid::file::v1_5::file::tests::import_and_export_a_v1_5_file", "grid::formats::format::test::clear", "grid::formats::format::test::combine", "grid::formats::format::test::format_to_format_update", "grid::formats::format::test::format_to_format_update_ref", "grid::formats::format::test::is_default", "grid::formats::format::test::merge_update_into", "grid::formats::format::test::needs_to_clear_cell_format_for_parent", "grid::formats::format::test::to_replace", "grid::formats::format_update::tests::clear_update", "grid::formats::format_update::tests::cleared", "grid::formats::format_update::tests::combine", "grid::formats::format_update::tests::fill_changed", "grid::formats::format_update::tests::format_update_to_format", "grid::file::v1_6::file::tests::import_and_export_a_v1_5_file", "grid::file::v1_6::file::tests::import_and_export_a_v1_6_borders_file", "grid::formats::format_update::tests::html_changed", "grid::formats::format_update::tests::is_default", "grid::formats::format_update::tests::render_cells_changed", "grid::formats::format_update::tests::serialize_format_update", "grid::formats::tests::repeat", "grid::js_types::test::to_js_number", "grid::resize::tests::test_default_behavior", "grid::resize::tests::test_iter_resize", "grid::resize::tests::test_reset", "grid::resize::tests::test_set_and_get_resize", "grid::resize::tests::test_serde", "grid::resize::tests::test_set_to_default", "grid::search::test::search", "grid::search::test::search_multiple_sheets", "grid::series::date_series::tests::find_date_series_day", "grid::series::date_series::tests::find_date_series_months", "grid::series::date_series::tests::find_date_series_day_by_2", "grid::series::date_series::tests::find_date_series_months_by_2", "grid::series::date_series::tests::find_date_series_one", "grid::series::date_series::tests::find_date_series_years", "grid::series::date_time_series::tests::date_time_series_days", "grid::series::date_series::tests::find_date_series_years_by_2", "grid::series::date_time_series::tests::date_time_series_hours", "grid::series::date_time_series::tests::date_time_series_minutes", "grid::series::date_time_series::tests::date_time_series_months", "grid::series::date_time_series::tests::date_time_series_seconds", "grid::series::date_time_series::tests::date_time_series_of_one", "grid::series::date_time_series::tests::date_time_series_years", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_one_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_two", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_one", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication_negative", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication_negative", "grid::series::string_series::tests::find_a_text_series_full_month", "grid::series::string_series::tests::find_a_text_series_lowercase_letters", "grid::series::string_series::tests::find_a_text_series_short_month", "grid::series::string_series::tests::find_a_text_series_uppercase_full_month_negative_wrap", "grid::series::string_series::tests::find_a_text_series_uppercase_letters", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap_negative", "grid::series::tests::copies_a_non_series", "grid::series::string_series::tests::find_a_text_series_uppercase_short_month_negative", "grid::series::tests::copies_a_non_series_negative", "grid::series::time_series::test::time_diff_overflow_underflow", "grid::series::tests::copies_a_series", "grid::series::time_series::test::time_series_hours", "grid::series::time_series::test::time_series_minutes", "grid::series::time_series::test::time_series_one", "grid::series::time_series::test::time_series_seconds", "grid::sheet::borders::borders_bounds::tests::bounds_bottom", "grid::sheet::borders::borders_bounds::tests::bounds_column_all", "grid::sheet::borders::borders_bounds::tests::bounds_column_bottom", "grid::sheet::borders::borders_bounds::tests::bounds_column_left", "grid::sheet::borders::borders_bounds::tests::bounds_column_right", "grid::sheet::borders::borders_bounds::tests::bounds_column_top", "grid::sheet::borders::borders_bounds::tests::bounds_horizontal", "grid::sheet::borders::borders_bounds::tests::bounds_left", "grid::sheet::borders::borders_bounds::tests::bounds_inner", "grid::sheet::borders::borders_bounds::tests::bounds_right", "grid::sheet::borders::borders_bounds::tests::bounds_row_left", "grid::sheet::borders::borders_bounds::tests::bounds_outer", "grid::sheet::borders::borders_bounds::tests::bounds_top", "grid::sheet::borders::borders_bounds::tests::bounds_single", "grid::sheet::borders::borders_bounds::tests::bounds_row_right", "grid::sheet::borders::borders_clear::tests::clear_all_cells", "grid::sheet::borders::borders_clear::tests::clear_column_neighbors", "grid::sheet::borders::borders_bounds::tests::bounds_vertical", "grid::sheet::borders::borders_clear::tests::clear_row_all", "grid::sheet::borders::borders_clear::tests::clear_column_only_column", "grid::sheet::borders::borders_clear::tests::clear_row_bottom", "grid::sheet::borders::borders_clear::tests::set_column_left", "grid::sheet::borders::borders_clear::tests::clear_row_top", "grid::sheet::borders::borders_clear::tests::set_column_right", "grid::sheet::borders::borders_clipboard::tests::simple_clipboard", "grid::sheet::borders::borders_col_row::tests::delete_column_empty", "grid::sheet::borders::borders_clipboard::tests::to_clipboard", "grid::sheet::borders::borders_col_row::tests::get_column_ops", "grid::sheet::borders::borders_col_row::tests::insert_column_empty", "grid::sheet::borders::borders_col_row::tests::get_row_ops", "grid::sheet::borders::borders_col_row::tests::delete_row_undo_code", "grid::sheet::borders::borders_col_row::tests::insert_column_end", "grid::sheet::borders::borders_col_row::tests::insert_row_empty", "grid::sheet::borders::borders_col_row::tests::insert_column_middle", "grid::sheet::borders::borders_col_row::tests::insert_column_start", "grid::sheet::borders::borders_col_row::tests::insert_row_end", "grid::sheet::borders::borders_col_row::tests::insert_row_middle", "grid::sheet::borders::borders_col_row::tests::insert_row_start", "grid::sheet::borders::borders_col_row::tests::insert_row_undo_code", "grid::sheet::borders::borders_col_row::tests::remove_column_end", "grid::sheet::borders::borders_col_row::tests::remove_row_empty", "grid::sheet::borders::borders_col_row::tests::remove_column_middle", "grid::sheet::borders::borders_col_row::tests::remove_column_start", "grid::sheet::borders::borders_col_row::tests::remove_row_end", "grid::sheet::borders::borders_col_row::tests::remove_row_middle", "grid::sheet::borders::borders_col_row::tests::remove_row_start", "grid::sheet::borders::borders_col_row::tests::to_clipboard", "grid::sheet::borders::borders_get::tests::get", "grid::sheet::borders::borders_get::tests::get_update_override", "grid::sheet::borders::borders_get::tests::one_cell_get", "grid::sheet::borders::borders_get::tests::try_get", "grid::sheet::borders::borders_render::tests::all_single", "grid::sheet::borders::borders_render::tests::columns", "grid::sheet::borders::borders_render::tests::horizontal_borders_in_rect", "grid::sheet::borders::borders_render::tests::right", "grid::sheet::borders::borders_render::tests::horizontal_vertical", "grid::sheet::borders::borders_render::tests::rows", "grid::sheet::borders::borders_render::tests::top", "grid::sheet::borders::borders_set::tests::set_borders_all", "grid::sheet::borders::borders_set::tests::set_borders_erase", "grid::sheet::borders::borders_set::tests::set_borders", "grid::sheet::borders::borders_style::tests::apply_update", "grid::sheet::borders::borders_render::tests::vertical_borders_in_rect", "grid::sheet::borders::borders_style::tests::clear", "grid::sheet::borders::borders_style::tests::cell_is_equal_ignore_timestamp", "grid::sheet::borders::borders_style::tests::convert_to_clear", "grid::sheet::borders::borders_style::tests::is_empty", "grid::sheet::borders::borders_style::tests::js_border_horizontal_new", "grid::sheet::borders::borders_style::tests::js_border_vertical_new", "grid::sheet::borders::borders_style::tests::override_border", "grid::sheet::borders::borders_style::tests::replace_clear_with_none", "grid::sheet::borders::borders_style::tests::remove_clear", "grid::sheet::borders::borders_style::tests::timestamp_is_equal_ignore_timestamp", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_columns", "grid::sheet::borders::borders_test::tests::print_borders", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_all", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_rows", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_rects", "grid::sheet::borders::sides::test::test_all", "grid::sheet::borders::sides::test::test_bottom", "grid::sheet::borders::sides::test::test_debug", "grid::sheet::borders::sides::test::test_default", "grid::sheet::borders::sides::test::test_left", "grid::sheet::borders::sides::test::test_right", "grid::sheet::borders::sides::test::test_top", "grid::sheet::borders::borders_toggle::test::test_toggle_border", "grid::sheet::bounds::test::code_run_column_bounds", "grid::sheet::bounds::test::code_run_columns_bounds", "grid::sheet::bounds::test::code_run_row_bounds", "grid::sheet::bounds::test::code_run_rows_bounds", "grid::sheet::bounds::test::column_bounds", "grid::sheet::bounds::test::column_bounds_code", "grid::sheet::bounds::test::empty_bounds_with_borders", "grid::sheet::bounds::test::find_last_data_row", "grid::sheet::bounds::test::recalculate_bounds_validations", "grid::sheet::bounds::test::row_bounds", "grid::sheet::bounds::test::row_bounds_code", "grid::sheet::bounds::test::row_bounds_formats", "grid::sheet::borders::borders_toggle::test::test_is_same_rect", "grid::sheet::bounds::test::send_updated_bounds_rect", "grid::sheet::bounds::test::test_bounds", "grid::sheet::bounds::test::test_columns_bounds", "grid::sheet::bounds::test::single_row_bounds", "grid::sheet::bounds::test::test_find_next_column", "grid::sheet::bounds::test::test_find_next_column_code", "grid::sheet::bounds::test::test_find_next_row", "grid::sheet::bounds::test::test_find_next_row_code", "grid::sheet::bounds::test::test_find_next_column_for_rect", "grid::sheet::bounds::test::test_find_next_row_for_rect", "grid::sheet::bounds::test::test_is_empty", "grid::sheet::bounds::test::test_row_bounds", "grid::sheet::bounds::test::test_read_write", "grid::sheet::cell_array::tests::get_cells_response", "grid::sheet::cell_array::tests::set_cell_values", "grid::sheet::bounds::test::test_rows_bounds", "grid::sheet::cell_array::tests::test_has_cell_values_in_rect", "grid::sheet::cell_values::test::merge_cell_values", "grid::sheet::cell_array::tests::test_find_spill_error_reasons", "grid::sheet::cell_values::test::rendered_value", "grid::sheet::clipboard::tests::clipboard_borders", "grid::sheet::clipboard::tests::copy_to_clipboard_exclude", "grid::sheet::code::test::code_columns_bounds", "grid::sheet::code::test::code_row_bounds", "grid::sheet::code::test::edit_code_value_spill", "grid::sheet::code::test::test_edit_code_value", "grid::sheet::code::test::test_get_code_run", "grid::sheet::code::test::test_render_size", "grid::sheet::code::test::test_set_code_run", "grid::sheet::col_row::column::tests::delete_column", "grid::sheet::col_row::column::tests::delete_column_offset", "grid::sheet::col_row::column::tests::insert_column_end", "grid::sheet::col_row::column::tests::insert_column_middle", "grid::sheet::col_row::column::tests::insert_column_offset", "grid::sheet::col_row::column::tests::insert_column_start", "grid::sheet::col_row::column::tests::values_ops_for_column", "grid::sheet::col_row::row::test::delete_column_offset", "grid::sheet::col_row::row::test::delete_row", "grid::sheet::col_row::row::test::delete_row_values", "grid::sheet::col_row::row::test::insert_row_end", "grid::sheet::col_row::row::test::insert_row_middle", "grid::sheet::col_row::row::test::insert_row_offset", "grid::sheet::col_row::row::test::insert_row_start", "grid::sheet::col_row::row::test::test_values_ops_for_column", "grid::sheet::formats::format_all::tests::find_overlapping_format_cells", "grid::sheet::formats::format_all::tests::find_overlapping_format_columns", "grid::sheet::formats::format_all::tests::find_overlapping_format_rows", "grid::sheet::formats::format_all::tests::format_all", "grid::sheet::formats::format_all::tests::set_format_all", "grid::sheet::formats::format_all::tests::set_format_all_remove_cell", "grid::sheet::formats::format_all::tests::set_format_all_remove_columns_rows", "grid::sheet::formats::format_cell::tests::decimal_places", "grid::sheet::formats::format_cell::tests::format_cell", "grid::file::tests::process_a_v1_4_airports_distance_file", "grid::sheet::formats::format_columns::tests::cleared", "grid::sheet::formats::format_columns::tests::format_column", "grid::sheet::formats::format_columns::tests::set_format_columns", "controller::user_actions::import::tests::imports_a_simple_parquet", "grid::sheet::formats::format_columns::tests::set_format_columns_remove_cell_formatting", "grid::sheet::formats::format_columns::tests::timestamp", "grid::sheet::formats::format_columns::tests::try_format_column", "grid::sheet::formats::format_rects::test::set_format_rects_none", "grid::sheet::formats::format_rects::test::set_formats_rects", "grid::file::tests::imports_and_exports_v1_5_qawolf_test_file", "grid::sheet::formats::format_rows::tests::format_row", "grid::sheet::formats::format_rows::tests::set_format_rows", "controller::user_actions::import::tests::import_all_excel_functions", "grid::sheet::formats::format_rows::tests::set_format_rows_remove_cell_formatting", "grid::sheet::formats::format_rows::tests::timestamp", "grid::sheet::formats::tests::sheet_formats", "grid::sheet::formatting::tests::override_cell_formats", "grid::sheet::rendering::tests::get_sheet_fills", "grid::sheet::rendering::tests::has_render_cells", "controller::user_actions::import::tests::should_import_with_title_header_and_empty_first_row", "grid::sheet::rendering::tests::render_cells_boolean", "grid::sheet::rendering::tests::render_cells_duration", "grid::sheet::rendering::tests::render_code_cell", "controller::user_actions::import::tests::imports_a_simple_csv", "controller::user_actions::import::tests::should_import_with_title_header", "controller::user_actions::import::tests::imports_a_simple_excel_file", "grid::sheet::rendering::tests::test_get_code_cells", "grid::sheet::rendering::tests::test_get_html_output", "grid::sheet::rendering::tests::test_get_render_cells", "grid::sheet::rendering::tests::test_get_render_cells_code", "grid::sheet::rendering::tests::validation_list", "grid::sheet::rendering_date_time::tests::cell_date_time_error", "grid::sheet::rendering_date_time::tests::render_cell_date_time", "grid::sheet::rendering_date_time::tests::value_date_time", "grid::sheet::row_resize::tests::test_convert_to_auto_resize_on_commit_single_resize", "grid::sheet::row_resize::tests::test_convert_to_manual_resize_on_commit_offsets_resize", "grid::sheet::row_resize::tests::test_get_auto_resize_rows", "grid::sheet::row_resize::tests::test_get_row_resize_custom", "grid::sheet::row_resize::tests::test_get_row_resize_default", "grid::sheet::row_resize::tests::test_get_row_resize_multiple", "grid::sheet::row_resize::tests::test_iter_row_resize_empty", "grid::sheet::row_resize::tests::test_iter_row_resize_multiple", "grid::sheet::row_resize::tests::test_set_and_reset_row_resize", "grid::sheet::row_resize::tests::test_set_row_resize", "grid::sheet::row_resize::tests::test_set_row_resize_interaction_with_other_methods", "grid::sheet::row_resize::tests::test_update_row_resize", "grid::sheet::search::test::case_sensitive_search", "grid::sheet::search::test::max_neighbor_text", "grid::sheet::search::test::neighbor_text_deduplication", "grid::sheet::search::test::neighbor_text_empty_column", "grid::sheet::search::test::neighbor_text_multiple_columns", "grid::sheet::search::test::neighbor_text_no_neighbors", "grid::sheet::search::test::neighbor_text_single_column", "grid::sheet::search::test::neighbor_text_with_gaps", "grid::sheet::search::test::search_code_runs", "grid::sheet::search::test::search_display_numbers", "grid::sheet::search::test::search_numbers", "grid::sheet::search::test::search_within_code_runs", "grid::sheet::search::test::simple_search", "grid::sheet::search::test::whole_cell_search", "grid::sheet::search::test::whole_cell_search_case_sensitive", "grid::sheet::selection::tests::format_selection", "grid::sheet::selection::tests::selection", "grid::sheet::selection::tests::selection_all", "grid::sheet::selection::tests::selection_blanks", "grid::sheet::selection::tests::selection_bounds", "grid::sheet::selection::tests::selection_columns", "grid::sheet::selection::tests::selection_rects_code", "grid::sheet::selection::tests::selection_rects_values", "grid::sheet::selection::tests::selection_rows", "grid::sheet::selection::tests::test_selection_rects_values", "grid::sheet::bounds::test::proptest_sheet_writes", "controller::execution::execute_operation::execute_col_rows::tests::insert_column_offsets", "controller::send_render::test::send_html_output_rect_after_resize", "grid::sheet::rendering::tests::render_bool_on_code_run", "grid::sheet::formats::format_cell::tests::set_format_cell", "grid::sheet::cell_values::test::merge_cell_values_validations", "controller::user_actions::validations::tests::remove_validations", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_column", "grid::sheet::formats::format_columns::tests::set_format_columns_fills", "controller::send_render::test::send_html_output_rect", "grid::sheet::rendering::tests::send_all_validation_warnings", "controller::send_render::test::send_render_cells_selection", "grid::sheet::formats::format_rects::test::set_formats_selection_rect_html", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_formula", "controller::user_actions::sheets::test::test_duplicate_sheet_code_rerun", "controller::send_render::test::send_render_cells", "controller::send_render::test::test_process_remaining_dirty_hashes", "grid::sheet::formats::format_rows::tests::set_format_rows_fills", "controller::execution::execute_operation::execute_sheets::tests::test_sheet_reorder", "controller::user_actions::validations::tests::update_validation", "controller::send_render::test::test_process_visible_dirty_hashes", "controller::user_actions::sheets::test::duplicate_sheet", "controller::execution::run_code::test::code_run_image", "grid::sheet::rendering::tests::render_images", "controller::send_render::test::send_fill_cells", "controller::send_render::test::send_render_cells_from_rects", "controller::execution::execute_operation::execute_col_rows::tests::insert_row_offsets", "controller::execution::receive_multiplayer::tests::test_send_request_transactions", "grid::sheet::rendering::tests::send_all_validations", "grid::sheet::send_render::test::send_column_render_cells", "grid::sheet::send_render::test::send_render_cells", "grid::sheet::test::test_current_decimal_places_text", "grid::sheet::test::test_current_decimal_places_value", "grid::sheet::sheet_test::tests::test_set_cell_number_empty", "grid::sheet::sheet_test::tests::test_set_code_run_array_2d", "grid::sheet::test::test_get_rows_with_wrap_in_rect", "grid::sheet::sheet_test::tests::test_set_code_run_array_horizontal", "grid::sheet::test::test_get_rows_with_wrap_in_column", "grid::sheet::sheet_test::tests::test_set_code_run_empty", "grid::sheet::sheet_test::tests::test_set_code_run_array_vertical", "grid::sheet::test::test_get_rows_with_wrap_in_selection", "controller::user_actions::import::tests::import_large_csv", "grid::sheet::sheet_test::tests::test_set_value", "grid::sheet::sheet_test::tests::test_set_values", "grid::sheet::validations::tests::remove", "grid::sheet::validations::tests::render_special_pos", "grid::sheet::summarize::tests::summarize_columns", "grid::sheet::summarize::tests::summarize_all", "grid::sheet::validations::tests::validation", "grid::sheet::summarize::tests::summarize_rounding", "grid::sheet::summarize::tests::summarize_trailing_zeros", "grid::sheet::summarize::tests::summarize_rows", "grid::sheet::summarize::tests::summarize_rects", "grid::sheet::test::decimal_places", "grid::sheet::validations::tests::get_validation_from_pos", "grid::sheet::test::delete_cell_values_code", "grid::sheet::test::display_value_blanks", "grid::sheet::validations::tests::validation_all", "grid::sheet::test::js_cell_value", "grid::sheet::validations::tests::validation_rect", "grid::sheet::validations::tests::validation_columns", "grid::sheet::test::test_cell_numeric_format_kind", "grid::sheet::validations::tests::validation_rows", "grid::sheet::validations::validation::tests::validation_display_is_default", "grid::sheet::validations::validation::tests::validation_display_sheet_is_default", "grid::sheet::validations::validation::tests::validation_render_special", "grid::sheet::test::test_check_if_wrap_in_cell", "grid::sheet::test::delete_cell_values", "grid::sheet::validations::validation_col_row::tests::inserted_column", "grid::sheet::validations::validation_col_row::tests::inserted_row", "grid::sheet::test::test_current_decimal_places_float", "grid::sheet::validations::validation_rules::tests::is_checkbox", "grid::sheet::validations::validation_col_row::tests::remove_column", "grid::sheet::validations::validation_rules::tests::is_list", "grid::sheet::test::test_check_if_wrap_in_row", "grid::sheet::validations::validation_col_row::tests::remove_row", "grid::sheet::validations::validation_rules::tests::validate_list_selection", "grid::sheet::validations::validation_rules::tests::validate_none", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_equal", "grid::sheet::validations::validation_rules::tests::validate_list_strings", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_single", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_end", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_ignore_blank", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_types", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_strings", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_values", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_selection", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_multiple", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical_ignore_blank", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_strings", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_equal_to", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_greater_than", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_ignore_blank", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_end", "grid::sheet::validations::validation_rules::validation_number::tests::validate_ranges", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains", "grid::sheet::validations::validation_warnings::tests::warnings", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains_not_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_exactly", "grid::sheet::validations::validations_clipboard::tests::to_clipboard", "grid::sheet::validations::validation_rules::validation_text::tests::validate_not_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_text_length", "grid::sheets::test::add_sheet_adds_suffix_if_name_already_in_use", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_less_than", "grid::sheets::test::test_first_sheet", "grid::sheets::test::test_move_sheet", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_not_equal_to", "grid::sheets::test::test_first_sheet_id", "grid::sheets::test::test_order_add_sheet", "grid::sheet::test::test_set_cell_values", "grid::sheets::test::test_order_move_sheet", "grid::sheets::test::test_previous_sheet_order", "grid::sheet::validations::validation_warnings::tests::has_warning", "grid::sheets::test::test_sort_sheets", "grid::sheets::test::test_try_sheet_mut_from_id", "pos::test::pos_new", "grid::sheets::test::test_next_sheet", "grid::sheets::test::test_try_sheet_from_id", "pos::test::test_pos_into", "pos::test::sheet_pos_from_str", "pos::test::test_sheet_rect_new_pos_span", "pos::test::to_quadrant", "pos::test::test_a1_string", "pos::test::test_quadrant_size", "rect::test::count", "rect::test::can_merge", "rect::test::rect_from_pos", "rect::test::extend_x", "rect::test::rect_from_positions", "rect::test::test_contains", "rect::test::test_extend_to", "rect::test::extend_y", "rect::test::test_from_numbers", "rect::test::test_from_pos_and_size", "grid::sheet::test::test_get_set_formatting_value", "rect::test::test_from_ranges", "rect::test::rect_intersection", "rect::test::rect_new", "rect::test::test_height", "grid::sheet::test::cell_format_summary", "grid::sheet::test::test_get_cell_value", "pos::test::test_to_sheet_pos", "rect::test::test_len", "rect::test::test_is_empty", "rect::test::test_rect_new_span", "rect::test::test_intersects", "rect::test::test_iter", "rect::test::test_single_pos", "rect::test::test_rect_combine", "rect::test::test_size", "rect::test::test_to_sheet_rect", "rect::test::test_translate", "rect::test::test_width", "rle::tests::size", "rect::test::test_x_range", "selection::test::contains_column", "selection::test::in_rect", "selection::test::inserted_column", "rle::tests::is_empty", "rle::tests::push_n", "selection::test::inserted_row", "selection::test::contains_row", "selection::test::new", "selection::test::count", "selection::test::count_parts", "rect::test::test_y_range", "selection::test::new_sheet_pos", "selection::test::intersection", "selection::test::origin", "selection::test::rects_to_hashes", "selection::test::is_empty", "selection::test::removed_column", "selection::test::removed_row", "selection::test::largest_rect", "selection::test::selection_columns", "selection::test::selection_from_pos", "selection::test::pos_in_selection", "selection::test::selection_from_str_all", "selection::test::selection_from_str_columns", "selection::test::selection_from_sheet_rect", "selection::test::selection_rows", "selection::test::selection_sheet_pos", "sheet_offsets::offsets::tests::test_changes", "selection::test::selection_from_str_rects", "selection::test::selection_from_rect", "sheet_offsets::offsets::tests::test_find_offsets_changed", "sheet_offsets::offsets::tests::test_delete", "selection::test::selection_from_str_rows", "sheet_offsets::offsets::tests::test_find_offsets_default", "sheet_offsets::offsets::tests::test_offsets_move", "sheet_offsets::offsets::tests::test_offsets_structure", "selection::test::translate_in_place", "selection::test::translate", "sheet_offsets::test::rect_cell_offsets", "sheet_offsets::test::screen_rect_cell_offsets", "sheet_rect::test::from_sheet_rect_to_pos", "sheet_rect::test::from_sheet_rect_to_sheet_pos", "sheet_rect::test::test_sheet_rect_from_numbers", "sheet_offsets::offsets::tests::test_insert", "selection::test::test_rects", "sheet_rect::test::test_sheet_rect_union", "sheet_rect::test::test_top_left", "small_timestamp::tests::new", "util::tests::test_column_names", "small_timestamp::tests::test_range", "util::tests::test_a1_notation_macros", "util::tests::test_date_string", "util::tests::test_from_column_names", "util::tests::test_round", "util::tests::test_unused_name", "values::cell_values::test::into_iter", "small_timestamp::tests::ensure_different", "values::cell_values::test::new", "values::array::test::from_string_list_empty", "test_util::test::print_table_sheet_format", "values::cell_values::test::cell_values_w_grows", "values::cellvalue::test::test_cell_value_to_display_number", "values::cell_values::test::from_cell_value_single", "values::cell_values::test::from_cell_value", "values::cellvalue::test::test_cell_value_to_display_percentage", "values::cellvalue::test::test_cell_value_to_display_text", "values::cell_values::test::from_flat_array", "values::cellvalue::test::test_exponential_display", "values::cellvalue::test::test_is_image", "values::cell_values::test::get_except_blank", "values::cell_values::test::from_str", "values::cell_values::test::size", "values::cellvalue::test::to_get_cells", "values::cellvalue::test::test_cell_value_equality", "values::cellvalue::test::to_number_display_scientific", "values::cellvalue::test::test_unpack_currency", "values::cellvalue::test::test_unpack_percentage", "values::cell_values::test::get_set_remove", "values::convert::test::test_convert_from_str_to_cell_value", "values::cellvalue::test::test_cell_value_to_display_currency", "values::date_time::tests::unpack_date", "values::tests::test_value_into_non_tuple", "values::date_time::tests::unpack_time", "values::time::tests::test_duration_construction", "values::from_js::tests::test_image", "values::from_js::tests::from_js_date", "values::isblank::tests::test_is_blank", "sheet_rect::test::test_sheet_rect_union_different_sheets - should panic", "values::tests::test_value_repr", "values::time::tests::test_duration_parsing", "values::date_time::tests::unpack_date_time", "grid::sheet::test::test_columns", "values::parquet::test::test_parquet_to_vec", "grid::sheet::summarize::tests::summary_too_large", "small_timestamp::tests::ensure_ordering", "grid::sheet::send_render::test::send_row_render_cells", "grid::sheet::send_render::test::send_sheet_fills", "grid::sheet::send_render::test::send_all_render_cells", "values::cell_values::test::cell_values_serialize_large", "controller::execution::execute_operation::execute_sheets::tests::test_set_sheet_color", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_a1_notation (line 84)", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_internal_cell_references (line 68)" ]
[]
[]
2024-11-05T12:35:17Z
8dc49a8a4dd2108ba11291b68e1abb24d9fe42a7
diff --git a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts --- a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts +++ b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts @@ -23,7 +23,7 @@ export const convertNumber = (n: string, format: JsNumber, currentFractionDigits if (currentFractionDigits === undefined) { if (format.decimals !== null) { currentFractionDigits = format.decimals; - } else if (isCurrency || isScientific) { + } else if (isCurrency || isScientific || isPercent) { currentFractionDigits = 2; } } diff --git a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts --- a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts +++ b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.ts @@ -71,7 +71,14 @@ export const getFractionDigits = (number: string, current: string, format: JsNum // this only works if there is a fractional part if (format.format?.type === 'EXPONENTIAL') { return number.length - (number[0] === '-' ? 2 : 1); - } else if (current.includes('.')) { + } + + // remove the % suffix for percentage + if (format.format?.type === 'PERCENTAGE') { + current = current.slice(0, -1); + } + + if (current.includes('.')) { return current.split('.')[1].length; } return 0; diff --git a/quadratic-core/src/grid/sheet.rs b/quadratic-core/src/grid/sheet.rs --- a/quadratic-core/src/grid/sheet.rs +++ b/quadratic-core/src/grid/sheet.rs @@ -395,8 +395,8 @@ impl Sheet { return Some(decimals); } - // if currency, then use the default 2 decimal places - if kind == NumericFormatKind::Currency { + // if currency and percentage, then use the default 2 decimal places + if kind == NumericFormatKind::Currency || kind == NumericFormatKind::Percentage { return Some(2); }
quadratichq__quadratic-1883
1,883
[ "1881" ]
0.5
quadratichq/quadratic
2024-09-18T21:06:45Z
diff --git a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts --- a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts +++ b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts @@ -13,7 +13,7 @@ describe('convertNumber', () => { expect(convertNumber('1234.5678', { commas: null, decimals: 5, format: null })).toBe('1234.56780'); expect( convertNumber('0.01234', { commas: null, decimals: null, format: { type: 'PERCENTAGE', symbol: null } }) - ).toBe('1.234%'); + ).toBe('1.23%'); expect( convertNumber('123456789', { commas: null, decimals: null, format: { type: 'EXPONENTIAL', symbol: null } }) ).toBe('1.23e+8'); diff --git a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts --- a/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts +++ b/quadratic-client/src/app/web-workers/renderWebWorker/worker/cellsLabel/convertNumber.test.ts @@ -86,4 +86,12 @@ describe('convertNumber', () => { 0 ) ).toEqual(undefined); + expect( + reduceDecimals( + '0.3333333333333333', + '33.33333333333333%', + { commas: null, decimals: null, format: { type: 'PERCENTAGE', symbol: null } }, + 4 + ) + ).toEqual({ number: '33.3333%', currentFractionDigits: 4 }); }); diff --git a/quadratic-core/src/grid/sheet.rs b/quadratic-core/src/grid/sheet.rs --- a/quadratic-core/src/grid/sheet.rs +++ b/quadratic-core/src/grid/sheet.rs @@ -587,7 +587,7 @@ mod test { 2, "0.23", NumericFormatKind::Percentage, - Some(0), + Some(2), ); // validate rounding diff --git a/quadratic-core/src/grid/sheet.rs b/quadratic-core/src/grid/sheet.rs --- a/quadratic-core/src/grid/sheet.rs +++ b/quadratic-core/src/grid/sheet.rs @@ -607,7 +607,7 @@ mod test { 2, "9.1234567891", NumericFormatKind::Percentage, - Some(7), + Some(2), ); assert_decimal_places_for_number(
bug: decimal precision with percentages 1. Add =1/3 in a cell 2. Format as a percent truncate to fewer decimals so it fits ![CleanShot 2024-09-18 at 10 50 54@2x](https://github.com/user-attachments/assets/1830aa59-5929-4786-88eb-e880919dcd01)
ba07e0c13859c2f461ee2d528c59e58773df4f6c
[ "grid::sheet::test::test_current_decimal_places_value" ]
[ "color::tests::test_size", "color::tests::test_from_str", "color::tests::test_from_css_str", "controller::active_transactions::pending_transaction::tests::is_user", "controller::active_transactions::pending_transaction::tests::test_to_transaction", "controller::active_transactions::unsaved_transactions::test::test_unsaved_transactions", "controller::active_transactions::unsaved_transactions::test::from_str", "controller::execution::control_transaction::tests::test_transactions_cell_hash", "controller::dependencies::test::test_graph", "compression::test::roundtrip_compression_json", "compression::test::roundtrip_compression_bincode", "controller::execution::execute_operation::execute_cursor::test::test_execute_set_cursor", "controller::execution::control_transaction::tests::test_transactions_updated_bounds_in_transaction", "controller::execution::control_transaction::tests::test_connection_complete", "controller::execution::control_transaction::tests::test_js_calculation_complete", "controller::execution::execute_operation::execute_values::tests::test_set_cell_value", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_undo", "controller::execution::control_transaction::tests::test_transactions_finalize_transaction", "controller::execution::control_transaction::tests::test_transactions_undo_redo", "controller::execution::receive_multiplayer::tests::python_multiple_calculations_receive_back_afterwards", "controller::execution::receive_multiplayer::tests::receive_our_transactions_out_of_order", "controller::execution::receive_multiplayer::tests::test_python_multiple_calculations_receive_back_between", "controller::execution::receive_multiplayer::tests::test_multiplayer_hello_world", "controller::execution::receive_multiplayer::tests::test_apply_multiplayer_before_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_out_of_order_transactions", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions_and_out_of_order_transactions", "controller::execution::receive_multiplayer::tests::test_receive_offline_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_receive_multiplayer_while_waiting_for_async", "controller::execution::receive_multiplayer::tests::test_server_apply_transaction", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_bad_transaction_id", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_no_transaction", "controller::execution::run_code::get_cells::test::test_calculation_get_cells", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_sheet_name_not_found", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_self_reference", "controller::execution::execute_operation::execute_values::tests::test_set_cell_values_no_sheet", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_transaction_but_no_current_sheet_pos", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_array", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_single", "controller::execution::receive_multiplayer::tests::test_receive_overlapping_multiplayer_while_waiting_for_async", "controller::execution::run_code::get_cells::test::calculation_get_cells_with_no_y1", "controller::execution::run_code::run_javascript::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_javascript::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_javascript::tests::test_python_cancellation", "controller::execution::run_code::run_javascript::tests::test_python_cell_reference_change", "controller::execution::run_code::run_javascript::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_javascript::tests::test_python_hello_world", "controller::execution::run_code::run_javascript::tests::test_python_multiple_calculations", "controller::execution::run_code::run_javascript::tests::test_run_python", "controller::execution::run_code::run_python::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_python::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_python::tests::test_python_cancellation", "controller::execution::run_code::run_python::tests::test_python_cell_reference_change", "controller::execution::run_code::run_python::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_python::tests::test_python_hello_world", "controller::execution::run_code::run_python::tests::test_python_multiple_calculations", "controller::execution::run_code::run_python::tests::test_run_python", "controller::execution::run_code::run_formula::test::test_execute_operation_set_cell_values_formula", "controller::execution::run_code::test::test_finalize_code_cell", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_code_cell_remove", "controller::execution::run_code::run_formula::test::test_formula_error", "controller::execution::spills::tests::test_check_deleted_code_runs", "controller::dependencies::test::dependencies_near_input", "controller::execution::receive_multiplayer::tests::ensure_code_run_ordering_is_maintained_for_undo", "controller::execution::run_code::run_formula::test::test_deleting_to_trigger_compute", "controller::execution::execute_operation::execute_code::tests::test_spilled_output_over_normal_cell", "controller::formula::tests::example_parse_formula_output", "controller::execution::spills::tests::test_check_spills", "controller::export::tests::exports_a_csv", "controller::execution::execute_operation::execute_values::test::dependencies_properly_trigger_on_set_cell_values", "controller::operations::cell_value::test::boolean_to_cell_value", "controller::formula::tests::text_parse_formula_output", "controller::operations::cell_value::test::number_to_cell_value", "controller::operations::cell_value::test::formula_to_cell_value", "controller::operations::cell_value::test::problematic_number", "controller::operations::clipboard::test::move_cell_operations", "controller::execution::run_code::run_formula::test::test_multiple_formula", "controller::operations::cell_value::test::test", "controller::operations::cell_value::test::delete_columns", "controller::execution::spills::tests::test_check_spills_by_code_run", "controller::operations::cell_value::test::delete_cells_operations", "controller::operations::clipboard::test::set_clipboard_validations", "controller::execution::run_code::run_formula::test::test_undo_redo_spill_change", "controller::execution::spills::tests::test_check_spills_over_code", "controller::operations::code_cell::test::test_set_code_cell_operations", "controller::operations::formats::tests::clear_format_selection_operations", "controller::execution::spills::tests::test_check_spills_over_code_array", "controller::operations::clipboard::test::paste_clipboard_cells_all", "controller::operations::clipboard::test::paste_clipboard_cells_rows", "controller::operations::clipboard::test::paste_clipboard_cells_columns", "controller::operations::import::test::import_excel_invalid", "controller::operations::clipboard::test::sheet_formats_operations_column_rows", "controller::operations::import::test::import_csv_date_time", "controller::operations::import::test::transmute_u8_to_u16", "controller::operations::code_cell::test::rerun_all_code_cells_one", "controller::operations::import::test::import_parquet_date_time", "controller::operations::import::test::imports_a_simple_csv", "controller::operations::import::test::import_excel", "controller::operations::import::test::import_excel_date_time", "controller::operations::sheets::test::test_move_sheet_operation", "controller::operations::sheets::test::sheet_names", "controller::operations::sheets::test::get_sheet_next_name", "controller::operations::clipboard::test::paste_clipboard_with_formula", "controller::sheet_offsets::tests::test_commit_offsets_resize", "controller::sheet_offsets::tests::test_commit_single_resize", "controller::sheets::test::test_sheet_ids", "controller::sheets::test::test_try_sheet_from_id", "controller::sheets::test::test_try_sheet_from_name", "controller::sheets::test::test_try_sheet_from_string_id", "controller::sheets::test::test_try_sheet_mut_from_id", "controller::sheets::test::test_try_sheet_mut_from_name", "controller::thumbnail::test::test_thumbnail_dirty_pos", "controller::thumbnail::test::test_thumbnail_dirty_rect", "controller::thumbnail::test::thumbnail_dirty_selection_all", "controller::thumbnail::test::thumbnail_dirty_selection_columns", "controller::thumbnail::test::thumbnail_dirty_selection_rects", "controller::thumbnail::test::thumbnail_dirty_selection_rows", "controller::operations::code_cell::test::rerun_all_code_cells_operations", "controller::user_actions::auto_complete::tests::test_autocomplete_sheet_id_not_found", "controller::user_actions::auto_complete::tests::test_cell_values_in_rect", "controller::user_actions::auto_complete::tests::test_expand_down_and_left", "controller::user_actions::auto_complete::tests::test_expand_down_and_right", "controller::user_actions::auto_complete::tests::test_expand_code_cell", "controller::user_actions::auto_complete::tests::test_expand_down_only", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_down_and_right", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_left", "controller::user_actions::auto_complete::tests::test_expand_formatting_only", "controller::user_actions::auto_complete::tests::test_expand_left_only", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_right", "controller::user_actions::auto_complete::tests::test_expand_right_only", "controller::user_actions::auto_complete::tests::test_expand_up_and_left", "controller::user_actions::auto_complete::tests::test_expand_up_and_right", "controller::user_actions::auto_complete::tests::test_expand_vertical_series_down_and_right", "controller::user_actions::auto_complete::tests::test_expand_up_only", "controller::user_actions::auto_complete::tests::test_shrink_height", "controller::user_actions::auto_complete::tests::test_shrink_width", "controller::user_actions::auto_complete::tests::test_shrink_width_and_height", "controller::user_actions::borders::tests::test_set_borders", "controller::user_actions::borders::tests::test_set_borders_sheet_id_not_found", "controller::user_actions::cells::test::clear_formatting", "controller::user_actions::cells::test::delete_values_and_formatting", "controller::user_actions::cells::test::test_set_cell_value", "controller::user_actions::cells::test::test_set_cell_value_undo_redo", "controller::user_actions::cells::test::test_unpack_currency", "controller::user_actions::clipboard::test::copy_cell_formats", "controller::user_actions::clipboard::test::copy_part_of_code_run", "controller::user_actions::clipboard::test::move_cells", "controller::user_actions::clipboard::test::paste_special_formats", "controller::user_actions::clipboard::test::paste_special_values", "controller::user_actions::clipboard::test::test_copy_borders_inside", "controller::user_actions::clipboard::test::test_copy_borders_to_clipboard", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard_with_array_output", "controller::user_actions::clipboard::test::test_copy_to_clipboard", "controller::user_actions::clipboard::test::test_paste_from_quadratic_clipboard", "controller::user_actions::clipboard::test::test_paste_relative_code_from_quadratic_clipboard", "controller::user_actions::code::tests::test_grid_formula_results", "controller::user_actions::formats::test::change_decimal_places_selection", "controller::user_actions::formats::test::clear_format", "controller::user_actions::formats::test::clear_format_column", "controller::user_actions::formats::test::set_align_selection", "controller::user_actions::formats::test::set_bold_selection", "controller::user_actions::formats::test::set_cell_wrap_selection", "controller::user_actions::formats::test::set_date_time_format", "controller::user_actions::formats::test::set_fill_color_selection", "controller::user_actions::formats::test::set_format_column_row", "controller::user_actions::formats::test::set_italic_selection", "controller::user_actions::formats::test::set_numeric_format_currency", "controller::user_actions::formats::test::set_numeric_format_exponential", "controller::user_actions::formats::test::set_numeric_format_percentage", "controller::user_actions::formats::test::set_strike_through_selection", "controller::user_actions::formats::test::set_text_color_selection", "controller::user_actions::formats::test::set_underline_selection", "controller::user_actions::formats::test::set_vertical_align_selection", "controller::user_actions::formats::test::toggle_commas_selection", "controller::user_actions::formatting::test::test_change_decimal_places", "controller::user_actions::formatting::test::test_number_formatting", "controller::user_actions::formatting::test::test_set_cell_render_size", "controller::user_actions::formatting::test::test_set_cell_text_color_undo_redo", "controller::user_actions::formatting::test::test_set_currency", "controller::user_actions::formatting::test::test_set_output_size", "controller::user_actions::import::tests::errors_on_an_empty_csv", "controller::user_actions::import::tests::import_all_excel_functions", "controller::operations::import::test::imports_a_long_csv", "controller::execution::receive_multiplayer::tests::test_send_request_transactions", "controller::send_render::test::send_html_output_rect", "controller::user_actions::import::tests::import_large_csv", "controller::send_render::test::send_html_output_rect_after_resize", "controller::execution::auto_resize_row_heights::tests::test_transaction_save_when_auto_resize_row_heights_when_not_executed", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_python", "controller::send_render::test::send_render_cells", "controller::send_render::test::send_render_cells_from_rects", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_user_transaction_only", "controller::send_render::test::send_render_cells_selection", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_formula", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_offset_resize", "controller::execution::run_code::test::code_run_image", "controller::execution::execute_operation::execute_code::tests::execute_code", "controller::execution::spills::tests::test_check_all_spills", "controller::user_actions::borders::tests::clear_borders", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_format", "controller::execution::execute_operation::execute_formats::test::execute_set_formats_render_size", "controller::execution::execute_operation::execute_sheets::tests::duplicate_sheet", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_row", "controller::user_actions::import::tests::import_problematic_line", "controller::user_actions::validations::tests::validation_list_cells", "controller::execution::execute_operation::execute_sheets::tests::test_undo_delete_sheet_code_rerun", "controller::execution::execute_operation::execute_validation::tests::execute_set_validation", "controller::viewport::tests::test_add_dirty_hashes_from_sheet_cell_positions", "controller::execution::execute_operation::execute_sheets::tests::test_delete_sheet", "controller::execution::execute_operation::execute_validation::tests::execute_remove_validation", "controller::send_render::test::send_fill_cells", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_value", "controller::execution::execute_operation::execute_sheets::tests::test_add_sheet", "controller::execution::execute_operation::execute_sheets::tests::test_sheet_reorder", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_column", "date_time::tests::naive_time_i32", "date_time::tests::parse_simple_times", "date_time::tests::test_parse_date", "date_time::tests::test_parse_time", "date_time::tests::time", "controller::user_actions::import::tests::should_import_utf16_with_invalid_characters", "formulas::cell_ref::tests::test_a1_parsing", "formulas::cell_ref::tests::test_a1_sheet_parsing", "controller::user_actions::import::tests::imports_a_simple_csv", "controller::user_actions::import::tests::should_import_with_title_header", "formulas::criteria::tests::test_formula_comparison_criteria", "controller::user_actions::import::tests::imports_a_simple_parquet", "controller::user_actions::import::tests::should_import_with_title_header_and_empty_first_row", "controller::user_actions::import::tests::imports_a_simple_excel_file", "controller::user_actions::sheets::test::test_delete_last_sheet", "controller::user_actions::sheets::test::test_move_sheet_sheet_does_not_exist", "controller::user_actions::sheets::test::test_delete_sheet", "controller::user_actions::validations::tests::validate_input", "controller::user_actions::validations::tests::validate_input_logical", "formulas::functions::lookup::tests::test_formula_indirect", "controller::user_actions::validations::tests::validation_list_strings", "controller::user_actions::validations::tests::validations", "controller::user_actions::sheets::test::test_set_sheet_color", "controller::viewport::tests::test_add_dirty_hashes_from_sheet_rect", "formulas::functions::lookup::tests::test_vlookup_ignore_errors", "date_time::tests::format_date", "date_time::tests::format_date_opposite_order", "date_time::tests::format_date_with_bad_ordering", "date_time::tests::format_time", "date_time::tests::format_time_wrong_order", "date_time::tests::naive_date_i64", "formulas::functions::mathematics::tests::test_abs", "formulas::functions::lookup::tests::test_xlookup", "controller::user_actions::sheets::test::test_add_delete_reorder_sheets", "controller::user_actions::validations::tests::get_validation_from_pos", "formulas::functions::mathematics::tests::test_pi", "formulas::functions::mathematics::tests::test_pow_0_0", "formulas::functions::logic::tests::test_formula_if", "formulas::functions::mathematics::tests::test_floor_math_and_ceiling_math", "formulas::functions::mathematics::tests::test_log_errors", "formulas::functions::mathematics::tests::test_ceiling", "formulas::functions::logic::tests::test_formula_iferror", "formulas::functions::lookup::tests::test_xlookup_validation", "formulas::functions::lookup::tests::test_vlookup_errors", "formulas::functions::mathematics::tests::test_int", "formulas::functions::mathematics::tests::test_negative_pow", "formulas::functions::lookup::tests::test_index", "formulas::functions::mathematics::tests::test_tau", "formulas::functions::mathematics::tests::test_sum_with_tuples", "formulas::functions::mathematics::tests::test_product", "formulas::functions::lookup::tests::test_xlookup_zip_map", "formulas::functions::mathematics::tests::test_sum", "formulas::functions::lookup::tests::test_hlookup_errors", "formulas::functions::lookup::tests::test_match", "formulas::functions::operators::tests::test_formula_math_operators_on_empty_string", "formulas::functions::operators::tests::test_formula_datetime_add", "formulas::functions::mathematics::tests::test_floor", "formulas::functions::operators::tests::test_formula_datetime_divide", "formulas::functions::mathematics::tests::test_mod", "formulas::functions::mathematics::tests::test_sqrt", "formulas::functions::mathematics::tests::test_sumifs", "formulas::functions::statistics::tests::test_averageif", "controller::user_actions::sheets::test::test_set_sheet_name", "formulas::functions::statistics::tests::test_formula_average", "formulas::functions::lookup::tests::test_vlookup", "formulas::functions::operators::tests::test_formula_math_operators", "formulas::functions::lookup::tests::test_xlookup_match_modes", "formulas::functions::operators::tests::test_formula_datetime_subtract", "formulas::functions::operators::tests::test_formula_datetime_multiply", "formulas::functions::statistics::tests::test_max", "formulas::functions::statistics::tests::test_countifs", "formulas::functions::string::tests::test_formula_exact", "formulas::functions::string::tests::test_formula_t", "formulas::functions::mathematics::tests::test_sumif", "formulas::functions::statistics::tests::test_min", "formulas::functions::string::tests::test_formula_clean", "formulas::functions::string::tests::test_formula_numbervalue", "formulas::functions::test_autocomplete_snippet", "formulas::functions::statistics::tests::test_countif", "formulas::functions::string::tests::test_formula_len_and_lenb", "formulas::functions::mathematics::tests::proptest_int_mod_invariant", "formulas::functions::lookup::tests::test_hlookup", "formulas::functions::statistics::tests::test_counta", "formulas::functions::string::tests::test_formula_char", "formulas::functions::string::tests::test_formula_trim", "formulas::functions::trigonometry::tests::test_atan2", "formulas::functions::statistics::tests::test_count", "formulas::functions::statistics::tests::test_countblank", "formulas::functions::operators::tests::test_formula_comparison_ops", "formulas::criteria::tests::test_formula_wildcards", "formulas::lexer::tests::test_lex_block_comment", "formulas::functions::string::tests::test_formula_concat", "formulas::functions::string::tests::test_formula_code", "formulas::functions::string::tests::test_formula_array_to_text", "formulas::functions::trigonometry::tests::test_formula_radian_degree_conversion", "formulas::parser::tests::test_formula_empty_expressions", "formulas::functions::tests::test_convert_to_tuple", "formulas::parser::tests::check_formula", "formulas::parser::tests::test_replace_a1_notation", "formulas::functions::tests::test_convert_to_cell_value", "formulas::functions::tests::test_convert_to_array", "formulas::tests::test_array_parsing", "formulas::tests::test_formula_blank_array_parsing", "grid::borders::compute_indices::tests::horizontal_indices", "formulas::tests::test_bool_parsing", "grid::block::test_blocks::idk", "grid::borders::compute_indices::tests::vertical_indices", "formulas::functions::string::tests::test_formula_casing", "formulas::tests::test_currency_string", "formulas::tests::test_find_cell_references", "formulas::parser::tests::test_replace_internal_cell_references", "formulas::tests::test_formula_array_op", "grid::borders::render::tests::horizontal::two_blocks_merge_for_render", "formulas::tests::test_formula_omit_required_argument", "formulas::tests::test_formula_circular_array_ref", "grid::borders::render::tests::horizontal::single_block", "formulas::tests::test_leading_equals", "formulas::tests::test_formula_blank_to_string", "grid::block::test_blocks::contiguous_singles", "grid::borders::render::tests::horizontal::insert_different_color_border_across_block", "formulas::functions::trigonometry::tests::test_formula_inverse_trigonometry", "grid::borders::render::tests::vertical::single_block", "grid::borders::render::tests::horizontal::two_horizontal_blocks_with_gap", "formulas::tests::test_cell_range_op_errors", "grid::borders::render::tests::vertical::insert_different_color_border_across_block", "formulas::tests::test_sheet_references", "grid::borders::render::tests::horizontal::undo_insert_different_color_border_across_block", "grid::borders::render::tests::vertical::two_blocks_merge_for_render", "grid::borders::render::tests::vertical::undo_horizontal_adjacent_insertion", "grid::borders::sheet::tests::all_borders", "grid::borders::sheet::tests::change_style_and_validate_previous_borders", "grid::borders::sheet::tests::change_style_for_subset_of_existing_borders", "formulas::tests::test_hyphen_after_cell_ref", "grid::bounds::test::test_bounds_rect", "grid::bounds::test::test_bounds_rect_empty", "formulas::functions::trigonometry::tests::test_formula_trigonometry", "formulas::tests::test_formula_cell_ref", "grid::bounds::test::test_bounds_rect_extend_x", "grid::borders::render::tests::vertical::two_vertical_blocks_with_gap", "grid::borders::sheet::tests::remove_and_validate_previous_borders", "grid::borders::sheet::tests::outer_borders", "grid::bounds::test::test_bounds_rect_extend_y", "grid::code_run::test::test_output_sheet_rect_spill_error", "grid::code_run::test::test_output_size", "grid::column::test::column_data_set_range", "grid::column::test::format", "grid::column::test::has_blocks_in_range", "grid::column::test::format_range", "grid::file::selection::tests::import_export_selection", "grid::borders::render::tests::vertical::undo_insert_different_color_border_across_block", "grid::file::sheet_schema::test::test_export_sheet", "grid::borders::sheet::tests::remove_subset_of_existing_borders", "formulas::functions::string::tests::test_formula_left_right_mid", "formulas::tests::test_formula_range_operator", "grid::file::tests::process_a_v1_4_borders_file", "formulas::tests::test_syntax_check_ok", "grid::file::v1_3::file::tests::import_export_and_upgrade_a_v1_3_file", "grid::file::v1_4::file::tests::import_and_export_a_v1_4_file", "grid::file::validations::tests::import_export_validation_numbers", "grid::file::validations::tests::import_export_validation_text", "grid::file::validations::tests::import_export_validation_date_time", "grid::file::v1_5::file::tests::import_and_export_a_v1_5_file", "grid::file::validations::tests::import_export_validations", "grid::file::v1_6::file::tests::import_and_export_a_v1_5_file", "grid::formats::format::test::clear", "grid::formats::format::test::combine", "grid::formats::format::test::format_to_format_update", "grid::formats::format::test::is_default", "grid::formats::format::test::format_to_format_update_ref", "grid::formats::format::test::needs_to_clear_cell_format_for_parent", "grid::formats::format::test::to_replace", "grid::formats::format_update::tests::cleared", "grid::formats::format::test::merge_update_into", "grid::formats::format_update::tests::combine", "grid::formats::format_update::tests::clear_update", "grid::formats::format_update::tests::fill_changed", "grid::formats::format_update::tests::html_changed", "grid::formats::format_update::tests::is_default", "grid::formats::format_update::tests::render_cells_changed", "grid::formats::format_update::tests::format_update_to_format", "grid::formats::format_update::tests::serialize_format_update", "grid::formats::tests::repeat", "grid::resize::tests::test_default_behavior", "grid::file::current::tests::import_and_export_date_time", "grid::js_types::test::to_js_number", "grid::resize::tests::test_reset", "grid::resize::tests::test_set_and_get_resize", "grid::resize::tests::test_serde", "grid::file::tests::process_a_simple_v1_4_borders_file", "grid::resize::tests::test_iter_resize", "grid::series::date_series::tests::find_date_series_day_by_2", "grid::series::date_series::tests::find_date_series_months", "grid::series::date_series::tests::find_date_series_months_by_2", "grid::search::test::search", "grid::search::test::search_multiple_sheets", "grid::series::date_series::tests::find_date_series_day", "grid::resize::tests::test_set_to_default", "grid::series::date_series::tests::find_date_series_one", "grid::series::date_series::tests::find_date_series_years", "grid::series::date_series::tests::find_date_series_years_by_2", "grid::series::date_time_series::tests::date_time_series_days", "grid::series::date_time_series::tests::date_time_series_seconds", "grid::series::date_time_series::tests::date_time_series_minutes", "grid::series::date_time_series::tests::date_time_series_years", "grid::series::date_time_series::tests::date_time_series_months", "grid::series::date_time_series::tests::date_time_series_of_one", "grid::series::date_time_series::tests::date_time_series_hours", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_one_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one_negative", "grid::file::tests::process_a_v1_3_borders_file", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication", "grid::series::string_series::tests::find_a_text_series_full_month", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication_negative", "grid::file::tests::process_a_v1_3_single_formula_file", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_two", "grid::series::string_series::tests::find_a_text_series_short_month", "grid::series::string_series::tests::find_a_text_series_uppercase_full_month_negative_wrap", "grid::series::string_series::tests::find_a_text_series_uppercase_short_month_negative", "grid::series::tests::copies_a_non_series", "grid::series::string_series::tests::find_a_text_series_uppercase_letters", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap_negative", "grid::series::string_series::tests::find_a_text_series_lowercase_letters", "grid::series::tests::copies_a_non_series_negative", "grid::series::time_series::test::time_diff_overflow_underflow", "grid::series::time_series::test::time_series_hours", "grid::series::time_series::test::time_series_minutes", "grid::series::time_series::test::time_series_one", "grid::series::time_series::test::time_series_seconds", "grid::series::tests::copies_a_series", "grid::sheet::bounds::test::column_bounds", "grid::sheet::bounds::test::column_bounds_code", "grid::sheet::bounds::test::row_bounds_code", "grid::file::tests::imports_and_exports_a_v1_5_grid", "grid::file::tests::process_a_v1_3_npm_downloads_file", "grid::sheet::bounds::test::test_bounds", "grid::file::tests::imports_and_exports_a_v1_6_grid", "grid::file::tests::imports_and_exports_v1_5_update_code_runs_file", "grid::sheet::bounds::test::send_updated_bounds_rect", "grid::file::tests::process_a_number_v1_3_file", "grid::sheet::bounds::test::test_columns_bounds", "grid::file::tests::process_a_v1_4_file", "grid::sheet::bounds::test::test_find_next_row", "grid::sheet::bounds::test::test_find_next_column", "grid::sheet::bounds::test::test_find_next_column_code", "grid::sheet::bounds::test::row_bounds", "grid::sheet::bounds::test::test_find_next_row_code", "grid::sheet::bounds::test::test_is_empty", "grid::sheet::bounds::test::test_row_bounds", "grid::sheet::cell_array::tests::get_cells_response", "grid::file::tests::process_a_v1_3_python_text_only_file", "grid::sheet::bounds::test::code_run_row_bounds", "grid::sheet::cell_array::tests::set_cell_values", "grid::sheet::cell_array::tests::test_has_cell_values_in_rect", "grid::sheet::cell_values::test::merge_cell_values", "grid::sheet::bounds::test::code_run_column_bounds", "grid::file::tests::imports_and_exports_v1_4_default", "grid::sheet::code::test::code_columns_bounds", "grid::sheet::code::test::code_row_bounds", "grid::sheet::bounds::test::find_last_data_row", "grid::sheet::cell_values::test::rendered_value", "grid::sheet::code::test::test_edit_code_value", "grid::sheet::code::test::test_get_code_run", "grid::sheet::bounds::test::test_read_write", "grid::sheet::bounds::test::recalculate_bounds_validations", "grid::sheet::bounds::test::test_rows_bounds", "grid::file::tests::process_a_v1_3_file", "grid::sheet::formats::format_all::tests::find_overlapping_format_rows", "grid::sheet::formats::format_all::tests::find_overlapping_format_columns", "grid::sheet::formats::format_all::tests::format_all", "grid::sheet::formats::format_all::tests::find_overlapping_format_cells", "grid::sheet::formats::format_all::tests::set_format_all", "grid::sheet::code::test::test_set_code_run", "grid::sheet::formats::format_all::tests::set_format_all_remove_columns_rows", "grid::sheet::formats::format_cell::tests::decimal_places", "grid::sheet::formats::format_columns::tests::format_column", "grid::sheet::formats::format_all::tests::set_format_all_remove_cell", "grid::sheet::formats::format_cell::tests::format_cell", "grid::sheet::formats::format_columns::tests::set_format_columns", "grid::file::tests::process_a_blank_v1_4_file", "grid::sheet::bounds::test::code_run_columns_bounds", "grid::sheet::formats::format_columns::tests::try_format_column", "grid::sheet::formats::format_columns::tests::timestamp", "grid::sheet::formats::format_columns::tests::set_format_columns_remove_cell_formatting", "grid::sheet::formats::format_columns::tests::cleared", "grid::sheet::formats::format_rects::test::set_formats_rects", "grid::sheet::formats::format_rows::tests::format_row", "grid::sheet::formats::format_rows::tests::set_format_rows", "grid::sheet::formats::format_rows::tests::timestamp", "grid::sheet::formats::format_rects::test::set_format_rects_none", "grid::sheet::formats::format_rows::tests::set_format_rows_remove_cell_formatting", "grid::sheet::formats::tests::sheet_formats", "grid::sheet::rendering::tests::get_sheet_fills", "grid::sheet::formatting::tests::override_cell_formats", "grid::sheet::bounds::test::code_run_rows_bounds", "grid::sheet::code::test::test_render_size", "grid::sheet::rendering::tests::has_render_cells", "grid::sheet::clipboard::tests::copy_to_clipboard_exclude", "grid::sheet::bounds::test::single_row_bounds", "grid::sheet::rendering::tests::test_get_code_cells", "grid::sheet::rendering::tests::test_get_render_cells", "grid::sheet::rendering::tests::render_code_cell", "grid::sheet::rendering::tests::validation_list", "grid::sheet::rendering_date_time::tests::cell_date_time_error", "grid::sheet::rendering_date_time::tests::render_cell_date_time", "grid::sheet::cell_array::tests::test_find_spill_error_reasons", "grid::sheet::rendering_date_time::tests::value_date_time", "grid::sheet::row_resize::tests::test_get_row_resize_custom", "grid::sheet::row_resize::tests::test_get_auto_resize_rows", "grid::sheet::row_resize::tests::test_get_row_resize_default", "grid::sheet::row_resize::tests::test_get_row_resize_multiple", "grid::sheet::row_resize::tests::test_iter_row_resize_empty", "grid::sheet::rendering::tests::test_get_render_cells_code", "grid::sheet::row_resize::tests::test_iter_row_resize_multiple", "grid::sheet::code::test::edit_code_value_spill", "grid::sheet::rendering::tests::render_cells_boolean", "grid::sheet::row_resize::tests::test_set_and_reset_row_resize", "grid::sheet::rendering::tests::test_get_html_output", "grid::sheet::row_resize::tests::test_set_row_resize", "grid::sheet::search::test::case_sensitive_search", "grid::sheet::row_resize::tests::test_set_row_resize_interaction_with_other_methods", "grid::sheet::row_resize::tests::test_update_row_resize", "grid::sheet::search::test::search_code_runs", "grid::sheet::search::test::search_numbers", "grid::sheet::search::test::whole_cell_search", "grid::sheet::search::test::simple_search", "grid::sheet::search::test::search_within_code_runs", "grid::sheet::search::test::whole_cell_search_case_sensitive", "grid::sheet::selection::tests::selection", "grid::sheet::selection::tests::selection_blanks", "grid::sheet::selection::tests::selection_all", "grid::sheet::selection::tests::format_selection", "grid::sheet::selection::tests::selection_bounds", "grid::sheet::selection::tests::selection_columns", "grid::sheet::row_resize::tests::test_convert_to_auto_resize_on_commit_single_resize", "grid::sheet::selection::tests::selection_rects_values", "grid::sheet::selection::tests::selection_rects_code", "grid::sheet::selection::tests::selection_rows", "grid::sheet::rendering::tests::render_cells_duration", "grid::sheet::selection::tests::test_selection_rects_values", "grid::sheet::sheet_test::tests::test_set_cell_number_empty", "grid::sheet::sheet_test::tests::test_set_code_run_array_horizontal", "grid::sheet::row_resize::tests::test_convert_to_manual_resize_on_commit_offsets_resize", "grid::sheet::sheet_test::tests::test_set_code_run_array_2d", "grid::sheet::sheet_test::tests::test_set_code_run_array_vertical", "grid::sheet::search::test::search_display_numbers", "grid::sheet::sheet_test::tests::test_set_value", "grid::sheet::sheet_test::tests::test_set_code_run_empty", "grid::sheet::sheet_test::tests::test_set_values", "grid::sheet::summarize::tests::summarize_all", "grid::sheet::summarize::tests::summarize_rounding", "grid::sheet::summarize::tests::summarize_columns", "grid::sheet::summarize::tests::summarize_rects", "grid::sheet::summarize::tests::summarize_trailing_zeros", "grid::sheet::summarize::tests::summarize_rows", "grid::file::tests::process_a_v1_3_python_file", "grid::sheet::test::decimal_places", "grid::sheet::test::display_value_blanks", "grid::sheet::test::delete_cell_values", "grid::sheet::test::js_cell_value", "grid::sheet::test::delete_cell_values_code", "grid::sheet::test::test_cell_numeric_format_kind", "grid::sheet::test::test_check_if_wrap_in_row", "grid::sheet::test::test_check_if_wrap_in_cell", "grid::sheet::test::test_current_decimal_places_float", "grid::sheet::test::test_current_decimal_places_text", "grid::sheet::test::test_get_rows_with_wrap_in_column", "formulas::functions::mathematics::tests::test_pow_log_invariant", "grid::sheet::test::test_get_cell_value", "grid::sheet::test::cell_format_summary", "grid::file::tests::imports_and_exports_v1_5_javascript_getting_started_example", "grid::sheet::test::test_get_rows_with_wrap_in_rect", "grid::sheet::validations::tests::get_validation_from_pos", "grid::sheet::test::test_get_rows_with_wrap_in_selection", "grid::sheet::validations::tests::render_special_pos", "grid::sheet::validations::tests::remove", "grid::sheet::validations::tests::validation", "grid::sheet::validations::tests::validation_rect", "grid::sheet::validations::tests::validation_all", "grid::sheet::validations::tests::validation_columns", "grid::sheet::validations::tests::validation_rows", "grid::sheet::validations::validation::tests::validation_display_sheet_is_default", "grid::sheet::validations::validation::tests::validation_render_special", "grid::sheet::validations::validation_rules::tests::is_checkbox", "grid::sheet::validations::validation::tests::validation_display_is_default", "grid::sheet::validations::validation_rules::tests::validate_list_selection", "grid::sheet::test::test_columns", "grid::sheet::validations::validation_rules::tests::is_list", "grid::sheet::validations::validation_rules::tests::validate_list_strings", "grid::sheet::validations::validation_rules::tests::validate_none", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_end", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_multiple", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_single", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_end", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_ignore_blank", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_types", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_strings", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_selection", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_strings", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_values", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical_ignore_blank", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_equal_to", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_greater_than", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_ignore_blank", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_not_equal_to", "grid::sheet::validations::validation_rules::validation_number::tests::validate_ranges", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_less_than", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains_not_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_text_length", "grid::sheet::validations::validation_rules::validation_text::tests::validate_not_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_exactly", "grid::sheet::validations::validation_warnings::tests::has_warning", "grid::sheet::validations::validation_warnings::tests::warnings", "grid::sheets::test::test_first_sheet", "grid::sheet::validations::validations_clipboard::tests::to_clipboard", "grid::sheets::test::add_sheet_adds_suffix_if_name_already_in_use", "grid::sheets::test::test_first_sheet_id", "grid::sheet::test::test_set_cell_values", "grid::sheets::test::test_next_sheet", "grid::sheets::test::test_order_add_sheet", "grid::sheets::test::test_move_sheet", "grid::sheets::test::test_order_move_sheet", "grid::sheets::test::test_sort_sheets", "grid::sheets::test::test_previous_sheet_order", "grid::sheets::test::test_try_sheet_from_id", "grid::sheets::test::test_try_sheet_mut_from_id", "position::test::extend_x", "position::test::from_sheet_rect_to_pos", "position::test::from_sheet_rect_to_sheet_pos", "position::test::count", "position::test::rect_from_pos", "position::test::extend_y", "position::test::rect_intersection", "position::test::rect_from_positions", "position::test::rect_new", "position::test::test_a1_string", "position::test::sheet_pos_from_str", "position::test::test_contains", "position::test::test_extend_to", "position::test::test_from_numbers", "position::test::test_from_pos_and_size", "position::test::test_from_ranges", "position::test::test_intersects", "position::test::test_height", "position::test::test_iter", "position::test::test_is_empty", "position::test::test_len", "position::test::test_pos_into", "position::test::test_quadrant_size", "position::test::test_sheet_rect_from_numbers", "position::test::test_rect_combine", "position::test::test_rect_new_span", "position::test::test_sheet_rect_new_pos_span", "position::test::test_single_pos", "position::test::test_sheet_rect_union", "position::test::test_to_sheet_rect", "position::test::test_size", "position::test::test_to_sheet_pos", "position::test::test_top_left", "grid::sheet::test::test_get_set_formatting_value", "position::test::test_x_range", "position::test::test_width", "position::test::test_translate", "rle::tests::is_empty", "position::test::test_y_range", "rle::tests::push_n", "rle::tests::size", "selection::test::contains_column", "selection::test::contains_row", "selection::test::count", "selection::test::in_rect", "selection::test::largest_rect", "selection::test::origin", "selection::test::intersection", "selection::test::selection_columns", "selection::test::is_empty", "selection::test::selection_from_pos", "selection::test::selection_from_sheet_rect", "selection::test::selection_from_rect", "selection::test::selection_from_str_all", "position::test::test_sheet_rect_union_different_sheets - should panic", "selection::test::pos_in_selection", "selection::test::selection_from_str_rows", "selection::test::selection_from_str_columns", "selection::test::selection_rows", "selection::test::translate", "selection::test::translate_in_place", "selection::test::selection_from_str_rects", "sheet_offsets::offsets::tests::test_changes", "sheet_offsets::offsets::tests::test_find_offsets_changed", "sheet_offsets::offsets::tests::test_find_offsets_default", "sheet_offsets::test::rect_cell_offsets", "sheet_offsets::offsets::tests::test_offsets_move", "sheet_offsets::test::screen_rect_cell_offsets", "sheet_offsets::offsets::tests::test_offsets_structure", "util::tests::test_column_names", "util::tests::test_a1_notation_macros", "util::tests::test_from_column_names", "util::tests::test_round", "util::tests::test_unused_name", "test_util::test::print_table_sheet_format", "util::tests::test_date_string", "values::array::test::from_string_list_empty", "values::cell_values::test::cell_values_w_grows", "values::cell_values::test::from_cell_value_single", "values::cell_values::test::from_flat_array", "values::cell_values::test::from_cell_value", "values::cell_values::test::get_except_blank", "values::cell_values::test::from_str", "values::cell_values::test::get_set_remove", "values::cell_values::test::into_iter", "values::cell_values::test::new", "values::cellvalue::test::test_cell_value_to_display_currency", "values::cell_values::test::size", "values::cellvalue::test::test_cell_value_to_display_number", "values::cellvalue::test::test_cell_value_to_display_percentage", "values::cellvalue::test::test_exponential_display", "values::cellvalue::test::test_cell_value_to_display_text", "values::cellvalue::test::test_is_image", "values::cellvalue::test::test_unpack_percentage", "values::cellvalue::test::to_get_cells", "values::cellvalue::test::to_number_display_scientific", "values::date_time::tests::unpack_date", "values::cellvalue::test::test_unpack_currency", "values::convert::test::test_convert_from_str_to_cell_value", "values::from_js::tests::from_js_date", "values::date_time::tests::unpack_time", "values::from_js::tests::test_image", "values::isblank::tests::test_is_blank", "values::tests::test_value_into_non_tuple", "values::time::tests::test_duration_construction", "values::tests::test_value_repr", "values::date_time::tests::unpack_date_time", "values::time::tests::test_duration_parsing", "values::parquet::test::test_parquet_to_vec", "formulas::functions::lookup::tests::test_xlookup_search_modes", "grid::sheet::summarize::tests::summary_too_large", "grid::file::tests::process_a_v1_4_airports_distance_file", "grid::sheet::bounds::test::proptest_sheet_writes", "grid::file::tests::imports_and_exports_v1_5_qawolf_test_file", "grid::sheet::send_render::test::send_column_render_cells", "grid::sheet::send_render::test::send_render_cells", "controller::user_actions::sheets::test::test_duplicate_sheet", "controller::execution::execute_operation::execute_sheets::tests::test_set_sheet_color", "grid::sheet::formats::format_rects::test::set_formats_selection_rect_html", "controller::user_actions::validations::tests::update_validation", "controller::viewport::tests::test_process_remaining_dirty_hashes", "grid::sheet::send_render::test::send_sheet_fills", "controller::user_actions::sheets::test::test_duplicate_sheet_code_rerun", "grid::sheet::send_render::test::send_row_render_cells", "grid::sheet::cell_values::test::merge_cell_values_validations", "grid::sheet::rendering::tests::send_all_validation_warnings", "controller::execution::execute_operation::execute_sheets::tests::test_execute_operation_set_sheet_name", "grid::sheet::formats::format_rows::tests::set_format_rows_fills", "grid::sheet::rendering::tests::send_all_validations", "values::cell_values::test::cell_values_serialize_large", "grid::sheet::rendering::tests::render_bool_on_code_run", "grid::sheet::rendering::tests::render_images", "controller::user_actions::validations::tests::remove_validations", "grid::sheet::formats::format_columns::tests::set_format_columns_fills", "grid::sheet::send_render::test::send_all_render_cells", "grid::sheet::formats::format_cell::tests::set_format_cell", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_a1_notation (line 83)", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_internal_cell_references (line 68)" ]
[]
[]
2025-03-06T19:15:17Z
ccca1fa5b9c65bceecffdcae588c3f6afce3cb76
diff --git a/quadratic-core/src/date_time.rs b/quadratic-core/src/date_time.rs --- a/quadratic-core/src/date_time.rs +++ b/quadratic-core/src/date_time.rs @@ -225,7 +225,7 @@ pub fn parse_date(value: &str) -> Option<NaiveDate> { "%d.%m.%Y", "%Y %m %d", "%m %d %Y", - "%d %m %Y", + "%d %m %G", "%Y %b %d", "%b %d %Y", "%d %b %Y",
quadratichq__quadratic-2012
2,012
[ "2011" ]
0.5
quadratichq/quadratic
2024-11-01T11:57:03Z
diff --git a/quadratic-core/src/date_time.rs b/quadratic-core/src/date_time.rs --- a/quadratic-core/src/date_time.rs +++ b/quadratic-core/src/date_time.rs @@ -319,8 +319,7 @@ mod tests { #[test] #[parallel] fn test_parse_date() { - let date = "12/23/2024".to_string(); - let parsed_date = parse_date(&date).unwrap(); + let parsed_date = parse_date("12/23/2024").unwrap(); assert_eq!(parsed_date, NaiveDate::from_ymd_opt(2024, 12, 23).unwrap()); assert_eq!( parse_date("12/23/2024"), diff --git a/quadratic-core/src/date_time.rs b/quadratic-core/src/date_time.rs --- a/quadratic-core/src/date_time.rs +++ b/quadratic-core/src/date_time.rs @@ -414,4 +413,11 @@ mod tests { let formatted_date = date_to_date_string(date.unwrap(), Some(format.to_string())); assert_eq!(formatted_date, "2024 December 23 Monday".to_string()); } + + #[test] + #[parallel] + fn test_parse_date_time() { + assert_eq!(parse_date("1893-01"), None); + assert_eq!(parse_date("1902-01"), None); + } }
Quadratic parses the dates in this CSV incorrectly [StnData.csv](https://github.com/user-attachments/files/17594099/StnData.csv) Quadratic ![CleanShot 2024-10-31 at 17 01 48@2x](https://github.com/user-attachments/assets/cfe11333-12c0-4b3d-8d82-ebda8b90fd61) Numbers Mac ![CleanShot 2024-10-31 at 17 02 30@2x](https://github.com/user-attachments/assets/4b121c7c-41d7-4c90-9e01-fe05ffc7c051)
ba07e0c13859c2f461ee2d528c59e58773df4f6c
[ "date_time::tests::test_parse_date_time" ]
[ "color::tests::new", "color::tests::test_size", "color::tests::test_from_str", "color::tests::test_from_css_str", "controller::active_transactions::pending_transaction::tests::is_user", "controller::active_transactions::pending_transaction::tests::test_add_code_cell", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_cell_positions", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_rect", "controller::active_transactions::pending_transaction::tests::test_add_from_code_run", "controller::active_transactions::pending_transaction::tests::test_add_image_cell", "controller::active_transactions::pending_transaction::tests::test_add_html_cell", "controller::active_transactions::pending_transaction::tests::test_offsets_modified", "controller::active_transactions::pending_transaction::tests::test_to_transaction", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_columns", "controller::active_transactions::pending_transaction::tests::test_add_dirty_hashes_from_sheet_rows", "compression::test::roundtrip_compression_json", "controller::active_transactions::unsaved_transactions::test::test_unsaved_transactions", "controller::active_transactions::unsaved_transactions::test::from_str", "compression::test::roundtrip_compression_bincode", "controller::dependencies::test::test_graph", "controller::execution::control_transaction::tests::test_transactions_cell_hash", "controller::execution::execute_operation::execute_col_rows::tests::adjust_formulas_nothing", "controller::execution::execute_operation::execute_cursor::test::test_execute_set_cursor", "controller::execution::control_transaction::tests::test_transactions_updated_bounds_in_transaction", "controller::execution::control_transaction::tests::test_js_calculation_complete", "controller::execution::control_transaction::tests::test_transactions_undo_redo", "controller::execution::control_transaction::tests::test_connection_complete", "controller::execution::control_transaction::tests::test_transactions_finalize_transaction", "controller::execution::execute_operation::execute_col_rows::tests::insert_column_validation", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_validation", "controller::execution::execute_operation::execute_col_rows::tests::insert_row_validation", "controller::execution::execute_operation::execute_borders::tests::test_old_borders_operation", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_validation", "controller::execution::execute_operation::execute_col_rows::tests::execute_insert_row", "controller::execution::execute_operation::execute_col_rows::tests::execute_insert_column", "controller::execution::execute_operation::execute_col_rows::tests::delete_columns", "controller::execution::execute_operation::execute_col_rows::tests::delete_row", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_undo", "controller::execution::execute_operation::execute_values::tests::test_set_cell_value", "controller::execution::execute_operation::execute_values::tests::test_set_cell_values_no_sheet", "controller::execution::execute_operation::execute_values::test::test_set_cell_values_code_cell_remove", "controller::execution::execute_operation::execute_col_rows::tests::adjust_formulas", "controller::execution::receive_multiplayer::tests::ensure_code_run_ordering_is_maintained_for_undo", "controller::execution::receive_multiplayer::tests::python_multiple_calculations_receive_back_afterwards", "controller::execution::receive_multiplayer::tests::receive_our_transactions_out_of_order", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_formula", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_formula", "controller::dependencies::test::dependencies_near_input", "controller::execution::execute_operation::execute_values::test::dependencies_properly_trigger_on_set_cell_values", "controller::execution::receive_multiplayer::tests::test_multiplayer_hello_world", "controller::execution::execute_operation::execute_code::tests::test_spilled_output_over_normal_cell", "controller::execution::receive_multiplayer::tests::test_apply_multiplayer_before_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_python_multiple_calculations_receive_back_between", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_out_of_order_transactions", "controller::execution::receive_multiplayer::tests::test_receive_offline_unsaved_transaction", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions", "controller::execution::receive_multiplayer::tests::test_server_apply_transaction", "controller::execution::run_code::get_cells::test::test_calculation_get_cells", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_bad_transaction_id", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_no_transaction", "controller::execution::receive_multiplayer::tests::test_handle_receipt_of_earlier_transactions_and_out_of_order_transactions", "controller::execution::receive_multiplayer::tests::test_receive_multiplayer_while_waiting_for_async", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_transaction_but_no_current_sheet_pos", "controller::execution::receive_multiplayer::tests::test_receive_overlapping_multiplayer_while_waiting_for_async", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_self_reference", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_array", "controller::execution::run_code::run_formula::test::test_js_code_result_to_code_cell_value_single", "controller::execution::run_code::get_cells::test::test_calculation_get_cells_sheet_name_not_found", "controller::execution::run_code::get_cells::test::calculation_get_cells_with_no_y1", "controller::execution::run_code::run_formula::test::test_execute_operation_set_cell_values_formula", "controller::execution::run_code::run_javascript::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_formula::test::test_deleting_to_trigger_compute", "controller::execution::run_code::run_javascript::tests::test_python_cancellation", "controller::execution::run_code::run_formula::test::test_formula_error", "controller::execution::run_code::run_javascript::tests::test_python_hello_world", "controller::execution::run_code::run_javascript::tests::test_python_cell_reference_change", "controller::execution::run_code::run_javascript::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_javascript::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_formula::test::test_multiple_formula", "controller::execution::run_code::run_javascript::tests::test_run_python", "controller::execution::run_code::run_python::tests::test_python_cancellation", "controller::execution::run_code::run_python::tests::test_python_addition_with_cell_reference", "controller::execution::run_code::run_python::tests::test_python_array_output_variable_length", "controller::execution::run_code::run_javascript::tests::test_python_multiple_calculations", "controller::execution::run_code::run_python::tests::test_python_hello_world", "controller::execution::run_code::run_formula::test::test_undo_redo_spill_change", "controller::execution::run_code::run_python::tests::test_run_python", "controller::execution::run_code::test::test_finalize_code_cell", "controller::execution::spills::tests::test_check_deleted_code_runs", "controller::execution::run_code::run_python::tests::test_python_cell_reference_change", "controller::execution::run_code::run_python::tests::test_python_does_not_replace_output_until_complete", "controller::execution::run_code::run_python::tests::test_python_multiple_calculations", "controller::execution::spills::tests::test_check_spills", "controller::export::tests::exports_a_csv", "controller::formula::tests::example_parse_formula_output", "controller::operations::borders::tests::borders_operations_columns", "controller::operations::borders::tests::borders_operations_rects", "controller::formula::tests::text_parse_formula_output", "controller::execution::spills::tests::test_check_spills_by_code_run", "controller::operations::borders::tests::check_sheet", "controller::operations::borders::tests::borders_operations_rows", "controller::operations::borders::tests::test_borders_operations_all", "controller::operations::cell_value::test::boolean_to_cell_value", "controller::operations::cell_value::test::formula_to_cell_value", "controller::execution::spills::tests::test_check_spills_over_code", "controller::operations::cell_value::test::number_to_cell_value", "controller::operations::cell_value::test::problematic_number", "controller::operations::clipboard::test::move_cell_operations", "controller::operations::cell_value::test::test", "controller::execution::spills::tests::test_check_spills_over_code_array", "controller::operations::cell_value::test::delete_cells_operations", "controller::operations::cell_value::test::delete_columns", "controller::operations::clipboard::test::set_clipboard_validations", "controller::operations::clipboard::test::paste_clipboard_cells_all", "controller::operations::clipboard::test::paste_clipboard_cells_columns", "controller::operations::clipboard::test::paste_clipboard_cells_rows", "controller::operations::code_cell::test::test_set_code_cell_operations", "controller::operations::formats::tests::clear_format_selection_operations", "controller::operations::clipboard::test::sheet_formats_operations_column_rows", "controller::operations::code_cell::test::rerun_all_code_cells_one", "controller::operations::clipboard::test::paste_clipboard_with_formula", "controller::operations::import::test::import_csv_date_time", "controller::operations::import::test::import_excel_invalid", "controller::operations::import::test::import_excel", "controller::operations::import::test::import_parquet_date_time", "controller::operations::import::test::transmute_u8_to_u16", "controller::operations::import::test::import_excel_date_time", "controller::operations::import::test::imports_a_simple_csv", "controller::operations::sheets::test::test_move_sheet_operation", "controller::operations::sheets::test::sheet_names", "controller::operations::sheets::test::get_sheet_next_name", "controller::operations::code_cell::test::rerun_all_code_cells_operations", "controller::operations::import::test::imports_a_long_csv", "controller::execution::execute_operation::execute_col_rows::tests::delete_row_offsets", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_column", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_formula", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_format", "controller::execution::spills::tests::test_check_all_spills", "controller::execution::auto_resize_row_heights::tests::test_transaction_save_when_auto_resize_row_heights_when_not_executed", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_user_transaction_only", "controller::execution::execute_operation::execute_code::tests::execute_code", "controller::execution::run_code::test::code_run_image", "controller::execution::execute_operation::execute_col_rows::tests::insert_row_offsets", "controller::execution::execute_operation::execute_col_rows::tests::insert_column_offsets", "controller::execution::receive_multiplayer::tests::test_send_request_transactions", "controller::thumbnail::test::test_thumbnail_dirty_pos", "controller::execution::execute_operation::execute_sheets::tests::test_delete_sheet", "controller::execution::execute_operation::execute_validation::tests::execute_remove_validation", "controller::execution::execute_operation::execute_sheets::tests::test_set_sheet_color", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_offset_resize", "controller::send_render::test::send_render_cells", "controller::send_render::test::send_html_output_rect", "controller::execution::execute_operation::execute_col_rows::tests::delete_column_offsets", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_compute_code_python", "controller::execution::execute_operation::execute_sheets::tests::test_add_sheet", "controller::execution::execute_operation::execute_formats::test::execute_set_formats_render_size", "controller::execution::execute_operation::execute_sheets::tests::duplicate_sheet", "controller::execution::execute_operation::execute_offsets::tests::test_execute_operation_resize_row", "controller::execution::execute_operation::execute_validation::tests::execute_set_validation", "controller::execution::execute_operation::execute_sheets::tests::test_execute_operation_set_sheet_name", "controller::execution::execute_operation::execute_sheets::tests::test_undo_delete_sheet_code_rerun", "controller::execution::auto_resize_row_heights::tests::test_auto_resize_row_heights_on_set_cell_value", "controller::send_render::test::send_html_output_rect_after_resize", "controller::execution::execute_operation::execute_sheets::tests::test_sheet_reorder", "controller::send_render::test::send_render_cells_from_rects", "controller::send_render::test::send_render_cells_selection", "controller::send_render::test::test_process_remaining_dirty_hashes", "controller::send_render::test::test_process_visible_dirty_hashes", "controller::sheet_offsets::tests::test_commit_offsets_resize", "controller::sheet_offsets::tests::test_commit_single_resize", "controller::sheets::test::test_sheet_ids", "controller::sheets::test::test_try_sheet_from_id", "controller::sheets::test::test_try_sheet_from_name", "controller::sheets::test::test_try_sheet_from_string_id", "controller::sheets::test::test_try_sheet_mut_from_id", "controller::sheets::test::test_try_sheet_mut_from_name", "controller::user_actions::auto_complete::tests::test_expand_vertical_series_down_and_right", "controller::thumbnail::test::test_thumbnail_dirty_rect", "controller::thumbnail::test::thumbnail_dirty_selection_all", "controller::thumbnail::test::thumbnail_dirty_selection_columns", "controller::thumbnail::test::thumbnail_dirty_selection_rects", "controller::thumbnail::test::thumbnail_dirty_selection_rows", "controller::user_actions::cells::test::test_unpack_currency", "controller::transaction::tests::serialize_and_compress_borders_selection", "controller::user_actions::cells::test::clear_formatting", "controller::user_actions::cells::test::delete_values_and_formatting", "controller::user_actions::auto_complete::tests::expand_down_borders", "controller::user_actions::auto_complete::tests::expand_left_borders", "controller::user_actions::cells::test::test_set_cell_value", "controller::user_actions::auto_complete::tests::expand_right_borders", "controller::user_actions::clipboard::test::copy_cell_formats", "controller::user_actions::auto_complete::tests::expand_up_borders", "controller::user_actions::clipboard::test::copy_part_of_code_run", "controller::user_actions::cells::test::test_set_cell_value_undo_redo", "controller::user_actions::auto_complete::tests::test_expand_up_and_right", "controller::user_actions::clipboard::test::paste_special_values", "controller::user_actions::clipboard::test::test_copy_borders_to_clipboard", "controller::user_actions::auto_complete::tests::test_expand_up_and_left", "controller::user_actions::clipboard::test::paste_special_formats", "controller::user_actions::clipboard::test::test_copy_borders_inside", "controller::user_actions::auto_complete::tests::test_expand_up_only", "controller::user_actions::col_row::tests::column_insert_formatting_after", "controller::user_actions::col_row::tests::column_insert_formatting_before", "controller::user_actions::col_row::tests::row_insert_formatting_after", "controller::user_actions::auto_complete::tests::test_shrink_width_and_height", "controller::user_actions::col_row::tests::delete_row_undo_code", "controller::user_actions::code::tests::test_grid_formula_results", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard_with_array_output", "controller::user_actions::clipboard::test::test_copy_code_to_clipboard", "controller::user_actions::auto_complete::tests::test_shrink_height", "controller::user_actions::formats::test::set_align_selection", "controller::user_actions::formats::test::set_cell_wrap_selection", "controller::user_actions::formats::test::change_decimal_places_selection", "controller::user_actions::formats::test::set_bold_selection", "controller::user_actions::clipboard::test::move_cells", "controller::user_actions::formats::test::clear_format", "controller::user_actions::auto_complete::tests::test_shrink_width", "controller::user_actions::formats::test::set_text_color_selection", "controller::user_actions::clipboard::test::test_paste_from_quadratic_clipboard", "controller::user_actions::formats::test::set_underline_selection", "controller::user_actions::formats::test::set_numeric_format_percentage", "controller::user_actions::formats::test::clear_format_column", "controller::user_actions::formats::test::toggle_commas_selection", "controller::user_actions::auto_complete::tests::test_cell_values_in_rect", "controller::user_actions::formats::test::set_italic_selection", "controller::user_actions::formats::test::set_date_time_format", "controller::user_actions::formats::test::set_fill_color_selection", "controller::user_actions::formats::test::set_format_column_row", "controller::user_actions::formats::test::set_strike_through_selection", "controller::user_actions::formats::test::set_numeric_format_exponential", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_down_and_right", "controller::user_actions::auto_complete::tests::test_expand_down_only", "controller::user_actions::col_row::tests::delete_row_undo_values_code", "controller::user_actions::col_row::tests::row_insert_formatting_before", "controller::user_actions::import::tests::errors_on_an_empty_csv", "controller::user_actions::formats::test::set_vertical_align_selection", "controller::user_actions::formats::test::set_numeric_format_currency", "controller::user_actions::formatting::test::test_set_output_size", "controller::user_actions::auto_complete::tests::test_expand_right_only", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_right", "controller::user_actions::auto_complete::tests::test_autocomplete_sheet_id_not_found", "controller::user_actions::import::tests::import_problematic_line", "controller::user_actions::clipboard::test::test_paste_relative_code_from_quadratic_clipboard", "controller::user_actions::formatting::test::test_number_formatting", "controller::user_actions::formatting::test::test_set_cell_render_size", "controller::user_actions::clipboard::test::test_copy_to_clipboard", "controller::user_actions::import::tests::should_import_utf16_with_invalid_characters", "controller::user_actions::formatting::test::test_set_currency", "controller::user_actions::validations::tests::validate_input", "controller::user_actions::validations::tests::validation_list_cells", "controller::user_actions::validations::tests::validate_input_logical", "controller::user_actions::auto_complete::tests::test_expand_left_only", "controller::user_actions::validations::tests::validation_list_strings", "controller::user_actions::validations::tests::validations", "date_time::tests::format_date", "date_time::tests::format_date_opposite_order", "date_time::tests::format_date_with_bad_ordering", "date_time::tests::format_time", "date_time::tests::format_time_wrong_order", "date_time::tests::naive_date_i64", "date_time::tests::parse_simple_times", "controller::user_actions::sheets::test::test_move_sheet_sheet_does_not_exist", "controller::user_actions::formatting::test::test_change_decimal_places", "controller::user_actions::formatting::test::test_set_cell_text_color_undo_redo", "date_time::tests::test_parse_time", "date_time::tests::naive_time_i32", "date_time::tests::test_parse_date", "date_time::tests::time", "formulas::cell_ref::tests::test_a1_sheet_parsing", "formulas::criteria::tests::test_formula_comparison_criteria", "formulas::cell_ref::tests::test_a1_parsing", "controller::user_actions::validations::tests::get_validation_from_pos", "formulas::functions::datetime::tests::test_formula_day", "formulas::functions::datetime::tests::test_formula_date", "controller::user_actions::sheets::test::test_delete_last_sheet", "controller::user_actions::sheets::test::test_set_sheet_name", "controller::user_actions::sheets::test::test_set_sheet_color", "controller::user_actions::import::tests::should_import_with_title_header", "controller::user_actions::sheets::test::test_delete_sheet", "controller::user_actions::import::tests::imports_a_simple_csv", "formulas::functions::array::tests::test_formula_filter", "controller::user_actions::import::tests::should_import_with_title_header_and_empty_first_row", "controller::user_actions::import::tests::imports_a_simple_excel_file", "formulas::functions::datetime::tests::test_formula_duration_ymd", "formulas::functions::array::tests::test_formula_sort_types", "formulas::functions::datetime::tests::test_formula_duration_hms", "formulas::functions::datetime::tests::test_formula_minute", "formulas::functions::array::tests::test_formula_unique", "formulas::functions::datetime::tests::test_formula_now_today", "controller::user_actions::auto_complete::tests::test_expand_down_and_right", "formulas::functions::array::tests::test_formula_sort", "formulas::functions::datetime::tests::test_formula_second", "formulas::functions::lookup::tests::test_formula_indirect", "formulas::functions::logic::tests::test_formula_if", "controller::user_actions::import::tests::imports_a_simple_parquet", "formulas::functions::lookup::tests::test_vlookup_ignore_errors", "formulas::functions::datetime::tests::test_formula_year", "formulas::functions::datetime::tests::test_formula_time", "formulas::functions::lookup::tests::test_xlookup_zip_map", "formulas::functions::mathematics::tests::test_abs", "formulas::functions::logic::tests::test_formula_iferror", "formulas::functions::mathematics::tests::test_ceiling", "formulas::functions::datetime::tests::test_formula_month", "controller::user_actions::auto_complete::tests::test_expand_horizontal_series_up_and_left", "controller::user_actions::sheets::test::test_add_delete_reorder_sheets", "formulas::functions::lookup::tests::test_xlookup", "formulas::functions::datetime::tests::test_formula_hour", "formulas::functions::mathematics::tests::test_pi", "formulas::functions::mathematics::tests::test_sqrt", "formulas::functions::mathematics::tests::test_floor", "formulas::functions::mathematics::tests::test_mod", "formulas::functions::mathematics::tests::test_negative_pow", "formulas::functions::mathematics::tests::test_log_errors", "formulas::functions::lookup::tests::test_vlookup_errors", "formulas::functions::mathematics::tests::test_int", "formulas::functions::mathematics::tests::test_pow_0_0", "formulas::functions::lookup::tests::test_match", "formulas::functions::mathematics::tests::test_product", "formulas::functions::lookup::tests::test_hlookup_errors", "formulas::functions::mathematics::tests::test_floor_math_and_ceiling_math", "controller::user_actions::auto_complete::tests::test_expand_down_and_left", "formulas::functions::lookup::tests::test_xlookup_validation", "formulas::functions::lookup::tests::test_index", "formulas::functions::mathematics::tests::test_tau", "formulas::functions::mathematics::tests::test_sum_with_tuples", "formulas::functions::mathematics::tests::test_sumif", "formulas::functions::operators::tests::test_formula_datetime_add", "formulas::functions::operators::tests::test_formula_math_operators_on_empty_string", "formulas::functions::mathematics::tests::test_sumifs", "formulas::functions::operators::tests::test_formula_math_operators", "formulas::functions::operators::tests::test_formula_datetime_subtract", "formulas::functions::statistics::tests::test_count", "formulas::functions::statistics::tests::test_max", "formulas::functions::statistics::tests::test_averageif", "formulas::functions::statistics::tests::test_countif", "formulas::functions::string::tests::test_formula_array_to_text", "formulas::functions::mathematics::tests::test_sum", "formulas::functions::statistics::tests::test_countblank", "formulas::functions::string::tests::test_formula_clean", "formulas::functions::operators::tests::test_formula_datetime_divide", "formulas::functions::string::tests::test_formula_exact", "formulas::functions::statistics::tests::test_counta", "formulas::functions::test_autocomplete_snippet", "formulas::criteria::tests::test_formula_wildcards", "formulas::functions::string::tests::test_formula_t", "formulas::functions::string::tests::test_formula_trim", "formulas::functions::statistics::tests::test_min", "formulas::functions::statistics::tests::test_countifs", "formulas::functions::string::tests::test_formula_concat", "formulas::functions::string::tests::test_formula_char", "formulas::functions::trigonometry::tests::test_atan2", "formulas::functions::statistics::tests::test_formula_average", "formulas::functions::tests::test_convert_to_tuple", "formulas::functions::string::tests::test_formula_casing", "formulas::parser::tests::check_formula", "formulas::functions::operators::tests::test_formula_datetime_multiply", "formulas::functions::trigonometry::tests::test_formula_radian_degree_conversion", "formulas::functions::tests::test_convert_to_array", "formulas::lexer::tests::test_lex_block_comment", "formulas::functions::tests::test_convert_to_cell_value", "controller::user_actions::auto_complete::tests::test_expand_code_cell", "formulas::functions::string::tests::test_formula_len_and_lenb", "formulas::functions::string::tests::test_formula_left_right_mid", "formulas::parser::tests::test_replace_a1_notation", "formulas::parser::tests::test_replace_xy_shift", "formulas::functions::string::tests::test_formula_code", "formulas::parser::tests::test_formula_empty_expressions", "formulas::tests::test_currency_string", "formulas::tests::test_formula_blank_array_parsing", "formulas::parser::tests::test_replace_internal_cell_references", "formulas::tests::test_bool_parsing", "formulas::functions::operators::tests::test_formula_comparison_ops", "formulas::tests::test_array_parsing", "formulas::tests::test_formula_blank_to_string", "formulas::tests::test_formula_omit_required_argument", "formulas::tests::test_leading_equals", "formulas::tests::test_hyphen_after_cell_ref", "grid::block::test_blocks::contiguous_singles", "formulas::functions::trigonometry::tests::test_formula_inverse_trigonometry", "formulas::tests::test_formula_array_op", "grid::block::test_blocks::idk", "grid::bounds::test::test_bounds_rect_empty", "grid::bounds::test::test_bounds_rect_extend_y", "grid::bounds::test::test_first_column", "grid::bounds::test::test_bounds_rect_extend_x", "grid::bounds::test::test_bounds_rect", "grid::bounds::test::test_first_row", "grid::bounds::test::test_last_row", "formulas::functions::string::tests::test_formula_numbervalue", "grid::bounds::test::test_last_column", "formulas::tests::test_cell_range_op_errors", "grid::column::test::column_data_set_range", "grid::code_run::test::test_output_sheet_rect_spill_error", "grid::code_run::test::test_output_size", "grid::column::test::format", "grid::column::test::format_range", "grid::column::test::has_blocks_in_range", "grid::column::test::has_format_in_row", "grid::column::test::insert_block", "grid::column::test::insert_and_shift_right_start", "grid::column::test::remove_and_shift_left_start", "grid::column::test::insert_and_shift_right_middle", "grid::column::test::insert_and_shift_right_simple", "grid::column::test::insert_and_shift_right_end", "grid::column::test::is_empty", "grid::column::test::min_max", "grid::column::test::remove_and_shift_left_end", "grid::file::serialize::selection::tests::import_export_selection", "formulas::tests::test_sheet_references", "formulas::functions::lookup::tests::test_vlookup", "formulas::functions::trigonometry::tests::test_formula_trigonometry", "grid::column::test::remove_and_shift_left_middle", "grid::file::serialize::validations::tests::import_export_validations", "grid::file::serialize::validations::tests::import_export_validation_text", "grid::file::serialize::validations::tests::import_export_validation_date_time", "formulas::tests::test_formula_range_operator", "grid::file::serialize::validations::tests::import_export_validation_numbers", "formulas::tests::test_find_cell_references", "grid::file::sheet_schema::test::test_export_sheet", "formulas::tests::test_formula_cell_ref", "formulas::tests::test_formula_circular_array_ref", "formulas::functions::lookup::tests::test_hlookup", "controller::user_actions::auto_complete::tests::test_expand_formatting_only", "formulas::tests::test_syntax_check_ok", "formulas::functions::lookup::tests::test_xlookup_match_modes", "grid::file::serialize::cell_value::tests::import_and_export_date_time", "grid::file::tests::process_a_v1_3_borders_file", "grid::file::v1_3::file::tests::import_export_and_upgrade_a_v1_3_file", "grid::file::tests::imports_and_exports_a_v1_6_grid", "grid::file::tests::imports_and_exports_a_v1_5_grid", "grid::file::tests::process_a_v1_4_borders_file", "grid::file::tests::imports_and_exports_v1_5_update_code_runs_file", "grid::file::tests::process_a_blank_v1_4_file", "grid::file::serialize::borders::tests::import_export_borders", "grid::formats::format::test::clear", "grid::formats::format::test::combine", "grid::formats::format::test::format_to_format_update", "grid::file::tests::process_a_v1_3_npm_downloads_file", "grid::file::v1_5::file::tests::import_and_export_a_v1_5_file", "grid::file::v1_4::file::tests::import_and_export_a_v1_4_file", "grid::formats::format::test::format_to_format_update_ref", "grid::formats::format::test::is_default", "grid::file::tests::process_a_simple_v1_4_borders_file", "grid::formats::format_update::tests::cleared", "grid::formats::format::test::needs_to_clear_cell_format_for_parent", "grid::formats::format_update::tests::combine", "grid::formats::format::test::to_replace", "grid::formats::format_update::tests::clear_update", "grid::formats::format::test::merge_update_into", "grid::formats::format_update::tests::fill_changed", "grid::formats::format_update::tests::format_update_to_format", "grid::formats::tests::repeat", "grid::js_types::test::to_js_number", "grid::formats::format_update::tests::is_default", "grid::formats::format_update::tests::render_cells_changed", "grid::formats::format_update::tests::serialize_format_update", "grid::formats::format_update::tests::html_changed", "grid::resize::tests::test_default_behavior", "grid::resize::tests::test_iter_resize", "grid::resize::tests::test_set_and_get_resize", "grid::resize::tests::test_reset", "grid::resize::tests::test_serde", "grid::resize::tests::test_set_to_default", "grid::search::test::search", "grid::search::test::search_multiple_sheets", "grid::series::date_series::tests::find_date_series_day", "grid::series::date_series::tests::find_date_series_day_by_2", "grid::series::date_series::tests::find_date_series_months", "grid::series::date_series::tests::find_date_series_months_by_2", "grid::series::date_series::tests::find_date_series_years", "grid::series::date_series::tests::find_date_series_years_by_2", "grid::file::tests::process_a_v1_3_python_text_only_file", "grid::series::date_time_series::tests::date_time_series_hours", "grid::series::date_series::tests::find_date_series_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_one_negative", "grid::series::date_time_series::tests::date_time_series_days", "grid::series::date_time_series::tests::date_time_series_minutes", "grid::series::date_time_series::tests::date_time_series_months", "grid::series::date_time_series::tests::date_time_series_of_one", "grid::series::date_time_series::tests::date_time_series_seconds", "grid::series::date_time_series::tests::date_time_series_years", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_add_two_negative", "formulas::functions::mathematics::tests::proptest_int_mod_invariant", "grid::file::tests::process_a_v1_4_file", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_one_negative", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication", "grid::series::number_series::tests::find_a_number_series_positive_descending_multiplication_negative", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication", "grid::file::tests::process_a_v1_3_single_formula_file", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two_negative", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_one", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_two", "grid::series::number_series::tests::find_a_number_series_positive_addition_by_minus_two", "grid::series::string_series::tests::find_a_text_series_lowercase_letters", "grid::series::string_series::tests::find_a_text_series_short_month", "grid::series::tests::copies_a_series", "grid::series::tests::copies_a_non_series_negative", "grid::series::number_series::tests::find_a_number_series_positive_positive_multiplication_negative", "grid::series::time_series::test::time_diff_overflow_underflow", "grid::series::string_series::tests::find_a_text_series_uppercase_letters", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap", "grid::series::time_series::test::time_series_minutes", "grid::series::time_series::test::time_series_one", "grid::series::string_series::tests::find_a_text_series_uppercase_short_month_negative", "grid::series::string_series::tests::find_a_text_series_uppercase_letters_with_wrap_negative", "grid::series::string_series::tests::find_a_text_series_full_month", "grid::series::time_series::test::time_series_hours", "grid::series::string_series::tests::find_a_text_series_uppercase_full_month_negative_wrap", "grid::series::tests::copies_a_non_series", "grid::series::time_series::test::time_series_seconds", "grid::sheet::borders::borders_bounds::tests::bounds_column_top", "grid::sheet::borders::borders_bounds::tests::bounds_single", "grid::file::v1_6::file::tests::import_and_export_a_v1_5_file", "grid::sheet::borders::borders_bounds::tests::bounds_column_right", "grid::sheet::borders::borders_bounds::tests::bounds_left", "grid::sheet::borders::borders_bounds::tests::bounds_column_left", "grid::sheet::borders::borders_bounds::tests::bounds_row_left", "grid::sheet::borders::borders_bounds::tests::bounds_column_all", "grid::sheet::borders::borders_bounds::tests::bounds_right", "grid::sheet::borders::borders_bounds::tests::bounds_row_right", "grid::sheet::borders::borders_bounds::tests::bounds_bottom", "grid::sheet::borders::borders_bounds::tests::bounds_column_bottom", "grid::sheet::borders::borders_bounds::tests::bounds_outer", "grid::file::v1_6::file::tests::import_and_export_a_v1_6_borders_file", "grid::file::tests::imports_and_exports_v1_4_default", "grid::file::tests::process_a_v1_3_file", "grid::sheet::borders::borders_col_row::tests::delete_column_empty", "grid::sheet::borders::borders_clear::tests::clear_all_cells", "grid::sheet::borders::borders_col_row::tests::get_column_ops", "grid::sheet::borders::borders_col_row::tests::insert_column_empty", "grid::sheet::borders::borders_clipboard::tests::simple_clipboard", "grid::sheet::borders::borders_col_row::tests::get_row_ops", "grid::sheet::borders::borders_clear::tests::set_column_right", "grid::sheet::borders::borders_bounds::tests::bounds_vertical", "grid::sheet::borders::borders_bounds::tests::bounds_horizontal", "grid::sheet::borders::borders_clear::tests::clear_row_top", "grid::sheet::borders::borders_bounds::tests::bounds_top", "grid::sheet::borders::borders_clear::tests::clear_row_all", "grid::sheet::borders::borders_clear::tests::set_column_left", "grid::sheet::borders::borders_bounds::tests::bounds_inner", "grid::sheet::borders::borders_clipboard::tests::to_clipboard", "grid::sheet::borders::borders_clear::tests::clear_column_neighbors", "grid::sheet::borders::borders_col_row::tests::insert_row_empty", "grid::sheet::borders::borders_col_row::tests::remove_row_empty", "grid::sheet::borders::borders_clear::tests::clear_row_bottom", "grid::sheet::borders::borders_clear::tests::clear_column_only_column", "grid::sheet::borders::borders_col_row::tests::delete_row_undo_code", "grid::sheet::borders::borders_get::tests::get", "grid::file::tests::process_a_number_v1_3_file", "grid::sheet::borders::borders_col_row::tests::insert_column_start", "grid::sheet::borders::borders_get::tests::one_cell_get", "grid::sheet::borders::borders_col_row::tests::to_clipboard", "grid::sheet::borders::borders_col_row::tests::insert_column_end", "grid::sheet::borders::borders_col_row::tests::remove_column_start", "grid::sheet::borders::borders_col_row::tests::remove_column_middle", "grid::sheet::borders::borders_get::tests::get_update_override", "grid::sheet::borders::borders_col_row::tests::remove_row_start", "grid::sheet::borders::borders_col_row::tests::insert_row_end", "grid::sheet::borders::borders_col_row::tests::insert_column_middle", "grid::sheet::borders::borders_col_row::tests::remove_row_middle", "grid::sheet::borders::borders_col_row::tests::insert_row_middle", "grid::sheet::borders::borders_col_row::tests::remove_row_end", "grid::sheet::borders::borders_col_row::tests::insert_row_start", "grid::sheet::borders::borders_style::tests::apply_update", "grid::sheet::borders::borders_set::tests::set_borders_all", "grid::sheet::borders::borders_style::tests::cell_is_equal_ignore_timestamp", "grid::sheet::borders::borders_style::tests::clear", "grid::sheet::borders::borders_style::tests::convert_to_clear", "grid::sheet::borders::borders_style::tests::js_border_horizontal_new", "grid::sheet::borders::borders_style::tests::is_empty", "grid::sheet::borders::borders_set::tests::set_borders", "grid::sheet::borders::borders_set::tests::set_borders_erase", "grid::sheet::borders::borders_style::tests::js_border_vertical_new", "grid::sheet::borders::borders_style::tests::override_border", "grid::sheet::borders::borders_style::tests::remove_clear", "grid::sheet::borders::borders_style::tests::replace_clear_with_none", "grid::sheet::borders::borders_style::tests::timestamp_is_equal_ignore_timestamp", "grid::sheet::borders::sides::test::test_all", "grid::sheet::borders::borders_col_row::tests::insert_row_undo_code", "grid::sheet::borders::sides::test::test_bottom", "grid::sheet::borders::borders_render::tests::top", "grid::sheet::borders::sides::test::test_default", "grid::sheet::borders::sides::test::test_left", "grid::sheet::borders::sides::test::test_debug", "grid::sheet::borders::sides::test::test_right", "grid::sheet::borders::borders_render::tests::all_single", "grid::sheet::borders::borders_render::tests::rows", "grid::sheet::borders::borders_render::tests::right", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_rows", "grid::sheet::borders::borders_render::tests::columns", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_rects", "grid::sheet::borders::sides::test::test_top", "grid::sheet::borders::borders_toggle::test::test_toggle_border", "grid::sheet::borders::borders_render::tests::vertical_borders_in_rect", "grid::sheet::bounds::test::column_bounds", "grid::sheet::bounds::test::column_bounds_code", "grid::sheet::borders::borders_col_row::tests::remove_column_end", "grid::sheet::bounds::test::row_bounds_code", "grid::sheet::bounds::test::row_bounds_formats", "grid::sheet::bounds::test::test_bounds", "grid::sheet::bounds::test::empty_bounds_with_borders", "grid::file::tests::imports_and_exports_v1_5_javascript_getting_started_example", "grid::sheet::bounds::test::test_columns_bounds", "grid::sheet::bounds::test::test_find_next_column", "grid::sheet::bounds::test::test_find_next_column_code", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_columns", "grid::sheet::bounds::test::test_find_next_row", "grid::sheet::bounds::test::test_find_next_row_code", "grid::sheet::bounds::test::test_is_empty", "grid::file::tests::process_a_v1_3_python_file", "grid::sheet::bounds::test::test_row_bounds", "grid::sheet::cell_array::tests::get_cells_response", "grid::sheet::borders::borders_get::tests::try_get", "grid::sheet::cell_array::tests::test_has_cell_values_in_rect", "grid::sheet::borders::borders_render::tests::horizontal_vertical", "grid::sheet::borders::borders_render::tests::horizontal_borders_in_rect", "grid::sheet::cell_values::test::merge_cell_values", "grid::sheet::bounds::test::test_read_write", "grid::sheet::cell_values::test::rendered_value", "grid::sheet::cell_array::tests::set_cell_values", "grid::sheet::borders::borders_toggle::test::is_toggle_borders_all", "grid::sheet::code::test::code_columns_bounds", "grid::sheet::code::test::code_row_bounds", "grid::sheet::bounds::test::test_rows_bounds", "grid::sheet::borders::borders_test::tests::print_borders", "grid::sheet::code::test::test_get_code_run", "formulas::functions::lookup::tests::test_xlookup_search_modes", "grid::sheet::code::test::test_edit_code_value", "grid::sheet::code::test::test_set_code_run", "grid::sheet::col_row::column::tests::delete_column_offset", "grid::sheet::col_row::column::tests::delete_column", "grid::sheet::bounds::test::code_run_column_bounds", "grid::sheet::bounds::test::code_run_columns_bounds", "grid::sheet::bounds::test::single_row_bounds", "grid::sheet::col_row::column::tests::insert_column_offset", "grid::sheet::col_row::column::tests::insert_column_end", "grid::sheet::col_row::column::tests::insert_column_middle", "grid::sheet::col_row::row::test::delete_row_values", "grid::sheet::col_row::column::tests::values_ops_for_column", "grid::sheet::col_row::row::test::delete_column_offset", "grid::sheet::col_row::row::test::insert_row_end", "grid::sheet::col_row::column::tests::insert_column_start", "grid::sheet::col_row::row::test::insert_row_offset", "grid::sheet::col_row::row::test::insert_row_middle", "grid::sheet::col_row::row::test::delete_row", "grid::sheet::formats::format_all::tests::find_overlapping_format_columns", "grid::sheet::col_row::row::test::insert_row_start", "grid::sheet::formats::format_all::tests::find_overlapping_format_rows", "grid::sheet::col_row::row::test::test_values_ops_for_column", "grid::sheet::formats::format_all::tests::find_overlapping_format_cells", "grid::sheet::formats::format_all::tests::set_format_all_remove_cell", "grid::sheet::formats::format_all::tests::format_all", "grid::sheet::formats::format_all::tests::set_format_all_remove_columns_rows", "grid::sheet::formats::format_cell::tests::decimal_places", "grid::sheet::formats::format_all::tests::set_format_all", "grid::sheet::formats::format_cell::tests::format_cell", "grid::sheet::formats::format_columns::tests::format_column", "grid::sheet::formats::format_columns::tests::set_format_columns", "grid::sheet::formats::format_columns::tests::cleared", "grid::sheet::formats::format_columns::tests::set_format_columns_remove_cell_formatting", "formulas::functions::mathematics::tests::test_pow_log_invariant", "grid::sheet::borders::borders_toggle::test::test_is_same_rect", "grid::sheet::formats::format_columns::tests::try_format_column", "grid::sheet::formats::format_columns::tests::timestamp", "grid::sheet::formats::format_rects::test::set_formats_rects", "grid::sheet::formats::format_rects::test::set_format_rects_none", "grid::sheet::formats::format_rows::tests::format_row", "grid::sheet::formats::format_rows::tests::set_format_rows", "grid::sheet::rendering::tests::get_sheet_fills", "grid::sheet::clipboard::tests::copy_to_clipboard_exclude", "grid::sheet::formats::format_rows::tests::set_format_rows_remove_cell_formatting", "grid::sheet::formats::format_rows::tests::timestamp", "grid::sheet::bounds::test::recalculate_bounds_validations", "grid::sheet::formatting::tests::override_cell_formats", "grid::sheet::formats::tests::sheet_formats", "grid::sheet::bounds::test::code_run_row_bounds", "grid::sheet::code::test::test_render_size", "grid::sheet::code::test::edit_code_value_spill", "grid::sheet::rendering::tests::render_code_cell", "grid::sheet::rendering::tests::test_get_code_cells", "grid::sheet::rendering::tests::test_get_render_cells", "grid::sheet::bounds::test::find_last_data_row", "grid::sheet::rendering::tests::validation_list", "grid::sheet::bounds::test::send_updated_bounds_rect", "grid::sheet::bounds::test::row_bounds", "grid::sheet::rendering_date_time::tests::cell_date_time_error", "grid::sheet::bounds::test::code_run_rows_bounds", "grid::sheet::rendering_date_time::tests::render_cell_date_time", "grid::sheet::clipboard::tests::clipboard_borders", "grid::sheet::row_resize::tests::test_get_auto_resize_rows", "grid::sheet::rendering_date_time::tests::value_date_time", "grid::sheet::row_resize::tests::test_iter_row_resize_empty", "grid::sheet::row_resize::tests::test_get_row_resize_default", "grid::sheet::row_resize::tests::test_get_row_resize_multiple", "grid::sheet::row_resize::tests::test_get_row_resize_custom", "grid::sheet::row_resize::tests::test_iter_row_resize_multiple", "grid::sheet::row_resize::tests::test_set_and_reset_row_resize", "grid::sheet::search::test::case_sensitive_search", "grid::sheet::row_resize::tests::test_set_row_resize_interaction_with_other_methods", "grid::sheet::row_resize::tests::test_set_row_resize", "grid::sheet::row_resize::tests::test_update_row_resize", "grid::sheet::search::test::neighbor_text_deduplication", "grid::sheet::search::test::neighbor_text_empty_column", "grid::sheet::search::test::neighbor_text_no_neighbors", "grid::sheet::search::test::neighbor_text_multiple_columns", "grid::sheet::search::test::neighbor_text_with_gaps", "grid::sheet::search::test::neighbor_text_single_column", "grid::sheet::search::test::max_neighbor_text", "grid::sheet::search::test::search_code_runs", "grid::sheet::search::test::search_within_code_runs", "grid::sheet::search::test::search_numbers", "grid::sheet::search::test::whole_cell_search", "grid::sheet::search::test::simple_search", "grid::sheet::search::test::whole_cell_search_case_sensitive", "grid::sheet::selection::tests::selection", "grid::sheet::selection::tests::selection_all", "grid::sheet::selection::tests::format_selection", "grid::sheet::cell_array::tests::test_find_spill_error_reasons", "grid::sheet::selection::tests::selection_blanks", "grid::sheet::rendering::tests::has_render_cells", "grid::sheet::selection::tests::selection_rects_values", "grid::sheet::selection::tests::selection_bounds", "grid::sheet::rendering::tests::render_cells_duration", "grid::sheet::selection::tests::selection_rects_code", "grid::sheet::selection::tests::selection_rows", "grid::sheet::row_resize::tests::test_convert_to_manual_resize_on_commit_offsets_resize", "grid::sheet::selection::tests::test_selection_rects_values", "grid::sheet::selection::tests::selection_columns", "grid::sheet::sheet_test::tests::test_set_cell_number_empty", "grid::sheet::sheet_test::tests::test_set_code_run_array_2d", "grid::sheet::rendering::tests::test_get_render_cells_code", "grid::sheet::row_resize::tests::test_convert_to_auto_resize_on_commit_single_resize", "grid::sheet::sheet_test::tests::test_set_code_run_array_horizontal", "grid::sheet::sheet_test::tests::test_set_code_run_empty", "grid::sheet::sheet_test::tests::test_set_code_run_array_vertical", "grid::sheet::sheet_test::tests::test_set_values", "grid::sheet::rendering::tests::test_get_html_output", "grid::sheet::sheet_test::tests::test_set_value", "grid::sheet::summarize::tests::summarize_columns", "grid::sheet::search::test::search_display_numbers", "grid::sheet::summarize::tests::summarize_all", "grid::sheet::summarize::tests::summarize_rounding", "grid::sheet::summarize::tests::summarize_rects", "grid::sheet::summarize::tests::summarize_trailing_zeros", "grid::sheet::test::decimal_places", "grid::sheet::summarize::tests::summarize_rows", "grid::sheet::test::test_cell_numeric_format_kind", "grid::sheet::test::display_value_blanks", "grid::sheet::rendering::tests::render_cells_boolean", "grid::sheet::test::js_cell_value", "grid::sheet::test::test_check_if_wrap_in_cell", "grid::sheet::test::test_current_decimal_places_float", "grid::sheet::test::test_check_if_wrap_in_row", "grid::sheet::test::test_current_decimal_places_value", "grid::sheet::test::test_current_decimal_places_text", "grid::sheet::test::test_get_rows_with_wrap_in_rect", "grid::sheet::test::test_get_rows_with_wrap_in_column", "grid::sheet::test::delete_cell_values", "grid::sheet::test::delete_cell_values_code", "grid::sheet::test::test_get_rows_with_wrap_in_selection", "grid::sheet::validations::tests::get_validation_from_pos", "grid::sheet::validations::tests::remove", "grid::sheet::validations::tests::validation", "grid::sheet::validations::tests::render_special_pos", "grid::sheet::validations::tests::validation_all", "grid::sheet::validations::tests::validation_columns", "grid::sheet::validations::tests::validation_rect", "grid::sheet::validations::tests::validation_rows", "grid::sheet::validations::validation::tests::validation_display_is_default", "grid::sheet::validations::validation::tests::validation_display_sheet_is_default", "grid::sheet::validations::validation::tests::validation_render_special", "grid::sheet::validations::validation_col_row::tests::inserted_column", "grid::sheet::validations::validation_col_row::tests::remove_column", "grid::sheet::validations::validation_col_row::tests::inserted_row", "grid::sheet::validations::validation_rules::tests::is_checkbox", "grid::sheet::validations::validation_col_row::tests::remove_row", "grid::sheet::validations::validation_rules::tests::is_list", "grid::sheet::validations::validation_rules::tests::validate_list_selection", "grid::sheet::validations::validation_rules::tests::validate_list_strings", "grid::sheet::validations::validation_rules::tests::validate_none", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_end", "grid::sheet::test::test_set_cell_values", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_multiple", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_single", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_not_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_equal", "grid::sheet::validations::validation_rules::validation_date_time::tests::date_range_start", "grid::sheet::test::cell_format_summary", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_end", "controller::user_actions::import::tests::import_all_excel_functions", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_types", "grid::sheet::test::test_get_cell_value", "grid::sheet::test::test_columns", "grid::sheet::validations::validation_rules::validation_date_time::tests::time_ranges_start", "grid::sheet::validations::validation_rules::validation_date_time::tests::validate_date_time_ignore_blank", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_strings", "grid::sheet::validations::validation_rules::validation_list::tests::to_drop_down_values", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_selection", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical_ignore_blank", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_equal_to", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_greater_than", "grid::sheet::validations::validation_rules::validation_logical::tests::validate_logical", "grid::sheet::validations::validation_rules::validation_list::tests::validate_list_strings", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_ignore_blank", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains", "grid::sheet::validations::validation_rules::validation_text::tests::validate_contains_not_contains", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_less_than", "grid::sheet::validations::validation_rules::validation_number::tests::validate_number_not_equal_to", "grid::sheet::validations::validation_rules::validation_text::tests::validate_text_length", "grid::sheet::validations::validation_warnings::tests::has_warning", "grid::sheet::validations::validation_rules::validation_number::tests::validate_ranges", "grid::sheet::validations::validation_warnings::tests::warnings", "grid::sheet::validations::validation_rules::validation_text::tests::validate_exactly", "grid::sheet::test::test_get_set_formatting_value", "grid::sheet::validations::validation_rules::validation_text::tests::validate_not_contains", "grid::sheet::validations::validations_clipboard::tests::to_clipboard", "grid::sheets::test::test_first_sheet", "grid::sheets::test::add_sheet_adds_suffix_if_name_already_in_use", "grid::sheets::test::test_first_sheet_id", "grid::sheets::test::test_move_sheet", "grid::sheets::test::test_next_sheet", "grid::sheets::test::test_order_add_sheet", "grid::sheets::test::test_previous_sheet_order", "grid::sheets::test::test_try_sheet_mut_from_id", "grid::sheets::test::test_order_move_sheet", "grid::sheets::test::test_try_sheet_from_id", "grid::sheets::test::test_sort_sheets", "pos::test::test_a1_string", "pos::test::test_pos_into", "pos::test::pos_new", "pos::test::test_quadrant_size", "pos::test::sheet_pos_from_str", "pos::test::test_sheet_rect_new_pos_span", "pos::test::to_quadrant", "rect::test::can_merge", "rect::test::count", "pos::test::test_to_sheet_pos", "rect::test::extend_x", "rect::test::extend_y", "rect::test::rect_from_pos", "rect::test::rect_new", "rect::test::test_extend_to", "rect::test::rect_intersection", "rect::test::test_from_numbers", "rect::test::rect_from_positions", "rect::test::test_contains", "rect::test::test_from_pos_and_size", "rect::test::test_intersects", "rect::test::test_is_empty", "rect::test::test_from_ranges", "rect::test::test_len", "rect::test::test_height", "rect::test::test_rect_combine", "rect::test::test_rect_new_span", "rect::test::test_size", "rect::test::test_to_sheet_rect", "rect::test::test_x_range", "rect::test::test_iter", "rect::test::test_translate", "rect::test::test_y_range", "rect::test::test_width", "rect::test::test_single_pos", "rle::tests::is_empty", "rle::tests::push_n", "selection::test::contains_column", "selection::test::count_parts", "selection::test::inserted_column", "rle::tests::size", "selection::test::inserted_row", "selection::test::count", "selection::test::intersection", "selection::test::in_rect", "selection::test::contains_row", "selection::test::origin", "selection::test::pos_in_selection", "selection::test::is_empty", "selection::test::largest_rect", "selection::test::new", "selection::test::rects_to_hashes", "selection::test::removed_column", "selection::test::removed_row", "selection::test::selection_columns", "selection::test::new_sheet_pos", "selection::test::selection_from_sheet_rect", "selection::test::selection_from_rect", "selection::test::selection_from_str_all", "selection::test::selection_from_str_columns", "selection::test::selection_from_pos", "selection::test::selection_from_str_rects", "selection::test::selection_from_str_rows", "selection::test::selection_sheet_pos", "selection::test::selection_rows", "selection::test::test_rects", "sheet_offsets::offsets::tests::test_changes", "sheet_offsets::offsets::tests::test_delete", "sheet_offsets::offsets::tests::test_find_offsets_changed", "selection::test::translate", "selection::test::translate_in_place", "sheet_offsets::offsets::tests::test_insert", "sheet_offsets::offsets::tests::test_offsets_move", "sheet_offsets::offsets::tests::test_find_offsets_default", "sheet_offsets::test::rect_cell_offsets", "sheet_offsets::test::screen_rect_cell_offsets", "sheet_rect::test::from_sheet_rect_to_pos", "sheet_offsets::offsets::tests::test_offsets_structure", "sheet_rect::test::from_sheet_rect_to_sheet_pos", "sheet_rect::test::test_sheet_rect_union", "sheet_rect::test::test_sheet_rect_from_numbers", "sheet_rect::test::test_top_left", "small_timestamp::tests::ensure_different", "small_timestamp::tests::new", "small_timestamp::tests::test_range", "util::tests::test_column_names", "util::tests::test_date_string", "util::tests::test_a1_notation_macros", "util::tests::test_from_column_names", "test_util::test::print_table_sheet_format", "util::tests::test_round", "values::cell_values::test::cell_values_w_grows", "values::array::test::from_string_list_empty", "util::tests::test_unused_name", "values::cell_values::test::from_cell_value", "values::cell_values::test::from_cell_value_single", "values::cell_values::test::get_except_blank", "values::cell_values::test::from_str", "values::cell_values::test::get_set_remove", "values::cell_values::test::from_flat_array", "sheet_rect::test::test_sheet_rect_union_different_sheets - should panic", "values::cell_values::test::into_iter", "values::cell_values::test::new", "values::cell_values::test::size", "values::cellvalue::test::test_cell_value_to_display_currency", "values::cellvalue::test::test_exponential_display", "values::cellvalue::test::test_cell_value_equality", "values::cellvalue::test::test_is_image", "values::cellvalue::test::test_cell_value_to_display_text", "values::cellvalue::test::test_cell_value_to_display_percentage", "values::cellvalue::test::test_cell_value_to_display_number", "values::cellvalue::test::test_unpack_currency", "values::cellvalue::test::test_unpack_percentage", "values::cellvalue::test::to_number_display_scientific", "values::cellvalue::test::to_get_cells", "values::date_time::tests::unpack_time", "values::convert::test::test_convert_from_str_to_cell_value", "values::from_js::tests::from_js_date", "values::date_time::tests::unpack_date", "values::from_js::tests::test_image", "values::isblank::tests::test_is_blank", "values::tests::test_value_into_non_tuple", "values::time::tests::test_duration_construction", "values::tests::test_value_repr", "values::time::tests::test_duration_parsing", "values::date_time::tests::unpack_date_time", "values::parquet::test::test_parquet_to_vec", "grid::sheet::summarize::tests::summary_too_large", "grid::file::tests::process_a_v1_4_airports_distance_file", "grid::sheet::bounds::test::proptest_sheet_writes", "small_timestamp::tests::ensure_ordering", "grid::file::tests::imports_and_exports_v1_5_qawolf_test_file", "controller::user_actions::sheets::test::test_duplicate_sheet_code_rerun", "grid::sheet::rendering::tests::render_bool_on_code_run", "grid::sheet::formats::format_cell::tests::set_format_cell", "grid::sheet::rendering::tests::render_images", "grid::sheet::formats::format_rows::tests::set_format_rows_fills", "grid::sheet::send_render::test::send_all_render_cells", "grid::sheet::cell_values::test::merge_cell_values_validations", "grid::sheet::rendering::tests::send_all_validations", "grid::sheet::send_render::test::send_column_render_cells", "grid::sheet::send_render::test::send_sheet_fills", "grid::sheet::send_render::test::send_row_render_cells", "values::cell_values::test::cell_values_serialize_large", "controller::user_actions::validations::tests::remove_validations", "controller::user_actions::validations::tests::update_validation", "controller::send_render::test::send_fill_cells", "grid::sheet::send_render::test::send_render_cells", "grid::sheet::rendering::tests::send_all_validation_warnings", "grid::sheet::formats::format_columns::tests::set_format_columns_fills", "controller::user_actions::import::tests::import_large_csv", "controller::user_actions::sheets::test::duplicate_sheet", "grid::sheet::formats::format_rects::test::set_formats_selection_rect_html", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_a1_notation (line 84)", "quadratic-core/src/formulas/parser/mod.rs - formulas::parser::replace_internal_cell_references (line 68)" ]
[]
[]
2025-03-06T19:15:37Z
9c64d1fbd17e99bbb8db1479492d88ba7578acc9
diff --git a/crates/bindings-macro/src/lib.rs b/crates/bindings-macro/src/lib.rs --- a/crates/bindings-macro/src/lib.rs +++ b/crates/bindings-macro/src/lib.rs @@ -45,6 +45,7 @@ mod sym { symbol!(public); symbol!(sats); symbol!(scheduled); + symbol!(scheduled_at); symbol!(unique); symbol!(update); diff --git a/crates/bindings-macro/src/lib.rs b/crates/bindings-macro/src/lib.rs --- a/crates/bindings-macro/src/lib.rs +++ b/crates/bindings-macro/src/lib.rs @@ -154,7 +155,7 @@ mod sym { pub fn reducer(args: StdTokenStream, item: StdTokenStream) -> StdTokenStream { cvt_attr::<ItemFn>(args, item, quote!(), |args, original_function| { let args = reducer::ReducerArgs::parse(args)?; - reducer::reducer_impl(args, &original_function) + reducer::reducer_impl(args, original_function) }) } diff --git a/crates/bindings-macro/src/lib.rs b/crates/bindings-macro/src/lib.rs --- a/crates/bindings-macro/src/lib.rs +++ b/crates/bindings-macro/src/lib.rs @@ -241,7 +242,7 @@ pub fn table(args: StdTokenStream, item: StdTokenStream) -> StdTokenStream { /// Provides helper attributes for `#[spacetimedb::table]`, so that we don't get unknown attribute errors. #[doc(hidden)] -#[proc_macro_derive(__TableHelper, attributes(sats, unique, auto_inc, primary_key, index))] +#[proc_macro_derive(__TableHelper, attributes(sats, unique, auto_inc, primary_key, index, scheduled_at))] pub fn table_helper(_input: StdTokenStream) -> StdTokenStream { Default::default() } diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -1,6 +1,6 @@ use crate::sats::{self, derive_deserialize, derive_satstype, derive_serialize}; use crate::sym; -use crate::util::{check_duplicate, check_duplicate_msg, ident_to_litstr, match_meta, MutItem}; +use crate::util::{check_duplicate, check_duplicate_msg, ident_to_litstr, match_meta}; use heck::ToSnakeCase; use proc_macro2::{Span, TokenStream}; use quote::{format_ident, quote, quote_spanned, ToTokens}; diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -36,21 +36,6 @@ impl TableAccess { } } -// add scheduled_id and scheduled_at fields to the struct -fn add_scheduled_fields(item: &mut syn::DeriveInput) { - if let syn::Data::Struct(struct_data) = &mut item.data { - if let syn::Fields::Named(fields) = &mut struct_data.fields { - let extra_fields: syn::FieldsNamed = parse_quote!({ - #[primary_key] - #[auto_inc] - pub scheduled_id: u64, - pub scheduled_at: spacetimedb::spacetimedb_lib::ScheduleAt, - }); - fields.named.extend(extra_fields.named); - } - } -} - struct IndexArg { name: Ident, kind: IndexType, diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -365,6 +350,7 @@ enum ColumnAttr { AutoInc(Span), PrimaryKey(Span), Index(IndexArg), + ScheduledAt(Span), } impl ColumnAttr { diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -384,23 +370,18 @@ impl ColumnAttr { } else if ident == sym::primary_key { attr.meta.require_path_only()?; Some(ColumnAttr::PrimaryKey(ident.span())) + } else if ident == sym::scheduled_at { + attr.meta.require_path_only()?; + Some(ColumnAttr::ScheduledAt(ident.span())) } else { None }) } } -pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput>) -> syn::Result<TokenStream> { - let scheduled_reducer_type_check = args.scheduled.as_ref().map(|reducer| { - add_scheduled_fields(&mut item); - let struct_name = &item.ident; - quote! { - const _: () = spacetimedb::rt::scheduled_reducer_typecheck::<#struct_name>(#reducer); - } - }); - +pub(crate) fn table_impl(mut args: TableArgs, item: &syn::DeriveInput) -> syn::Result<TokenStream> { let vis = &item.vis; - let sats_ty = sats::sats_type_from_derive(&item, quote!(spacetimedb::spacetimedb_lib))?; + let sats_ty = sats::sats_type_from_derive(item, quote!(spacetimedb::spacetimedb_lib))?; let original_struct_ident = sats_ty.ident; let table_ident = &args.name; diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -429,7 +410,7 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput if fields.len() > u16::MAX.into() { return Err(syn::Error::new_spanned( - &*item, + item, "too many columns; the most a table can have is 2^16", )); } diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -438,6 +419,7 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput let mut unique_columns = vec![]; let mut sequenced_columns = vec![]; let mut primary_key_column = None; + let mut scheduled_at_column = None; for (i, field) in fields.iter().enumerate() { let col_num = i as u16; diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -446,6 +428,7 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput let mut unique = None; let mut auto_inc = None; let mut primary_key = None; + let mut scheduled_at = None; for attr in field.original_attrs { let Some(attr) = ColumnAttr::parse(attr, field_ident)? else { continue; diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -464,6 +447,10 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput primary_key = Some(span); } ColumnAttr::Index(index_arg) => args.indices.push(index_arg), + ColumnAttr::ScheduledAt(span) => { + check_duplicate(&scheduled_at, span)?; + scheduled_at = Some(span); + } } } diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -489,10 +476,27 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput check_duplicate_msg(&primary_key_column, span, "can only have one primary key per table")?; primary_key_column = Some(column); } + if let Some(span) = scheduled_at { + check_duplicate_msg( + &scheduled_at_column, + span, + "can only have one scheduled_at column per table", + )?; + scheduled_at_column = Some(column); + } columns.push(column); } + let scheduled_at_typecheck = scheduled_at_column.map(|col| { + let ty = col.ty; + quote!(let _ = |x: #ty| { let _: spacetimedb::ScheduleAt = x; };) + }); + let scheduled_id_typecheck = primary_key_column.filter(|_| args.scheduled.is_some()).map(|col| { + let ty = col.ty; + quote!(spacetimedb::rt::assert_scheduled_table_primary_key::<#ty>();) + }); + let row_type = quote!(#original_struct_ident); let mut indices = args diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -540,17 +544,46 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput let primary_col_id = primary_key_column.iter().map(|col| col.index); let sequence_col_ids = sequenced_columns.iter().map(|col| col.index); + let scheduled_reducer_type_check = args.scheduled.as_ref().map(|reducer| { + quote! { + spacetimedb::rt::scheduled_reducer_typecheck::<#original_struct_ident>(#reducer); + } + }); let schedule = args .scheduled .as_ref() .map(|reducer| { - // scheduled_at was inserted as the last field - let scheduled_at_id = (fields.len() - 1) as u16; - quote!(spacetimedb::table::ScheduleDesc { + // better error message when both are missing + if scheduled_at_column.is_none() && primary_key_column.is_none() { + return Err(syn::Error::new( + original_struct_ident.span(), + "scheduled table missing required columns; add these to your struct:\n\ + #[primary_key]\n\ + #[auto_inc]\n\ + scheduled_id: u64,\n\ + #[scheduled_at]\n\ + scheduled_at: spacetimedb::ScheduleAt,", + )); + } + let scheduled_at_column = scheduled_at_column.ok_or_else(|| { + syn::Error::new( + original_struct_ident.span(), + "scheduled tables must have a `#[scheduled_at] scheduled_at: spacetimedb::ScheduleAt` column.", + ) + })?; + let scheduled_at_id = scheduled_at_column.index; + if primary_key_column.is_none() { + return Err(syn::Error::new( + original_struct_ident.span(), + "scheduled tables should have a `#[primary_key] #[auto_inc] scheduled_id: u64` column", + )); + } + Ok(quote!(spacetimedb::table::ScheduleDesc { reducer_name: <#reducer as spacetimedb::rt::ReducerInfo>::NAME, scheduled_at_column: #scheduled_at_id, - }) + })) }) + .transpose()? .into_iter(); let unique_err = if !unique_columns.is_empty() { diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -564,7 +597,6 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput quote!(::core::convert::Infallible) }; - let field_names = fields.iter().map(|f| f.ident.unwrap()).collect::<Vec<_>>(); let field_types = fields.iter().map(|f| f.ty).collect::<Vec<_>>(); let tabletype_impl = quote! { diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -599,16 +631,6 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput } }; - let col_num = 0u16..; - let field_access_impls = quote! { - #(impl spacetimedb::table::FieldAccess<#col_num> for #original_struct_ident { - type Field = #field_types; - fn get_field(&self) -> &Self::Field { - &self.#field_names - } - })* - }; - let row_type_to_table = quote!(<#row_type as spacetimedb::table::__MapRowTypeToTable>::Table); // Output all macro data diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -635,6 +657,9 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput let emission = quote! { const _: () = { #(let _ = <#field_types as spacetimedb::rt::TableColumn>::_ITEM;)* + #scheduled_reducer_type_check + #scheduled_at_typecheck + #scheduled_id_typecheck }; #trait_def diff --git a/crates/bindings-macro/src/table.rs b/crates/bindings-macro/src/table.rs --- a/crates/bindings-macro/src/table.rs +++ b/crates/bindings-macro/src/table.rs @@ -669,10 +694,6 @@ pub(crate) fn table_impl(mut args: TableArgs, mut item: MutItem<syn::DeriveInput #schema_impl #deserialize_impl #serialize_impl - - #field_access_impls - - #scheduled_reducer_type_check }; if std::env::var("PROC_MACRO_DEBUG").is_ok() { diff --git a/crates/bindings-macro/src/util.rs b/crates/bindings-macro/src/util.rs --- a/crates/bindings-macro/src/util.rs +++ b/crates/bindings-macro/src/util.rs @@ -10,24 +10,14 @@ pub(crate) fn cvt_attr<Item: Parse + quote::ToTokens>( args: StdTokenStream, item: StdTokenStream, extra_attr: TokenStream, - f: impl FnOnce(TokenStream, MutItem<'_, Item>) -> syn::Result<TokenStream>, + f: impl FnOnce(TokenStream, &Item) -> syn::Result<TokenStream>, ) -> StdTokenStream { let item: TokenStream = item.into(); - let mut parsed_item = match syn::parse2::<Item>(item.clone()) { + let parsed_item = match syn::parse2::<Item>(item.clone()) { Ok(i) => i, Err(e) => return TokenStream::from_iter([item, e.into_compile_error()]).into(), }; - let mut modified = false; - let mut_item = MutItem { - val: &mut parsed_item, - modified: &mut modified, - }; - let generated = f(args.into(), mut_item).unwrap_or_else(syn::Error::into_compile_error); - let item = if modified { - parsed_item.into_token_stream() - } else { - item - }; + let generated = f(args.into(), &parsed_item).unwrap_or_else(syn::Error::into_compile_error); TokenStream::from_iter([extra_attr, item, generated]).into() } diff --git a/crates/bindings-macro/src/util.rs b/crates/bindings-macro/src/util.rs --- a/crates/bindings-macro/src/util.rs +++ b/crates/bindings-macro/src/util.rs @@ -35,23 +25,6 @@ pub(crate) fn ident_to_litstr(ident: &Ident) -> syn::LitStr { syn::LitStr::new(&ident.to_string(), ident.span()) } -pub(crate) struct MutItem<'a, T> { - val: &'a mut T, - modified: &'a mut bool, -} -impl<T> std::ops::Deref for MutItem<'_, T> { - type Target = T; - fn deref(&self) -> &Self::Target { - self.val - } -} -impl<T> std::ops::DerefMut for MutItem<'_, T> { - fn deref_mut(&mut self) -> &mut Self::Target { - *self.modified = true; - self.val - } -} - pub(crate) trait ErrorSource { fn error(self, msg: impl std::fmt::Display) -> syn::Error; } diff --git a/crates/bindings/src/table.rs b/crates/bindings/src/table.rs --- a/crates/bindings/src/table.rs +++ b/crates/bindings/src/table.rs @@ -262,19 +262,6 @@ impl MaybeError for AutoIncOverflow { } } -/// A trait for types exposing an operation to access their `N`th field. -/// -/// In other words, a type implementing `FieldAccess<N>` allows -/// shared projection from `self` to its `N`th field. -#[doc(hidden)] -pub trait FieldAccess<const N: u16> { - /// The type of the field at the `N`th position. - type Field; - - /// Project to the value of the field at position `N`. - fn get_field(&self) -> &Self::Field; -} - pub trait Column { type Row; type ColType;
clockworklabs__SpacetimeDB-1894
1,894
[ "1818" ]
1.78
clockworklabs/SpacetimeDB
2024-10-24T02:23:38Z
diff --git a/crates/bindings/tests/ui/reducers.rs b/crates/bindings/tests/ui/reducers.rs --- a/crates/bindings/tests/ui/reducers.rs +++ b/crates/bindings/tests/ui/reducers.rs @@ -25,8 +25,22 @@ fn missing_ctx(_a: u8) {} #[spacetimedb::reducer] fn ctx_by_val(_ctx: ReducerContext, _a: u8) {} +#[spacetimedb::table(name = scheduled_table_missing_rows, scheduled(scheduled_table_missing_rows_reducer))] +struct ScheduledTableMissingRows { + x: u8, + y: u8, +} + +// #[spacetimedb::reducer] +// fn scheduled_table_missing_rows_reducer(_ctx: &ReducerContext, _: &ScheduledTableMissingRows) {} + #[spacetimedb::table(name = scheduled_table, scheduled(scheduled_table_reducer))] struct ScheduledTable { + #[primary_key] + #[auto_inc] + scheduled_id: u64, + #[scheduled_at] + scheduled_at: spacetimedb::ScheduleAt, x: u8, y: u8, } diff --git a/crates/bindings/tests/ui/reducers.stderr b/crates/bindings/tests/ui/reducers.stderr --- a/crates/bindings/tests/ui/reducers.stderr +++ b/crates/bindings/tests/ui/reducers.stderr @@ -10,16 +10,27 @@ error: const parameters are not allowed on reducers 20 | fn const_param<const X: u8>() {} | ^^^^^^^^^^^ +error: scheduled table missing required columns; add these to your struct: + #[primary_key] + #[auto_inc] + scheduled_id: u64, + #[scheduled_at] + scheduled_at: spacetimedb::ScheduleAt, + --> tests/ui/reducers.rs:29:8 + | +29 | struct ScheduledTableMissingRows { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0593]: function is expected to take 2 arguments, but it takes 3 arguments - --> tests/ui/reducers.rs:28:56 + --> tests/ui/reducers.rs:37:56 | -28 | #[spacetimedb::table(name = scheduled_table, scheduled(scheduled_table_reducer))] +37 | #[spacetimedb::table(name = scheduled_table, scheduled(scheduled_table_reducer))] | -------------------------------------------------------^^^^^^^^^^^^^^^^^^^^^^^--- | | | | | expected function that takes 2 arguments | required by a bound introduced by this call ... -35 | fn scheduled_table_reducer(_ctx: &ReducerContext, _x: u8, _y: u8) {} +49 | fn scheduled_table_reducer(_ctx: &ReducerContext, _x: u8, _y: u8) {} | ----------------------------------------------------------------- takes 3 arguments | = note: required for `for<'a> fn(&'a ReducerContext, u8, u8) {scheduled_table_reducer}` to implement `Reducer<'_, (ScheduledTable,)>` diff --git a/crates/cli/tests/snapshots/codegen__codegen_csharp.snap b/crates/cli/tests/snapshots/codegen__codegen_csharp.snap --- a/crates/cli/tests/snapshots/codegen__codegen_csharp.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_csharp.snap @@ -372,22 +372,22 @@ namespace SpacetimeDB [DataContract] public partial class RepeatingTestArg : IDatabaseRow { - [DataMember(Name = "prev_time")] - public ulong PrevTime; [DataMember(Name = "scheduled_id")] public ulong ScheduledId; [DataMember(Name = "scheduled_at")] public SpacetimeDB.ScheduleAt ScheduledAt; + [DataMember(Name = "prev_time")] + public ulong PrevTime; public RepeatingTestArg( - ulong PrevTime, ulong ScheduledId, - SpacetimeDB.ScheduleAt ScheduledAt + SpacetimeDB.ScheduleAt ScheduledAt, + ulong PrevTime ) { - this.PrevTime = PrevTime; this.ScheduledId = ScheduledId; this.ScheduledAt = ScheduledAt; + this.PrevTime = PrevTime; } public RepeatingTestArg() diff --git a/crates/cli/tests/snapshots/codegen__codegen_rust.snap b/crates/cli/tests/snapshots/codegen__codegen_rust.snap --- a/crates/cli/tests/snapshots/codegen__codegen_rust.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_rust.snap @@ -2003,9 +2003,9 @@ pub(super) fn parse_table_update( #[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] #[sats(crate = __lib)] pub struct RepeatingTestArg { - pub prev_time: u64, pub scheduled_id: u64, pub scheduled_at: __sdk::ScheduleAt, + pub prev_time: u64, } diff --git a/crates/cli/tests/snapshots/codegen__codegen_typescript.snap b/crates/cli/tests/snapshots/codegen__codegen_typescript.snap --- a/crates/cli/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_typescript.snap @@ -2165,9 +2165,9 @@ import { deepEqual, } from "@clockworklabs/spacetimedb-sdk"; export type RepeatingTestArg = { - prevTime: bigint, scheduledId: bigint, scheduledAt: { tag: "Interval", value: bigint } | { tag: "Time", value: bigint }, + prevTime: bigint, }; /** diff --git a/crates/cli/tests/snapshots/codegen__codegen_typescript.snap b/crates/cli/tests/snapshots/codegen__codegen_typescript.snap --- a/crates/cli/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/cli/tests/snapshots/codegen__codegen_typescript.snap @@ -2180,9 +2180,9 @@ export namespace RepeatingTestArg { */ export function getTypeScriptAlgebraicType(): AlgebraicType { return AlgebraicType.createProductType([ - new ProductTypeElement("prevTime", AlgebraicType.createU64Type()), new ProductTypeElement("scheduledId", AlgebraicType.createU64Type()), new ProductTypeElement("scheduledAt", AlgebraicType.createScheduleAtType()), + new ProductTypeElement("prevTime", AlgebraicType.createU64Type()), ]); } diff --git a/modules/rust-wasm-test/src/lib.rs b/modules/rust-wasm-test/src/lib.rs --- a/modules/rust-wasm-test/src/lib.rs +++ b/modules/rust-wasm-test/src/lib.rs @@ -104,6 +104,11 @@ pub type TestAlias = TestA; #[spacetimedb::table(name = repeating_test_arg, scheduled(repeating_test))] pub struct RepeatingTestArg { + #[primary_key] + #[auto_inc] + scheduled_id: u64, + #[scheduled_at] + scheduled_at: spacetimedb::ScheduleAt, prev_time: Timestamp, } diff --git a/smoketests/tests/modules.py b/smoketests/tests/modules.py --- a/smoketests/tests/modules.py +++ b/smoketests/tests/modules.py @@ -144,6 +144,11 @@ class UploadModule2(Smoketest): #[spacetimedb::table(name = scheduled_message, public, scheduled(my_repeating_reducer))] pub struct ScheduledMessage { + #[primary_key] + #[auto_inc] + scheduled_id: u64, + #[scheduled_at] + scheduled_at: spacetimedb::ScheduleAt, prev: Timestamp, } diff --git a/smoketests/tests/schedule_reducer.py b/smoketests/tests/schedule_reducer.py --- a/smoketests/tests/schedule_reducer.py +++ b/smoketests/tests/schedule_reducer.py @@ -25,6 +25,11 @@ class CancelReducer(Smoketest): #[spacetimedb::table(name = scheduled_reducer_args, public, scheduled(reducer))] pub struct ScheduledReducerArgs { + #[primary_key] + #[auto_inc] + scheduled_id: u64, + #[scheduled_at] + scheduled_at: spacetimedb::ScheduleAt, num: i32, } diff --git a/smoketests/tests/schedule_reducer.py b/smoketests/tests/schedule_reducer.py --- a/smoketests/tests/schedule_reducer.py +++ b/smoketests/tests/schedule_reducer.py @@ -53,6 +58,11 @@ class SubscribeScheduledTable(Smoketest): #[spacetimedb::table(name = scheduled_table, public, scheduled(my_reducer))] pub struct ScheduledTable { + #[primary_key] + #[auto_inc] + scheduled_id: u64, + #[scheduled_at] + scheduled_at: spacetimedb::ScheduleAt, prev: Timestamp, }
`#[spacetimedb::table(scheduled())]` should probably not autogen the scheduled_id/at fields for you - should just require they already be present UX story: > Someone new comes to the codebase and wants to insert a row into the table. the compiler complains "missing fields scheduled_id and schedule_at" and so they go to the struct definition but they're not there. what the heck are they?? what do they do?? how is the compiler complaining about these fields that don't exist??
8075567da42408ecf53146fb3f72832e41d8a956
[ "ui" ]
[ "deptree_snapshot", "tests/ui/tables.rs", "crates/bindings/src/rng.rs - rng::ReducerContext::rng (line 30)" ]
[]
[]
2025-02-11T02:53:30Z
058c0db72f43fbe1574d0db654560e693755cd7e
diff --git /dev/null b/.changes/use_https_windows-and-android-config.md new file mode 100644 --- /dev/null +++ b/.changes/use_https_windows-and-android-config.md @@ -0,0 +1,6 @@ +--- +"tauri": "minor:feat" +"tauri-utils": "minor:feat" +--- + +Add `app > windows > useHttpsScheme` config option to choose whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android diff --git /dev/null b/.changes/use_https_windows-and-android.md new file mode 100644 --- /dev/null +++ b/.changes/use_https_windows-and-android.md @@ -0,0 +1,7 @@ +--- +"tauri": "minor:feat" +"tauri-runtime": "minor:feat" +"tauri-runtime-wry": "minor:feat" +--- + +Add `WebviewWindowBuilder/WebviewBuilder::use_https_scheme` to choose whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -486,6 +486,11 @@ "description": "Whether browser extensions can be installed for the webview process\n\n ## Platform-specific:\n\n - **Windows**: Enables the WebView2 environment's [`AreBrowserExtensionsEnabled`](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2environmentoptions?view=webview2-winrt-1.0.2739.15#arebrowserextensionsenabled)\n - **MacOS / Linux / iOS / Android** - Unsupported.", "default": false, "type": "boolean" + }, + "useHttpsScheme": { + "description": "Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`.\n\n ## Note\n\n Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux.\n\n ## Warning\n\n Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access the old data.", + "default": false, + "type": "boolean" } }, "additionalProperties": false diff --git a/crates/tauri-cli/src/migrate/migrations/v1/config.rs b/crates/tauri-cli/src/migrate/migrations/v1/config.rs --- a/crates/tauri-cli/src/migrate/migrations/v1/config.rs +++ b/crates/tauri-cli/src/migrate/migrations/v1/config.rs @@ -87,6 +87,28 @@ fn migrate_config(config: &mut Value) -> Result<MigratedConfig> { migrated.permissions = permissions; } + // dangerousUseHttpScheme/useHttpsScheme + let dangerouse_use_http = tauri_config + .get("security") + .and_then(|w| w.as_object()) + .and_then(|w| { + w.get("dangerousUseHttpScheme") + .or_else(|| w.get("dangerous-use-http-scheme")) + }) + .and_then(|v| v.as_bool()) + .unwrap_or_default(); + + if let Some(windows) = tauri_config + .get_mut("windows") + .and_then(|w| w.as_array_mut()) + { + for window in windows { + if let Some(window) = window.as_object_mut() { + window.insert("useHttpsScheme".to_string(), (!dangerouse_use_http).into()); + } + } + } + // security if let Some(security) = tauri_config .get_mut("security") diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -22,8 +22,8 @@ use tauri_runtime::{ monitor::Monitor, webview::{DetachedWebview, DownloadEvent, PendingWebview, WebviewIpcHandler}, window::{ - CursorIcon, DetachedWindow, DragDropEvent, PendingWindow, RawWindow, WebviewEvent, - WindowBuilder, WindowBuilderBase, WindowEvent, WindowId, WindowSizeConstraints, + CursorIcon, DetachedWindow, DetachedWindowWebview, DragDropEvent, PendingWindow, RawWindow, + WebviewEvent, WindowBuilder, WindowBuilderBase, WindowEvent, WindowId, WindowSizeConstraints, }, DeviceEventFilter, Error, EventLoopProxy, ExitRequestedEventAction, Icon, ProgressBarState, ProgressBarStatus, Result, RunEvent, Runtime, RuntimeHandle, RuntimeInitArgs, UserAttentionType, diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -276,7 +276,16 @@ impl<T: UserEvent> Context<T> { let label = pending.label.clone(); let context = self.clone(); let window_id = self.next_window_id(); - let webview_id = pending.webview.as_ref().map(|_| context.next_webview_id()); + let (webview_id, use_https_scheme) = pending + .webview + .as_ref() + .map(|w| { + ( + Some(context.next_webview_id()), + w.webview_attributes.use_https_scheme, + ) + }) + .unwrap_or((None, false)); send_user_message( self, diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -300,13 +309,19 @@ impl<T: UserEvent> Context<T> { context: self.clone(), }; - let detached_webview = webview_id.map(|id| DetachedWebview { - label: label.clone(), - dispatcher: WryWebviewDispatcher { - window_id: Arc::new(Mutex::new(window_id)), - webview_id: id, - context: self.clone(), - }, + let detached_webview = webview_id.map(|id| { + let webview = DetachedWebview { + label: label.clone(), + dispatcher: WryWebviewDispatcher { + window_id: Arc::new(Mutex::new(window_id)), + webview_id: id, + context: self.clone(), + }, + }; + DetachedWindowWebview { + webview, + use_https_scheme, + } }); Ok(DetachedWindow { diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -746,6 +761,8 @@ impl WindowBuilder for WindowBuilderWrapper { builder = builder.title_bar_style(TitleBarStyle::Visible); } + builder = builder.title("Tauri App"); + builder } diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -2497,10 +2514,16 @@ impl<T: UserEvent> Runtime<T> for Wry<T> { ) -> Result<DetachedWindow<T, Self>> { let label = pending.label.clone(); let window_id = self.context.next_window_id(); - let webview_id = pending + let (webview_id, use_https_scheme) = pending .webview .as_ref() - .map(|_| self.context.next_webview_id()); + .map(|w| { + ( + Some(self.context.next_webview_id()), + w.webview_attributes.use_https_scheme, + ) + }) + .unwrap_or((None, false)); let window = create_window( window_id, diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -2524,13 +2547,19 @@ impl<T: UserEvent> Runtime<T> for Wry<T> { .borrow_mut() .insert(window_id, window); - let detached_webview = webview_id.map(|id| DetachedWebview { - label: label.clone(), - dispatcher: WryWebviewDispatcher { - window_id: Arc::new(Mutex::new(window_id)), - webview_id: id, - context: self.context.clone(), - }, + let detached_webview = webview_id.map(|id| { + let webview = DetachedWebview { + label: label.clone(), + dispatcher: WryWebviewDispatcher { + window_id: Arc::new(Mutex::new(window_id)), + webview_id: id, + context: self.context.clone(), + }, + }; + DetachedWindowWebview { + webview, + use_https_scheme, + } }); Ok(DetachedWindow { diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -4026,6 +4055,11 @@ fn create_webview<T: UserEvent>( .with_clipboard(webview_attributes.clipboard) .with_hotkeys_zoom(webview_attributes.zoom_hotkeys_enabled); + #[cfg(any(target_os = "windows", target_os = "android"))] + { + webview_builder = webview_builder.with_https_scheme(webview_attributes.use_https_scheme); + } + if webview_attributes.drag_drop_handler_enabled { let proxy = context.proxy.clone(); let window_id_ = window_id.clone(); diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -4168,11 +4202,6 @@ fn create_webview<T: UserEvent>( }); } - #[cfg(windows)] - { - webview_builder = webview_builder.with_https_scheme(false); - } - #[cfg(windows)] { webview_builder = webview_builder diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -4282,7 +4311,7 @@ fn create_webview<T: UserEvent>( builder } } - .map_err(|e| Error::CreateWebview(Box::new(dbg!(e))))?; + .map_err(|e| Error::CreateWebview(Box::new(e)))?; if kind == WebviewKind::WindowContent { #[cfg(any( diff --git a/crates/tauri-runtime/src/webview.rs b/crates/tauri-runtime/src/webview.rs --- a/crates/tauri-runtime/src/webview.rs +++ b/crates/tauri-runtime/src/webview.rs @@ -210,6 +210,7 @@ pub struct WebviewAttributes { pub proxy_url: Option<Url>, pub zoom_hotkeys_enabled: bool, pub browser_extensions_enabled: bool, + pub use_https_scheme: bool, } impl From<&WindowConfig> for WebviewAttributes { diff --git a/crates/tauri-runtime/src/webview.rs b/crates/tauri-runtime/src/webview.rs --- a/crates/tauri-runtime/src/webview.rs +++ b/crates/tauri-runtime/src/webview.rs @@ -218,6 +219,7 @@ impl From<&WindowConfig> for WebviewAttributes { .incognito(config.incognito) .focused(config.focus) .zoom_hotkeys_enabled(config.zoom_hotkeys_enabled) + .use_https_scheme(config.use_https_scheme) .browser_extensions_enabled(config.browser_extensions_enabled); #[cfg(any(not(target_os = "macos"), feature = "macos-private-api"))] { diff --git a/crates/tauri-runtime/src/webview.rs b/crates/tauri-runtime/src/webview.rs --- a/crates/tauri-runtime/src/webview.rs +++ b/crates/tauri-runtime/src/webview.rs @@ -264,6 +266,7 @@ impl WebviewAttributes { proxy_url: None, zoom_hotkeys_enabled: false, browser_extensions_enabled: false, + use_https_scheme: false, } } diff --git a/crates/tauri-runtime/src/webview.rs b/crates/tauri-runtime/src/webview.rs --- a/crates/tauri-runtime/src/webview.rs +++ b/crates/tauri-runtime/src/webview.rs @@ -388,6 +391,21 @@ impl WebviewAttributes { self.browser_extensions_enabled = enabled; self } + + /// Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`. + /// + /// ## Note + /// + /// Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux. + /// + /// ## Warning + /// + /// Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access the old data. + #[must_use] + pub fn use_https_scheme(mut self, enabled: bool) -> Self { + self.use_https_scheme = enabled; + self + } } /// IPC handler. diff --git a/crates/tauri-runtime/src/window.rs b/crates/tauri-runtime/src/window.rs --- a/crates/tauri-runtime/src/window.rs +++ b/crates/tauri-runtime/src/window.rs @@ -512,7 +512,23 @@ pub struct DetachedWindow<T: UserEvent, R: Runtime<T>> { pub dispatcher: R::WindowDispatcher, /// The webview dispatcher in case this window has an attached webview. - pub webview: Option<DetachedWebview<T, R>>, + pub webview: Option<DetachedWindowWebview<T, R>>, +} + +/// A detached webview associated with a window. +#[derive(Debug)] +pub struct DetachedWindowWebview<T: UserEvent, R: Runtime<T>> { + pub webview: DetachedWebview<T, R>, + pub use_https_scheme: bool, +} + +impl<T: UserEvent, R: Runtime<T>> Clone for DetachedWindowWebview<T, R> { + fn clone(&self) -> Self { + Self { + webview: self.webview.clone(), + use_https_scheme: self.use_https_scheme, + } + } } impl<T: UserEvent, R: Runtime<T>> Clone for DetachedWindow<T, R> { diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -486,6 +486,11 @@ "description": "Whether browser extensions can be installed for the webview process\n\n ## Platform-specific:\n\n - **Windows**: Enables the WebView2 environment's [`AreBrowserExtensionsEnabled`](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/winrt/microsoft_web_webview2_core/corewebview2environmentoptions?view=webview2-winrt-1.0.2739.15#arebrowserextensionsenabled)\n - **MacOS / Linux / iOS / Android** - Unsupported.", "default": false, "type": "boolean" + }, + "useHttpsScheme": { + "description": "Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`.\n\n ## Note\n\n Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux.\n\n ## Warning\n\n Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access the old data.", + "default": false, + "type": "boolean" } }, "additionalProperties": false diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -1519,6 +1519,18 @@ pub struct WindowConfig { /// - **MacOS / Linux / iOS / Android** - Unsupported. #[serde(default)] pub browser_extensions_enabled: bool, + + /// Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`. + /// + /// ## Note + /// + /// Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux. + /// + /// ## Warning + /// + /// Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access the old data. + #[serde(default, alias = "use-https-scheme")] + pub use_https_scheme: bool, } impl Default for WindowConfig { diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -1567,6 +1579,7 @@ impl Default for WindowConfig { proxy_url: None, zoom_hotkeys_enabled: false, browser_extensions_enabled: false, + use_https_scheme: false, } } } diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -2538,6 +2551,7 @@ mod build { let parent = opt_str_lit(self.parent.as_ref()); let zoom_hotkeys_enabled = self.zoom_hotkeys_enabled; let browser_extensions_enabled = self.browser_extensions_enabled; + let use_https_scheme = self.use_https_scheme; literal_struct!( tokens, diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -2584,7 +2598,8 @@ mod build { incognito, parent, zoom_hotkeys_enabled, - browser_extensions_enabled + browser_extensions_enabled, + use_https_scheme ); } } diff --git a/crates/tauri/scripts/core.js b/crates/tauri/scripts/core.js --- a/crates/tauri/scripts/core.js +++ b/crates/tauri/scripts/core.js @@ -8,12 +8,13 @@ } const osName = __TEMPLATE_os_name__ + const protocolScheme = __TEMPLATE_protocol_scheme__ Object.defineProperty(window.__TAURI_INTERNALS__, 'convertFileSrc', { value: function (filePath, protocol = 'asset') { const path = encodeURIComponent(filePath) return osName === 'windows' || osName === 'android' - ? `http://${protocol}.localhost/${path}` + ? `${protocolScheme}://${protocol}.localhost/${path}` : `${protocol}://localhost/${path}` } }) diff --git a/crates/tauri/src/app.rs b/crates/tauri/src/app.rs --- a/crates/tauri/src/app.rs +++ b/crates/tauri/src/app.rs @@ -268,6 +268,10 @@ pub struct AssetResolver<R: Runtime> { impl<R: Runtime> AssetResolver<R> { /// Gets the app asset associated with the given path. /// + /// By default it tries to infer your application's URL scheme in production by checking if all webviews + /// were configured with [`crate::webview::WebviewBuilder::use_https_scheme`] or `tauri.conf.json > app > windows > useHttpsScheme`. + /// If you are resolving an asset for a webview with a more dynamic configuration, see [`AssetResolver::get_for_scheme`]. + /// /// Resolves to the embedded asset that is part of the app /// in dev when [`devUrl`](https://v2.tauri.app/reference/config/#devurl) points to a folder in your filesystem /// or in production when [`frontendDist`](https://v2.tauri.app/reference/config/#frontenddist) diff --git a/crates/tauri/src/app.rs b/crates/tauri/src/app.rs --- a/crates/tauri/src/app.rs +++ b/crates/tauri/src/app.rs @@ -276,6 +280,19 @@ impl<R: Runtime> AssetResolver<R> { /// Fallbacks to reading the asset from the [distDir] folder so the behavior is consistent in development. /// Note that the dist directory must exist so you might need to build your frontend assets first. pub fn get(&self, path: String) -> Option<Asset> { + let use_https_scheme = self + .manager + .webviews() + .values() + .all(|webview| webview.use_https_scheme()); + self.get_for_scheme(path, use_https_scheme) + } + + /// Same as [AssetResolver::get] but resolves the custom protocol scheme based on a parameter. + /// + /// - `use_https_scheme`: If `true` when using [`Pattern::Isolation`](tauri::Pattern::Isolation), + /// the csp header will contain `https://tauri.localhost` instead of `http://tauri.localhost` + pub fn get_for_scheme(&self, path: String, use_https_scheme: bool) -> Option<Asset> { #[cfg(dev)] { // on dev if the devPath is a path to a directory we have the embedded assets diff --git a/crates/tauri/src/app.rs b/crates/tauri/src/app.rs --- a/crates/tauri/src/app.rs +++ b/crates/tauri/src/app.rs @@ -306,7 +323,7 @@ impl<R: Runtime> AssetResolver<R> { } } - self.manager.get_asset(path).ok() + self.manager.get_asset(path, use_https_scheme).ok() } /// Iterate on all assets. diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -340,9 +340,10 @@ impl<R: Runtime> AppManager<R> { self.config.build.dev_url.as_ref() } - pub(crate) fn protocol_url(&self) -> Cow<'_, Url> { + pub(crate) fn protocol_url(&self, https: bool) -> Cow<'_, Url> { if cfg!(windows) || cfg!(target_os = "android") { - Cow::Owned(Url::parse("http://tauri.localhost").unwrap()) + let scheme = if https { "https" } else { "http" }; + Cow::Owned(Url::parse(&format!("{scheme}://tauri.localhost")).unwrap()) } else { Cow::Owned(Url::parse("tauri://localhost").unwrap()) } diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -351,10 +352,10 @@ impl<R: Runtime> AppManager<R> { /// Get the base URL to use for webview requests. /// /// In dev mode, this will be based on the `devUrl` configuration value. - pub(crate) fn get_url(&self) -> Cow<'_, Url> { + pub(crate) fn get_url(&self, https: bool) -> Cow<'_, Url> { match self.base_path() { Some(url) => Cow::Borrowed(url), - _ => self.protocol_url(), + _ => self.protocol_url(https), } } diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -372,7 +373,11 @@ impl<R: Runtime> AppManager<R> { } } - pub fn get_asset(&self, mut path: String) -> Result<Asset, Box<dyn std::error::Error>> { + pub fn get_asset( + &self, + mut path: String, + use_https_schema: bool, + ) -> Result<Asset, Box<dyn std::error::Error>> { let assets = &self.assets; if path.ends_with('/') { path.pop(); diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -435,7 +440,7 @@ impl<R: Runtime> AppManager<R> { let default_src = csp_map .entry("default-src".into()) .or_insert_with(Default::default); - default_src.push(crate::pattern::format_real_schema(schema)); + default_src.push(crate::pattern::format_real_schema(schema, use_https_schema)); } csp_header.replace(Csp::DirectiveMap(csp_map).to_string()); diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -137,10 +137,14 @@ impl<R: Runtime> WebviewManager<R> { let mut webview_attributes = pending.webview_attributes; + let use_https_scheme = webview_attributes.use_https_scheme; + let ipc_init = IpcJavascript { isolation_origin: &match &*app_manager.pattern { #[cfg(feature = "isolation")] - crate::Pattern::Isolation { schema, .. } => crate::pattern::format_real_schema(schema), + crate::Pattern::Isolation { schema, .. } => { + crate::pattern::format_real_schema(schema, use_https_scheme) + } _ => "".to_string(), }, } diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -180,6 +184,7 @@ impl<R: Runtime> WebviewManager<R> { &ipc_init.into_string(), &pattern_init.into_string(), is_init_global, + use_https_scheme, )?); for plugin_init_script in plugin_init_scripts { diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -190,7 +195,7 @@ impl<R: Runtime> WebviewManager<R> { if let crate::Pattern::Isolation { schema, .. } = &*app_manager.pattern { webview_attributes = webview_attributes.initialization_script( &IsolationJavascript { - isolation_src: &crate::pattern::format_real_schema(schema), + isolation_src: &crate::pattern::format_real_schema(schema, use_https_scheme), style: tauri_utils::pattern::isolation::IFRAME_STYLE, } .render_default(&Default::default())? diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -232,7 +237,8 @@ impl<R: Runtime> WebviewManager<R> { && window_url.scheme() != "http" && window_url.scheme() != "https" { - format!("http://{}.localhost", window_url.scheme()) + let https = if use_https_scheme { "https" } else { "http" }; + format!("{https}://{}.localhost", window_url.scheme()) } else if let Some(host) = window_url.host() { format!( "{}://{}{}", diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -320,6 +326,7 @@ impl<R: Runtime> WebviewManager<R> { assets.clone(), *crypto_keys.aes_gcm().raw(), window_origin, + use_https_scheme, ); pending.register_uri_scheme_protocol(schema, move |webview_id, request, responder| { protocol(webview_id, request, UriSchemeResponder(responder)) diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -335,6 +342,7 @@ impl<R: Runtime> WebviewManager<R> { ipc_script: &str, pattern_script: &str, with_global_tauri: bool, + use_https_scheme: bool, ) -> crate::Result<String> { #[derive(Template)] #[default_template("../../scripts/init.js")] diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -357,6 +365,7 @@ impl<R: Runtime> WebviewManager<R> { #[default_template("../../scripts/core.js")] struct CoreJavascript<'a> { os_name: &'a str, + protocol_scheme: &'a str, invoke_key: &'a str, } diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -378,6 +387,7 @@ impl<R: Runtime> WebviewManager<R> { bundle_script, core_script: &CoreJavascript { os_name: std::env::consts::OS, + protocol_scheme: if use_https_scheme { "https" } else { "http" }, invoke_key: self.invoke_key(), } .render_default(&Default::default())? diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -411,7 +421,7 @@ impl<R: Runtime> WebviewManager<R> { let url = if PROXY_DEV_SERVER { Cow::Owned(Url::parse("tauri://localhost").unwrap()) } else { - app_manager.get_url() + app_manager.get_url(pending.webview_attributes.use_https_scheme) }; // ignore "index.html" just to simplify the url if path.to_str() != Some("index.html") { diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -425,7 +435,7 @@ impl<R: Runtime> WebviewManager<R> { } } WebviewUrl::External(url) => { - let config_url = app_manager.get_url(); + let config_url = app_manager.get_url(pending.webview_attributes.use_https_scheme); let is_local = config_url.make_relative(url).is_some(); let mut url = url.clone(); if is_local && PROXY_DEV_SERVER { diff --git a/crates/tauri/src/manager/webview.rs b/crates/tauri/src/manager/webview.rs --- a/crates/tauri/src/manager/webview.rs +++ b/crates/tauri/src/manager/webview.rs @@ -572,8 +582,9 @@ impl<R: Runtime> WebviewManager<R> { &self, window: Window<R>, webview: DetachedWebview<EventLoopMessage, R>, + use_https_scheme: bool, ) -> Webview<R> { - let webview = Webview::new(window, webview); + let webview = Webview::new(window, webview, use_https_scheme); let webview_event_listeners = self.event_listeners.clone(); let webview_ = webview.clone(); diff --git a/crates/tauri/src/pattern.rs b/crates/tauri/src/pattern.rs --- a/crates/tauri/src/pattern.rs +++ b/crates/tauri/src/pattern.rs @@ -85,9 +85,10 @@ pub(crate) struct PatternJavascript { } #[allow(dead_code)] -pub(crate) fn format_real_schema(schema: &str) -> String { +pub(crate) fn format_real_schema(schema: &str, https: bool) -> String { if cfg!(windows) || cfg!(target_os = "android") { - format!("http://{schema}.{ISOLATION_IFRAME_SRC_DOMAIN}") + let scheme = if https { "https" } else { "http" }; + format!("{scheme}://{schema}.{ISOLATION_IFRAME_SRC_DOMAIN}") } else { format!("{schema}://{ISOLATION_IFRAME_SRC_DOMAIN}") } diff --git a/crates/tauri/src/protocol/isolation.rs b/crates/tauri/src/protocol/isolation.rs --- a/crates/tauri/src/protocol/isolation.rs +++ b/crates/tauri/src/protocol/isolation.rs @@ -21,9 +21,11 @@ pub fn get<R: Runtime>( assets: Arc<EmbeddedAssets>, aes_gcm_key: [u8; 32], window_origin: String, + use_https_scheme: bool, ) -> UriSchemeProtocolHandler { let frame_src = if cfg!(any(windows, target_os = "android")) { - format!("http://{schema}.localhost") + let https = if use_https_scheme { "https" } else { "http" }; + format!("{https}://{schema}.localhost") } else { format!("{schema}:") }; diff --git a/crates/tauri/src/protocol/tauri.rs b/crates/tauri/src/protocol/tauri.rs --- a/crates/tauri/src/protocol/tauri.rs +++ b/crates/tauri/src/protocol/tauri.rs @@ -30,7 +30,10 @@ pub fn get<R: Runtime>( ) -> UriSchemeProtocolHandler { #[cfg(all(dev, mobile))] let url = { - let mut url = manager.get_url().as_str().to_string(); + let mut url = manager + .get_url(window_origin.starts_with("https")) + .as_str() + .to_string(); if url.ends_with('/') { url.pop(); } diff --git a/crates/tauri/src/protocol/tauri.rs b/crates/tauri/src/protocol/tauri.rs --- a/crates/tauri/src/protocol/tauri.rs +++ b/crates/tauri/src/protocol/tauri.rs @@ -152,7 +155,8 @@ fn get_response<R: Runtime>( #[cfg(not(all(dev, mobile)))] let mut response = { - let asset = manager.get_asset(path)?; + let use_https_scheme = request.uri().scheme() == Some(&http::uri::Scheme::HTTPS); + let asset = manager.get_asset(path, use_https_scheme)?; builder = builder.header(CONTENT_TYPE, &asset.mime_type); if let Some(csp) = &asset.csp_header { builder = builder.header("Content-Security-Policy", csp); diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -605,11 +605,17 @@ tauri::Builder::default() pending.webview_attributes.bounds = Some(tauri_runtime::Rect { size, position }); + let use_https_scheme = pending.webview_attributes.use_https_scheme; + let webview = match &mut window.runtime() { RuntimeOrDispatch::Dispatch(dispatcher) => dispatcher.create_webview(pending), _ => unimplemented!(), } - .map(|webview| app_manager.webview.attach_webview(window.clone(), webview))?; + .map(|webview| { + app_manager + .webview + .attach_webview(window.clone(), webview, use_https_scheme) + })?; Ok(webview) } diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -794,6 +800,21 @@ fn main() { self.webview_attributes.browser_extensions_enabled = enabled; self } + + /// Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`. + /// + /// ## Note + /// + /// Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux. + /// + /// ## Warning + /// + /// Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access the old data. + #[must_use] + pub fn use_https_scheme(mut self, enabled: bool) -> Self { + self.webview_attributes.use_https_scheme = enabled; + self + } } /// Webview. diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -806,6 +827,7 @@ pub struct Webview<R: Runtime> { pub(crate) manager: Arc<AppManager<R>>, pub(crate) app_handle: AppHandle<R>, pub(crate) resources_table: Arc<Mutex<ResourceTable>>, + use_https_scheme: bool, } impl<R: Runtime> std::fmt::Debug for Webview<R> { diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -813,6 +835,7 @@ impl<R: Runtime> std::fmt::Debug for Webview<R> { f.debug_struct("Window") .field("window", &self.window.lock().unwrap()) .field("webview", &self.webview) + .field("use_https_scheme", &self.use_https_scheme) .finish() } } diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -825,6 +848,7 @@ impl<R: Runtime> Clone for Webview<R> { manager: self.manager.clone(), app_handle: self.app_handle.clone(), resources_table: self.resources_table.clone(), + use_https_scheme: self.use_https_scheme, } } } diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -847,13 +871,18 @@ impl<R: Runtime> PartialEq for Webview<R> { /// Base webview functions. impl<R: Runtime> Webview<R> { /// Create a new webview that is attached to the window. - pub(crate) fn new(window: Window<R>, webview: DetachedWebview<EventLoopMessage, R>) -> Self { + pub(crate) fn new( + window: Window<R>, + webview: DetachedWebview<EventLoopMessage, R>, + use_https_scheme: bool, + ) -> Self { Self { manager: window.manager.clone(), app_handle: window.app_handle.clone(), window: Arc::new(Mutex::new(window)), webview, resources_table: Default::default(), + use_https_scheme, } } diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -880,6 +909,11 @@ impl<R: Runtime> Webview<R> { &self.webview.label } + /// Whether the webview was configured to use the HTTPS scheme or not. + pub(crate) fn use_https_scheme(&self) -> bool { + self.use_https_scheme + } + /// Registers a window event listener. pub fn on_webview_event<F: Fn(&WebviewEvent) + Send + 'static>(&self, f: F) { self diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -1180,9 +1214,11 @@ fn main() { } fn is_local_url(&self, current_url: &Url) -> bool { + let uses_https = current_url.scheme() == "https"; + // if from `tauri://` custom protocol ({ - let protocol_url = self.manager().protocol_url(); + let protocol_url = self.manager().protocol_url(uses_https); current_url.scheme() == protocol_url.scheme() && current_url.domain() == protocol_url.domain() }) || diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -1190,7 +1226,7 @@ fn main() { // or if relative to `devUrl` or `frontendDist` self .manager() - .get_url() + .get_url(uses_https) .make_relative(current_url) .is_some() diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -1206,7 +1242,7 @@ fn main() { // so we check using the first part of the domain #[cfg(any(windows, target_os = "android"))] let local = { - let protocol_url = self.manager().protocol_url(); + let protocol_url = self.manager().protocol_url(uses_https); let maybe_protocol = current_url .domain() .and_then(|d| d .split_once('.')) diff --git a/crates/tauri/src/webview/webview_window.rs b/crates/tauri/src/webview/webview_window.rs --- a/crates/tauri/src/webview/webview_window.rs +++ b/crates/tauri/src/webview/webview_window.rs @@ -898,6 +898,21 @@ impl<'a, R: Runtime, M: Manager<R>> WebviewWindowBuilder<'a, R, M> { self.webview_builder = self.webview_builder.browser_extensions_enabled(enabled); self } + + /// Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`. + /// + /// ## Note + /// + /// Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux. + /// + /// ## Warning + /// + /// Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access the old data. + #[must_use] + pub fn use_https_scheme(mut self, enabled: bool) -> Self { + self.webview_builder = self.webview_builder.use_https_scheme(enabled); + self + } } /// A type that wraps a [`Window`] together with a [`Webview`]. diff --git a/crates/tauri/src/window/mod.rs b/crates/tauri/src/window/mod.rs --- a/crates/tauri/src/window/mod.rs +++ b/crates/tauri/src/window/mod.rs @@ -381,7 +381,11 @@ tauri::Builder::default() ); if let Some(webview) = detached_window.webview { - app_manager.webview.attach_webview(window.clone(), webview); + app_manager.webview.attach_webview( + window.clone(), + webview.webview, + webview.use_https_scheme, + ); } window diff --git a/packages/api/src/webview.ts b/packages/api/src/webview.ts --- a/packages/api/src/webview.ts +++ b/packages/api/src/webview.ts @@ -734,6 +734,21 @@ interface WebviewOptions { * - **Android / iOS**: Unsupported. */ zoomHotkeysEnabled?: boolean + + /** + * Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`. + * + * #### Note + * + * Using a `https` scheme will NOT allow mixed content when trying to fetch `http` endpoints and therefore will not match the behavior of the `<scheme>://localhost` protocols used on macOS and Linux. + * + * #### Warning + * + * Changing this value between releases will change the IndexedDB, cookies and localstorage location and your app will not be able to access them. + * + * @since 2.1.0 + */ + useHttpsScheme?: boolean } export { Webview, getCurrentWebview, getAllWebviews }
tauri-apps__tauri-11477
11,477
[ "11252" ]
1.77
tauri-apps/tauri
2024-10-24T08:00:11Z
diff --git a/crates/tauri-cli/src/migrate/migrations/v1/config.rs b/crates/tauri-cli/src/migrate/migrations/v1/config.rs --- a/crates/tauri-cli/src/migrate/migrations/v1/config.rs +++ b/crates/tauri-cli/src/migrate/migrations/v1/config.rs @@ -802,7 +824,8 @@ mod test { "pattern": { "use": "brownfield" }, "security": { "csp": "default-src 'self' tauri:" - } + }, + "windows": [{}] } }); diff --git a/crates/tauri-cli/src/migrate/migrations/v1/config.rs b/crates/tauri-cli/src/migrate/migrations/v1/config.rs --- a/crates/tauri-cli/src/migrate/migrations/v1/config.rs +++ b/crates/tauri-cli/src/migrate/migrations/v1/config.rs @@ -907,6 +930,8 @@ mod test { migrated["app"]["withGlobalTauri"], original["build"]["withGlobalTauri"] ); + + assert_eq!(migrated["app"]["windows"][0]["useHttpsScheme"], true); } #[test] diff --git a/crates/tauri-cli/src/migrate/migrations/v1/config.rs b/crates/tauri-cli/src/migrate/migrations/v1/config.rs --- a/crates/tauri-cli/src/migrate/migrations/v1/config.rs +++ b/crates/tauri-cli/src/migrate/migrations/v1/config.rs @@ -941,6 +966,28 @@ mod test { ); } + #[test] + fn migrate_dangerous_use_http_scheme() { + let original = serde_json::json!({ + "tauri": { + "windows": [{}], + "security": { + "dangerousUseHttpScheme": true, + } + } + }); + + let migrated = migrate(&original); + assert_eq!( + !migrated["app"]["windows"][0]["useHttpsScheme"] + .as_bool() + .unwrap(), + original["tauri"]["security"]["dangerousUseHttpScheme"] + .as_bool() + .unwrap() + ); + } + #[test] fn can_migrate_default_config() { let original = serde_json::to_value(tauri_utils_v1::config::Config::default()).unwrap(); diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -771,17 +776,25 @@ mod test { #[cfg(custom_protocol)] { assert_eq!( - manager.get_url().to_string(), + manager.get_url(false).to_string(), if cfg!(windows) || cfg!(target_os = "android") { "http://tauri.localhost/" } else { "tauri://localhost" } ); + assert_eq!( + manager.get_url(true).to_string(), + if cfg!(windows) || cfg!(target_os = "android") { + "https://tauri.localhost/" + } else { + "tauri://localhost" + } + ); } #[cfg(dev)] - assert_eq!(manager.get_url().to_string(), "http://localhost:4000/"); + assert_eq!(manager.get_url(false).to_string(), "http://localhost:4000/"); } struct EventSetup { diff --git a/crates/tauri/src/test/mock_runtime.rs b/crates/tauri/src/test/mock_runtime.rs --- a/crates/tauri/src/test/mock_runtime.rs +++ b/crates/tauri/src/test/mock_runtime.rs @@ -9,8 +9,10 @@ use tauri_runtime::{ dpi::{PhysicalPosition, PhysicalSize, Position, Size}, monitor::Monitor, webview::{DetachedWebview, PendingWebview}, - window::{CursorIcon, DetachedWindow, PendingWindow, RawWindow, WindowEvent, WindowId}, - window::{WindowBuilder, WindowBuilderBase}, + window::{ + CursorIcon, DetachedWindow, DetachedWindowWebview, PendingWindow, RawWindow, WindowBuilder, + WindowBuilderBase, WindowEvent, WindowId, + }, DeviceEventFilter, Error, EventLoopProxy, ExitRequestedEventAction, Icon, ProgressBarState, Result, RunEvent, Runtime, RuntimeHandle, RuntimeInitArgs, UserAttentionType, UserEvent, WebviewDispatch, WindowDispatch, WindowEventId, diff --git a/crates/tauri/src/test/mock_runtime.rs b/crates/tauri/src/test/mock_runtime.rs --- a/crates/tauri/src/test/mock_runtime.rs +++ b/crates/tauri/src/test/mock_runtime.rs @@ -158,14 +160,17 @@ impl<T: UserEvent> RuntimeHandle<T> for MockRuntimeHandle { }, ); - let webview = webview_id.map(|id| DetachedWebview { - label: pending.label.clone(), - dispatcher: MockWebviewDispatcher { - id, - context: self.context.clone(), - url: Arc::new(Mutex::new(pending.webview.unwrap().url)), - last_evaluated_script: Default::default(), + let webview = webview_id.map(|id| DetachedWindowWebview { + webview: DetachedWebview { + label: pending.label.clone(), + dispatcher: MockWebviewDispatcher { + id, + context: self.context.clone(), + url: Arc::new(Mutex::new(pending.webview.unwrap().url)), + last_evaluated_script: Default::default(), + }, }, + use_https_scheme: false, }); Ok(DetachedWindow { diff --git a/crates/tauri/src/test/mock_runtime.rs b/crates/tauri/src/test/mock_runtime.rs --- a/crates/tauri/src/test/mock_runtime.rs +++ b/crates/tauri/src/test/mock_runtime.rs @@ -773,14 +778,17 @@ impl<T: UserEvent> WindowDispatch<T> for MockWindowDispatcher { }, ); - let webview = webview_id.map(|id| DetachedWebview { - label: pending.label.clone(), - dispatcher: MockWebviewDispatcher { - id, - context: self.context.clone(), - url: Arc::new(Mutex::new(pending.webview.unwrap().url)), - last_evaluated_script: Default::default(), + let webview = webview_id.map(|id| DetachedWindowWebview { + webview: DetachedWebview { + label: pending.label.clone(), + dispatcher: MockWebviewDispatcher { + id, + context: self.context.clone(), + url: Arc::new(Mutex::new(pending.webview.unwrap().url)), + last_evaluated_script: Default::default(), + }, }, + use_https_scheme: false, }); Ok(DetachedWindow { diff --git a/crates/tauri/src/test/mock_runtime.rs b/crates/tauri/src/test/mock_runtime.rs --- a/crates/tauri/src/test/mock_runtime.rs +++ b/crates/tauri/src/test/mock_runtime.rs @@ -1065,14 +1073,17 @@ impl<T: UserEvent> Runtime<T> for MockRuntime { }, ); - let webview = webview_id.map(|id| DetachedWebview { - label: pending.label.clone(), - dispatcher: MockWebviewDispatcher { - id, - context: self.context.clone(), - url: Arc::new(Mutex::new(pending.webview.unwrap().url)), - last_evaluated_script: Default::default(), + let webview = webview_id.map(|id| DetachedWindowWebview { + webview: DetachedWebview { + label: pending.label.clone(), + dispatcher: MockWebviewDispatcher { + id, + context: self.context.clone(), + url: Arc::new(Mutex::new(pending.webview.unwrap().url)), + last_evaluated_script: Default::default(), + }, }, + use_https_scheme: false, }); Ok(DetachedWindow { diff --git a/examples/api/src-tauri/src/lib.rs b/examples/api/src-tauri/src/lib.rs --- a/examples/api/src-tauri/src/lib.rs +++ b/examples/api/src-tauri/src/lib.rs @@ -66,7 +66,8 @@ pub fn run_app<R: Runtime, F: FnOnce(&App<R>) + Send + 'static>( .build()?, )); - let mut window_builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::default()); + let mut window_builder = + WebviewWindowBuilder::new(app, "main", WebviewUrl::default()).use_https_scheme(true); #[cfg(all(desktop, not(test)))] {
[bug] [v2] IndexedDB path changed after upgrading to tauri 2 ### Describe the bug After upgrading from tauri 1 to tauri 2, the IndexedDB directory changed from `https_tauri.localhost_0.indexeddb.leveldb` to `http_tauri.localhost_0.indexeddb.leveldb`. Since my app stores all data in IndexedDB, this will cause "data losing" from user's point of view. This happens on Windows, the full paths are: - `C:\Users\[username]\AppData\Local\[appid]\EBWebView\Default\IndexedDB\https_tauri.localhost_0.indexeddb.leveldb` - `C:\Users\[username]\AppData\Local\[appid]\EBWebView\Default\IndexedDB\http_tauri.localhost_0.indexeddb.leveldb` ### Reproduction To verify that tauri 2 uses said IndexedDB directory `http_tauri.localhost_0.indexeddb.leveldb`, following these steps: 1. create a new app: `pnpm create tauri-app` 2. do anything that causes IndexedDB directory being created, for example, using `idb`: a. `pnpm i idb` b. open IndexedDB: `openDB("test").then((db) => console.log("db opened: ", db));` 3. build: `pnpm tauri build --debug` 4. run the app and check the directory I've set up a repo at https://github.com/hut36/tauri2-indexeddb for you to test. ### Expected behavior The directory `https_tauri.localhost_0.indexeddb.leveldb` is expected, instead of `http_tauri.localhost_0.indexeddb.leveldb`. See above for the full path. ### Full `tauri info` output ```text [✔] Environment - OS: Windows 10.0.22631 x86_64 (X64) ✔ WebView2: 125.0.2535.92 ✔ MSVC: Visual Studio 生成工具 2022 ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04) ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20) ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24) ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default) - node: 20.12.0 - pnpm: 9.10.0 - yarn: 1.22.22 - npm: 9.6.3 [-] Packages - tauri 🦀: 2.0.1 - tauri-build 🦀: 2.0.1 - wry 🦀: 0.44.1 - tao 🦀: 0.30.3 - @tauri-apps/api : 2.0.1 - @tauri-apps/cli : 2.0.1 [-] Plugins - tauri-plugin-shell 🦀: 2.0.1 - @tauri-apps/plugin-shell : 2.0.0 [-] App - build-type: bundle - CSP: unset - frontendDist: ../build - devUrl: http://localhost:1420/ - framework: Svelte - bundler: Vite ``` ### Stack trace _No response_ ### Additional context Related discussion: https://github.com/tauri-apps/tauri/discussions/11231. @FabianLars says this is related to `dangerousUseHttpScheme`.
17bcec8abe827c8a9eaa9bebf01bf5da87e92ed2
[ "migrate::migrations::v1::config::test::migrate_dangerous_use_http_scheme", "migrate::migrations::v1::config::test::migrate_full" ]
[ "interface::rust::tests::parse_cargo_option", "interface::rust::tests::parse_profile_from_opts", "interface::rust::manifest::tests::inject_features_string", "interface::rust::manifest::tests::inject_features_table", "interface::rust::manifest::tests::inject_features_inline_table", "migrate::migrations::v1::config::test::migrate_csp_existing_connect_src_string", "migrate::migrations::v1::config::test::migrate_csp_existing_connect_src_array", "migrate::migrations::v1::config::test::migrate_csp_object", "interface::rust::manifest::tests::inject_features_target", "migrate::migrations::v1::config::test::can_migrate_cli_template_config", "migrate::migrations::v1::config::test::migrate_invalid_url_dev_path", "migrate::migrations::v1::config::test::migrate_webview_fixed_runtime_path", "migrate::migrations::v1::config::test::migrate_updater_target", "migrate::migrations::v1::config::test::migrate_updater_pubkey", "migrate::migrations::v1::config::test::can_migrate_default_config", "migrate::migrations::v1::frontend::partial_loader::svelte::test::test_parse_svelte", "migrate::migrations::v1::config::test::can_migrate_api_example_config", "migrate::migrations::v1::config::test::skips_migrating_updater", "migrate::migrations::v1::frontend::partial_loader::svelte::test::test_parse_svelte_ts_with_generic", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_brace_with_regex_in_template_literal", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_build_vue_with_escape_string", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_build_vue_with_ts_flag_1", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_build_vue_with_ts_flag_2", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_build_vue_with_ts_flag_3", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_build_vue_with_tsx_flag", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_multi_level_template_literal", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_multiple_scripts", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_no_script", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_parse_vue_one_line", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_syntax_error", "migrate::migrations::v1::frontend::partial_loader::vue::test::test_unicode", "migrate::migrations::v1::frontend::tests::migrates_svelte", "migrate::migrations::v1::manifest::tests::migrate_add_crate_types", "migrate::migrations::v1::frontend::tests::migrates_vue", "migrate::migrations::v1::manifest::tests::migrate_str", "migrate::migrations::v1::frontend::tests::migrates_js", "migrate::migrations::v1::manifest::tests::migrate_inline_table", "migrate::migrations::v1::manifest::tests::migrate_table", "tests::verify_cli", "interface::rust::tests::parse_target_dir_from_opts", "helpers::updater_signature::tests::empty_password_is_valid" ]
[]
[]
2024-11-05T12:49:01Z
7bfd47eb8130f02f2a8f695c255df2f5302636b4
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to eww will be listed here, starting at changes since versio ### Fixes - The `shell-completions` subcommand is now run before anything is set up - Fix nix flake +- Fix `jq` (By: w-lfchen) ## [0.5.0] (17.02.2024) diff --git a/crates/simplexpr/src/eval.rs b/crates/simplexpr/src/eval.rs --- a/crates/simplexpr/src/eval.rs +++ b/crates/simplexpr/src/eval.rs @@ -467,6 +467,7 @@ fn prepare_jaq_filter(code: String) -> Result<Arc<jaq_interpret::Filter>, EvalEr None => return Err(EvalError::JaqParseError(Box::new(JaqParseError(errors.pop())))), }; let mut defs = jaq_interpret::ParseCtx::new(Vec::new()); + defs.insert_natives(jaq_core::core()); defs.insert_defs(jaq_std::std()); let filter = defs.compile(filter);
elkowar__eww-1044
1,044
For an easy bisect it would be nice to know which version/commit you were previously on, would you mind adding that? Yeah, sorry about the bad bug report. I'm not sure exactly which version I was on before upgrading since it was built from git, but it was 0.4.0 something. I've now tested various revisions, and 4385782be4152517d432c3a1e356b95695617325 is the culprit. e6817f221bb18d0604ff44ec13671d793469a90c works fine. Version in nix unstable has the same bug > Version in nix unstable has the same bug This is due to nixpkgs currently using the v0.5.0 tag, as can be seen [here](https://github.com/NixOS/nixpkgs/blob/b6401f808a81578655d4745760379cd621cf97b9/pkgs/applications/window-managers/eww/default.nix#L19C1-L19C25). > > Version in nix unstable has the same bug > > This is due to nixpkgs currently using the v0.5.0 tag, as can be seen [here](https://github.com/NixOS/nixpkgs/blob/b6401f808a81578655d4745760379cd621cf97b9/pkgs/applications/window-managers/eww/default.nix#L19C1-L19C25). Sorry if I'm missing something, isn't v0.5.0 the latest release?
[ "1039" ]
0.1
elkowar/eww
2024-03-02T22:40:51Z
diff --git a/crates/simplexpr/src/eval.rs b/crates/simplexpr/src/eval.rs --- a/crates/simplexpr/src/eval.rs +++ b/crates/simplexpr/src/eval.rs @@ -544,5 +545,6 @@ mod tests { lazy_evaluation_and(r#"false && "null".test"#) => Ok(DynVal::from(false)), lazy_evaluation_or(r#"true || "null".test"#) => Ok(DynVal::from(true)), lazy_evaluation_elvis(r#""test"?: "null".test"#) => Ok(DynVal::from("test")), + jq_basic_index(r#"jq("[7,8,9]", ".[0]")"#) => Ok(DynVal::from(7)), } }
[BUG] jq broken in 5.0.0 ### Checklist before submitting an issue - [X] I have searched through the existing [closed and open issues](https://github.com/elkowar/eww/issues?q=is%3Aissue) for eww and made sure this is not a duplicate - [X] I have specifically verified that this bug is not a common [user error](https://github.com/elkowar/eww/issues?q=is%3Aissue+label%3Ano-actual-bug+is%3Aclosed) - [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable) ### Description of the bug After upgrading to eww 5.0.0 all my jq expressions are broken. It seems they always return the full document regardless of the filter. Here is a simple example: ``` ❯ eww --version eww 0.5.0 387d344690903949121040f8a892f946e323c472 ❯ bat ~/.config/eww/eww.yuck 1 (defvar ws {jq("[7,8,9]", ".[0]")}) 2 ❯ eww reload ❯ eww get ws [7,8,9] ❯ eww get ws | jaq ".[0]" 7 ``` ### Reproducing the issue _No response_ ### Expected behaviour _No response_ ### Additional context _No response_
8661abf2bf07f5a809fc995233d93810cc1ac871
[ "eval::tests::jq_basic_index" ]
[ "eval::tests::string_to_string", "eval::tests::lazy_evaluation_or", "eval::tests::lazy_evaluation_elvis", "eval::tests::safe_access_index_to_non_indexable", "eval::tests::safe_access_index_to_missing", "eval::tests::lazy_evaluation_and", "eval::tests::normal_access_to_existing", "eval::tests::safe_access_index_to_existing", "eval::tests::safe_access_to_existing", "eval::tests::normal_access_to_missing", "eval::tests::safe_access_to_missing", "parser::lexer::test::quote_backslash_eof", "parser::lexer::test::weird_char_boundaries", "parser::lexer::test::number_in_ident", "parser::lexer::test::escaping", "parser::lexer::test::interpolation_nested", "parser::lexer::test::comments", "parser::lexer::test::basic", "dynval::test::test_parse_duration", "parser::lexer::test::digit", "parser::lexer::test::safe_interpolation", "parser::lexer::test::weird_nesting", "dynval::test::test_parse_vec", "parser::lexer::test::empty_interpolation", "parser::lexer::test::symbol_spam", "parser::lexer::test::json_in_interpolation", "parser::lexer::test::interpolation_1", "parser::tests::test" ]
[]
[]
2024-03-16T20:45:46Z
8801fa36a057b0c1d2d57585673496f0bc4240d2
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to eww will be listed here, starting at changes since versio ## Unreleased +### BREAKING CHANGES +- [#1176](https://github.com/elkowar/eww/pull/1176) changed safe access (`?.`) behavior: + Attempting to index in an empty JSON string (`'""'`) is now an error. + ### Fixes - Re-enable some scss features (By: w-lfchen) - Fix and refactor nix flake (By: w-lfchen) diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +27,7 @@ All notable changes to eww will be listed here, starting at changes since versio - Add `flip-x`, `flip-y`, `vertical` options to the graph widget to determine its direction - Add `transform-origin-x`/`transform-origin-y` properties to transform widget (By: mario-kr) - Add keyboard support for button presses (By: julianschuler) +- Support empty string for safe access operator (By: ModProg) ## [0.6.0] (21.04.2024) diff --git a/crates/simplexpr/src/eval.rs b/crates/simplexpr/src/eval.rs --- a/crates/simplexpr/src/eval.rs +++ b/crates/simplexpr/src/eval.rs @@ -268,6 +268,10 @@ impl SimplExpr { let is_safe = *safe == AccessType::Safe; + // Needs to be done first as `as_json_value` fails on empty string + if is_safe && val.as_string()?.is_empty() { + return Ok(DynVal::from(&serde_json::Value::Null).at(*span)); + } match val.as_json_value()? { serde_json::Value::Array(val) => { let index = index.as_i32()?; diff --git a/crates/simplexpr/src/eval.rs b/crates/simplexpr/src/eval.rs --- a/crates/simplexpr/src/eval.rs +++ b/crates/simplexpr/src/eval.rs @@ -281,9 +285,6 @@ impl SimplExpr { .unwrap_or(&serde_json::Value::Null); Ok(DynVal::from(indexed_value).at(*span)) } - serde_json::Value::String(val) if val.is_empty() && is_safe => { - Ok(DynVal::from(&serde_json::Value::Null).at(*span)) - } serde_json::Value::Null if is_safe => Ok(DynVal::from(&serde_json::Value::Null).at(*span)), _ => Err(EvalError::CannotIndex(format!("{}", val)).at(*span)), } diff --git a/docs/src/expression_language.md b/docs/src/expression_language.md --- a/docs/src/expression_language.md +++ b/docs/src/expression_language.md @@ -28,10 +28,10 @@ Supported currently are the following features: - if the left side is `""` or a JSON `null`, then returns the right side, otherwise evaluates to the left side. - Safe Access operator (`?.`) or (`?.[index]`) - - if the left side is `""` or a JSON `null`, then return `null`. Otherwise, - attempt to index. + - if the left side is an empty string or a JSON `null`, then return `null`. Otherwise, + attempt to index. Note that indexing an empty JSON string (`'""'`) is an error. - This can still cause an error to occur if the left hand side exists but is - not an object. + not an object or an array. (`Number` or `String`). - conditionals (`condition ? 'value' : 'other value'`) - numbers, strings, booleans and variable references (`12`, `'hi'`, `true`, `some_variable`)
elkowar__eww-1176
1,176
[ "1209" ]
0.1
elkowar/eww
2024-08-27T15:32:03Z
diff --git a/crates/simplexpr/src/eval.rs b/crates/simplexpr/src/eval.rs --- a/crates/simplexpr/src/eval.rs +++ b/crates/simplexpr/src/eval.rs @@ -564,6 +565,8 @@ mod tests { string_to_string(r#""Hello""#) => Ok(DynVal::from("Hello".to_string())), safe_access_to_existing(r#"{ "a": { "b": 2 } }.a?.b"#) => Ok(DynVal::from(2)), safe_access_to_missing(r#"{ "a": { "b": 2 } }.b?.b"#) => Ok(DynVal::from(&serde_json::Value::Null)), + safe_access_to_empty(r#"""?.test"#) => Ok(DynVal::from(&serde_json::Value::Null)), + safe_access_to_empty_json_string(r#"'""'?.test"#) => Err(super::EvalError::CannotIndex("\"\"".to_string())), safe_access_index_to_existing(r#"[1, 2]?.[1]"#) => Ok(DynVal::from(2)), safe_access_index_to_missing(r#""null"?.[1]"#) => Ok(DynVal::from(&serde_json::Value::Null)), safe_access_index_to_non_indexable(r#"32?.[1]"#) => Err(super::EvalError::CannotIndex("32".to_string())),
[BUG] Incorrect handling of an empty string by the safe access operator ### Checklist before submitting an issue - [X] I have searched through the existing [closed and open issues](https://github.com/elkowar/eww/issues?q=is%3Aissue) for eww and made sure this is not a duplicate - [X] I have specifically verified that this bug is not a common [user error](https://github.com/elkowar/eww/issues?q=is%3Aissue+label%3Ano-actual-bug+is%3Aclosed) - [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable) ### Description of the bug The safe access operator (?.) fails to recognize an empty string on the left side and return null (as it should according to the [documentation](https://elkowar.github.io/eww/expression_language.html#features)), instead throwing an error. ### Reproducing the issue The way I encountered this issue was using a `deflisten` on `playerctl` output, which outputs a JSON string but produces an empty string when all players are shut down. Here's a minimal `eww.yuck` (for Wayland): ``` (deflisten playerctlstatus 'playerctl metadata -aFf \'{"status": "{{status}}"}\'') (defwidget playerctl [] (label :text {playerctlstatus?.status})) (defwindow test :geometry (geometry :width "100%" :height "22px" :anchor "bottom center") :exclusive true :stacking "fg" :monitor 0 (playerctl)) ``` When there is an active player, the label correctly contains its state. However, when the player shuts down, `playerctl` outputs "" and the logs show an error: ``` error: Failed to turn `` into a value of type json-value ┌─ /home/mex/.config/eww/test-bug/eww.yuck:4:19 │ 4 │ (label :text {playerctlstatus?.status})) │ ─────────────── ``` ### Expected behaviour Either 1. The operator returning a `null` with an empty string on the left, or 2. The [documentation](https://elkowar.github.io/eww/expression_language.html#features) explicitly stating that the operator only works with a `null` on the left side and not an empty string. ### Additional context _No response_
8661abf2bf07f5a809fc995233d93810cc1ac871
[ "eval::tests::safe_access_to_empty", "eval::tests::safe_access_to_empty_json_string" ]
[ "eval::tests::string_to_string", "eval::tests::safe_access_index_to_missing", "eval::tests::lazy_evaluation_elvis", "eval::tests::lazy_evaluation_and", "eval::tests::lazy_evaluation_or", "eval::tests::safe_access_index_to_non_indexable", "eval::tests::safe_access_index_to_existing", "eval::tests::safe_access_to_missing", "eval::tests::normal_access_to_existing", "eval::tests::normal_access_to_missing", "eval::tests::safe_access_to_existing", "eval::tests::jq_basic_index", "parser::lexer::test::quote_backslash_eof", "parser::lexer::test::number_in_ident", "parser::lexer::test::basic", "parser::lexer::test::digit", "parser::lexer::test::weird_nesting", "parser::lexer::test::empty_interpolation", "parser::lexer::test::escaping", "parser::lexer::test::interpolation_1", "parser::lexer::test::comments", "parser::lexer::test::json_in_interpolation", "parser::lexer::test::weird_char_boundaries", "parser::lexer::test::interpolation_nested", "parser::lexer::test::symbol_spam", "parser::lexer::test::safe_interpolation", "dynval::test::test_parse_vec", "dynval::test::test_parse_duration", "parser::tests::test" ]
[]
[]
2024-10-12T08:44:24Z
78ec3a4d75075c8dff0cb543cd5fc797b7f15132
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.6.1 + +## Fixed + * gzip: examine Content-Length header before removing (#578) + # 2.6.0 ## Added diff --git a/Cargo.toml b/Cargo.toml --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ureq" -version = "2.6.0" +version = "2.6.1" authors = ["Martin Algesten <martin@algesten.se>", "Jacob Hoffman-Andrews <ureq@hoffman-andrews.com>"] description = "Simple, safe HTTP client" license = "MIT/Apache-2.0" diff --git a/src/response.rs b/src/response.rs --- a/src/response.rs +++ b/src/response.rs @@ -566,12 +566,13 @@ impl Response { let compression = get_header(&headers, "content-encoding").and_then(Compression::from_header_value); + let body_type = Self::body_type(&unit.method, status, http_version, &headers); + // remove Content-Encoding and length due to automatic decompression if compression.is_some() { headers.retain(|h| !h.is_name("content-encoding") && !h.is_name("content-length")); } - let body_type = Self::body_type(&unit.method, status, http_version, &headers); let reader = Self::stream_to_reader(stream, &unit, body_type, compression); let url = unit.url.clone();
algesten__ureq-578
578
Please add `env_logger` to your Cargo.toml, add `env_logger::int()` to your `fn main`, and run your program with `RUST_LOG=debug cargo run`, then paste the full debug output here. Also, please post a full copy of your program and any parameters you are invoking it with (like URLs or hostnames). I'm running into the same problem with the newly-released `2.6.0` anytime a gzipped-response has an unknown `content-length`. ```bash # rustup show Default host: x86_64-unknown-linux-gnu rustup home: /usr/local/rustup stable-x86_64-unknown-linux-gnu (default) rustc 1.66.0 (69f9c33d7 2022-12-12) ``` Here is what `env_logger` spits out before the program hangs: ``` [2023-01-02T22:01:07Z DEBUG ureq::stream] connecting to github.com:443 at 140.82.112.3:443 [2023-01-02T22:01:07Z DEBUG rustls::client::hs] No cached session for DnsName(DnsName(DnsName("github.com"))) [2023-01-02T22:01:07Z DEBUG rustls::client::hs] Not resuming any session [2023-01-02T22:01:07Z DEBUG rustls::client::hs] Using ciphersuite TLS13_AES_128_GCM_SHA256 [2023-01-02T22:01:07Z DEBUG rustls::client::tls13] Not resuming [2023-01-02T22:01:07Z DEBUG rustls::client::tls13] TLS1.3 encrypted extensions: [ServerNameAck] [2023-01-02T22:01:07Z DEBUG rustls::client::hs] ALPN protocol is None [2023-01-02T22:01:07Z DEBUG ureq::stream] created stream: Stream(RustlsStream) [2023-01-02T22:01:07Z DEBUG ureq::unit] sending request GET https://github.com/Fyrd/caniuse/raw/main/fulldata-json/data-2.0.json [2023-01-02T22:01:07Z DEBUG ureq::unit] writing prelude: GET /Fyrd/caniuse/raw/main/fulldata-json/data-2.0.json HTTP/1.1 Host: github.com Accept: */* user-agent: Mozilla/5.0 accept-encoding: gzip [2023-01-02T22:01:08Z DEBUG rustls::client::tls13] Ticket saved [2023-01-02T22:01:08Z DEBUG rustls::client::tls13] Ticket saved [2023-01-02T22:01:08Z DEBUG ureq::response] zero-length body returning stream directly to pool [2023-01-02T22:01:08Z DEBUG ureq::pool] adding stream to pool: https|github.com|443 -> Stream(RustlsStream) [2023-01-02T22:01:08Z DEBUG ureq::unit] response 302 to GET https://github.com/Fyrd/caniuse/raw/main/fulldata-json/data-2.0.json [2023-01-02T22:01:08Z DEBUG ureq::unit] redirect 302 https://github.com/Fyrd/caniuse/raw/main/fulldata-json/data-2.0.json -> https://raw.githubusercontent.com/Fyrd/caniuse/main/fulldata-json/data-2.0.json [2023-01-02T22:01:08Z DEBUG ureq::stream] connecting to raw.githubusercontent.com:443 at 185.199.108.133:443 [2023-01-02T22:01:08Z DEBUG rustls::client::hs] No cached session for DnsName(DnsName(DnsName("raw.githubusercontent.com"))) [2023-01-02T22:01:08Z DEBUG rustls::client::hs] Not resuming any session [2023-01-02T22:01:08Z DEBUG rustls::client::hs] Using ciphersuite TLS13_AES_256_GCM_SHA384 [2023-01-02T22:01:08Z DEBUG rustls::client::tls13] Not resuming [2023-01-02T22:01:08Z DEBUG rustls::client::tls13] TLS1.3 encrypted extensions: [ServerNameAck] [2023-01-02T22:01:08Z DEBUG rustls::client::hs] ALPN protocol is None [2023-01-02T22:01:08Z DEBUG rustls::client::tls13] Ticket saved [2023-01-02T22:01:08Z DEBUG ureq::stream] created stream: Stream(RustlsStream) [2023-01-02T22:01:08Z DEBUG ureq::unit] sending request GET https://raw.githubusercontent.com/Fyrd/caniuse/main/fulldata-json/data-2.0.json [2023-01-02T22:01:08Z DEBUG ureq::unit] writing prelude: GET /Fyrd/caniuse/main/fulldata-json/data-2.0.json HTTP/1.1 Host: raw.githubusercontent.com Accept: */* user-agent: Mozilla/5.0 accept-encoding: gzip [2023-01-02T22:01:08Z DEBUG ureq::response] Body of unknown size - read until socket close [2023-01-02T22:01:08Z DEBUG ureq::unit] response 200 to GET https://raw.githubusercontent.com/Fyrd/caniuse/main/fulldata-json/data-2.0.json ``` This can be reproduced with a `cargo init` boilerplate like: Cargo.toml: ```toml [package] name = "ureqtest" version = "0.1.0" edition = "2021" [dependencies] env_logger = "*" [dependencies.ureq] version = "=2.6.0" default-features = false features = [ "tls", "gzip" ] ``` main.rs: ```rust fn main() { env_logger::init(); let res = ureq::get("https://github.com/Fyrd/caniuse/raw/main/fulldata-json/data-2.0.json") .set("user-agent", "Mozilla/5.0") .call() .expect("Call fail."); let mut out: Vec<u8> = Vec::new(); res.into_reader().read_to_end(&mut out).expect("Read fail."); println!("{}", out.len()); // Never makes it here. } ``` Trying to limit the reader with `.take(10_000_000)` doesn't fix the issue. The take amount has to be less than or equal to the actual decoded payload size or else it has no effect. Excellent. Thanks for the detailed report. I'll reproduce this when I get home.
[ "575" ]
2.6
algesten/ureq
2023-01-03T02:49:21Z
diff --git a/src/response.rs b/src/response.rs --- a/src/response.rs +++ b/src/response.rs @@ -1183,4 +1184,37 @@ mod tests { .unwrap(); assert_eq!(agent2.state.pool.len(), 1); } + + #[test] + #[cfg(feature = "gzip")] + fn gzip_content_length() { + use std::io::Cursor; + let response_bytes = + b"HTTP/1.1 200 OK\r\nContent-Encoding: gzip\r\nContent-Length: 23\r\n\r\n\ +\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\xcb\xc8\xe4\x02\x00\x7a\x7a\x6f\xed\x03\x00\x00\x00"; + // Follow the response with an infinite stream of 0 bytes, so the content-length + // is important. + let reader = Cursor::new(response_bytes).chain(std::io::repeat(0u8)); + let test_stream = crate::test::TestStream::new(reader, std::io::sink()); + let agent = Agent::new(); + let stream = Stream::new( + test_stream, + "1.1.1.1:4343".parse().unwrap(), + PoolReturner::none(), + ); + let resp = Response::do_from_stream( + stream, + Unit::new( + &agent, + "GET", + &"https://example.com/".parse().unwrap(), + vec![], + &Payload::Empty.into_read(), + None, + ), + ) + .unwrap(); + let body = resp.into_string().unwrap(); + assert_eq!(body, "hi\n"); + } }
Reading a gzipped response hangs forever upon reaching the end of the response Hello, i use the actual git version (that solves a problem with the cookiestore for me) and rust compiles without an error but the code hang on every function call like: ``` let test = httpreq.into_string().unwrap(); or let json: serde_json::Value = httpreq.into_json().unwrap(); ``` He hangs and i must break the compiled program.
905bf8f0b2d22f95b2d61884591197f24cea4218
[ "response::tests::gzip_content_length", "test::agent_test::connection_reuse_with_408" ]
[ "chunked::decoder::test::test_read_chunk_size", "chunked::decoder::test::invalid_input2", "header::tests::test_valid_value", "header::tests::test_iso8859_utf8_mixup", "error::tests::ensure_error_size", "pool::tests::pool_per_host_connections_limit", "pool::tests::poolkey_new", "header::tests::test_valid_name", "pool::tests::pool_checks_proxy", "body::tests::test_copy_chunked", "chunked::decoder::test::test_valid_chunk_decode", "error::tests::connection_closed", "proxy::tests::parse_proxy_http_user_pass_server_port_trailing_slash", "agent::tests::agent_implements_send_and_sync", "header::tests::name_and_value", "pool::tests::read_exact_chunked_gzip", "header::tests::value_with_whitespace", "header::tests::test_parse_non_utf8_value", "pool::tests::read_exact", "error::tests::error_implements_send_and_sync", "header::tests::empty_value", "chunked::decoder::test::test_decode_invalid_chunk_length", "agent::tests::agent_config_debug", "chunked::decoder::test::invalid_input1", "pool::tests::pool_connections_limit", "chunked::decoder::test::test_decode_zero_length", "chunked::encoder::test::flush_after_write", "chunked::encoder::test::test", "error::tests::io_error", "proxy::tests::parse_proxy_server", "request::tests::request_implements_send_and_sync", "proxy::tests::parse_proxy_fakeproto", "response::tests::charset", "response::tests::history", "response::tests::ensure_response_size", "response::tests::charset_default", "proxy::tests::parse_proxy_socks_user_pass_server_port", "proxy::tests::parse_proxy_server_port", "proxy::tests::parse_proxy_socks4a_user_pass_server_port", "proxy::tests::parse_proxy_socks5_user_pass_server_port", "proxy::tests::parse_proxy_socks4_user_pass_server_port", "request::tests::disallow_empty_host", "response::tests::parse_deserialize_json", "header::tests::test_parse_invalid_name", "response::tests::content_type_default", "response::tests::content_type_without_cr", "response::tests::parse_borked_header", "proxy::tests::parse_proxy_user_pass_server_port", "request::tests::send_byte_slice", "response::tests::content_type_without_charset", "proxy::tests::parse_proxy_http_user_pass_server_port", "response::tests::short_read", "error::tests::status_code_error_redirect", "response::tests::into_string_large", "response::tests::read_next_line_non_ascii_reason", "response::tests::response_implements_send_and_sync", "response::tests::parse_header_without_reason", "response::tests::content_type_with_charset", "response::tests::chunked_transfer", "error::tests::status_code_error", "response::tests::parse_header_with_non_utf8", "response::tests::too_many_headers", "test::body_send::content_length_and_chunked", "response::tests::parse_simple_json", "test::body_read::brotli_text", "test::body_send::user_set_content_length_on_str", "test::query_string::query_in_path", "test::body_send::content_length_on_str", "test::query_string::escaped_query_string", "test::redirect::redirect_308", "test::redirect::redirect_on", "test::redirect::redirect_post_with_data", "test::body_read::no_reader_on_head", "test::body_read::gzip_text", "test::body_read::transfer_encoding_bogus", "test::redirect::redirect_head", "test::redirect::redirect_host", "test::body_send::content_length_on_json", "test::redirect::redirect_no_keep_authorization", "test::body_send::str_with_encoding", "response::tests::zero_length_body_immediate_return", "stream::tests::test_deadline_stream_buffering", "test::agent_test::test_cookies_on_redirect", "response::tests::read_next_line_large", "test::agent_test::custom_resolver", "test::agent_test::dirty_streams_not_returned", "test::simple::request_debug", "test::simple::body_as_json_deserialize", "test::simple::body_as_json", "test::body_read::content_length_limited", "test::body_send::content_type_not_overriden_on_json", "test::redirect::redirect_many", "test::body_read::ignore_content_length_when_chunked", "test::query_string::query_in_path_and_req", "test::redirect::redirect_off", "test::redirect::redirect_keep_auth_same_host", "test::redirect::redirect_post", "test::redirect::redirect_no_keep_auth_different_host", "test::simple::no_status_text", "test::simple::repeat_non_x_header", "test::simple::host_no_port", "test::redirect::redirects_hit_timeout", "test::simple::host_with_port", "test::redirect::redirect_get", "test::simple::body_as_text", "test::simple::non_ascii_header", "test::timeout::read_timeout_during_headers", "test::query_string::no_query_string", "tests::connect_https_invalid_name", "test::simple::header_with_spaces_before_value", "unit::tests::check_cookie_crate_allows_illegal", "unit::tests::match_cookies_returns_one_header", "test::simple::body_as_reader", "test::simple::escape_path", "test::simple::header_passing", "unit::tests::illegal_cookie_value", "unit::tests::illegal_cookie_name", "unit::tests::not_send_illegal_cookies", "unit::tests::legal_cookie_name_value", "test::simple::repeat_x_header", "test::redirect::too_many_redirects", "test::timeout::overall_timeout_during_headers", "test::timeout::overall_timeout_during_body", "test::timeout::overall_timeout_override_during_headers", "test::timeout::overall_timeout_reading_json", "test::body_send::content_type_on_json", "test::agent_test::connection_reuse", "tls_client_certificate", "agent_set_header", "src/lib.rs - (line 70) - compile", "src/agent.rs - agent::Agent::cookie_store (line 220) - compile", "src/agent.rs - agent::AgentBuilder::cookie_store (line 626) - compile", "src/lib.rs - (line 279) - compile", "src/error.rs - error::Error (line 26) - compile", "src/middleware.rs - middleware::Middleware (line 13) - compile", "src/lib.rs - (line 250)", "src/lib.rs - (line 232)", "src/lib.rs - (line 119)", "src/middleware.rs - middleware::Middleware (line 61)", "src/agent.rs - agent::AgentBuilder::max_idle_connections (line 329)", "src/agent.rs - agent::AgentBuilder::timeout_read (line 405)", "src/agent.rs - agent::Agent::request (line 146)", "src/agent.rs - agent::AgentBuilder::tls_config (line 566)", "src/agent.rs - agent::AgentBuilder::proxy (line 295)", "src/agent.rs - agent::AgentBuilder::tls_connector (line 601)", "src/agent.rs - agent::AgentBuilder::max_idle_connections_per_host (line 343)", "src/agent.rs - agent::AgentBuilder::no_delay (line 472)", "src/agent.rs - agent::Agent::request_url (line 168)", "src/lib.rs - request (line 489)", "src/agent.rs - agent::AgentBuilder::resolver (line 362)", "src/request.rs - request::Request::method (line 433)", "src/middleware.rs - middleware::Middleware (line 27)", "src/agent.rs - agent::Agent (line 89)", "src/agent.rs - agent::AgentBuilder::redirects (line 497)", "src/agent.rs - agent::AgentBuilder::timeout (line 451)", "src/error.rs - error::Error (line 42)", "src/error.rs - error::Error (line 68)", "src/request.rs - request::Request::has (line 345)", "src/request.rs - request::Request (line 18)", "src/error.rs - error::Error::kind (line 292)", "src/agent.rs - agent::AgentBuilder::user_agent (line 534)", "src/request.rs - request::Request::all (line 356)", "src/lib.rs - (line 200)", "src/lib.rs - (line 95)", "src/lib.rs - (line 53)", "src/agent.rs - agent::AgentBuilder::https_only (line 315)", "src/middleware.rs - middleware::Middleware (line 92)", "src/request.rs - request::Request::header (line 319)", "src/error.rs - error::Transport (line 118)", "src/request.rs - request::Request::header_names (line 330)", "src/request.rs - request::Request::request_url (line 488)", "src/error.rs - error::OrAnyStatus::or_any_status (line 181)", "src/request.rs - request::Request::call (line 70)", "src/lib.rs - request_url (line 506)", "src/request.rs - request::Request::query (line 374)", "src/agent.rs - agent::AgentBuilder::timeout_write (line 427)", "src/request.rs - request::Request::url (line 451)", "src/response.rs - response::Response::content_type (line 193)", "src/response.rs - response::Response::into_string (line 400)", "src/response.rs - response::Response::into_reader (line 250)", "src/response.rs - response::Response::into_json (line 491)", "src/request.rs - request::Request::send_form (line 256)", "src/request.rs - request::Request::send (line 286)", "src/response.rs - response::Response::into_json (line 461)", "src/request.rs - request::Request::send_string (line 234)", "src/request.rs - request::RequestUrl::query_pairs (line 553)", "src/agent.rs - agent::AgentBuilder::timeout_connect (line 383)", "src/response.rs - response::Response (line 59)", "src/response.rs - response::Response::new (line 115)", "src/request.rs - request::Request::url (line 462)", "src/response.rs - response::Response::charset (line 217)", "src/request.rs - request::Request::send_json (line 182)", "src/request.rs - request::Request::set (line 302)", "src/request.rs - request::Request::query_pairs (line 398)", "src/request.rs - request::Request::send_bytes (line 209)" ]
[ "test::range::read_range_rustls", "tests::connect_http_google", "tests::connect_https_google_rustls", "test::range::read_range_native_tls", "tests::connect_https_google_native_tls" ]
[ "test::timeout::read_timeout_during_body" ]
2023-01-03T08:04:17Z
641eb3df10decef45df1fcad9d985fdec484e429
diff --git a/src/proxy.rs b/src/proxy.rs --- a/src/proxy.rs +++ b/src/proxy.rs @@ -79,11 +79,13 @@ impl Proxy { /// * `john:smith@socks.google.com:8000` /// * `localhost` pub fn new<S: AsRef<str>>(proxy: S) -> Result<Self, Error> { - let mut proxy_parts = proxy - .as_ref() - .splitn(2, "://") - .collect::<Vec<&str>>() - .into_iter(); + let mut proxy = proxy.as_ref(); + + while proxy.ends_with('/') { + proxy = &proxy[..(proxy.len() - 1)]; + } + + let mut proxy_parts = proxy.splitn(2, "://").collect::<Vec<&str>>().into_iter(); let proto = if proxy_parts.len() == 2 { match proxy_parts.next() {
algesten__ureq-408
408
[ "402" ]
2.1
algesten/ureq
2021-08-12T10:49:17Z
diff --git a/src/proxy.rs b/src/proxy.rs --- a/src/proxy.rs +++ b/src/proxy.rs @@ -196,6 +198,16 @@ mod tests { assert_eq!(proxy.proto, Proto::HTTPConnect); } + #[test] + fn parse_proxy_http_user_pass_server_port_trailing_slash() { + let proxy = Proxy::new("http://user:p@ssw0rd@localhost:9999/").unwrap(); + assert_eq!(proxy.user, Some(String::from("user"))); + assert_eq!(proxy.password, Some(String::from("p@ssw0rd"))); + assert_eq!(proxy.server, String::from("localhost")); + assert_eq!(proxy.port, 9999); + assert_eq!(proxy.proto, Proto::HTTPConnect); + } + #[cfg(feature = "socks-proxy")] #[test] fn parse_proxy_socks4_user_pass_server_port() {
Parsing proxy with trailing slash results in wrong port When proxy url is set to `http://127.0.0.1:3128/` (with trailing slash), port is resolved to `8080`: ```plain with https_proxy (http://127.0.0.1:3128/): AgentBuilder { config: AgentConfig { proxy: Some( Proxy { server: "127.0.0.1", port: 8080, user: None, password: None, proto: HTTPConnect, }, ), timeout_connect: Some( 30s, ), timeout_read: None, timeout_write: None, timeout: None, redirects: 5, user_agent: "ureq/2.1.1", tls_config: Some( TLSClientConfig, ), }, max_idle_connections: 100, max_idle_connections_per_host: 1, resolver: ArcResolver(...), } ``` But when proxy url has no trailing slash (`http://127.0.0.1:3128`) it resolves its port correctly (`3128`): ```plain with https_proxy (http://127.0.0.1:3128): AgentBuilder { config: AgentConfig { proxy: Some( Proxy { server: "127.0.0.1", port: 3128, user: None, password: None, proto: HTTPConnect, }, ), timeout_connect: Some( 30s, ), timeout_read: None, timeout_write: None, timeout: None, redirects: 5, user_agent: "ureq/2.1.1", tls_config: Some( TLSClientConfig, ), }, max_idle_connections: 100, max_idle_connections_per_host: 1, resolver: ArcResolver(...), } ``` I was using: ```plain [[package]] name = "ureq" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2475a6781e9bc546e7b64f4013d2f4032c8c6a40fcffd7c6f4ee734a890972ab" dependencies = [ "base64", "chunked_transfer", "log", "once_cell", "rustls", "url", "webpki", "webpki-roots", ] ```
30f0ec01e74cc6dc2dd342616c16a1d735f0170d
[ "proxy::tests::parse_proxy_http_user_pass_server_port_trailing_slash", "test::timeout::read_timeout_during_body" ]
[ "proxy::tests::parse_proxy_socks4_user_pass_server_port", "proxy::tests::parse_proxy_socks4a_user_pass_server_port", "proxy::tests::parse_proxy_fakeproto", "header::tests::test_parse_invalid_name", "pool::tests::poolkey_new", "pool::tests::pool_per_host_connections_limit", "pool::tests::pool_connections_limit", "pool::tests::pool_checks_proxy", "header::tests::value_with_whitespace", "response::tests::content_type_without_charset", "response::tests::content_type_without_cr", "response::tests::ensure_response_size", "response::tests::parse_borked_header", "response::tests::parse_deserialize_json", "response::tests::parse_header_with_non_utf8", "header::tests::test_valid_name", "response::tests::parse_header_without_reason", "response::tests::parse_simple_json", "response::tests::read_next_line_large", "response::tests::read_next_line_non_ascii_reason", "response::tests::response_implements_send_and_sync", "response::tests::short_read", "response::tests::content_type_with_charset", "response::tests::content_type_default", "proxy::tests::parse_proxy_socks5_user_pass_server_port", "agent::tests::agent_implements_send_and_sync", "proxy::tests::parse_proxy_socks_user_pass_server_port", "request::tests::request_implements_send_and_sync", "proxy::tests::parse_proxy_server_port", "proxy::tests::parse_proxy_user_pass_server_port", "request::tests::disallow_empty_host", "body::tests::test_copy_chunked", "response::tests::charset", "error::tests::connection_closed", "proxy::tests::parse_proxy_server", "error::tests::status_code_error", "header::tests::name_and_value", "header::tests::test_iso8859_utf8_mixup", "response::tests::charset_default", "response::tests::chunked_transfer", "header::tests::empty_value", "error::tests::error_implements_send_and_sync", "header::tests::test_parse_non_utf8_value", "proxy::tests::parse_proxy_http_user_pass_server_port", "error::tests::ensure_error_size", "response::tests::history", "error::tests::io_error", "response::tests::too_many_headers", "test::agent_test::custom_resolver", "header::tests::test_valid_value", "response::tests::into_string_large", "request::tests::send_byte_slice", "error::tests::status_code_error_redirect", "test::body_send::content_length_on_json", "test::query_string::query_in_path", "test::query_string::escaped_query_string", "test::query_string::no_query_string", "test::query_string::query_in_path_and_req", "test::simple::body_as_reader", "test::simple::body_as_text", "test::simple::escape_path", "test::simple::header_passing", "test::simple::header_with_spaces_before_value", "test::simple::host_no_port", "test::redirect::redirect_off", "test::body_read::content_length_limited", "test::body_send::user_set_content_length_on_str", "test::redirect::redirect_head", "test::simple::non_ascii_header", "test::redirect::redirect_get", "test::simple::body_as_json", "test::simple::host_with_port", "test::redirect::redirect_on", "test::redirect::redirect_post", "test::redirect::redirect_post_with_data", "test::body_read::transfer_encoding_bogus", "test::body_send::str_with_encoding", "test::body_send::content_length_on_str", "test::body_send::content_type_not_overriden_on_json", "test::body_send::content_length_and_chunked", "test::body_read::ignore_content_length_when_chunked", "test::simple::no_status_text", "test::body_read::no_reader_on_head", "test::simple::body_as_json_deserialize", "test::body_send::content_type_on_json", "test::agent_test::test_cookies_on_redirect", "test::redirect::redirect_host", "test::redirect::redirect_308", "test::redirect::redirect_many", "unit::tests::illegal_cookie_value", "unit::tests::illegal_cookie_name", "unit::tests::legal_cookie_name_value", "test::simple::repeat_x_header", "unit::tests::check_cookie_crate_allows_illegal", "test::redirect::redirects_hit_timeout", "unit::tests::not_send_illegal_cookies", "test::timeout::read_timeout_during_headers", "tests::connect_https_invalid_name", "unit::tests::match_cookies_returns_one_header", "test::simple::request_debug", "test::simple::repeat_non_x_header", "test::agent_test::dirty_streams_not_returned", "test::redirect::too_many_redirects", "test::timeout::overall_timeout_during_headers", "test::timeout::overall_timeout_override_during_headers", "test::timeout::overall_timeout_during_body", "test::agent_test::connection_reuse", "test::agent_test::connection_reuse_with_408", "agent_set_header", "src/agent.rs - agent::Agent::cookie_store (line 176) - compile", "src/lib.rs - (line 49) - compile", "src/error.rs - error::Error (line 26) - compile", "src/agent.rs - agent::AgentBuilder::cookie_store (line 497) - compile", "src/lib.rs - (line 221)", "src/lib.rs - (line 203)", "src/request.rs - request::Request::header (line 266)", "src/agent.rs - agent::Agent::request (line 107)", "src/lib.rs - (line 32)", "src/error.rs - error::OrAnyStatus::or_any_status (line 108)", "src/lib.rs - (line 98)", "src/agent.rs - agent::Agent::request_url (line 129)", "src/agent.rs - agent::AgentBuilder::resolver (line 299)", "src/error.rs - error::Error (line 42)", "src/request.rs - request::Request::call (line 72)", "src/error.rs - error::Error::kind (line 220)", "src/lib.rs - (line 74)", "src/lib.rs - request (line 360)", "src/request.rs - request::Request::url (line 361)", "src/request.rs - request::Request::url (line 372)", "src/request.rs - request::Request::method (line 343)", "src/request.rs - request::Request::request_url (line 398)", "src/request.rs - request::Request::send_bytes (line 156)", "src/request.rs - request::Request::send_string (line 181)", "src/request.rs - request::Request::send_form (line 203)", "src/request.rs - request::Request::set (line 249)", "src/request.rs - request::Request::send_json (line 133)", "src/request.rs - request::Request::header_names (line 277)", "src/request.rs - request::Request::query (line 321)", "src/request.rs - request::Request::send (line 233)", "src/agent.rs - agent::AgentBuilder::timeout_read (line 342)", "src/response.rs - response::Response::from_str (line 567)", "src/response.rs - response::Response::new (line 102)", "src/response.rs - response::Response::into_json (line 376)", "src/response.rs - response::Response (line 42)", "src/response.rs - response::Response::content_type (line 180)", "src/response.rs - response::Response::into_reader (line 232)", "src/response.rs - response::Response::into_string (line 315)", "src/response.rs - response::Response::charset (line 204)", "src/response.rs - response::Response::into_json (line 400)", "src/request.rs - request::RequestUrl::query_pairs (line 463)", "src/request.rs - request::Request::has (line 292)", "src/agent.rs - agent::AgentBuilder::timeout_write (line 364)", "src/agent.rs - agent::AgentBuilder::proxy (line 247)", "src/agent.rs - agent::AgentBuilder::max_idle_connections_per_host (line 280)", "src/agent.rs - agent::Agent (line 50)", "src/agent.rs - agent::AgentBuilder::timeout (line 388)", "src/request.rs - request::Request::all (line 303)", "src/agent.rs - agent::AgentBuilder::user_agent (line 442)", "src/agent.rs - agent::AgentBuilder::tls_config (line 473)", "src/request.rs - request::Request (line 19)", "src/lib.rs - (line 171)", "src/lib.rs - request_url (line 377)", "src/agent.rs - agent::AgentBuilder::max_idle_connections (line 266)", "src/agent.rs - agent::AgentBuilder::timeout_connect (line 320)", "src/agent.rs - agent::AgentBuilder::redirects (line 414)", "src/error.rs - error::Error (line 68)" ]
[ "test::timeout::overall_timeout_reading_json", "test::range::read_range", "tests::connect_https_google", "tests::connect_http_google", "tls_client_certificate" ]
[]
2021-08-23T18:57:32Z
c833acfe5cd8e6f6bb01bde4ca71681873e8bdf9
diff --git a/src/response.rs b/src/response.rs --- a/src/response.rs +++ b/src/response.rs @@ -469,7 +469,12 @@ fn parse_status_line(line: &str) -> Result<(ResponseStatusIndex, u16), Error> { } // https://tools.ietf.org/html/rfc7230#section-3.1.2 // status-line = HTTP-version SP status-code SP reason-phrase CRLF - let split: Vec<&str> = line.splitn(3, ' ').collect(); + let mut split: Vec<&str> = line.splitn(3, ' ').collect(); + if split.len() == 2 { + // As a special case, we are lenient parsing lines without a space after the code. + // This is technically against spec. "HTTP/1.1 200\r\n" + split.push(""); + } if split.len() != 3 { return Err(BadStatus.msg("Wrong number of tokens in status line")); }
algesten__ureq-327
327
Thanks for the report. We recently added some stricter parsing of the status line. Per spec, [reason-phrase can be empty](https://tools.ietf.org/html/rfc7230#section-3.1.2), but the space after the status code is mandatory. hack.pl omits the space. Still, perhaps this is a place to be a little lenient and allow an omitted space. ``` 00000000: 4854 5450 2f31 2e31 2033 3032 0d0a 4461 HTTP/1.1 302..Da 00000010: 7465 3a20 4d6f 6e2c 2031 3520 4665 6220 te: Mon, 15 Feb 00000020: 3230 3231 2030 303a 3331 3a33 3120 474d 2021 00:31:31 GM 00000030: 540d 0a43 6f6e 7465 6e74 2d54 7970 653a T..Content-Type: ```
[ "316" ]
2.0
algesten/ureq
2021-02-21T10:23:31Z
diff --git a/src/response.rs b/src/response.rs --- a/src/response.rs +++ b/src/response.rs @@ -747,6 +752,13 @@ mod tests { assert_eq!(err.kind(), BadStatus); } + #[test] + fn parse_header_without_reason() { + let s = "HTTP/1.1 302\r\n\r\n".to_string(); + let resp = s.parse::<Response>().unwrap(); + assert_eq!(resp.status_text(), ""); + } + #[test] fn history() { let mut response0 = Response::new(302, "Found", "").unwrap();
"Bad Status: Wrong number of tokens in status line" error on some websites On some websites, e.g. http://hack.pl, ureq fails with the following error: > Bad Status: Wrong number of tokens in status line However, curl and Firefox work fine. There's 296 such websites in the top million (I'm using [Tranco list generated on the 3rd of February](https://tranco-list.eu/list/3G6L)). Archive with all occurrences: [ureq-bad-status.tar.gz](https://github.com/algesten/ureq/files/5978826/ureq-bad-status.tar.gz) Code used for testing: https://github.com/Shnatsel/rust-http-clients-smoke-test/blob/f206362f2e81521bbefb84007cdd25242f6db590/ureq-smoke-test/src/main.rs
9ec4e7192aa80d38d968e5989742ba10fbbbe575
[ "response::tests::parse_header_without_reason" ]
[ "agent::tests::agent_implements_send_and_sync", "proxy::tests::parse_proxy_socks_user_pass_server_port", "proxy::tests::parse_proxy_socks5_user_pass_server_port", "header::test_valid_name", "body::test_copy_chunked", "error::error_is_send_and_sync", "proxy::tests::parse_proxy_server", "pool::poolkey_new", "header::test_parse_invalid_name", "response::tests::content_type_with_charset", "error::io_error", "header::value_with_whitespace", "response::tests::parse_simple_json", "error::connection_closed", "header::empty_value", "proxy::tests::parse_proxy_user_pass_server_port", "proxy::tests::parse_proxy_server_port", "header::test_valid_value", "proxy::tests::parse_proxy_http_user_pass_server_port", "test::body_send::content_length_on_json", "test::body_send::content_type_on_json", "test::body_send::str_with_encoding", "test::body_send::content_type_not_overriden_on_json", "test::body_send::user_set_content_length_on_str", "proxy::tests::parse_proxy_fakeproto", "request::request_implements_send_and_sync", "test::body_read::content_length_limited", "response::tests::chunked_transfer", "response::tests::parse_borked_header", "response::tests::content_type_default", "response::tests::content_type_without_charset", "response::tests::history", "test::body_send::content_length_and_chunked", "test::body_read::transfer_encoding_bogus", "test::body_read::no_reader_on_head", "header::name_and_value", "response::tests::content_type_without_cr", "response::short_read", "pool::pool_checks_proxy", "test::body_read::ignore_content_length_when_chunked", "test::redirect::redirect_head", "test::agent_test::test_cookies_on_redirect", "test::agent_test::custom_resolver", "test::query_string::no_query_string", "test::query_string::query_in_path", "test::query_string::query_in_path_and_req", "test::redirect::redirect_308", "test::redirect::redirect_many", "response::tests::charset_default", "response::tests::charset", "test::body_send::content_length_on_str", "test::redirect::redirect_post", "test::simple::escape_path", "error::status_code_error", "pool::pool_connections_limit", "response::tests::parse_deserialize_json", "pool::pool_per_host_connections_limit", "test::simple::body_as_text", "test::simple::request_debug", "test::simple::non_ascii_header", "test::simple::no_status_text", "test::simple::header_with_spaces_before_value", "test::simple::repeat_non_x_header", "test::timeout::read_timeout_during_headers", "test::redirect::redirect_host", "test::redirect::redirect_on", "test::simple::body_as_reader", "test::simple::repeat_x_header", "unit::tests::match_cookies_returns_one_header", "test::redirect::redirect_off", "test::redirect::redirects_hit_timeout", "test::simple::host_no_port", "tests::connect_https_invalid_name", "test::redirect::redirect_get", "test::simple::body_as_json_deserialize", "test::simple::header_passing", "test::simple::host_with_port", "test::query_string::escaped_query_string", "error::status_code_error_redirect", "test::simple::body_as_json", "test::timeout::overall_timeout_during_body", "request::send_byte_slice", "test::agent_test::dirty_streams_not_returned", "test::timeout::overall_timeout_during_headers", "test::redirect::too_many_redirects", "test::agent_test::connection_reuse", "agent_set_header", "src/agent.rs - agent::Agent::cookie_store (line 176) - compile", "src/error.rs - error::Error (line 26) - compile", "src/agent.rs - agent::AgentBuilder::cookie_store (line 499) - compile", "src/lib.rs - (line 42) - compile", "src/lib.rs - (line 214)", "src/lib.rs - (line 91)", "src/lib.rs - (line 196)", "src/request.rs - request::Request::call (line 92)", "src/error.rs - error::Error (line 68)", "src/request.rs - request::Request::has (line 310)", "src/request.rs - request::Request::all (line 321)", "src/agent.rs - agent::AgentBuilder::timeout_read (line 344)", "src/lib.rs - (line 67)", "src/request.rs - request::Request::send (line 251)", "src/error.rs - error::Error::kind (line 221)", "src/request.rs - request::Request::query (line 339)", "src/lib.rs - request_url (line 370)", "src/agent.rs - agent::AgentBuilder::tls_config (line 475)", "src/agent.rs - agent::AgentBuilder::proxy (line 249)", "src/lib.rs - (line 25)", "src/request.rs - request::Request::header (line 284)", "src/agent.rs - agent::AgentBuilder::timeout_write (line 366)", "src/agent.rs - agent::Agent (line 50)", "src/lib.rs - request (line 353)", "src/request.rs - request::Request::set (line 267)", "src/response.rs - response::Response::new (line 85)", "src/response.rs - response::Response (line 31)", "src/response.rs - response::Response::into_json (line 359)", "src/response.rs - response::Response::into_string (line 283)", "src/response.rs - response::Response::into_json (line 335)", "src/response.rs - response::Response::into_reader (line 203)", "src/response.rs - response::Response::charset (line 180)", "src/agent.rs - agent::AgentBuilder::user_agent (line 444)", "src/request.rs - request::Request::send_bytes (line 174)", "src/error.rs - error::OrAnyStatus::or_any_status (line 108)", "src/request.rs - request::Request (line 26)", "src/agent.rs - agent::Agent::request_url (line 129)", "src/agent.rs - agent::Agent::request (line 107)", "src/agent.rs - agent::AgentBuilder::timeout (line 390)", "src/agent.rs - agent::AgentBuilder::timeout_connect (line 322)", "src/agent.rs - agent::AgentBuilder::resolver (line 301)", "src/agent.rs - agent::AgentBuilder::max_idle_connections (line 268)", "src/request.rs - request::Request::send_form (line 221)", "src/agent.rs - agent::AgentBuilder::redirects (line 416)", "src/lib.rs - (line 164)", "src/response.rs - response::Response::content_type (line 156)", "src/agent.rs - agent::AgentBuilder::max_idle_connections_per_host (line 282)", "src/error.rs - error::Error (line 42)", "src/request.rs - request::Request::header_names (line 295)", "src/request.rs - request::Request::send_string (line 199)", "src/request.rs - request::Request::send_json (line 151)" ]
[ "test::timeout::overall_timeout_reading_json", "test::range::read_range", "tests::connect_http_google", "tests::connect_https_google", "tls_client_certificate" ]
[ "test::timeout::read_timeout_during_body" ]
2021-02-21T22:21:10Z
b246f0a9d2e6150b29b5504924edc090d2bf9168
diff --git a/src/response.rs b/src/response.rs --- a/src/response.rs +++ b/src/response.rs @@ -537,14 +537,16 @@ fn read_next_line(reader: &mut impl BufRead) -> io::Result<String> { )); } - if !s.ends_with("\r\n") { + if !s.ends_with("\n") { return Err(io::Error::new( io::ErrorKind::InvalidInput, - format!("Header field didn't end with \\r: {}", s), + format!("Header field didn't end with \\n: {}", s), )); } s.pop(); - s.pop(); + if s.ends_with("\r") { + s.pop(); + } Ok(s) }
algesten__ureq-324
324
This is per spec: https://tools.ietf.org/html/rfc7230#section-3.1.2 > The first line of a response message is the status-line, consisting > of the protocol version, a space (SP), the status code, another > space, a possibly empty textual phrase describing the status code, > and ending with CRLF. > > status-line = HTTP-version SP status-code SP reason-phrase CRLF Spot-checking `GET http://etihad.com/`, the status line ends in LF, not CRLF. From [this stackoverflow answer](https://stackoverflow.com/questions/5757290/http-header-line-break-style), [section 3.5](https://tools.ietf.org/html/rfc7230#section-3.5) states: > Although the line terminator for the start-line and header fields is the sequence CRLF, a recipient MAY recognize a single LF as a line terminator and ignore any preceding CR. And [rfc 2616 19.3](https://tools.ietf.org/html/rfc2616#section-19.3): > The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. So accepting LF instead of CRLF would not only be valid, it is recommended (But not accepting it is still compliant AIUI)
[ "321" ]
2.0
algesten/ureq
2021-02-15T20:59:07Z
diff --git a/src/response.rs b/src/response.rs --- a/src/response.rs +++ b/src/response.rs @@ -644,6 +646,16 @@ mod tests { assert_eq!("application/json", resp.content_type()); } + #[test] + fn content_type_without_cr() { + let s = "HTTP/1.1 200 OK\r\n\ + Content-Type: application/json\n\ + \r\n\ + OK"; + let resp = s.parse::<Response>().unwrap(); + assert_eq!("application/json", resp.content_type()); + } + #[test] fn content_type_with_charset() { let s = "HTTP/1.1 200 OK\r\n\
"Header field didn't end with \r" error on some websites On some websites, e.g. etihad.com, ureq fails with the following error: > Header field didn't end with \r Firefox and curl work fine. There's 295 such websites in the top million (I'm using [Tranco list generated on the 3rd of February](https://tranco-list.eu/list/3G6L)). Archive with all occurrences: [ureq-header-did-not-end-well.tar.gz](https://github.com/algesten/ureq/files/5983467/ureq-header-did-not-end-well.tar.gz) Code used for testing: https://github.com/Shnatsel/rust-http-clients-smoke-test/blob/f206362f2e81521bbefb84007cdd25242f6db590/ureq-smoke-test/src/main.rs
9ec4e7192aa80d38d968e5989742ba10fbbbe575
[ "response::tests::content_type_without_cr", "test::timeout::read_timeout_during_body" ]
[ "proxy::tests::parse_proxy_http_user_pass_server_port", "request::request_implements_send_and_sync", "proxy::tests::parse_proxy_server", "response::short_read", "response::tests::charset", "header::name_and_value", "error::error_is_send_and_sync", "proxy::tests::parse_proxy_socks_user_pass_server_port", "response::tests::charset_default", "proxy::tests::parse_proxy_server_port", "header::test_valid_value", "error::connection_closed", "pool::pool_checks_proxy", "pool::poolkey_new", "proxy::tests::parse_proxy_fakeproto", "header::value_with_whitespace", "proxy::tests::parse_proxy_socks5_user_pass_server_port", "header::empty_value", "header::test_parse_invalid_name", "error::status_code_error", "header::test_valid_name", "pool::pool_connections_limit", "proxy::tests::parse_proxy_user_pass_server_port", "agent::tests::agent_implements_send_and_sync", "response::tests::parse_borked_header", "error::status_code_error_redirect", "response::tests::history", "error::io_error", "body::test_copy_chunked", "response::tests::parse_deserialize_json", "request::send_byte_slice", "response::tests::content_type_with_charset", "response::tests::chunked_transfer", "response::tests::content_type_default", "test::body_send::content_length_on_str", "test::query_string::query_in_path", "test::body_read::ignore_content_length_when_chunked", "response::tests::parse_simple_json", "test::simple::body_as_reader", "test::redirect::redirect_get", "test::simple::escape_path", "test::simple::header_passing", "test::simple::header_with_spaces_before_value", "test::simple::body_as_text", "test::body_send::content_length_on_json", "test::body_send::str_with_encoding", "test::redirect::redirect_308", "response::tests::content_type_without_charset", "test::query_string::no_query_string", "test::redirect::redirect_many", "test::simple::non_ascii_header", "test::simple::host_no_port", "pool::pool_per_host_connections_limit", "test::redirect::redirect_host", "test::agent_test::test_cookies_on_redirect", "test::body_send::content_length_and_chunked", "test::agent_test::dirty_streams_not_returned", "test::simple::request_debug", "tests::connect_https_invalid_name", "test::timeout::read_timeout_during_headers", "test::simple::repeat_non_x_header", "unit::tests::match_cookies_returns_one_header", "test::simple::body_as_json_deserialize", "test::query_string::query_in_path_and_req", "test::body_send::user_set_content_length_on_str", "test::body_send::content_type_on_json", "test::simple::no_status_text", "test::redirect::redirect_on", "test::redirect::redirects_hit_timeout", "test::body_read::no_reader_on_head", "test::redirect::redirect_off", "test::simple::host_with_port", "test::redirect::redirect_post", "test::query_string::escaped_query_string", "test::body_send::content_type_not_overriden_on_json", "test::body_read::content_length_limited", "test::redirect::redirect_head", "test::agent_test::custom_resolver", "test::simple::body_as_json", "test::simple::repeat_x_header", "test::timeout::overall_timeout_during_body", "test::redirect::too_many_redirects", "test::timeout::overall_timeout_during_headers", "test::body_read::transfer_encoding_bogus", "test::agent_test::connection_reuse", "agent_set_header", "src/agent.rs - agent::AgentBuilder::cookie_store (line 499) - compile", "src/agent.rs - agent::Agent::cookie_store (line 176) - compile", "src/error.rs - error::Error (line 26) - compile", "src/lib.rs - (line 42) - compile", "src/lib.rs - (line 196)", "src/lib.rs - (line 91)", "src/lib.rs - (line 214)", "src/agent.rs - agent::AgentBuilder::max_idle_connections (line 268)", "src/request.rs - request::Request::send_bytes (line 174)", "src/agent.rs - agent::AgentBuilder::proxy (line 249)", "src/request.rs - request::Request::query (line 339)", "src/agent.rs - agent::Agent::request_url (line 129)", "src/error.rs - error::OrAnyStatus::or_any_status (line 108)", "src/agent.rs - agent::AgentBuilder::max_idle_connections_per_host (line 282)", "src/agent.rs - agent::AgentBuilder::tls_config (line 475)", "src/agent.rs - agent::AgentBuilder::timeout_write (line 366)", "src/agent.rs - agent::AgentBuilder::timeout (line 390)", "src/error.rs - error::Error::kind (line 221)", "src/request.rs - request::Request::send_string (line 199)", "src/response.rs - response::Response::content_type (line 156)", "src/response.rs - response::Response::from_str (line 514)", "src/request.rs - request::Request::send (line 251)", "src/response.rs - response::Response::into_json (line 335)", "src/response.rs - response::Response::charset (line 180)", "src/response.rs - response::Response::into_string (line 283)", "src/response.rs - response::Response::new (line 85)", "src/response.rs - response::Response::into_reader (line 203)", "src/response.rs - response::Response::into_json (line 359)", "src/error.rs - error::Error (line 42)", "src/request.rs - request::Request::header (line 284)", "src/request.rs - request::Request::has (line 310)", "src/agent.rs - agent::AgentBuilder::redirects (line 416)", "src/lib.rs - (line 164)", "src/request.rs - request::Request::header_names (line 295)", "src/lib.rs - request (line 353)", "src/agent.rs - agent::Agent (line 50)", "src/request.rs - request::Request::call (line 92)", "src/request.rs - request::Request (line 26)", "src/request.rs - request::Request::send_json (line 151)", "src/agent.rs - agent::AgentBuilder::timeout_read (line 344)", "src/agent.rs - agent::AgentBuilder::resolver (line 301)", "src/request.rs - request::Request::set (line 267)", "src/response.rs - response::Response (line 31)", "src/request.rs - request::Request::all (line 321)", "src/agent.rs - agent::AgentBuilder::user_agent (line 444)", "src/error.rs - error::Error (line 68)", "src/lib.rs - (line 25)", "src/request.rs - request::Request::send_form (line 221)", "src/agent.rs - agent::AgentBuilder::timeout_connect (line 322)", "src/agent.rs - agent::Agent::request (line 107)", "src/lib.rs - (line 67)", "src/lib.rs - request_url (line 370)" ]
[ "test::timeout::overall_timeout_reading_json", "test::range::read_range", "tests::connect_http_google", "tests::connect_https_google", "tls_client_certificate" ]
[]
2021-02-21T08:06:27Z
96f6ed15d7d0d2d6e2fefe6b8ffc98b9efb20e71
diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -83,7 +83,7 @@ impl Error { Some(e) => e, None => return false, }; - let ioe: &Box<io::Error> = match source.downcast_ref() { + let ioe: &io::Error = match source.downcast_ref() { Some(e) => e, None => return false, };
algesten__ureq-238
238
[ "237" ]
1.5
algesten/ureq
2020-11-22T05:24:05Z
diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -183,6 +183,17 @@ fn io_error() { assert_eq!(err.to_string(), "http://example.com/: Io: oops: too slow"); } +#[test] +fn connection_closed() { + let ioe = io::Error::new(io::ErrorKind::ConnectionReset, "connection reset"); + let err = ErrorKind::Io.new().src(ioe); + assert!(err.connection_closed()); + + let ioe = io::Error::new(io::ErrorKind::ConnectionAborted, "connection aborted"); + let err = ErrorKind::Io.new().src(ioe); + assert!(err.connection_closed()); +} + #[test] fn error_is_send_and_sync() { fn takes_send(_: impl Send) {}
Intermittent test error since #234 landed I'm getting this test error approximately 1 out of 2 test runs. I checked out the prior commit and ran the tests a bunch of time without reproducing, so it's probably something in #234. I'll investigate. ``` ---- test::agent_test::dirty_streams_not_returned stdout ---- Error: Error { kind: Io, message: None, url: Some("http://localhost:45341/"), source: Some(Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" }), response: None } thread 'test::agent_test::dirty_streams_not_returned' panicked at 'assertion failed: `(left == right)` left: `1`, right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', /home/jsha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:193:5 stack backtrace: 0: rust_begin_unwind at /rustc/b1496c6e606dd908dd651ac2cce89815e10d7fc5/library/std/src/panicking.rs:483:5 1: std::panicking::begin_panic_fmt at /rustc/b1496c6e606dd908dd651ac2cce89815e10d7fc5/library/std/src/panicking.rs:437:5 2: test::assert_test_result at /home/jsha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:193:5 3: ureq::test::agent_test::dirty_streams_not_returned::{{closure}} at ./src/test/agent_test.rs:136:1 4: core::ops::function::FnOnce::call_once at /home/jsha/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5 5: core::ops::function::FnOnce::call_once at /rustc/b1496c6e606dd908dd651ac2cce89815e10d7fc5/library/core/src/ops/function.rs:227:5 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ```
62cf25fd3575be0652a6766670e6dab2739d6c55
[ "error::connection_closed", "test::agent_test::dirty_streams_not_returned" ]
[ "response::tests::charset", "body::test_copy_chunked", "header::test_parse_invalid_name", "agent::tests::agent_implements_send_and_sync", "header::test_valid_name", "proxy::tests::parse_proxy_http_user_pass_server_port", "proxy::tests::parse_proxy_fakeproto", "header::test_valid_value", "proxy::tests::parse_proxy_server", "header::empty_value", "error::status_code_error", "error::io_error", "response::tests::charset_default", "header::value_with_whitespace", "response::tests::parse_borked_header", "proxy::tests::parse_proxy_server_port", "header::name_and_value", "pool::poolkey_new", "error::error_is_send_and_sync", "response::tests::content_type_without_charset", "pool::pool_checks_proxy", "proxy::tests::parse_proxy_user_pass_server_port", "response::short_read", "proxy::tests::parse_proxy_socks_user_pass_server_port", "response::tests::content_type_default", "request::request_implements_send_and_sync", "proxy::tests::parse_proxy_socks5_user_pass_server_port", "response::tests::content_type_with_charset", "pool::pool_connections_limit", "request::send_byte_slice", "pool::pool_per_host_connections_limit", "response::tests::chunked_transfer", "test::body_send::user_set_content_length_on_str", "test::redirect::redirect_many", "test::body_send::content_type_not_overriden_on_json", "test::query_string::no_query_string", "test::body_send::content_length_on_str", "test::body_read::transfer_encoding_bogus", "test::simple::body_as_json", "test::simple::body_as_json_deserialize", "test::body_send::content_length_on_json", "response::tests::parse_simple_json", "test::query_string::query_in_path_and_req", "test::query_string::query_in_path", "test::body_send::content_length_and_chunked", "test::body_send::str_with_encoding", "test::redirect::redirect_on", "test::redirect::redirect_head", "test::body_read::content_length_limited", "test::body_send::content_type_on_json", "response::tests::parse_deserialize_json", "test::body_read::no_reader_on_head", "test::redirect::redirect_post", "test::agent_test::custom_resolver", "test::redirect::redirect_get", "test::query_string::escaped_query_string", "test::simple::host_no_port", "test::simple::host_with_port", "test::simple::body_as_reader", "test::simple::non_ascii_header", "test::redirect::redirect_off", "test::agent_test::test_cookies_on_redirect", "test::simple::no_status_text", "test::simple::repeat_non_x_header", "unit::tests::match_cookies_returns_one_header", "test::simple::escape_path", "test::simple::header_passing", "tests::connect_https_invalid_name", "test::simple::body_as_text", "test::simple::repeat_x_header", "test::body_read::ignore_content_length_when_chunked", "test::redirect::redirect_host", "test::simple::request_debug", "test::simple::header_with_spaces_before_value", "test::timeout::read_timeout_during_headers", "test::timeout::overall_timeout_during_body", "test::timeout::overall_timeout_during_headers", "test::agent_test::connection_reuse", "agent_set_header", "src/agent.rs - agent::Agent::cookie_store (line 175) - compile", "src/agent.rs - agent::AgentBuilder::cookie_store (line 454) - compile", "src/lib.rs - (line 38) - compile", "src/request.rs - request::Request::header (line 269)", "src/request.rs - request::Request::all (line 306)", "src/request.rs - request::Request::send (line 236)", "src/agent.rs - agent::Agent::request (line 106)", "src/request.rs - request::Request::send_string (line 184)", "src/agent.rs - agent::AgentBuilder::resolver (line 299)", "src/request.rs - request::Request::header_names (line 280)", "src/agent.rs - agent::AgentBuilder::max_idle_connections (line 266)", "src/agent.rs - agent::AgentBuilder::tls_config (line 430)", "src/request.rs - request::Request::error_on_non_2xx (line 345)", "src/request.rs - request::Request::call (line 92)", "src/lib.rs - request (line 276)", "src/request.rs - request::Request::has (line 295)", "src/request.rs - request::Request::query (line 324)", "src/agent.rs - agent::AgentBuilder::timeout (line 388)", "src/request.rs - request::Request::set (line 252)", "src/response.rs - response::Response (line 31)", "src/agent.rs - agent::AgentBuilder::max_idle_connections_per_host (line 280)", "src/agent.rs - agent::Agent::request_url (line 128)", "src/agent.rs - agent::AgentBuilder::proxy (line 247)", "src/lib.rs - request_url (line 293)", "src/request.rs - request::Request::send_json (line 136)", "src/agent.rs - agent::Agent (line 49)", "src/request.rs - request::Request::send_form (line 206)", "src/request.rs - request::Request::send_bytes (line 159)", "src/lib.rs - (line 63)", "src/lib.rs - (line 21)", "src/request.rs - request::Request (line 26)", "src/lib.rs - (line 135)", "src/response.rs - response::Response::new (line 79)", "src/agent.rs - agent::AgentBuilder::timeout_read (line 342)", "src/response.rs - response::Response::content_type (line 179)", "src/response.rs - response::Response::into_string (line 306)", "src/response.rs - response::Response::into_reader (line 226)", "src/response.rs - response::Response::from_str (line 499)", "src/response.rs - response::Response::into_json (line 356)", "src/response.rs - response::Response::charset (line 203)", "src/response.rs - response::Response::into_json (line 380)", "src/agent.rs - agent::AgentBuilder::timeout_write (line 364)", "src/agent.rs - agent::AgentBuilder::redirects (line 411)", "src/agent.rs - agent::AgentBuilder::timeout_connect (line 320)" ]
[ "test::timeout::overall_timeout_reading_json", "test::range::read_range", "tests::connect_http_google", "tests::connect_https_google", "tls_client_certificate" ]
[ "test::timeout::read_timeout_during_body" ]
2020-11-22T20:57:02Z
652500f5a84461f793a05c4c1039cf7b279294b5
diff --git a/src/stream.rs b/src/stream.rs --- a/src/stream.rs +++ b/src/stream.rs @@ -147,7 +147,8 @@ pub(crate) fn connect_https(unit: &Unit) -> Result<Stream, Error> { let hostname = unit.url.host_str().unwrap(); let port = unit.url.port().unwrap_or(443); - let sni = webpki::DNSNameRef::try_from_ascii_str(hostname).unwrap(); + let sni = webpki::DNSNameRef::try_from_ascii_str(hostname) + .map_err(|err| Error::DnsFailed(err.to_string()))?; let sess = rustls::ClientSession::new(&*TLS_CONF, sni); let sock = connect_host(unit, hostname, port)?;
algesten__ureq-50
50
Thanks! I'll follow the bug in ring and update when I can. I'm not sure if I made it clear, so just in case: there are two distinct panics, one in ring (assertion failure) and another one in ureq (unwrap). Ah. Yes. The unwrap in ureq we should fix!
[ "24" ]
0.12
algesten/ureq
2020-04-12T02:04:22Z
diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -202,4 +202,12 @@ mod tests { ); assert_eq!("text/html", resp.content_type()); } + + #[test] + #[cfg(feature = "tls")] + fn connect_https_invalid_name() { + let resp = get("https://example.com{REQUEST_URI}/").call(); + assert_eq!(400, resp.status()); + assert!(resp.synthetic()); + } }
Panic in ureq::stream::connect_https on some websites I've tested `ureq` by downloading homepages of the [top million websites](https://blog.majestic.com/development/majestic-million-csv-daily/) with it. I've found [a panic](https://github.com/briansmith/ring/issues/929) in `ring`, and 13 out of 1,000,000 websites triggered a panic in `ureq::stream::connect_https`. Steps to reproduce: Run [this simple program](https://gist.githubusercontent.com/deltaphc/2949ed292c7d1169e744e5ffa7fd0687/raw/bb5e5f30bbfa38406a6bd7bd538224f450717db3/ureq_test.rs) with "yardmaster2020.com" given as the only command-line argument. The same website opens fine in Chrome. Full list of websites where this happens: amadriapark.com, bda.org.uk, egain.cloud, gdczt.gov.cn, hsu.edu.hk, mathewingram.com, roadrover.cn, srichinmoyraces.org, thetouchx.com, tradekorea.com, utest.com, wlcbcgs.cn, yardmaster2020.com Backtrace: ``` thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidDNSNameError', src/libcore/result.rs:1189:5 stack backtrace: 0: backtrace::backtrace::libunwind::trace at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88 1: backtrace::backtrace::trace_unsynchronized at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66 2: std::sys_common::backtrace::_print_fmt at src/libstd/sys_common/backtrace.rs:77 3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt at src/libstd/sys_common/backtrace.rs:59 4: core::fmt::write at src/libcore/fmt/mod.rs:1057 5: std::io::Write::write_fmt at src/libstd/io/mod.rs:1426 6: std::sys_common::backtrace::_print at src/libstd/sys_common/backtrace.rs:62 7: std::sys_common::backtrace::print at src/libstd/sys_common/backtrace.rs:49 8: std::panicking::default_hook::{{closure}} at src/libstd/panicking.rs:195 9: std::panicking::default_hook at src/libstd/panicking.rs:215 10: std::panicking::rust_panic_with_hook at src/libstd/panicking.rs:472 11: rust_begin_unwind at src/libstd/panicking.rs:376 12: core::panicking::panic_fmt at src/libcore/panicking.rs:84 13: core::result::unwrap_failed at src/libcore/result.rs:1189 14: ureq::stream::connect_https 15: ureq::unit::connect_socket ```
652500f5a84461f793a05c4c1039cf7b279294b5
[ "tests::connect_https_invalid_name" ]
[ "agent::tests::agent_implements_send", "test::body_send::str_with_encoding", "test::body_send::user_set_content_length_on_str", "agent::tests::request_implements_send", "test::query_string::query_in_path_and_req", "test::redirect::redirect_get", "test::redirect::redirect_head", "test::redirect::redirect_many", "test::redirect::redirect_off", "test::redirect::redirect_on", "test::redirect::redirect_post", "response::tests::content_type_default", "response::tests::chunked_transfer", "response::tests::content_type_without_charset", "response::tests::charset_default", "response::tests::charset", "body::test_copy_chunked", "response::tests::parse_simple_json", "test::simple::body_as_json", "response::tests::parse_borked_header", "proxy::tests::parse_proxy", "test::simple::body_as_reader", "test::body_read::no_reader_on_head", "test::agent_test::agent_reuse_headers", "response::tests::content_type_with_charset", "test::simple::escape_path", "test::simple::header_passing", "test::auth::basic_auth", "test::body_send::content_length_and_chunked", "test::auth::url_auth", "test::simple::no_status_text", "test::body_read::content_length_limited", "test::simple::request_debug", "test::body_send::content_type_on_json", "test::body_send::content_length_on_str", "test::body_read::ignore_content_length_when_chunked", "test::auth::kind_auth", "test::simple::non_ascii_header", "test::simple::repeat_non_x_header", "test::auth::url_auth_overridden", "test::simple::repeat_x_header", "test::query_string::escaped_query_string", "test::body_send::content_type_not_overriden_on_json", "test::body_send::content_length_on_json", "test::simple::header_with_spaces_before_value", "test::simple::body_as_text", "test::query_string::query_in_path", "test::query_string::no_query_string", "test::agent_test::agent_cookies", "test::body_read::transfer_encoding_bogus", "test::agent_test::connection_reuse", "tls_connection_close", "src/header.rs - header::Header::name (line 26)", "src/agent.rs - agent::Agent::set_cookie (line 191)", "src/agent.rs - agent::Agent::request (line 157)", "src/header.rs - header::Header::value (line 38)", "src/request.rs - request::Request::get_scheme (line 478)", "src/request.rs - request::Request::header_names (line 235)", "src/request.rs - request::Request::has (line 251)", "src/request.rs - request::Request::get_query (line 490)", "src/request.rs - request::Request::get_path (line 504)", "src/agent.rs - agent::Agent::set (line 98)", "src/agent.rs - agent::Agent::auth (line 121)", "src/request.rs - request::Request::all (line 263)", "src/header.rs - header::Header::is_name (line 50)", "src/request.rs - request::Request::header (line 223)", "src/agent.rs - agent::Agent::new (line 75)", "src/request.rs - request::Request::get_url (line 449)", "src/request.rs - request::Request::build (line 84)", "src/request.rs - request::Request::query (line 281)", "src/agent.rs - agent::Agent (line 16)", "src/request.rs - request::Request::redirects (line 394)", "src/request.rs - request::Request::get_host (line 461)", "src/agent.rs - agent::Agent::auth_kind (line 139)", "src/lib.rs - (line 9)", "src/request.rs - request::Request::auth_kind (line 374)", "src/request.rs - request::Request::get_method (line 434)", "src/request.rs - request::Request::auth (line 358)", "src/request.rs - request::Request::query_str (line 298)", "src/request.rs - request::Request::call (line 97)", "src/serde_macros.rs - serde_macros::json (line 14)", "src/serde_macros.rs - serde_macros::json (line 53)", "src/serde_macros.rs - serde_macros::json (line 36)", "src/request.rs - request::Request::send (line 188)", "src/lib.rs - (line 71)", "src/response.rs - response::Response::from_str (line 491)", "src/request.rs - request::Request::timeout_connect (line 313)", "src/request.rs - request::Request::set_proxy (line 522)", "src/response.rs - response::Response::from_read (line 405)", "src/request.rs - request::Request::send_json (line 124)", "src/request.rs - request::Request::timeout_write (line 343)", "src/request.rs - request::Request::send_string (line 169)", "src/request.rs - request::Request::set (line 204)", "src/response.rs - response::Response::synthetic (line 189)", "src/response.rs - response::Response::new (line 75)", "src/request.rs - request::Request::send_bytes (line 146)", "src/request.rs - request::Request::timeout_read (line 328)", "src/response.rs - response::Response (line 30)", "src/lib.rs - request (line 129)", "src/request.rs - request::Request (line 26)" ]
[ "tests::connect_http_google", "tests::connect_https_google", "test::range::agent_pool", "test::range::read_range", "src/response.rs - response::Response::into_string (line 336)", "src/agent.rs - agent::Agent::cookie (line 173)", "src/response.rs - response::Response::content_type (line 217)", "src/response.rs - response::Response::into_json (line 379)", "src/response.rs - response::Response::charset (line 237)", "src/response.rs - response::Response::into_reader (line 256)" ]
[]
2020-04-12T13:20:45Z
89f237be86163f36fdfda87fe3d1ef0a83139f1c
diff --git a/linkerd/app/outbound/src/http/concrete.rs b/linkerd/app/outbound/src/http/concrete.rs --- a/linkerd/app/outbound/src/http/concrete.rs +++ b/linkerd/app/outbound/src/http/concrete.rs @@ -408,13 +408,22 @@ where match self.param() { http::Version::H2 => client::Settings::H2, http::Version::Http1 => match self.metadata.protocol_hint() { - ProtocolHint::Unknown => client::Settings::Http1, + // If the protocol hint is unknown or indicates that the + // endpoint's proxy will treat connections as opaque, do not + // perform a protocol upgrade to HTTP/2. + ProtocolHint::Unknown | ProtocolHint::Opaque => client::Settings::Http1, ProtocolHint::Http2 => client::Settings::OrigProtoUpgrade, }, } } } +impl<T> svc::Param<ProtocolHint> for Endpoint<T> { + fn param(&self) -> ProtocolHint { + self.metadata.protocol_hint() + } +} + // TODO(ver) move this into the endpoint stack? impl<T> tap::Inspect for Endpoint<T> { fn src_addr<B>(&self, req: &http::Request<B>) -> Option<SocketAddr> { diff --git a/linkerd/app/outbound/src/http/endpoint.rs b/linkerd/app/outbound/src/http/endpoint.rs --- a/linkerd/app/outbound/src/http/endpoint.rs +++ b/linkerd/app/outbound/src/http/endpoint.rs @@ -7,7 +7,7 @@ use super::{ use crate::{tcp::tagged_transport, Outbound}; use linkerd_app_core::{ classify, config, errors, http_tracing, metrics, - proxy::{http, tap}, + proxy::{api_resolve::ProtocolHint, http, tap}, svc::{self, ExtractParam}, tls, transport::{self, Remote, ServerAddr}, diff --git a/linkerd/app/outbound/src/http/endpoint.rs b/linkerd/app/outbound/src/http/endpoint.rs --- a/linkerd/app/outbound/src/http/endpoint.rs +++ b/linkerd/app/outbound/src/http/endpoint.rs @@ -206,9 +206,19 @@ impl errors::HttpRescue<Error> for ClientRescue { // === impl Connect === -impl<T> svc::Param<Option<SessionProtocol>> for Connect<T> { +impl<T> svc::Param<Option<SessionProtocol>> for Connect<T> +where + T: svc::Param<ProtocolHint>, +{ #[inline] fn param(&self) -> Option<SessionProtocol> { + // The discovered protocol hint indicates that this endpoint will treat + // all connections as opaque TCP streams. Don't send our detected + // session protocol as part of a transport header. + if self.inner.param() == ProtocolHint::Opaque { + return None; + } + match self.version { http::Version::Http1 => Some(SessionProtocol::Http1), http::Version::H2 => Some(SessionProtocol::Http2), diff --git a/linkerd/proxy/api-resolve/src/metadata.rs b/linkerd/proxy/api-resolve/src/metadata.rs --- a/linkerd/proxy/api-resolve/src/metadata.rs +++ b/linkerd/proxy/api-resolve/src/metadata.rs @@ -31,6 +31,9 @@ pub enum ProtocolHint { Unknown, /// The destination can receive HTTP2 messages. Http2, + /// The destination will handle traffic as opaque, regardless of + /// the local proxy's handling of the traffic. + Opaque, } // === impl Metadata === diff --git a/linkerd/proxy/api-resolve/src/pb.rs b/linkerd/proxy/api-resolve/src/pb.rs --- a/linkerd/proxy/api-resolve/src/pb.rs +++ b/linkerd/proxy/api-resolve/src/pb.rs @@ -26,15 +26,10 @@ pub fn to_addr_meta( let mut proto_hint = ProtocolHint::Unknown; let mut tagged_transport_port = None; if let Some(hint) = pb.protocol_hint { - // the match will make sense later... - #[allow(clippy::collapsible_match, clippy::single_match)] - if let Some(proto) = hint.protocol { - match proto { - Protocol::H2(..) => { - proto_hint = ProtocolHint::Http2; - } - _ => {} // TODO(eliza): handle opaque protocol hints - } + match hint.protocol { + Some(Protocol::H2(..)) => proto_hint = ProtocolHint::Http2, + Some(Protocol::Opaque(..)) => proto_hint = ProtocolHint::Opaque, + None => {} } if let Some(OpaqueTransport { inbound_port }) = hint.opaque_transport {
linkerd__linkerd2-proxy-2237
2,237
> For instance, there's a lot of test infra change in this PR that i haven't really parsed. We can remove the integration test changes if we don't care about having integration tests for this case; I wrote that initially while trying to reproduce the issue. If it's more desirable to have a smaller branch, I can back that out for now and we can consider merging those changes separately (or not at all)? > We can remove the integration test changes if we don't care about having integration tests for this case My point was kind of the opposite: there are probably some parts of this that are relatively easy/uncontroversial to merge that don't actually touch the outbound stack. The outbound stack changes need to be considered in the scope of other changes, while much of the other changes (proxy-api bump, test infra stuff, etc) do not. > > We can remove the integration test changes if we don't care about having integration tests for this case > > My point was kind of the opposite: there are probably some parts of this that are relatively easy/uncontroversial to merge that don't actually touch the outbound stack. The outbound stack changes need to be considered in the scope of other changes, while much of the other changes (proxy-api bump, test infra stuff, etc) do not. Ooooh, gotcha. I'll pull that stuff out, then. https://github.com/linkerd/linkerd2-proxy/pull/2226/ includes some of those test changes
[ "2209" ]
0.1
linkerd/linkerd2-proxy
2023-02-15T22:54:58Z
diff --git a/linkerd/app/integration/src/tests.rs b/linkerd/app/integration/src/tests.rs --- a/linkerd/app/integration/src/tests.rs +++ b/linkerd/app/integration/src/tests.rs @@ -1,4 +1,5 @@ mod client_policy; +mod direct; mod discovery; mod identity; mod orig_proto; diff --git a/linkerd/app/integration/src/tests/direct.rs b/linkerd/app/integration/src/tests/direct.rs --- a/linkerd/app/integration/src/tests/direct.rs +++ b/linkerd/app/integration/src/tests/direct.rs @@ -1,7 +1,7 @@ use crate::*; #[tokio::test] -async fn tagged_transport_http() { +async fn h2_hinted() { let _trace = trace_init(); // identity is always required for direct connections diff --git a/linkerd/app/integration/src/tests/direct.rs b/linkerd/app/integration/src/tests/direct.rs --- a/linkerd/app/integration/src/tests/direct.rs +++ b/linkerd/app/integration/src/tests/direct.rs @@ -39,6 +39,56 @@ async fn tagged_transport_http() { assert_eq!(client.get("/").await, "hello"); } +/// Reproduces linkerd/linkerd2#9888. A proxy receives HTTP traffic direct +/// traffic with a transport header, and the port is also in the +/// `INBOUND_PORTS_DISABLE_PROTOCOL_DETECTION` env var. +/// TODO(eliza): add a similar test where the policy on the opaque port is +/// discovered from the policy controller. +#[tokio::test] +async fn opaque_hinted() { + let _trace = trace_init(); + + // identity is always required for direct connections + let in_svc_acct = "foo.ns1.serviceaccount.identity.linkerd.cluster.local"; + let in_identity = identity::Identity::new("foo-ns1", in_svc_acct.to_string()); + + let out_svc_acct = "bar.ns1.serviceaccount.identity.linkerd.cluster.local"; + let out_identity = identity::Identity::new("bar-ns1", out_svc_acct.to_string()); + + let srv = server::http1().route("/", "hello").run().await; + let srv_addr = srv.addr; + let dst = format!("opaque.test.svc.cluster.local:{}", srv_addr.port()); + + let (inbound, _profile_in) = { + let id_svc = in_identity.service(); + let mut env = in_identity.env; + env.put( + app::env::ENV_INBOUND_PORTS_DISABLE_PROTOCOL_DETECTION, + srv_addr.port().to_string(), + ); + let (proxy, profile) = mk_inbound(srv, id_svc, &dst).await; + let proxy = proxy.run_with_test_env(env).await; + (proxy, profile) + }; + + let (outbound, _profile_out, _dst) = { + let ctrl = controller::new(); + let dst = ctrl.destination_tx(dst); + dst.send( + controller::destination_add(srv_addr) + .hint(controller::Hint::Opaque) + .opaque_port(inbound.inbound.port()) + .identity(in_svc_acct), + ); + let (proxy, profile) = mk_outbound(srv_addr, ctrl, out_identity).await; + (proxy, profile, dst) + }; + + let client = client::http1(outbound.outbound, "opaque.test.svc.cluster.local"); + + assert_eq!(client.get("/").await, "hello"); +} + async fn mk_inbound( srv: server::Listening, id: identity::Controller, diff --git a/linkerd/app/integration/src/tests/direct.rs b/linkerd/app/integration/src/tests/direct.rs --- a/linkerd/app/integration/src/tests/direct.rs +++ b/linkerd/app/integration/src/tests/direct.rs @@ -54,8 +104,7 @@ async fn mk_inbound( .controller(ctrl) .identity(id.run().await) .inbound(srv) - .inbound_direct() - .named("inbound"); + .inbound_direct(); (proxy, profile) } diff --git a/linkerd/app/integration/src/tests/direct.rs b/linkerd/app/integration/src/tests/direct.rs --- a/linkerd/app/integration/src/tests/direct.rs +++ b/linkerd/app/integration/src/tests/direct.rs @@ -73,7 +122,6 @@ async fn mk_outbound( .controller(ctrl) .identity(out_identity.service().run().await) .outbound_ip(srv_addr) - .named("outbound") .run_with_test_env(out_identity.env) .await; (proxy, profile) diff --git a/linkerd/app/outbound/src/http/endpoint/tests.rs b/linkerd/app/outbound/src/http/endpoint/tests.rs --- a/linkerd/app/outbound/src/http/endpoint/tests.rs +++ b/linkerd/app/outbound/src/http/endpoint/tests.rs @@ -314,13 +314,19 @@ impl svc::Param<http::client::Settings> for Endpoint { match self.version { http::Version::H2 => http::client::Settings::H2, http::Version::Http1 => match self.hint { - ProtocolHint::Unknown => http::client::Settings::Http1, + ProtocolHint::Unknown | ProtocolHint::Opaque => http::client::Settings::Http1, ProtocolHint::Http2 => http::client::Settings::OrigProtoUpgrade, }, } } } +impl svc::Param<ProtocolHint> for Endpoint { + fn param(&self) -> ProtocolHint { + self.hint + } +} + impl tap::Inspect for Endpoint { fn src_addr<B>(&self, req: &http::Request<B>) -> Option<SocketAddr> { req.extensions().get::<http::ClientHandle>().map(|c| c.addr) diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -155,6 +155,7 @@ mod test { port_override: Option<u16>, authority: Option<http::uri::Authority>, server_id: Option<tls::ServerId>, + proto: Option<SessionProtocol>, } impl svc::Param<tls::ConditionalClientTls> for Endpoint { diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -197,7 +198,28 @@ mod test { impl svc::Param<Option<SessionProtocol>> for Endpoint { fn param(&self) -> Option<SessionProtocol> { - None + self.proto.clone() + } + } + + fn expect_header( + header: TransportHeader, + ) -> impl Fn(Connect) -> futures::future::Ready<Result<(tokio_test::io::Mock, ConnectMeta), io::Error>> + { + move |ep| { + let Remote(ServerAddr(sa)) = ep.addr; + assert_eq!(sa.port(), 4143); + assert!(ep.tls.is_some()); + let buf = header.encode_prefaced_buf().expect("Must encode"); + let io = tokio_test::io::Builder::new() + .write(&buf[..]) + .write(b"hello") + .build(); + let meta = tls::ConnectMeta { + socket: Local(ClientAddr(([0, 0, 0, 0], 0).into())), + tls: Conditional::Some(Some(tls::NegotiatedProtocolRef(PROTOCOL).into())), + }; + future::ready(Ok::<_, io::Error>((io, meta))) } } diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -230,26 +252,11 @@ mod test { let _trace = linkerd_tracing::test::trace_init(); let svc = TaggedTransport { - inner: service_fn(|ep: Connect| { - let Remote(ServerAddr(sa)) = ep.addr; - assert_eq!(sa.port(), 4143); - assert!(ep.tls.is_some()); - let hdr = TransportHeader { - port: 4321, - name: None, - protocol: None, - }; - let buf = hdr.encode_prefaced_buf().expect("Must encode"); - let io = tokio_test::io::Builder::new() - .write(&buf[..]) - .write(b"hello") - .build(); - let meta = tls::ConnectMeta { - socket: Local(ClientAddr(([0, 0, 0, 0], 0).into())), - tls: Conditional::Some(Some(tls::NegotiatedProtocolRef(PROTOCOL).into())), - }; - future::ready(Ok::<_, io::Error>((io, meta))) - }), + inner: service_fn(expect_header(TransportHeader { + port: 4321, + name: None, + protocol: None, + })), }; let e = Endpoint { diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -258,6 +265,7 @@ mod test { identity::Name::from_str("server.id").unwrap(), )), authority: None, + proto: None, }; let (mut io, _meta) = svc.oneshot(e).await.expect("Connect must not fail"); io.write_all(b"hello").await.expect("Write must succeed"); diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -268,26 +276,11 @@ mod test { let _trace = linkerd_tracing::test::trace_init(); let svc = TaggedTransport { - inner: service_fn(|ep: Connect| { - let Remote(ServerAddr(sa)) = ep.addr; - assert_eq!(sa.port(), 4143); - assert!(ep.tls.is_some()); - let hdr = TransportHeader { - port: 5555, - name: Some(dns::Name::from_str("foo.bar.example.com").unwrap()), - protocol: None, - }; - let buf = hdr.encode_prefaced_buf().expect("Must encode"); - let io = tokio_test::io::Builder::new() - .write(&buf[..]) - .write(b"hello") - .build(); - let meta = tls::ConnectMeta { - socket: Local(ClientAddr(([0, 0, 0, 0], 0).into())), - tls: Conditional::Some(Some(tls::NegotiatedProtocolRef(PROTOCOL).into())), - }; - future::ready(Ok::<_, io::Error>((io, meta))) - }), + inner: service_fn(expect_header(TransportHeader { + port: 5555, + name: Some(dns::Name::from_str("foo.bar.example.com").unwrap()), + protocol: None, + })), }; let e = Endpoint { diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -296,6 +289,7 @@ mod test { identity::Name::from_str("server.id").unwrap(), )), authority: Some(http::uri::Authority::from_str("foo.bar.example.com:5555").unwrap()), + proto: None, }; let (mut io, _meta) = svc.oneshot(e).await.expect("Connect must not fail"); io.write_all(b"hello").await.expect("Write must succeed"); diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -306,26 +300,83 @@ mod test { let _trace = linkerd_tracing::test::trace_init(); let svc = TaggedTransport { - inner: service_fn(|ep: Connect| { - let Remote(ServerAddr(sa)) = ep.addr; - assert_eq!(sa.port(), 4143); - assert!(ep.tls.is_some()); - let hdr = TransportHeader { - port: 4321, - name: None, - protocol: None, - }; - let buf = hdr.encode_prefaced_buf().expect("Must encode"); - let io = tokio_test::io::Builder::new() - .write(&buf[..]) - .write(b"hello") - .build(); - let meta = tls::ConnectMeta { - socket: Local(ClientAddr(([0, 0, 0, 0], 0).into())), - tls: Conditional::Some(Some(tls::NegotiatedProtocolRef(PROTOCOL).into())), - }; - future::ready(Ok::<_, io::Error>((io, meta))) - }), + inner: service_fn(expect_header(TransportHeader { + port: 4321, + name: None, + protocol: None, + })), + }; + + let e = Endpoint { + port_override: Some(4143), + server_id: Some(tls::ServerId( + identity::Name::from_str("server.id").unwrap(), + )), + authority: None, + proto: None, + }; + let (mut io, _meta) = svc.oneshot(e).await.expect("Connect must not fail"); + io.write_all(b"hello").await.expect("Write must succeed"); + } + + #[tokio::test(flavor = "current_thread")] + async fn http_no_name() { + let _trace = linkerd_tracing::test::trace_init(); + + let svc = TaggedTransport { + inner: service_fn(expect_header(TransportHeader { + port: 4321, + name: None, + protocol: Some(SessionProtocol::Http1), + })), + }; + + let e = Endpoint { + port_override: Some(4143), + server_id: Some(tls::ServerId( + identity::Name::from_str("server.id").unwrap(), + )), + authority: None, + proto: Some(SessionProtocol::Http1), + }; + let (mut io, _meta) = svc.oneshot(e).await.expect("Connect must not fail"); + io.write_all(b"hello").await.expect("Write must succeed"); + } + + #[tokio::test(flavor = "current_thread")] + async fn http_named_with_port() { + let _trace = linkerd_tracing::test::trace_init(); + + let svc = TaggedTransport { + inner: service_fn(expect_header(TransportHeader { + port: 5555, + name: Some(dns::Name::from_str("foo.bar.example.com").unwrap()), + protocol: Some(SessionProtocol::Http1), + })), + }; + + let e = Endpoint { + port_override: Some(4143), + server_id: Some(tls::ServerId( + identity::Name::from_str("server.id").unwrap(), + )), + authority: Some(http::uri::Authority::from_str("foo.bar.example.com:5555").unwrap()), + proto: Some(SessionProtocol::Http1), + }; + let (mut io, _meta) = svc.oneshot(e).await.expect("Connect must not fail"); + io.write_all(b"hello").await.expect("Write must succeed"); + } + + #[tokio::test(flavor = "current_thread")] + async fn http_named_no_port() { + let _trace = linkerd_tracing::test::trace_init(); + + let svc = TaggedTransport { + inner: service_fn(expect_header(TransportHeader { + port: 4321, + name: None, + protocol: Some(SessionProtocol::Http1), + })), }; let e = Endpoint { diff --git a/linkerd/app/outbound/src/tcp/tagged_transport.rs b/linkerd/app/outbound/src/tcp/tagged_transport.rs --- a/linkerd/app/outbound/src/tcp/tagged_transport.rs +++ b/linkerd/app/outbound/src/tcp/tagged_transport.rs @@ -334,6 +385,7 @@ mod test { identity::Name::from_str("server.id").unwrap(), )), authority: None, + proto: Some(SessionProtocol::Http1), }; let (mut io, _meta) = svc.oneshot(e).await.expect("Connect must not fail"); io.write_all(b"hello").await.expect("Write must succeed");
handle `Opaque` protocol hints on endpoints Currently, when the outbound proxy makes a direct connection prefixed with a `TransportHeader` in order to send HTTP traffic, it will always send a `SessionProtocol` hint with the HTTP version as part of the header. This instructs the inbound proxy to use that protocol, even if the target port has a ServerPolicy that marks that port as opaque, which can result in incorrect handling of that connection. See linkerd/linkerd2#9888 for details. In order to prevent this, linkerd/linkerd2-proxy-api#197 adds a new `ProtocolHint` value to the protobuf endpoint metadata message. This will allow the Destination controller to explicitly indicate to the outbound proxy that a given endpoint is known to handle all connections to a port as an opaque TCP stream, and that the proxy should not perform a protocol upgrade or send a `SessionProtocol` in the transport header. This branch updates the proxy to handle this new hint value, and adds tests that the outbound proxy behaves as expected. Once the Destination controller is updated to send this `ProtocolHint` for ports that are marked as opaque on the inbound side, this will fix linkerd/linkerd2#9888. This branch is currently a draft because the `linkerd2-proxy-api` changes have not been published yet. Once a new version of the proxy API is published, we'll update this branch to depend on that, and this can be merged.
89f237be86163f36fdfda87fe3d1ef0a83139f1c
[ "tests::telemetry::transport::outbound_tcp_open_connections", "tests::telemetry::tcp_errors::inbound_multi" ]
[ "test_assert_eventually - should panic", "tests::client_policy::empty_http2_route", "tests::discovery::http1::absolute_uris::outbound_reconnects_if_controller_stream_ends", "tests::discovery::http1::absolute_uris::outbound_falls_back_to_orig_dst_after_invalid_argument", "tests::client_policy::default_http1_route", "tests::client_policy::empty_http1_route", "tests::discovery::http1::outbound_reconnects_if_controller_stream_ends", "tests::discovery::http1::outbound_falls_back_to_orig_dst_when_outside_search_path", "tests::direct::opaque_hinted", "tests::discovery::http1::absolute_uris::outbound_asks_controller_api", "tests::discovery::http1::outbound_asks_controller_api", "tests::client_policy::default_http2_route", "tests::direct::h2_hinted", "tests::discovery::http1::absolute_uris::dst_resolutions_are_cached", "tests::client_policy::path_based_routing", "tests::discovery::http2::outbound_falls_back_to_orig_dst_when_outside_search_path", "tests::discovery::http2::outbound_reconnects_if_controller_stream_ends", "tests::discovery::http1::outbound_error_reconnects_after_backoff", "tests::discovery::http1::outbound_falls_back_to_orig_dst_after_invalid_argument", "tests::identity::http1_rejects_tls_before_identity_is_certified", "tests::discovery::http2::outbound_asks_controller_api", "tests::discovery::http1::dst_resolutions_are_cached", "tests::discovery::http2::dst_resolutions_are_cached", "tests::discovery::http1::absolute_uris::outbound_falls_back_to_orig_dst_when_outside_search_path", "tests::discovery::http1::absolute_uris::outbound_error_reconnects_after_backoff", "tests::identity::http2_rejects_tls_before_identity_is_certified", "tests::discovery::http2::outbound_falls_back_to_orig_dst_after_invalid_argument", "tests::identity::http1_accepts_tls_after_identity_is_certified", "tests::identity::nonblocking_identity_detection", "tests::discovery::http2::outbound_balancer_waits_for_ready_endpoint", "tests::identity::refresh", "tests::identity::ready", "tests::client_policy::header_based_routing", "tests::identity::http2_accepts_tls_after_identity_is_certified", "tests::profiles::grpc_retry::retries_failure_in_headers", "tests::profiles::http1::does_not_retry_if_body_is_too_long", "tests::orig_proto::outbound_http1", "tests::profiles::http1::does_not_retry_if_earlier_response_class_is_success", "tests::discovery::http2::outbound_error_reconnects_after_backoff", "tests::identity::identity_header_stripping", "tests::profiles::http1::does_not_retry_if_request_does_not_match", "tests::profile_dst_overrides::add_a_dst_override", "tests::profile_dst_overrides::add_multiple_dst_overrides", "tests::profiles::http1::ignores_invalid_retry_budget_negative_ratio", "tests::profiles::http1::retry_if_profile_allows", "tests::profiles::http1::retry_uses_budget", "tests::profiles::grpc_retry::does_not_retry_success_in_trailers", "tests::profiles::grpc_retry::retries_failure_in_trailers", "tests::orig_proto::inbound_http1", "tests::profiles::http1::ignores_invalid_retry_budget_ttl", "tests::profiles::http1::retry_with_small_post_body", "tests::profiles::http1::does_not_retry_if_missing_retry_budget", "tests::profiles::http1::ignores_invalid_retry_budget_ratio", "tests::profiles::http1::retry_with_small_put_body", "tests::profile_dst_overrides::remove_a_dst_override", "tests::profiles::grpc_retry::does_not_eat_multiple_data_frame_body", "tests::profiles::http1::retry_without_content_length", "tests::profiles::http2::does_not_retry_if_body_is_too_long", "tests::profile_dst_overrides::set_a_dst_override_weight_to_zero", "tests::profile_dst_overrides::set_all_dst_override_weights_to_zero", "tests::profiles::http2::does_not_retry_if_earlier_response_class_is_success", "tests::profiles::http2::does_not_retry_if_missing_retry_budget", "tests::profiles::http2::does_not_retry_if_request_does_not_match", "tests::profiles::http2::http2_failures_dont_leak_connection_window", "tests::profiles::http2::does_not_retry_if_streaming_body_exceeds_max_length", "tests::profiles::http2::ignores_invalid_retry_budget_negative_ratio", "tests::profiles::http2::ignores_invalid_retry_budget_ratio", "tests::profiles::http2::retry_if_profile_allows", "tests::profiles::http2::ignores_invalid_retry_budget_ttl", "tests::profiles::http2::retry_with_small_post_body", "tests::profiles::http2::retry_uses_budget", "tests::profiles::http2::retry_with_small_put_body", "tests::profiles::http2::retry_without_content_length", "tests::tap::tap_disabled_when_identity_disabled", "tests::shutdown::h2_goaways_connections", "tests::shutdown::http1_closes_idle_connections", "tests::shutdown::tcp_waits_for_proxies_to_close", "tests::tap::tap_disabled_when_tap_svc_name_not_set", "tests::tap::tap_enabled_when_tap_svc_name_set", "tests::telemetry::env::returns_env_var_json", "tests::profiles::http1::timeout", "tests::profiles::http1::does_not_retry_if_streaming_body_exceeds_max_length", "tests::telemetry::env::filters_on_query_params", "tests::telemetry::admin_transport_metrics", "tests::telemetry::log_stream::valid_query_does_not_error", "tests::discovery::http1::absolute_uris::outbound_fails_fast_when_destination_has_no_endpoints", "tests::discovery::http1::absolute_uris::outbound_times_out", "tests::telemetry::log_stream::valid_get_does_not_error", "tests::discovery::http1::outbound_times_out", "tests::discovery::http1::outbound_fails_fast_when_destination_has_no_endpoints", "tests::shutdown::h2_exercise_goaways_connections", "tests::discovery::http1::outbound_fails_fast_when_destination_does_not_exist", "tests::discovery::http1::absolute_uris::outbound_fails_fast_when_destination_does_not_exist", "tests::discovery::http2::outbound_fails_fast_when_destination_does_not_exist", "tests::discovery::http2::outbound_fails_fast_when_destination_has_no_endpoints", "tests::telemetry::admin_request_count", "tests::telemetry::metrics_has_start_time", "tests::discovery::http2::outbound_times_out", "tests::profiles::http2::timeout", "tests::telemetry::outbound_dst_labels::multiple_addrset_labels", "tests::telemetry::metrics_endpoint_inbound_request_count", "tests::telemetry::metrics_endpoint_inbound_response_count", "tests::discovery::http1::absolute_uris::outbound_destinations_reset_on_reconnect_followed_by_dne", "tests::discovery::http1::absolute_uris::outbound_destinations_reset_on_reconnect_followed_by_empty", "tests::discovery::http1::outbound_destinations_reset_on_reconnect_followed_by_dne", "tests::discovery::http2::outbound_destinations_reset_on_reconnect_followed_by_dne", "tests::discovery::http2::outbound_destinations_reset_on_reconnect_followed_by_empty", "tests::telemetry::response_classification::outbound_http", "tests::discovery::http1::outbound_destinations_reset_on_reconnect_followed_by_empty", "tests::telemetry::metrics_endpoint_outbound_response_count", "tests::telemetry::transport::inbound_tcp_connect", "tests::telemetry::transport::inbound_tcp_write_bytes_total", "tests::telemetry::log_stream::query_is_valid_json", "tests::telemetry::transport::inbound_tcp_accept", "tests::telemetry::outbound_dst_labels::multiple_addr_labels", "tests::telemetry::log_stream::is_valid_json", "tests::telemetry::outbound_dst_labels::labeled_addr_and_addrset", "tests::telemetry::tcp_errors::inbound_io_err", "tests::telemetry::metrics_endpoint_outbound_request_count", "tests::telemetry::transport::outbound_tcp_connect", "tests::telemetry::transport::inbound_http_connect", "tests::telemetry::transport::inbound_http_accept", "tests::telemetry::transport::inbound_http_tcp_open_connections", "tests::telemetry::transport::outbound_tcp_read_bytes_total", "tests::telemetry::tcp_errors::inbound_timeout", "tests::telemetry::inbound_response_latency", "tests::telemetry::response_classification::inbound_http", "tests::telemetry::transport::outbound_tcp_write_bytes_total", "tests::transparency::inbound_tcp", "tests::telemetry::tcp_errors::inbound_success", "tests::transparency::one_proxy::http10_with_host", "tests::transparency::http2_request_without_authority", "tests::transparency::http2_rst_stream_is_propagated", "tests::transparency::http1_orig_proto_does_not_propagate_rst_stream", "tests::telemetry::transport::outbound_http_connect", "tests::telemetry::transport::inbound_tcp_read_bytes_total", "tests::transparency::http1_requests_without_host_have_unique_connections", "tests::telemetry::transport::outbound_http_accept", "tests::telemetry::transport::outbound_http_tcp_open_connections", "tests::transparency::http10_without_host", "tests::telemetry::transport::inbound_tcp_open_connections", "tests::telemetry::metrics_have_no_double_commas", "tests::telemetry::transport::outbound_tcp_accept", "tests::transparency::http1_one_connection_per_host", "tests::transparency::one_proxy::http1_content_length_zero_is_preserved", "tests::transparency::one_proxy::http1_head_responses", "tests::transparency::one_proxy::http1_removes_connection_headers", "tests::transparency::one_proxy::http1_requests_without_body_doesnt_add_transfer_encoding", "tests::telemetry::outbound_response_latency", "tests::transparency::outbound_http1", "tests::transparency::outbound_tcp", "tests::transparency::outbound_tcp_external", "tests::transparency::one_proxy::l5d_orig_proto_header_isnt_leaked", "tests::transparency::proxy_to_proxy::http11_connect", "tests::transparency::proxy_to_proxy::http11_connect_headers_stripped", "tests::transparency::proxy_to_proxy::http11_upgrade_h2_stripped", "tests::transparency::proxy_to_proxy::http11_upgrades", "tests::transparency::proxy_to_proxy::http1_bodyless_responses", "tests::transparency::proxy_to_proxy::http1_content_length_zero_is_preserved", "tests::transparency::proxy_to_proxy::http1_head_responses", "tests::transparency::proxy_to_proxy::http1_inbound_timeout", "tests::transparency::proxy_to_proxy::http1_removes_connection_headers", "tests::transparency::proxy_to_proxy::http1_request_with_body_content_length", "tests::transparency::proxy_to_proxy::http1_request_with_body_chunked", "tests::transparency::proxy_to_proxy::http1_requests_without_body_doesnt_add_transfer_encoding", "tests::transparency::inbound_http1", "tests::transparency::one_proxy::http11_upgrade_h2_stripped", "tests::transparency::proxy_to_proxy::http1_response_end_of_file", "tests::transparency::proxy_to_proxy::http11_connect_bad_requests", "tests::transparency::one_proxy::http11_connect_bad_requests", "tests::transparency::one_proxy::http1_request_with_body_content_length", "tests::transparency::one_proxy::http11_connect", "tests::transparency::one_proxy::http11_connect_headers_stripped", "tests::transparency::one_proxy::http11_upgrades", "tests::transparency::one_proxy::http1_bodyless_responses", "tests::transparency::tcp_connections_close_if_client_closes", "tests::transparency::proxy_to_proxy::inbound_http1", "tests::transparency::retry_reconnect_errors", "tests::transparency::one_proxy::http1_response_end_of_file", "tests::transparency::proxy_to_proxy::l5d_orig_proto_header_isnt_leaked", "tests::telemetry::metrics_compression", "tests::transparency::proxy_to_proxy::http11_absolute_uri_differs_from_host", "tests::transparency::proxy_to_proxy::http10_with_host", "tests::transparency::one_proxy::http1_request_with_body_chunked", "tests::transparency::one_proxy::http11_absolute_uri_differs_from_host", "tests::telemetry::tcp_errors::inbound_direct_success", "tests::transparency::one_proxy::inbound_http1" ]
[ "tests::telemetry::tcp_errors::inbound_direct_multi" ]
[ "tests::telemetry::log_stream::multi_filter", "tests::telemetry::tcp_errors::inbound_invalid_ip", "tests::transparency::tcp_server_first" ]
2023-04-13T21:09:03Z
38172469151f21bae1ec868c548f2ca537146dad
diff --git a/common/src/format.rs b/common/src/format.rs --- a/common/src/format.rs +++ b/common/src/format.rs @@ -335,10 +335,11 @@ impl FormatSpec { let offset = (disp_digit_cnt % (inter + 1) == 0) as i32; let disp_digit_cnt = disp_digit_cnt + offset; let pad_cnt = disp_digit_cnt - magnitude_len; - if pad_cnt > 0 { + let sep_cnt = disp_digit_cnt / (inter + 1); + let diff = pad_cnt - sep_cnt; + if pad_cnt > 0 && diff > 0 { // separate with 0 padding - let sep_cnt = disp_digit_cnt / (inter + 1); - let padding = "0".repeat((pad_cnt - sep_cnt) as usize); + let padding = "0".repeat(diff as usize); let padded_num = format!("{padding}{magnitude_str}"); FormatSpec::insert_separator(padded_num, inter, sep, sep_cnt) } else {
RustPython__RustPython-4711
4,711
not reproducible not reproducible
[ "4588", "4593", "4588" ]
0.2
RustPython/RustPython
2023-03-18T04:44:26Z
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -403,7 +403,6 @@ def test_float__format__locale(self): self.assertEqual(locale.format_string('%g', x, grouping=True), format(x, 'n')) self.assertEqual(locale.format_string('%.10g', x, grouping=True), format(x, '.10n')) - @unittest.skip("TODO: RustPython format code n is not integrated with locale") @run_with_locale('LC_NUMERIC', 'en_US.UTF8') def test_int__format__locale(self): # test locale support for __format__ code 'n' for integers diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -422,6 +421,9 @@ def test_int__format__locale(self): self.assertEqual(len(format(0, rfmt)), len(format(x, rfmt))) self.assertEqual(len(format(0, lfmt)), len(format(x, lfmt))) self.assertEqual(len(format(0, cfmt)), len(format(x, cfmt))) + + if sys.platform != "darwin": + test_int__format__locale = unittest.expectedFailure(test_int__format__locale) def test_float__format__(self): def test(f, format_spec, result): diff --git a/common/src/format.rs b/common/src/format.rs --- a/common/src/format.rs +++ b/common/src/format.rs @@ -1027,6 +1028,16 @@ mod tests { ); } + #[test] + fn test_format_int_sep() { + let spec = FormatSpec::parse(",").expect(""); + assert_eq!(spec.grouping_option, Some(FormatGrouping::Comma)); + assert_eq!( + spec.format_int(&BigInt::from_str("1234567890123456789012345678").unwrap()), + Ok("1,234,567,890,123,456,789,012,345,678".to_owned()) + ); + } + #[test] fn test_format_parse() { let expected = Ok(FormatString { diff --git a/extra_tests/snippets/builtin_format.py b/extra_tests/snippets/builtin_format.py --- a/extra_tests/snippets/builtin_format.py +++ b/extra_tests/snippets/builtin_format.py @@ -133,3 +133,9 @@ def test_zero_padding(): assert f"{3.1415:#.2}" == "3.1" assert f"{3.1415:#.3}" == "3.14" assert f"{3.1415:#.4}" == "3.142" + +# test issue 4558 +x = 123456789012345678901234567890 +for i in range(0, 30): + format(x, ',') + x = x // 10
Format panic in test_int__format__locale ## Issues In `Lib/test/test_types.py``test_int__format__locale`, if you change from `format(x, 'n')` to `format(x, ',')` and run the test, RustPython will panic! It doesn't crash in CPython! See #4593 for test case broken test case of FormatSpec::format_int test case of #4588 Format panic in test_int__format__locale ## Issues In `Lib/test/test_types.py``test_int__format__locale`, if you change from `format(x, 'n')` to `format(x, ',')` and run the test, RustPython will panic! It doesn't crash in CPython! See #4593 for test case
7e66db0d43b6fd93bc114773ac8e896b7eda62c9
[ "format::tests::test_format_int_sep" ]
[ "cformat::tests::test_fill_and_align", "cformat::tests::test_format_parse", "cformat::tests::test_format_parse_key_fail", "cformat::tests::test_format_parse_type_fail", "cformat::tests::test_incomplete_format_fail", "cformat::tests::test_parse_and_format_float", "cformat::tests::test_parse_and_format_number", "cformat::tests::test_parse_and_format_string", "cformat::tests::test_parse_and_format_unicode_string", "cformat::tests::test_parse_flags", "cformat::tests::test_parse_key", "float_ops::test_maybe_remove_trailing_redundant_chars", "float_ops::test_remove_trailing_decimal_point", "float_ops::test_remove_trailing_zeros", "format::tests::test_all", "format::tests::test_fill_and_align", "format::tests::test_fill_and_width", "format::tests::test_format_int", "format::tests::test_format_invalid_specification", "format::tests::test_format_parse", "format::tests::test_format_parse_escape", "format::tests::test_format_parse_fail", "format::tests::test_format_parse_multi_byte_char", "format::tests::test_parse_field_name", "format::tests::test_width_only", "int::test_bytes_to_int", "str::tests::test_get_chars", "float_ops::test_to_hex", "common/src/float_ops.rs - float_ops::eq_int (line 22)" ]
[]
[]
2023-03-23T07:38:32Z
c3d24feebef4c605535a6661ddfeaa18b9bde60c
diff --git a/src/address.rs b/src/address.rs --- a/src/address.rs +++ b/src/address.rs @@ -1,4 +1,5 @@ //! Provides functions to parse input IP addresses, CIDRs or files. +use std::collections::BTreeSet; use std::fs::{self, File}; use std::io::{prelude::*, BufReader}; use std::net::{IpAddr, SocketAddr, ToSocketAddrs}; diff --git a/src/address.rs b/src/address.rs --- a/src/address.rs +++ b/src/address.rs @@ -27,6 +28,8 @@ use crate::warning; /// /// let ips = parse_addresses(&opts); /// ``` +/// +/// Finally, any duplicates are removed to avoid excessive scans. pub fn parse_addresses(input: &Opts) -> Vec<IpAddr> { let mut ips: Vec<IpAddr> = Vec::new(); let mut unresolved_addresses: Vec<&str> = Vec::new(); diff --git a/src/address.rs b/src/address.rs --- a/src/address.rs +++ b/src/address.rs @@ -66,7 +69,10 @@ pub fn parse_addresses(input: &Opts) -> Vec<IpAddr> { } } - ips + ips.into_iter() + .collect::<BTreeSet<_>>() + .into_iter() + .collect() } /// Given a string, parse it as a host, IP address, or CIDR.
RustScan__RustScan-660
660
I suspect that when we got 79.98.104.0/21 79.98.104.0/24 dublication comes from this
[ "651" ]
2.3
RustScan/RustScan
2024-09-19T00:46:28Z
diff --git a/src/address.rs b/src/address.rs --- a/src/address.rs +++ b/src/address.rs @@ -256,6 +262,16 @@ mod tests { assert_eq!(ips.len(), 0); } + #[test] + fn parse_duplicate_cidrs() { + let mut opts = Opts::default(); + opts.addresses = vec!["79.98.104.0/21".to_owned(), "79.98.104.0/24".to_owned()]; + + let ips = parse_addresses(&opts); + + assert_eq!(ips.len(), 2_048); + } + #[test] fn resolver_default_cloudflare() { let opts = Opts::default();
Dublication of ports in output rustscan.exe -a tmp/asns_prefixes_specific.txt -p 80,443,8443,8080,8006 --scripts none <img width="365" alt="Screenshot_2" src="https://github.com/user-attachments/assets/ef874b42-60b5-4260-bc67-dd7abe6dbfce"> tmp/asns_prefixes_specific.txt `185.52.205.0/24 79.98.109.0/24 185.239.124.0/24 185.52.204.0/22 185.228.27.0/24 185.239.127.0/24 79.98.111.0/24 185.52.207.0/24 79.98.110.0/24 79.98.108.0/24 195.189.81.0/24 185.52.206.0/24 194.145.63.0/24 185.228.26.0/24 185.52.204.0/24 185.228.25.0/24 79.98.105.0/24 185.55.228.0/24 79.98.104.0/21 5.182.21.0/24 79.98.107.0/24 185.228.24.0/24 185.55.231.0/24 185.55.228.0/22 195.189.83.0/24 185.55.229.0/24 185.199.38.0/24 185.55.230.0/24 185.199.37.0/24 45.67.19.0/24 185.166.238.0/24 89.187.83.0/24 5.182.20.0/24 79.98.106.0/24 185.228.24.0/22 195.189.80.0/24 185.239.126.0/24 195.189.80.0/22 185.133.72.0/24 195.189.82.0/24 79.98.104.0/24 `
c3d24feebef4c605535a6661ddfeaa18b9bde60c
[ "address::tests::parse_duplicate_cidrs" ]
[ "address::tests::parse_correct_addresses", "address::tests::parse_empty_hosts_file", "address::tests::parse_naughty_host_file", "input::tests::opts_merge_required_arguments", "input::tests::opts_no_merge_when_config_is_ignored", "input::tests::opts_merge_optional_arguments", "input::tests::parse_trailing_command::case_0", "input::tests::parse_trailing_command::case_3", "address::tests::parse_correct_and_incorrect_addresses", "input::tests::parse_trailing_command::case_2", "input::tests::parse_trailing_command::case_1", "port_strategy::tests::serial_strategy_with_ports", "port_strategy::tests::random_strategy_with_ports", "address::tests::resolver_default_cloudflare", "port_strategy::tests::serial_strategy_with_range", "port_strategy::tests::random_strategy_with_range", "scanner::socket_iterator::tests::goes_through_every_ip_port_combination", "input::tests::verify_cli", "input::tests::parse_trailing_command::case_4", "address::tests::parse_incorrect_addresses", "address::tests::parse_correct_host_addresses", "address::tests::parse_hosts_file_and_incorrect_hosts", "port_strategy::range_iterator::tests::range_iterator_iterates_through_the_entire_range", "scripts::tests::find_and_parse_scripts", "scripts::tests::find_invalid_folder - should panic", "scripts::tests::open_nonexisting_script_file - should panic", "scripts::tests::open_script_file_invalid_call_format - should panic", "scripts::tests::open_script_file_invalid_headers - should panic", "scripts::tests::open_script_file_missing_call_format - should panic", "scripts::tests::parse_txt_script", "scripts::tests::run_bash_script", "scripts::tests::run_perl_script", "scripts::tests::run_python_script", "address::tests::resolver_args_google_dns", "scanner::tests::scanner_runs", "benchmark::benchmark", "scanner::tests::ipv6_scanner_runs", "scanner::tests::quad_zero_scanner_runs", "scanner::tests::udp_scan_runs", "scanner::tests::udp_ipv6_runs", "scanner::tests::udp_quad_zero_scanner_runs", "scanner::tests::google_dns_runs", "scanner::tests::udp_google_dns_runs", "scanner::tests::infer_ulimit_lowering_no_panic", "tests::batch_size_adjusted_2000", "tests::batch_size_equals_ulimit_lowered", "tests::batch_size_lowered_average_size", "tests::batch_size_lowered", "tests::test_high_ulimit_no_greppable_mode", "tests::test_print_opening_no_panic", "src/scanner/mod.rs - scanner::Scanner::udp_bind (line 229) - compile fail", "src/scanner/mod.rs - scanner::Scanner::scan_socket (line 133) - compile fail", "src/scanner/mod.rs - scanner::Scanner::connect (line 206) - compile fail", "src/scanner/mod.rs - scanner::Scanner::udp_scan (line 252) - compile fail", "src/benchmark/mod.rs - benchmark (line 5)", "src/lib.rs - (line 10)" ]
[]
[]
2024-09-21T18:08:33Z
7dd9352baee3b467b4c55c95edf4de8494ca8a40
diff --git a/src/port_strategy/mod.rs b/src/port_strategy/mod.rs --- a/src/port_strategy/mod.rs +++ b/src/port_strategy/mod.rs @@ -67,7 +67,7 @@ pub struct SerialRange { impl RangeOrder for SerialRange { fn generate(&self) -> Vec<u16> { - (self.start..self.end).collect() + (self.start..=self.end).collect() } } diff --git a/src/port_strategy/range_iterator.rs b/src/port_strategy/range_iterator.rs --- a/src/port_strategy/range_iterator.rs +++ b/src/port_strategy/range_iterator.rs @@ -22,7 +22,7 @@ impl RangeIterator { /// For example, the range `1000-2500` will be normalized to `0-1500` /// before going through the algorithm. pub fn new(start: u32, end: u32) -> Self { - let normalized_end = end - start; + let normalized_end = end - start + 1; let step = pick_random_coprime(normalized_end); // Randomly choose a number within the range to be the first
RustScan__RustScan-518
518
[ "515" ]
2.1
RustScan/RustScan
2023-05-26T04:18:08Z
diff --git a/src/port_strategy/mod.rs b/src/port_strategy/mod.rs --- a/src/port_strategy/mod.rs +++ b/src/port_strategy/mod.rs @@ -104,7 +104,7 @@ mod tests { let range = PortRange { start: 1, end: 100 }; let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Serial); let result = strategy.order(); - let expected_range = (1..100).into_iter().collect::<Vec<u16>>(); + let expected_range = (1..=100).into_iter().collect::<Vec<u16>>(); assert_eq!(expected_range, result); } #[test] diff --git a/src/port_strategy/mod.rs b/src/port_strategy/mod.rs --- a/src/port_strategy/mod.rs +++ b/src/port_strategy/mod.rs @@ -112,7 +112,7 @@ mod tests { let range = PortRange { start: 1, end: 100 }; let strategy = PortStrategy::pick(&Some(range), None, ScanOrder::Random); let mut result = strategy.order(); - let expected_range = (1..100).into_iter().collect::<Vec<u16>>(); + let expected_range = (1..=100).into_iter().collect::<Vec<u16>>(); assert_ne!(expected_range, result); result.sort_unstable(); diff --git a/src/port_strategy/range_iterator.rs b/src/port_strategy/range_iterator.rs --- a/src/port_strategy/range_iterator.rs +++ b/src/port_strategy/range_iterator.rs @@ -103,23 +103,23 @@ mod tests { #[test] fn range_iterator_iterates_through_the_entire_range() { let result = generate_sorted_range(1, 10); - let expected_range = (1..10).into_iter().collect::<Vec<u16>>(); + let expected_range = (1..=10).into_iter().collect::<Vec<u16>>(); assert_eq!(expected_range, result); let result = generate_sorted_range(1, 100); - let expected_range = (1..100).into_iter().collect::<Vec<u16>>(); + let expected_range = (1..=100).into_iter().collect::<Vec<u16>>(); assert_eq!(expected_range, result); let result = generate_sorted_range(1, 1000); - let expected_range = (1..1000).into_iter().collect::<Vec<u16>>(); + let expected_range = (1..=1000).into_iter().collect::<Vec<u16>>(); assert_eq!(expected_range, result); let result = generate_sorted_range(1, 65_535); - let expected_range = (1..65_535).into_iter().collect::<Vec<u16>>(); + let expected_range = (1..=65_535).into_iter().collect::<Vec<u16>>(); assert_eq!(expected_range, result); let result = generate_sorted_range(1000, 2000); - let expected_range = (1000..2000).into_iter().collect::<Vec<u16>>(); + let expected_range = (1000..=2000).into_iter().collect::<Vec<u16>>(); assert_eq!(expected_range, result); }
--range <start-end>, only contain start, But not end port In nmap run:**nmap 192.168.1.2 -p 1-65535** ,nmap scan port range is 1-65535. But in RustScan run:**rustscan 192.168.1.2 --range 1-65535** (or directly execute **rustscan 192.168.1.2**) by wireshark verification, the scan range is 1-65534, does not contain 65535. The same in nmap exec: **nmap 192.168.1.2 -p 1-5**, nmap scan range is 1-5. But in the RustScan exec: **rustscan 192.168.1.2 --range 1-5**, rustscan scan range is 1-4. Please fix this bug. Services open on 65535 may be missed when execute full port scan.
2ab7191a659e4e431098d530b6376c753b8616dd
[ "port_strategy::tests::serial_strategy_with_range", "port_strategy::tests::random_strategy_with_range", "port_strategy::range_iterator::tests::range_iterator_iterates_through_the_entire_range" ]
[ "input::tests::opts_merge_optional_arguments", "input::tests::opts_no_merge_when_config_is_ignored", "input::tests::opts_merge_required_arguments", "port_strategy::tests::serial_strategy_with_ports", "port_strategy::tests::random_strategy_with_ports", "scanner::socket_iterator::tests::goes_through_every_ip_port_combination", "scripts::tests::open_nonexisting_script_file - should panic", "scripts::tests::find_invalid_folder - should panic", "scripts::tests::open_script_file_invalid_headers - should panic", "scripts::tests::open_script_file_missing_call_format - should panic", "scripts::tests::parse_txt_script", "scripts::tests::open_script_file_invalid_call_format - should panic", "scripts::tests::find_and_parse_scripts", "tests::batch_size_adjusted_2000", "tests::batch_size_equals_ulimit_lowered", "tests::batch_size_lowered", "tests::batch_size_lowered_average_size", "scripts::tests::run_bash_script", "scripts::tests::run_perl_script", "tests::parse_correct_addresses", "tests::parse_empty_hosts_file", "tests::parse_correct_host_addresses", "tests::parse_naughty_host_file", "tests::test_high_ulimit_no_greppable_mode", "tests::test_print_opening_no_panic", "scripts::tests::run_python_script", "scanner::tests::ipv6_scanner_runs", "tests::parse_correct_and_incorrect_addresses", "scanner::tests::scanner_runs", "scanner::tests::quad_zero_scanner_runs", "benchmark::benchmark", "scanner::tests::google_dns_runs", "scanner::tests::infer_ulimit_lowering_no_panic", "tests::parse_incorrect_addresses", "tests::parse_hosts_file_and_incorrect_hosts" ]
[]
[]
2024-04-07T07:10:45Z
d67c77b6f73ccab63d544adffe9cf3d859e71fa4
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed regression where configuration present in current working directory not used when formatting from stdin and no `--stdin-filepath` is provided ([#928](https://github.com/JohnnyMorganz/StyLua/issues/928)) + ## [2.0.1] - 2024-11-18 ### Added diff --git a/src/cli/config.rs b/src/cli/config.rs --- a/src/cli/config.rs +++ b/src/cli/config.rs @@ -55,15 +55,22 @@ impl ConfigResolver<'_> { }) } + /// Returns the root used when searching for configuration + /// If `--search-parent-directories`, then there is no root, and we keep searching + /// Else, the root is the current working directory, and we do not search higher than the cwd + fn get_configuration_search_root(&self) -> Option<PathBuf> { + match self.opt.search_parent_directories { + true => None, + false => Some(self.current_directory.to_path_buf()), + } + } + pub fn load_configuration(&mut self, path: &Path) -> Result<Config> { if let Some(configuration) = self.forced_configuration { return Ok(configuration); } - let root = match self.opt.search_parent_directories { - true => None, - false => Some(self.current_directory.to_path_buf()), - }; + let root = self.get_configuration_search_root(); let absolute_path = self.current_directory.join(path); let parent_path = &absolute_path diff --git a/src/cli/config.rs b/src/cli/config.rs --- a/src/cli/config.rs +++ b/src/cli/config.rs @@ -91,19 +98,25 @@ impl ConfigResolver<'_> { return Ok(configuration); } + let root = self.get_configuration_search_root(); + let my_current_directory = self.current_directory.to_owned(); + match &self.opt.stdin_filepath { Some(filepath) => self.load_configuration(filepath), - None => { - #[cfg(feature = "editorconfig")] - if self.opt.no_editorconfig { + None => match self.find_config_file(&my_current_directory, root)? { + Some(config) => Ok(config), + None => { + #[cfg(feature = "editorconfig")] + if self.opt.no_editorconfig { + Ok(self.default_configuration) + } else { + editorconfig::parse(self.default_configuration, &PathBuf::from("*.lua")) + .context("could not parse editorconfig") + } + #[cfg(not(feature = "editorconfig"))] Ok(self.default_configuration) - } else { - editorconfig::parse(self.default_configuration, &PathBuf::from("*.lua")) - .context("could not parse editorconfig") } - #[cfg(not(feature = "editorconfig"))] - Ok(self.default_configuration) - } + }, } }
JohnnyMorganz__StyLua-931
931
Looks like a mistake in https://github.com/JohnnyMorganz/StyLua/blob/1daf4c18fb6baf687cc41082f1cc6905ced226a4/src/cli/config.rs#L96, we forget to check the current directory if stdin file path was not provided. Thanks for reporting! As a work around, you can use `--stdin-filepath` to specify the file path for the file you're formatting. It can even be a dummy file: `--stdin-filepath ./dummy` should in theory lookup config in the current working directory sure but hope can fix in next release
[ "928" ]
2.0
JohnnyMorganz/StyLua
2024-11-30T20:21:18Z
diff --git a/src/cli/main.rs b/src/cli/main.rs --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -810,6 +810,24 @@ mod tests { cwd.close().unwrap(); } + #[test] + fn test_cwd_configuration_respected_when_formatting_from_stdin() { + let cwd = construct_tree!({ + "stylua.toml": "quote_style = 'AutoPreferSingle'", + "foo.lua": "local x = \"hello\"", + }); + + let mut cmd = create_stylua(); + cmd.current_dir(cwd.path()) + .arg("-") + .write_stdin("local x = \"hello\"") + .assert() + .success() + .stdout("local x = 'hello'\n"); + + cwd.close().unwrap(); + } + #[test] fn test_cwd_configuration_respected_for_file_in_cwd() { let cwd = construct_tree!({
after new release stdin does not repsect .stylua.toml by default unless must set config-path .. before no need ![image](https://github.com/user-attachments/assets/22c7f2c4-60d4-478c-bc21-cd0593252d23)
f581279895a7040a36abaea4a6c8a6f50f112cd7
[ "tests::test_cwd_configuration_respected_when_formatting_from_stdin" ]
[ "editorconfig::tests::test_call_parentheses_always", "editorconfig::tests::test_call_parentheses_no_single_string", "editorconfig::tests::test_call_parentheses_no_single_table", "editorconfig::tests::test_call_parentheses_none", "editorconfig::tests::test_collapse_simple_statement_always", "editorconfig::tests::test_collapse_simple_statement_conditional_only", "editorconfig::tests::test_collapse_simple_statement_function_only", "editorconfig::tests::test_end_of_line_cr", "editorconfig::tests::test_collapse_simple_statement_never", "editorconfig::tests::test_end_of_line_lf", "editorconfig::tests::test_end_of_line_crlf", "editorconfig::tests::test_indent_size", "editorconfig::tests::test_indent_size_use_tab_width", "editorconfig::tests::test_indent_style_space", "editorconfig::tests::test_indent_style_tab", "editorconfig::tests::test_max_line_length", "editorconfig::tests::test_max_line_length_off", "editorconfig::tests::test_sort_requires_disabled", "editorconfig::tests::test_quote_type_auto", "editorconfig::tests::test_space_after_function_names_always", "editorconfig::tests::test_sort_requires_enabled", "editorconfig::tests::test_quote_type_double", "editorconfig::tests::test_space_after_function_names_calls", "editorconfig::tests::test_invalid_properties", "editorconfig::tests::test_quote_type_single", "editorconfig::tests::test_space_after_function_names_definitions", "editorconfig::tests::test_space_after_function_names_never", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments", "formatters::trivia_util::tests::test_token_contains_singleline_comments", "sort_requires::tests::fail_extracting_non_identifier_token", "sort_requires::tests::get_expression_kind_other_1", "sort_requires::tests::get_expression_kind_get_service", "sort_requires::tests::get_expression_kind_other_2", "sort_requires::tests::get_expression_kind_other_4", "sort_requires::tests::get_expression_kind_other_3", "sort_requires::tests::get_expression_kind_other_5", "sort_requires::tests::get_expression_kind_other_6", "sort_requires::tests::get_expression_kind_require_stmt", "tests::test_invalid_input", "sort_requires::tests::get_expression_kind_require_type_assertion", "verify_ast::tests::test_different_asts", "tests::test_entry_point", "verify_ast::tests::test_different_binary_numbers", "verify_ast::tests::test_different_hex_numbers", "verify_ast::tests::test_equivalent_conditions", "verify_ast::tests::test_equivalent_binary_numbers", "verify_ast::tests::test_equivalent_hex_numbers_very_large_number", "tests::test_with_ast_verification", "verify_ast::tests::test_equivalent_hex_numbers_with_separators", "verify_ast::tests::test_equivalent_luajit_numbers", "verify_ast::tests::test_equivalent_asts", "verify_ast::tests::test_equivalent_function_calls", "verify_ast::tests::test_equivalent_numbers", "verify_ast::tests::test_equivalent_hex_numbers", "verify_ast::tests::test_equivalent_function_calls_2", "verify_ast::tests::test_equivalent_numbers_2", "verify_ast::tests::test_equivalent_string_quote_types", "verify_ast::tests::test_equivalent_types_removed_parentheses", "verify_ast::tests::test_equivalent_string_escapes", "verify_ast::tests::test_equivalent_stmt_semicolons", "verify_ast::tests::test_equivalent_table_separators", "output_diff::tests::test_addition_diff", "output_diff::tests::test_deletion_diff", "output_diff::tests::test_no_diff", "output_diff::tests::test_change_diff", "opt::tests::verify_opt", "config::tests::test_override_call_parentheses", "config::tests::test_override_indent_width", "config::tests::test_override_line_endings", "config::tests::test_override_indent_type", "config::tests::test_override_syntax", "config::tests::test_override_column_width", "config::tests::test_override_quote_style", "tests::explicitly_provided_files_dont_check_ignores_stdin", "tests::test_no_files_provided", "tests::test_format_stdin", "tests::test_respect_ignores", "tests::test_respect_config_path_override_for_stdin_filepath", "tests::test_respect_ignores_directory_no_glob", "tests::test_respect_ignores_stdin", "tests::test_stdin_filepath_respects_cwd_configuration_for_nested_file", "tests::test_stdin_filepath_respects_cwd_configuration_next_to_file", "tests::test_uses_cli_overrides_instead_of_default_configuration_stdin_filepath", "tests::test_format_file", "tests::test_configuration_used_outside_of_cwd_when_search_parent_directories_is_enabled", "tests::test_uses_cli_overrides_instead_of_found_configuration_stdin_filepath", "tests::test_uses_cli_overrides_instead_of_default_configuration", "tests::test_configuration_is_searched_next_to_file", "tests::test_configuration_is_not_used_outside_of_cwd", "tests::test_configuration_is_used_closest_to_the_file", "tests::explicitly_provided_files_dont_check_ignores", "tests::test_stylua_ignore", "tests::test_cwd_configuration_respected_for_nested_file", "tests::test_respect_config_path_override", "tests::test_cwd_configuration_respected_for_file_in_cwd", "tests::test_uses_cli_overrides_instead_of_found_configuration", "test_call_parens_semicolons", "test_call_parens_no_single_string_handles_table_correctly", "test_call_parens_no_single_table_handles_string_correctly", "test_call_parens_none_handles_table_correctly", "test_call_parens_always_handles_table_correctly", "test_call_parens_no_single_string_handles_string_correctly", "test_call_parens_none_handles_string_correctly", "test_call_parens_always_handles_string_correctly", "test_call_parens_comments", "test_call_parens_no_single_table_handles_table_correctly", "test_call_parens_input", "test_call_parens_has_no_affect_on_multi_arg_fn_calls_", "test_root", "test_empty_root", "test_local", "test_global", "test_stylua_toml", "test_no_parens_brackets_string", "test_no_parens_method_chain_2", "test_no_parens_method_chain_1", "test_keep_parens_binop_string", "test_omit_parens_string", "test_omit_parens_brackets_string", "test_no_parens_large_example", "test_no_parens_string", "test_no_parens_singleline_table", "test_no_parens_multiline_table", "test_force_single_quotes", "test_auto_prefer_double_quotes", "test_auto_prefer_single_quotes", "test_force_double_quotes", "test_incomplete_range", "test_ignore_last_stmt", "test_default", "test_nested_range_do", "test_dont_modify_eof", "test_nested_range_else_if", "test_nested_range_function_call", "test_nested_range_function_call_table", "test_nested_range_generic_for", "test_nested_range_binop", "test_nested_range", "test_large_example", "test_nested_range_repeat", "test_nested_range_while", "test_no_range_end", "test_nested_range_local_function", "test_no_range_start", "test_nested_range_table_1", "test_nested_range_table_2", "test_always_space_after_function_names", "test_never_space_after_function_names", "test_space_after_function_calls", "test_space_after_function_definitions", "test_crlf_in_multiline_strings", "test_crlf_in_multiline_comments", "test_collapse_single_statement_lua_52", "test_lua52", "test_lua54", "test_ignores", "test_lua53", "test_full_moon_test_suite", "test_sort_requires", "test_collapse_single_statement", "test_luau_full_moon", "test_luau", "test_standard" ]
[]
[]
2024-11-30T12:36:13Z
08e536f3a02d9a07b0991726897e0013ff78dd21
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed CLI overrides not applying on top of a resolved `stylua.toml` file ([#925](https://github.com/JohnnyMorganz/StyLua/issues/925)) + ## [2.0.0] - 2024-11-17 ### Breaking Changes diff --git a/src/cli/config.rs b/src/cli/config.rs --- a/src/cli/config.rs +++ b/src/cli/config.rs @@ -113,7 +113,9 @@ impl ConfigResolver<'_> { match config_file { Some(file_path) => { debug!("config: found config at {}", file_path.display()); - read_config_file(&file_path).map(Some) + let config = read_and_apply_overrides(&file_path, self.opt)?; + debug!("config: {:#?}", config); + Ok(Some(config)) } None => Ok(None), } diff --git a/src/cli/main.rs b/src/cli/main.rs --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -271,9 +271,6 @@ fn format(opt: opt::Opt) -> Result<i32> { let opt_for_config_resolver = opt.clone(); let mut config_resolver = config::ConfigResolver::new(&opt_for_config_resolver)?; - // TODO: - // debug!("config: {:#?}", config); - // Create range if provided let range = if opt.range_start.is_some() || opt.range_end.is_some() { Some(Range::from_values(opt.range_start, opt.range_end))
JohnnyMorganz__StyLua-926
926
Hm, this does look like line endings changing for some reason. Which is weird, since I don't think we touched that at all. Do you by any chance have an example file I can test this with? Either in a public repo, or attaching a code file here (not in a code block since we need to preserve the line endings) Yes, sure [runTests.zip](https://github.com/user-attachments/files/17792304/runTests.zip)
[ "925" ]
2.0
JohnnyMorganz/StyLua
2024-11-18T05:01:53Z
diff --git a/src/cli/main.rs b/src/cli/main.rs --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -953,4 +950,74 @@ mod tests { cwd.close().unwrap(); } + + #[test] + fn test_uses_cli_overrides_instead_of_default_configuration() { + let cwd = construct_tree!({ + "foo.lua": "local x = \"hello\"", + }); + + let mut cmd = create_stylua(); + cmd.current_dir(cwd.path()) + .args(["--quote-style", "AutoPreferSingle", "."]) + .assert() + .success(); + + cwd.child("foo.lua").assert("local x = 'hello'\n"); + + cwd.close().unwrap(); + } + + #[test] + fn test_uses_cli_overrides_instead_of_default_configuration_stdin_filepath() { + let cwd = construct_tree!({ + "foo.lua": "local x = \"hello\"", + }); + + let mut cmd = create_stylua(); + cmd.current_dir(cwd.path()) + .args(["--quote-style", "AutoPreferSingle", "-"]) + .write_stdin("local x = \"hello\"") + .assert() + .success() + .stdout("local x = 'hello'\n"); + + cwd.close().unwrap(); + } + + #[test] + fn test_uses_cli_overrides_instead_of_found_configuration() { + let cwd = construct_tree!({ + "stylua.toml": "quote_style = 'AutoPreferDouble'", + "foo.lua": "local x = \"hello\"", + }); + + let mut cmd = create_stylua(); + cmd.current_dir(cwd.path()) + .args(["--quote-style", "AutoPreferSingle", "."]) + .assert() + .success(); + + cwd.child("foo.lua").assert("local x = 'hello'\n"); + + cwd.close().unwrap(); + } + + #[test] + fn test_uses_cli_overrides_instead_of_found_configuration_stdin_filepath() { + let cwd = construct_tree!({ + "stylua.toml": "quote_style = 'AutoPreferDouble'", + "foo.lua": "local x = \"hello\"", + }); + + let mut cmd = create_stylua(); + cmd.current_dir(cwd.path()) + .args(["--quote-style", "AutoPreferSingle", "-"]) + .write_stdin("local x = \"hello\"") + .assert() + .success() + .stdout("local x = 'hello'\n"); + + cwd.close().unwrap(); + } }
CLI overrides not applied when formatting files in v2.0.0 I tried to run it both from Windows and from Docker for Windows `stylua.exe --line-endings Windows --check .` `stylua.exe --line-endings Unix --check .` The result is the same, it gives errors in all files. Example of the first two files ``` Diff in ./cloud_test_tasks/runTests.luau: 1 |-require(game.ReplicatedStorage.Shared.LuTestRoblox.LuTestRunner) 1 |+require(game.ReplicatedStorage.Shared.LuTestRoblox.LuTestRunner) Diff in ./place_battle/replicated_storage/tests/test_workspace.luau: 1 |-local tests = {} 2 |-local Workspace = game:GetService("Workspace") 3 |- 4 |-function tests.test_server_workspace_gravity() 5 |- assert(math.floor(Workspace.Gravity) == 196, "Gravity value is: " .. Workspace.Gravity) 6 |-end 7 |- 8 |-return tests 1 |+local tests = {} 2 |+local Workspace = game:GetService("Workspace") 3 |+ 4 |+function tests.test_server_workspace_gravity() 5 |+ assert(math.floor(Workspace.Gravity) == 196, "Gravity value is: " .. Workspace.Gravity) 6 |+end 7 |+ 8 |+return tests Diff in ./place_battle/replicated_storage/tests/test_starterplayer.luau: ``` After reverting to 0.20.0 the results became normal again
f581279895a7040a36abaea4a6c8a6f50f112cd7
[ "tests::test_uses_cli_overrides_instead_of_found_configuration" ]
[ "editorconfig::tests::test_call_parentheses_no_single_table", "editorconfig::tests::test_call_parentheses_always", "editorconfig::tests::test_call_parentheses_no_single_string", "editorconfig::tests::test_call_parentheses_none", "editorconfig::tests::test_collapse_simple_statement_function_only", "editorconfig::tests::test_collapse_simple_statement_always", "editorconfig::tests::test_collapse_simple_statement_conditional_only", "editorconfig::tests::test_collapse_simple_statement_never", "editorconfig::tests::test_end_of_line_crlf", "editorconfig::tests::test_end_of_line_cr", "editorconfig::tests::test_end_of_line_lf", "editorconfig::tests::test_indent_size", "editorconfig::tests::test_indent_size_use_tab_width", "editorconfig::tests::test_invalid_properties", "editorconfig::tests::test_indent_style_space", "editorconfig::tests::test_indent_style_tab", "editorconfig::tests::test_max_line_length_off", "editorconfig::tests::test_quote_type_double", "editorconfig::tests::test_max_line_length", "editorconfig::tests::test_sort_requires_enabled", "editorconfig::tests::test_sort_requires_disabled", "editorconfig::tests::test_space_after_function_names_always", "editorconfig::tests::test_space_after_function_names_calls", "editorconfig::tests::test_space_after_function_names_definitions", "editorconfig::tests::test_quote_type_single", "editorconfig::tests::test_space_after_function_names_never", "editorconfig::tests::test_quote_type_auto", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2", "formatters::trivia_util::tests::test_token_contains_singleline_comments", "sort_requires::tests::fail_extracting_non_identifier_token", "sort_requires::tests::get_expression_kind_other_1", "sort_requires::tests::get_expression_kind_other_3", "sort_requires::tests::get_expression_kind_other_5", "sort_requires::tests::get_expression_kind_get_service", "sort_requires::tests::get_expression_kind_other_2", "sort_requires::tests::get_expression_kind_other_4", "sort_requires::tests::get_expression_kind_other_6", "sort_requires::tests::get_expression_kind_require_type_assertion", "sort_requires::tests::get_expression_kind_require_stmt", "tests::test_invalid_input", "tests::test_entry_point", "tests::test_with_ast_verification", "verify_ast::tests::test_different_binary_numbers", "verify_ast::tests::test_different_hex_numbers", "verify_ast::tests::test_equivalent_conditions", "verify_ast::tests::test_equivalent_binary_numbers", "verify_ast::tests::test_different_asts", "verify_ast::tests::test_equivalent_luajit_numbers", "verify_ast::tests::test_equivalent_hex_numbers_with_separators", "verify_ast::tests::test_equivalent_asts", "verify_ast::tests::test_equivalent_string_escapes", "verify_ast::tests::test_equivalent_stmt_semicolons", "verify_ast::tests::test_equivalent_function_calls", "verify_ast::tests::test_equivalent_numbers", "verify_ast::tests::test_equivalent_hex_numbers", "verify_ast::tests::test_equivalent_types_removed_parentheses", "verify_ast::tests::test_equivalent_numbers_2", "verify_ast::tests::test_equivalent_table_separators", "verify_ast::tests::test_equivalent_function_calls_2", "verify_ast::tests::test_equivalent_string_quote_types", "verify_ast::tests::test_equivalent_hex_numbers_very_large_number", "output_diff::tests::test_deletion_diff", "config::tests::test_override_indent_type", "output_diff::tests::test_no_diff", "config::tests::test_override_quote_style", "config::tests::test_override_line_endings", "config::tests::test_override_syntax", "output_diff::tests::test_addition_diff", "config::tests::test_override_column_width", "output_diff::tests::test_change_diff", "config::tests::test_override_call_parentheses", "config::tests::test_override_indent_width", "opt::tests::verify_opt", "tests::explicitly_provided_files_dont_check_ignores_stdin", "tests::test_format_stdin", "tests::test_no_files_provided", "tests::test_respect_ignores", "tests::test_respect_config_path_override_for_stdin_filepath", "tests::test_respect_ignores_directory_no_glob", "tests::test_respect_ignores_stdin", "tests::test_stdin_filepath_respects_cwd_configuration_for_nested_file", "tests::test_stdin_filepath_respects_cwd_configuration_next_to_file", "tests::test_uses_cli_overrides_instead_of_default_configuration_stdin_filepath", "tests::explicitly_provided_files_dont_check_ignores", "tests::test_cwd_configuration_respected_for_nested_file", "tests::test_configuration_is_not_used_outside_of_cwd", "tests::test_stylua_ignore", "tests::test_format_file", "tests::test_cwd_configuration_respected_for_file_in_cwd", "tests::test_configuration_is_used_closest_to_the_file", "tests::test_uses_cli_overrides_instead_of_default_configuration", "tests::test_configuration_used_outside_of_cwd_when_search_parent_directories_is_enabled", "tests::test_configuration_is_searched_next_to_file", "tests::test_respect_config_path_override", "tests::test_uses_cli_overrides_instead_of_found_configuration_stdin_filepath", "test_call_parens_comments", "test_call_parens_always_handles_table_correctly", "test_call_parens_always_handles_string_correctly", "test_call_parens_input", "test_call_parens_no_single_table_handles_table_correctly", "test_call_parens_semicolons", "test_call_parens_has_no_affect_on_multi_arg_fn_calls_", "test_call_parens_no_single_string_handles_table_correctly", "test_call_parens_no_single_string_handles_string_correctly", "test_call_parens_no_single_table_handles_string_correctly", "test_call_parens_none_handles_table_correctly", "test_call_parens_none_handles_string_correctly", "test_local", "test_global", "test_empty_root", "test_root", "test_stylua_toml", "test_omit_parens_brackets_string", "test_no_parens_singleline_table", "test_no_parens_brackets_string", "test_no_parens_multiline_table", "test_no_parens_string", "test_omit_parens_string", "test_no_parens_method_chain_1", "test_keep_parens_binop_string", "test_no_parens_method_chain_2", "test_no_parens_large_example", "test_auto_prefer_single_quotes", "test_force_double_quotes", "test_auto_prefer_double_quotes", "test_force_single_quotes", "test_default", "test_dont_modify_eof", "test_nested_range_do", "test_ignore_last_stmt", "test_nested_range_binop", "test_incomplete_range", "test_nested_range_else_if", "test_nested_range", "test_nested_range_function_call", "test_nested_range_generic_for", "test_nested_range_function_call_table", "test_large_example", "test_nested_range_local_function", "test_nested_range_repeat", "test_nested_range_table_1", "test_no_range_end", "test_no_range_start", "test_nested_range_while", "test_nested_range_table_2", "test_always_space_after_function_names", "test_space_after_function_calls", "test_never_space_after_function_names", "test_space_after_function_definitions", "test_crlf_in_multiline_strings", "test_crlf_in_multiline_comments", "test_collapse_single_statement_lua_52", "test_lua52", "test_ignores", "test_lua53", "test_full_moon_test_suite", "test_sort_requires", "test_lua54", "test_collapse_single_statement", "test_luau_full_moon", "test_luau", "test_standard" ]
[]
[]
2024-11-17T21:06:05Z
bc3ce881eaaee46e8eb851366d33cba808d2a1f7
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The CLI tool will now only write files if the contents differ, and not modify if no change ([#827](https://github.com/JohnnyMorganz/StyLua/issues/827)) - Fixed parentheses around a Luau compound type inside of a type table indexer being removed causing a syntax error ([#828](https://github.com/JohnnyMorganz/StyLua/issues/828)) - Fixed function body parentheses being placed on multiple lines unnecessarily when there are no parameters ([#830](https://github.com/JohnnyMorganz/StyLua/issues/830)) +- Fixed directory paths w/o globs in `.styluaignore` not matching when using `--respect-ignores` ([#845](https://github.com/JohnnyMorganz/StyLua/issues/845)) ## [0.19.1] - 2023-11-15 diff --git a/src/cli/main.rs b/src/cli/main.rs --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -262,7 +262,7 @@ fn path_is_stylua_ignored(path: &Path, search_parent_directories: bool) -> Resul .context("failed to parse ignore file")?; Ok(matches!( - ignore.matched(path, false), + ignore.matched_path_or_any_parents(path, false), ignore::Match::Ignore(_) )) }
JohnnyMorganz__StyLua-852
852
We use the ignore crate to provide gitignore-style ignores: https://docs.rs/ignore/latest/ignore/. This may actually be an issue upstream, but I will verify it myself first (Ignore my previous response - I did not read your issue properly!) Yes, I find that ignoring a (sub)directory works when scanning, i.e., "stylua ." (unit tests: https://github.com/JohnnyMorganz/StyLua/blob/v0.19.1/src/cli/main.rs#L723), but doesn't work only for `--respect-ignores <individual filename>`.
[ "845" ]
0.19
JohnnyMorganz/StyLua
2024-01-20T20:13:59Z
diff --git a/src/cli/main.rs b/src/cli/main.rs --- a/src/cli/main.rs +++ b/src/cli/main.rs @@ -769,4 +769,21 @@ mod tests { cwd.close().unwrap(); } + + #[test] + fn test_respect_ignores_directory_no_glob() { + // https://github.com/JohnnyMorganz/StyLua/issues/845 + let cwd = construct_tree!({ + ".styluaignore": "build/", + "build/foo.lua": "local x = 1", + }); + + let mut cmd = create_stylua(); + cmd.current_dir(cwd.path()) + .args(["--check", "--respect-ignores", "build/foo.lua"]) + .assert() + .success(); + + cwd.close().unwrap(); + } }
`--respect-ignores`: does not correctly ignore folders without the globbing pattern Problem: `.styluaignore` does not ignore **folders** or **directories** like `.gitignore`, `.rgignore`, etc. do. Instead, full globbing patterns (`*.lua` or `**/*.lua`) would be needed to ignore all files under a directory. EDIT: This seems to be the case only when used with `--respect-ignores <pattern>`. ## Example (Tested with stylua 0.19.1, which already includes #765) Let's say we have `src/foo.lua` and `build/foo.lua` in the project root (with `.styluaignore`). ### Current behavior With the following `.styluaignore`: ``` build/ ``` `$ stylua --check --respect-ignores build/foo.lua` would not ignore `build/foo.lua`. ### Expected behavior `build/foo.lua` should be ignored. ### Current behavior (2) With the following `.styluaignore`: ``` build/**/*.lua ``` `$ stylua --check --respect-ignores build/foo.lua` does ignore `build/foo.lua`. This behavior is consistent with `.gitignore`, etc.
bc3ce881eaaee46e8eb851366d33cba808d2a1f7
[ "tests::test_respect_ignores_directory_no_glob" ]
[ "editorconfig::tests::test_call_parentheses_none", "editorconfig::tests::test_call_parentheses_always", "editorconfig::tests::test_call_parentheses_no_single_table", "editorconfig::tests::test_call_parentheses_no_single_string", "editorconfig::tests::test_collapse_simple_statement_conditional_only", "editorconfig::tests::test_collapse_simple_statement_always", "editorconfig::tests::test_collapse_simple_statement_function_only", "editorconfig::tests::test_end_of_line_cr", "editorconfig::tests::test_end_of_line_crlf", "editorconfig::tests::test_end_of_line_lf", "editorconfig::tests::test_indent_size_use_tab_width", "editorconfig::tests::test_indent_size", "editorconfig::tests::test_indent_style_space", "editorconfig::tests::test_collapse_simple_statement_never", "editorconfig::tests::test_indent_style_tab", "editorconfig::tests::test_invalid_properties", "editorconfig::tests::test_max_line_length", "editorconfig::tests::test_max_line_length_off", "editorconfig::tests::test_quote_type_auto", "editorconfig::tests::test_quote_type_single", "editorconfig::tests::test_quote_type_double", "editorconfig::tests::test_sort_requires_disabled", "editorconfig::tests::test_sort_requires_enabled", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments", "formatters::trivia_util::tests::test_token_contains_singleline_comments", "sort_requires::tests::fail_extracting_non_identifier_token", "tests::test_config_call_parentheses", "tests::test_config_indent_type", "tests::test_config_column_width", "tests::test_config_indent_width", "tests::test_config_line_endings", "tests::test_config_quote_style", "sort_requires::tests::get_expression_kind_other_2", "sort_requires::tests::get_expression_kind_other_6", "sort_requires::tests::get_expression_kind_other_4", "sort_requires::tests::get_expression_kind_other_1", "sort_requires::tests::get_expression_kind_get_service", "sort_requires::tests::get_expression_kind_require_stmt", "sort_requires::tests::get_expression_kind_require_type_assertion", "tests::test_invalid_input", "sort_requires::tests::get_expression_kind_other_3", "sort_requires::tests::get_expression_kind_other_5", "tests::test_entry_point", "verify_ast::tests::test_equivalent_asts", "tests::test_with_ast_verification", "verify_ast::tests::test_equivalent_binary_numbers", "verify_ast::tests::test_different_binary_numbers", "verify_ast::tests::test_different_asts", "verify_ast::tests::test_different_hex_numbers", "verify_ast::tests::test_equivalent_conditions", "verify_ast::tests::test_equivalent_function_calls", "verify_ast::tests::test_equivalent_hex_numbers", "verify_ast::tests::test_equivalent_string_escapes", "verify_ast::tests::test_equivalent_numbers_2", "verify_ast::tests::test_equivalent_luajit_numbers", "verify_ast::tests::test_equivalent_string_quote_types", "verify_ast::tests::test_equivalent_types_removed_parentheses", "verify_ast::tests::test_equivalent_numbers", "verify_ast::tests::test_equivalent_stmt_semicolons", "verify_ast::tests::test_equivalent_function_calls_2", "verify_ast::tests::test_equivalent_table_separators", "output_diff::tests::test_no_diff", "output_diff::tests::test_addition_diff", "output_diff::tests::test_deletion_diff", "output_diff::tests::test_change_diff", "opt::tests::verify_opt", "config::tests::test_override_column_width", "config::tests::test_override_indent_type", "config::tests::test_override_indent_width", "config::tests::test_override_quote_style", "config::tests::test_override_call_parentheses", "config::tests::test_override_line_endings", "tests::test_no_files_provided", "tests::test_format_stdin", "tests::test_respect_ignores", "tests::explicitly_provided_files_dont_check_ignores", "tests::test_format_file", "tests::test_stylua_ignore", "test_call_parens_comments", "test_call_parens_always_handles_table_correctly", "test_call_parens_no_single_string_handles_table_correctly", "test_call_parens_no_single_table_handles_string_correctly", "test_call_parens_semicolons", "test_call_parens_none_handles_string_correctly", "test_call_parens_no_single_string_handles_string_correctly", "test_call_parens_input", "test_call_parens_none_handles_table_correctly", "test_call_parens_no_single_table_handles_table_correctly", "test_call_parens_always_handles_string_correctly", "test_call_parens_has_no_affect_on_multi_arg_fn_calls_", "test_root", "test_global", "test_local", "test_empty_root", "test_stylua_toml", "test_no_parens_brackets_string", "test_omit_parens_brackets_string", "test_no_parens_multiline_table", "test_no_parens_singleline_table", "test_omit_parens_string", "test_no_parens_string", "test_no_parens_method_chain_1", "test_keep_parens_binop_string", "test_no_parens_method_chain_2", "test_no_parens_large_example", "test_auto_prefer_single_quotes", "test_auto_prefer_double_quotes", "test_force_double_quotes", "test_force_single_quotes", "test_incomplete_range", "test_ignore_last_stmt", "test_dont_modify_eof", "test_default", "test_nested_range_do", "test_nested_range_generic_for", "test_nested_range_else_if", "test_nested_range_function_call_table", "test_nested_range_function_call", "test_nested_range_binop", "test_nested_range", "test_nested_range_local_function", "test_no_range_end", "test_no_range_start", "test_nested_range_while", "test_nested_range_repeat", "test_nested_range_table_1", "test_nested_range_table_2", "test_crlf_in_multiline_strings", "test_crlf_in_multiline_comments", "test_collapse_single_statement_lua_52", "test_lua52", "test_lua54", "test_lua53", "test_ignores", "test_sort_requires", "test_collapse_single_statement", "test_luau_full_moon", "test_luau" ]
[]
[]
2024-01-20T12:37:21Z
46457ad4e4130d07ee0f9a5cf95ac10023c8ceeb
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bumped internal parser dependency which should fix parsing problems for comments with Chinese characters, and multiline string escapes - Fixed comments in punctuated lists for return statements or assignments being incorrectly formatted leading to syntax errors ([#662](https://github.com/JohnnyMorganz/StyLua/issues/662)) +- Fixed line endings not being correctly formatted in multiline string literals and comments ([#665](https://github.com/JohnnyMorganz/StyLua/issues/665)) ## [0.17.0] - 2023-03-11 diff --git a/src/context.rs b/src/context.rs --- a/src/context.rs +++ b/src/context.rs @@ -155,7 +155,7 @@ impl Context { } /// Returns the relevant line ending string from the [`LineEndings`] enum -fn line_ending_character(line_endings: LineEndings) -> String { +pub fn line_ending_character(line_endings: LineEndings) -> String { match line_endings { LineEndings::Unix => String::from("\n"), LineEndings::Windows => String::from("\r\n"), diff --git a/src/formatters/general.rs b/src/formatters/general.rs --- a/src/formatters/general.rs +++ b/src/formatters/general.rs @@ -1,5 +1,7 @@ use crate::{ - context::{create_indent_trivia, create_newline_trivia, Context, FormatNode}, + context::{ + create_indent_trivia, create_newline_trivia, line_ending_character, Context, FormatNode, + }, formatters::{ trivia::{FormatTriviaType, UpdateLeadingTrivia, UpdateTrailingTrivia, UpdateTrivia}, trivia_util::{ diff --git a/src/formatters/general.rs b/src/formatters/general.rs --- a/src/formatters/general.rs +++ b/src/formatters/general.rs @@ -121,8 +123,14 @@ pub fn format_token( } => { // If we have a brackets string, don't mess with it if let StringLiteralQuoteType::Brackets = quote_type { + // Convert the string to the correct line endings, by first normalising to LF + // then converting LF to output + let literal = literal + .replace("\r\n", "\n") + .replace('\n', &line_ending_character(ctx.config().line_endings)); + TokenType::StringLiteral { - literal: literal.to_owned(), + literal: literal.into(), multi_line: *multi_line, quote_type: StringLiteralQuoteType::Brackets, } diff --git a/src/formatters/general.rs b/src/formatters/general.rs --- a/src/formatters/general.rs +++ b/src/formatters/general.rs @@ -209,9 +217,15 @@ pub fn format_token( trailing_trivia = Some(vec![create_newline_trivia(ctx)]); } + // Convert the comment to the correct line endings, by first normalising to LF + // then converting LF to output + let comment = comment + .replace("\r\n", "\n") + .replace('\n', &line_ending_character(ctx.config().line_endings)); + TokenType::MultiLineComment { blocks: *blocks, - comment: comment.to_owned(), + comment: comment.into(), } } TokenType::Whitespace { characters } => TokenType::Whitespace {
JohnnyMorganz__StyLua-666
666
Definitely unintended, let me take a look. Thanks for the report!
[ "665" ]
0.17
JohnnyMorganz/StyLua
2023-03-30T15:38:41Z
diff --git a/tests/tests.rs b/tests/tests.rs --- a/tests/tests.rs +++ b/tests/tests.rs @@ -127,3 +127,40 @@ fn test_sort_requires() { .unwrap()); }) } + +#[test] +fn test_crlf_in_multiline_comments() { + // We need to do this outside of insta since it normalises line endings to LF + let code = r###" +local a = "testing" +--[[ + This comment + is multiline + and we want to ensure the line endings + convert to CRLF +]] +local x = 1 +"###; + + let code_crlf = code.lines().collect::<Vec<_>>().join("\r\n"); + let output = format(&code_crlf); + assert_eq!(output.find("\r\n"), None); +} + +#[test] +fn test_crlf_in_multiline_strings() { + // We need to do this outside of insta since it normalises line endings to LF + let code = r###" +local a = [[ + This string + is multiline + and we want to ensure the line endings + convert to CRLF +]] +local x = 1 +"###; + + let code_crlf = code.lines().collect::<Vec<_>>().join("\r\n"); + let output = format(&code_crlf); + assert_eq!(output.find("\r\n"), None); +}
Line endings appear to not be converted when they occur in multiline comments (?) Heyo, we've run into an odd formatting glitch that causes huge git diffs in combination with VS Code's LF/CRLF setting. In this example file, we have CRLFs present in the comment but LFs everywhere else (as created by StyLua, using the default config): ![image](https://user-images.githubusercontent.com/16489133/228876584-b2431274-dd1c-4578-a4d8-a49cd5e1a12e.png) Copy these hex bytes for a simple test case (CRLF/LF distinction): ``` 0D 0A 2D 2D 5B 5B 0D 0A 20 20 20 20 20 20 74 65 73 74 0D 0A 20 20 20 20 20 20 2D 2D 20 61 73 64 66 0D 0A 20 20 5D 5D 0D 0A ``` After running StyLua on this CRLF-based file, all CRLFs in the regular code are correctly turned into LF, but those in the comment are not: ![image](https://user-images.githubusercontent.com/16489133/228876678-cad77aa8-5559-4785-90da-067a396e92ea.png) Again, the hex bytes show that this is the case: ``` 0A 2D 2D 5B 5B 0D 0A 20 20 20 20 20 20 74 65 73 74 0D 0A 20 20 20 20 20 20 2D 2D 20 61 73 64 66 0D 0A 20 20 5D 5D 0A ``` I would expect all line endings to be consistent after running the formatter, which is is preferable to ugly hacks like `autocrlf`: ![image](https://user-images.githubusercontent.com/16489133/228879758-e743b80b-056a-4cc6-98e7-edaf01a66356.png) Expected hex bytes: ``` 0A 2D 2D 5B 5B 0A 20 20 20 20 20 20 74 65 73 74 0A 20 20 20 20 20 20 2D 2D 20 61 73 64 66 0A 20 20 5D 5D 0A ``` I don't know Rust at all so I can't contribute a fix, but feel free to use the above as a test case if this is unintended :)
5c6d59135f419274121349799a5227be467358b1
[ "test_crlf_in_multiline_strings", "test_crlf_in_multiline_comments" ]
[ "editorconfig::tests::test_call_parentheses_always", "editorconfig::tests::test_call_parentheses_no_single_string", "editorconfig::tests::test_call_parentheses_no_single_table", "editorconfig::tests::test_call_parentheses_none", "editorconfig::tests::test_collapse_simple_statement_conditional_only", "editorconfig::tests::test_collapse_simple_statement_always", "editorconfig::tests::test_collapse_simple_statement_function_only", "editorconfig::tests::test_collapse_simple_statement_never", "editorconfig::tests::test_end_of_line_cr", "editorconfig::tests::test_end_of_line_crlf", "editorconfig::tests::test_end_of_line_lf", "editorconfig::tests::test_indent_size", "editorconfig::tests::test_indent_size_use_tab_width", "editorconfig::tests::test_indent_style_space", "editorconfig::tests::test_indent_style_tab", "editorconfig::tests::test_invalid_properties", "editorconfig::tests::test_max_line_length", "editorconfig::tests::test_max_line_length_off", "editorconfig::tests::test_quote_type_auto", "editorconfig::tests::test_quote_type_double", "editorconfig::tests::test_quote_type_single", "editorconfig::tests::test_sort_requires_disabled", "editorconfig::tests::test_sort_requires_enabled", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2", "formatters::trivia_util::tests::test_token_contains_singleline_comments", "sort_requires::tests::fail_extracting_non_identifier_token", "sort_requires::tests::get_expression_kind_other_1", "sort_requires::tests::get_expression_kind_get_service", "sort_requires::tests::get_expression_kind_other_2", "sort_requires::tests::get_expression_kind_other_4", "tests::test_config_indent_width", "tests::test_config_line_endings", "tests::test_config_quote_style", "tests::test_config_column_width", "tests::test_config_indent_type", "tests::test_config_call_parentheses", "sort_requires::tests::get_expression_kind_other_5", "sort_requires::tests::get_expression_kind_other_3", "sort_requires::tests::get_expression_kind_require_stmt", "sort_requires::tests::get_expression_kind_other_6", "tests::test_invalid_input", "verify_ast::tests::test_different_asts", "verify_ast::tests::test_different_binary_numbers", "verify_ast::tests::test_different_hex_numbers", "tests::test_entry_point", "verify_ast::tests::test_equivalent_binary_numbers", "verify_ast::tests::test_equivalent_conditions", "verify_ast::tests::test_equivalent_string_quote_types", "verify_ast::tests::test_equivalent_hex_numbers", "verify_ast::tests::test_equivalent_numbers", "verify_ast::tests::test_equivalent_asts", "verify_ast::tests::test_equivalent_types_removed_parentheses", "tests::test_with_ast_verification", "verify_ast::tests::test_equivalent_stmt_semicolons", "verify_ast::tests::test_equivalent_function_calls_2", "verify_ast::tests::test_equivalent_numbers_2", "verify_ast::tests::test_equivalent_function_calls", "verify_ast::tests::test_equivalent_table_separators", "verify_ast::tests::test_equivalent_string_escapes", "opt::tests::verify_opt", "config::tests::test_override_column_width", "config::tests::test_override_indent_type", "config::tests::test_override_indent_width", "config::tests::test_override_call_parentheses", "output_diff::tests::test_addition_diff", "config::tests::test_override_quote_style", "config::tests::test_override_line_endings", "output_diff::tests::test_deletion_diff", "output_diff::tests::test_no_diff", "output_diff::tests::test_change_diff", "tests::test_no_files_provided", "tests::test_format_stdin", "test_call_parens_semicolons", "test_call_parens_comments", "test_call_parens_none_handles_string_correctly", "test_call_parens_no_single_table_handles_string_correctly", "test_call_parens_no_single_string_handles_string_correctly", "test_call_parens_no_single_string_handles_table_correctly", "test_call_parens_always_handles_table_correctly", "test_call_parens_no_single_table_handles_table_correctly", "test_call_parens_none_handles_table_correctly", "test_call_parens_always_handles_string_correctly", "test_call_parens_has_no_affect_on_multi_arg_fn_calls_", "test_global", "test_empty_root", "test_root", "test_local", "test_stylua_toml", "test_omit_parens_brackets_string", "test_no_parens_brackets_string", "test_no_parens_singleline_table", "test_no_parens_multiline_table", "test_no_parens_method_chain_1", "test_keep_parens_binop_string", "test_omit_parens_string", "test_no_parens_method_chain_2", "test_no_parens_large_example", "test_no_parens_string", "test_force_single_quotes", "test_force_double_quotes", "test_auto_prefer_single_quotes", "test_auto_prefer_double_quotes", "test_ignore_last_stmt", "test_incomplete_range", "test_dont_modify_eof", "test_default", "test_nested_range_binop", "test_nested_range_function_call_table", "test_nested_range_do", "test_nested_range_else_if", "test_nested_range_generic_for", "test_nested_range", "test_nested_range_repeat", "test_no_range_end", "test_no_range_start", "test_nested_range_while", "test_nested_range_table_1", "test_nested_range_function_call", "test_nested_range_local_function", "test_nested_range_table_2", "test_large_example", "test_collapse_single_statement_lua_52", "test_lua52", "test_lua54", "test_lua53", "test_ignores", "test_sort_requires", "test_collapse_single_statement", "test_luau_full_moon", "test_luau" ]
[]
[]
2023-03-30T15:47:25Z
3699358f0ceebe6651789cff25f289d3ac84c937
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Unnecessary parentheses around Luau types will now be removed ([#611](https://github.com/JohnnyMorganz/StyLua/issues/611)) +- Collapse a body containing only a `goto` statement when `collapse_simple_statement` is set ([#618](https://github.com/JohnnyMorganz/StyLua/issues/618)) ## [0.15.3] - 2022-12-07 diff --git a/src/formatters/lua52.rs b/src/formatters/lua52.rs --- a/src/formatters/lua52.rs +++ b/src/formatters/lua52.rs @@ -24,6 +24,13 @@ pub fn format_goto(ctx: &Context, goto: &Goto, shape: Shape) -> Goto { Goto::new(label_name).with_goto_token(goto_token) } +pub fn format_goto_no_trivia(ctx: &Context, goto: &Goto, shape: Shape) -> Goto { + let goto_token = fmt_symbol!(ctx, goto.goto_token(), "goto ", shape); + let label_name = format_token_reference(ctx, goto.label_name(), shape); + + Goto::new(label_name).with_goto_token(goto_token) +} + pub fn format_label(ctx: &Context, label: &Label, shape: Shape) -> Label { // Calculate trivia let leading_trivia = vec![create_indent_trivia(ctx, shape)]; diff --git a/src/formatters/stmt.rs b/src/formatters/stmt.rs --- a/src/formatters/stmt.rs +++ b/src/formatters/stmt.rs @@ -1,5 +1,5 @@ #[cfg(feature = "lua52")] -use crate::formatters::lua52::{format_goto, format_label}; +use crate::formatters::lua52::{format_goto, format_goto_no_trivia, format_label}; #[cfg(feature = "luau")] use crate::formatters::luau::{ format_compound_assignment, format_exported_type_declaration, format_type_declaration_stmt, diff --git a/src/formatters/stmt.rs b/src/formatters/stmt.rs --- a/src/formatters/stmt.rs +++ b/src/formatters/stmt.rs @@ -1117,6 +1117,8 @@ pub fn format_stmt_no_trivia(ctx: &Context, stmt: &Stmt, shape: Shape) -> Stmt { } Stmt::Assignment(stmt) => Stmt::Assignment(format_assignment_no_trivia(ctx, stmt, shape)), Stmt::FunctionCall(stmt) => Stmt::FunctionCall(format_function_call(ctx, stmt, shape)), - _ => unreachable!("format_stmt_no_trivia: node != assignment/function call"), + #[cfg(feature = "lua52")] + Stmt::Goto(goto) => Stmt::Goto(format_goto_no_trivia(ctx, goto, shape)), + _ => unreachable!("format_stmt_no_trivia: node != assignment/function call/goto"), } } diff --git a/src/formatters/trivia_util.rs b/src/formatters/trivia_util.rs --- a/src/formatters/trivia_util.rs +++ b/src/formatters/trivia_util.rs @@ -100,6 +100,8 @@ pub fn is_block_simple(block: &Block) -> bool { true } Stmt::FunctionCall(_) => true, + #[cfg(feature = "lua52")] + Stmt::Goto(_) => true, _ => false, }) }
JohnnyMorganz__StyLua-631
631
[ "618" ]
0.15
JohnnyMorganz/StyLua
2022-12-18T14:08:23Z
diff --git a/tests/tests.rs b/tests/tests.rs --- a/tests/tests.rs +++ b/tests/tests.rs @@ -89,3 +89,25 @@ fn test_collapse_single_statement() { .unwrap()); }) } + +// Collapse simple statement for goto +#[test] +#[cfg(feature = "lua52")] +fn test_collapse_single_statement_lua_52() { + insta::assert_snapshot!( + format_code( + r###" + if key == "s" then + goto continue + end + "###, + Config::default().with_collapse_simple_statement(CollapseSimpleStatement::Always), + None, + OutputVerification::None + ) + .unwrap(), + @r###" + if key == "s" then goto continue end + "### + ); +}
`collapse_simple_statement` for goto using `collapse_simple_statement = "Always"`: ```lua -- won't collapse if key == "s" then goto continue end -- on the other hand something like this does collapse local modes = { "n", "v" } if key == "p" then modes = { "n" } end -- ... ```
540ecfb832e3bccf86e0e037b9c855aa464fc4e7
[ "test_collapse_single_statement_lua_52" ]
[ "formatters::trivia_util::tests::test_token_contains_no_singleline_comments_2", "formatters::trivia_util::tests::test_token_contains_no_singleline_comments", "formatters::trivia_util::tests::test_token_contains_singleline_comments", "tests::test_config_call_parentheses", "tests::test_config_column_width", "tests::test_config_indent_type", "tests::test_config_indent_width", "tests::test_config_line_endings", "tests::test_config_quote_style", "tests::test_invalid_input", "tests::test_entry_point", "verify_ast::tests::test_different_binary_numbers", "verify_ast::tests::test_different_asts", "verify_ast::tests::test_different_hex_numbers", "verify_ast::tests::test_equivalent_asts", "tests::test_with_ast_verification", "verify_ast::tests::test_equivalent_binary_numbers", "verify_ast::tests::test_equivalent_hex_numbers", "verify_ast::tests::test_equivalent_string_quote_types", "verify_ast::tests::test_equivalent_conditions", "verify_ast::tests::test_equivalent_function_calls", "verify_ast::tests::test_equivalent_stmt_semicolons", "verify_ast::tests::test_equivalent_string_escapes", "verify_ast::tests::test_equivalent_numbers_2", "verify_ast::tests::test_equivalent_numbers", "verify_ast::tests::test_equivalent_function_calls_2", "verify_ast::tests::test_equivalent_table_separators", "config::tests::test_override_line_endings", "config::tests::test_override_indent_width", "config::tests::test_override_column_width", "config::tests::test_override_indent_type", "config::tests::test_override_call_parentheses", "config::tests::test_override_quote_style", "opt::tests::verify_opt", "output_diff::tests::test_addition_diff", "output_diff::tests::test_change_diff", "output_diff::tests::test_deletion_diff", "output_diff::tests::test_no_diff", "tests::test_no_files_provided", "tests::test_format_stdin", "test_call_parens_comments", "test_call_parens_always_handles_string_correctly", "test_call_parens_no_single_string_handles_string_correctly", "test_call_parens_none_handles_string_correctly", "test_call_parens_no_single_string_handles_table_correctly", "test_call_parens_no_single_table_handles_string_correctly", "test_call_parens_always_handles_table_correctly", "test_call_parens_semicolons", "test_call_parens_no_single_table_handles_table_correctly", "test_call_parens_none_handles_table_correctly", "test_call_parens_has_no_affect_on_multi_arg_fn_calls_", "test_no_parens_brackets_string", "test_no_parens_singleline_table", "test_omit_parens_brackets_string", "test_no_parens_multiline_table", "test_keep_parens_binop_string", "test_omit_parens_string", "test_no_parens_method_chain_2", "test_no_parens_string", "test_no_parens_large_example", "test_no_parens_method_chain_1", "test_force_single_quotes", "test_force_double_quotes", "test_auto_prefer_single_quotes", "test_auto_prefer_double_quotes", "test_nested_range_table_2", "test_nested_range_repeat", "test_no_range_start", "test_nested_range_while", "test_nested_range_function_call", "test_nested_range_do", "test_incomplete_range", "test_nested_range_table_1", "test_nested_range_binop", "test_default", "test_dont_modify_eof", "test_nested_range_function_call_table", "test_ignore_last_stmt", "test_nested_range", "test_nested_range_generic_for", "test_nested_range_else_if", "test_no_range_end", "test_nested_range_local_function", "test_large_example", "test_lua52", "test_lua54", "test_lua53", "test_ignores", "test_luau_full_moon", "test_collapse_single_statement", "test_luau" ]
[]
[]
2023-01-04T20:16:33Z
c6eba2da9b6ead6112433f7d2aaa1f2d19a22395
diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -1,6 +1,10 @@ # Changes ## Unreleased - 2022-xx-xx +### Fixed +- Fix parsing ambiguity in Transfer-Encoding and Content-Length headers for HTTP/1.0 requests. [#2794] + +[#2794]: https://github.com/actix/actix-web/pull/2794 ## 3.2.0 - 2022-06-30 diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -46,6 +46,23 @@ pub(crate) enum PayloadLength { None, } +impl PayloadLength { + /// Returns true if variant is `None`. + fn is_none(&self) -> bool { + matches!(self, Self::None) + } + + /// Returns true if variant is represents zero-length (not none) payload. + fn is_zero(&self) -> bool { + matches!( + self, + PayloadLength::Payload(PayloadType::Payload(PayloadDecoder { + kind: Kind::Length(0) + })) + ) + } +} + pub(crate) trait MessageType: Sized { fn set_connection_type(&mut self, conn_type: Option<ConnectionType>); diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -59,6 +76,7 @@ pub(crate) trait MessageType: Sized { &mut self, slice: &Bytes, raw_headers: &[HeaderIndex], + version: Version, ) -> Result<PayloadLength, ParseError> { let mut ka = None; let mut has_upgrade_websocket = false; diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -87,21 +105,23 @@ pub(crate) trait MessageType: Sized { return Err(ParseError::Header); } - header::CONTENT_LENGTH => match value.to_str() { - Ok(s) if s.trim().starts_with('+') => { - debug!("illegal Content-Length: {:?}", s); + header::CONTENT_LENGTH => match value.to_str().map(str::trim) { + Ok(val) if val.starts_with('+') => { + debug!("illegal Content-Length: {:?}", val); return Err(ParseError::Header); } - Ok(s) => { - if let Ok(len) = s.parse::<u64>() { - if len != 0 { - content_length = Some(len); - } + + Ok(val) => { + if let Ok(len) = val.parse::<u64>() { + // accept 0 lengths here and remove them in `decode` after all + // headers have been processed to prevent request smuggling issues + content_length = Some(len); } else { - debug!("illegal Content-Length: {:?}", s); + debug!("illegal Content-Length: {:?}", val); return Err(ParseError::Header); } } + Err(_) => { debug!("illegal Content-Length: {:?}", value); return Err(ParseError::Header); diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -114,22 +134,23 @@ pub(crate) trait MessageType: Sized { return Err(ParseError::Header); } - header::TRANSFER_ENCODING => { + header::TRANSFER_ENCODING if version == Version::HTTP_11 => { seen_te = true; - if let Ok(s) = value.to_str().map(str::trim) { - if s.eq_ignore_ascii_case("chunked") { + if let Ok(val) = value.to_str().map(str::trim) { + if val.eq_ignore_ascii_case("chunked") { chunked = true; - } else if s.eq_ignore_ascii_case("identity") { + } else if val.eq_ignore_ascii_case("identity") { // allow silently since multiple TE headers are already checked } else { - debug!("illegal Transfer-Encoding: {:?}", s); + debug!("illegal Transfer-Encoding: {:?}", val); return Err(ParseError::Header); } } else { return Err(ParseError::Header); } } + // connection keep-alive state header::CONNECTION => { ka = if let Ok(conn) = value.to_str().map(str::trim) { diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -146,6 +167,7 @@ pub(crate) trait MessageType: Sized { None }; } + header::UPGRADE => { if let Ok(val) = value.to_str().map(str::trim) { if val.eq_ignore_ascii_case("websocket") { diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -153,19 +175,23 @@ pub(crate) trait MessageType: Sized { } } } + header::EXPECT => { let bytes = value.as_bytes(); if bytes.len() >= 4 && &bytes[0..4] == b"100-" { expect = true; } } + _ => {} } headers.append(name, value); } } + self.set_connection_type(ka); + if expect { self.set_expect() } diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -249,7 +275,22 @@ impl MessageType for Request { let mut msg = Request::new(); // convert headers - let length = msg.set_headers(&src.split_to(len).freeze(), &headers[..h_len])?; + let mut length = + msg.set_headers(&src.split_to(len).freeze(), &headers[..h_len], ver)?; + + // disallow HTTP/1.0 POST requests that do not contain a Content-Length headers + // see https://datatracker.ietf.org/doc/html/rfc1945#section-7.2.2 + if ver == Version::HTTP_10 && method == Method::POST && length.is_none() { + debug!("no Content-Length specified for HTTP/1.0 POST request"); + return Err(ParseError::Header); + } + + // Remove CL value if 0 now that all headers and HTTP/1.0 special cases are processed. + // Protects against some request smuggling attacks. + // See https://github.com/actix/actix-web/issues/2767. + if length.is_zero() { + length = PayloadLength::None; + } // payload decoder let decoder = match length { diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -337,7 +378,15 @@ impl MessageType for ResponseHead { msg.version = ver; // convert headers - let length = msg.set_headers(&src.split_to(len).freeze(), &headers[..h_len])?; + let mut length = + msg.set_headers(&src.split_to(len).freeze(), &headers[..h_len], ver)?; + + // Remove CL value if 0 now that all headers and HTTP/1.0 special cases are processed. + // Protects against some request smuggling attacks. + // See https://github.com/actix/actix-web/issues/2767. + if length.is_zero() { + length = PayloadLength::None; + } // message payload let decoder = if let PayloadLength::Payload(pl) = length {
actix__actix-web-2794
2,794
yea `actix-http` is very bad at this. Instead of naively use boolean and options for tracking payload decoder spec it should just take a mutable referenced decoder type with fallible method on mutation. Would there be any fix for this , accepting multiple content-length headers and parsing the body might lead to HTTP request smuggling ? Only if anyone care to actually fix it. The related code is here. https://github.com/actix/actix-web/blob/6a5b37020676fdfed4b8c7466d8542904bca825c/actix-http/src/h1/decoder.rs#L112 Some needed changes: 1. check the `http::Version` on transfer-encoding header. 2. check multiple transfer-encoding header value separated by , and accept pattern like "gzip, chunked". Some nice to have change: 1. simplify header checking a bit. the current one is a mess and error prone. 2. possible accept content-length: 0 (debatable though)
[ "2767" ]
4.1
actix/actix-web
2022-06-27T02:48:53Z
diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -606,14 +655,40 @@ mod tests { } #[test] - fn test_parse_post() { - let mut buf = BytesMut::from("POST /test2 HTTP/1.0\r\n\r\n"); + fn parse_h10_post() { + let mut buf = BytesMut::from( + "POST /test1 HTTP/1.0\r\n\ + Content-Length: 3\r\n\ + \r\n\ + abc", + ); + + let mut reader = MessageDecoder::<Request>::default(); + let (req, _) = reader.decode(&mut buf).unwrap().unwrap(); + assert_eq!(req.version(), Version::HTTP_10); + assert_eq!(*req.method(), Method::POST); + assert_eq!(req.path(), "/test1"); + + let mut buf = BytesMut::from( + "POST /test2 HTTP/1.0\r\n\ + Content-Length: 0\r\n\ + \r\n", + ); let mut reader = MessageDecoder::<Request>::default(); let (req, _) = reader.decode(&mut buf).unwrap().unwrap(); assert_eq!(req.version(), Version::HTTP_10); assert_eq!(*req.method(), Method::POST); assert_eq!(req.path(), "/test2"); + + let mut buf = BytesMut::from( + "POST /test3 HTTP/1.0\r\n\ + \r\n", + ); + + let mut reader = MessageDecoder::<Request>::default(); + let err = reader.decode(&mut buf).unwrap_err(); + assert!(err.to_string().contains("Header")) } #[test] diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -981,6 +1056,17 @@ mod tests { ); expect_parse_err!(&mut buf); + + let mut buf = BytesMut::from( + "GET / HTTP/1.1\r\n\ + Host: example.com\r\n\ + Content-Length: 0\r\n\ + Content-Length: 2\r\n\ + \r\n\ + ab", + ); + + expect_parse_err!(&mut buf); } #[test] diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -996,6 +1082,40 @@ mod tests { expect_parse_err!(&mut buf); } + #[test] + fn hrs_te_http10() { + // in HTTP/1.0 transfer encoding is ignored and must therefore contain a CL header + + let mut buf = BytesMut::from( + "POST / HTTP/1.0\r\n\ + Host: example.com\r\n\ + Transfer-Encoding: chunked\r\n\ + \r\n\ + 3\r\n\ + aaa\r\n\ + 0\r\n\ + ", + ); + + expect_parse_err!(&mut buf); + } + + #[test] + fn hrs_cl_and_te_http10() { + // in HTTP/1.0 transfer encoding is simply ignored so it's fine to have both + + let mut buf = BytesMut::from( + "GET / HTTP/1.0\r\n\ + Host: example.com\r\n\ + Content-Length: 3\r\n\ + Transfer-Encoding: chunked\r\n\ + \r\n\ + 000", + ); + + parse_ready!(&mut buf); + } + #[test] fn hrs_unknown_transfer_encoding() { let mut buf = BytesMut::from(
Parsing ambiguity in transfer-encoding and content length headers ## Expected Behavior 1. There is no transfer-encoding: chunked header in HTTP/1.0 acccording to RFC spec , so the content-length header should get interpreted 2. According to [RFC message body length](https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.3) , if a request received with multiple content-length it should reject the request with 400 3. According to [RFC Transfer-Encoding](https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.1) header can have multiple comma seperated field values and the final value should be chunked is valid ## Current Behavior 1. transfer-encoding header got accepted instead of content-length in HTTP/1.0 2. content-length with multiple different values , especially 0 and anything got accepted 3. transfer-encoding with multiple field values , eventhough ended with chunked got rejected with 400 ## Steps to Reproduce (for bugs) 1. different field values for content length get accepted ```bash echo -ne "GET / HTTP/1.1\r\nHost: localhost\r\nContent-Length: 0\r\nContent-Length: 3\r\n\r\naaa" | nc localhost 8001 ``` 2. Transfer-Encoding: chunked get accepted for 1.0 version ```bash echo -ne "GET / HTTP/1.0\r\nHost: localhost\r\nTransfer-Encoding: chunked\r\n\r\n3\r\naaa\r\n0\r\n\r\n" | nc localhost 8001 ``` For 1.0 instead of content-length , transfer-encoding got interepted ```bash echo -ne "GET / HTTP/1.0\r\nHost: localhost\r\nTransfer-Encoding: chunked\r\nContent-Length: 13\r\n\r\n2\r\naa\r\n0\r\n\r\nX" | nc localhost 8001 ``` 3. Multiple Transfer Encoding field values request got rejected ```bash echo -ne "GET / HTTP/1.1\r\nHost: localhost\r\nTransfer-Encoding: gzip, chunked\r\n\r\n3\r\naaa\r\n0\r\n\r\n" | nc localhost 8001 ``` ## Context 1. Due to the parsing deviations from RFC , the behavior can be combined with some other techstacks to exploit the applications architecture Eg: If a proxy interprets content-length in http/1.0 and ignores transfer-encoding according to rfc and forwarded downstream to actix-web , if actix interprets transfer-encoding in http/1.0 which is deviation from RFC it can lead to attacks like HTTP request smuggling ## Your Environment - Rust Version : rustc 1.60.0 (7737e0b5c 2022-04-04) - Actix Web Version: 4 ```toml Cargo toml [package] name = "actix" version = "1.0.0" edition = "2021" [dependencies] actix-web = "4" ``` Created a simple web server and ran it to test the parsing behavior of actix ```rust use actix_web::{get, post, App, HttpResponse, HttpServer, Responder}; #[post("/")] async fn echo1(req_body: String) -> impl Responder { let mut answer: String = "Body length: ".to_owned(); answer.push_str(&req_body.len().to_string()); answer.push_str(" Body: "); answer.push_str(&req_body); HttpResponse::Ok().body(answer) } #[get("/")] async fn echo2(req_body: String) -> impl Responder { let mut answer: String = "Body length: ".to_owned(); answer.push_str(&req_body.len().to_string()); answer.push_str(" Body: "); answer.push_str(&req_body); HttpResponse::Ok().body(answer) } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| App::new().service(echo1).service(echo2)) .bind("0.0.0.0:80")? .run() .await } ```
6408291ab00ed4244ceaa4081315691156d66011
[ "h1::decoder::tests::hrs_multiple_transfer_encoding", "h1::decoder::tests::parse_h10_post", "h1::decoder::tests::hrs_te_http10" ]
[ "body::body_stream::tests::read_to_bytes", "body::body_stream::tests::stream_boxed_error", "body::sized_stream::tests::read_to_bytes", "body::message_body::tests::complete_body_combinators", "body::message_body::tests::test_bytes_mut", "body::message_body::tests::test_vec", "body::body_stream::tests::stream_immediate_error", "error::tests::test_error_http_response", "config::tests::test_date", "error::tests::test_as_response", "body::body_stream::tests::skips_empty_chunks", "body::either::tests::type_parameter_inference", "error::tests::test_error_display", "body::message_body::tests::complete_body_combinators_poll", "body::message_body::tests::test_static_str", "config::tests::test_date_camel_case", "body::body_stream::tests::stream_string_error", "body::body_stream::tests::stream_delayed_error", "body::boxed::tests::nested_boxed_body", "body::message_body::tests::test_static_bytes", "config::tests::test_date_len", "body::message_body::tests::test_unit", "body::message_body::tests::none_body_combinators", "error::tests::test_from", "extensions::tests::test_clear", "extensions::tests::test_composition", "config::tests::test_date_service_drop", "extensions::tests::test_remove", "h1::chunked::tests::hrs_chunk_extension_invalid", "h1::chunked::tests::chunk_extension_quoted", "extensions::tests::test_integers", "error::tests::test_into_response", "h1::chunked::tests::hrs_chunk_size_overflow", "body::sized_stream::tests::skips_empty_chunks", "extensions::tests::test_extend", "h1::chunked::tests::test_http_request_chunked_payload_chunks", "h1::chunked::tests::test_http_request_chunked_payload", "body::message_body::tests::test_body_casting", "extensions::tests::test_extensions", "body::sized_stream::tests::stream_boxed_error", "h1::chunked::tests::test_request_chunked", "h1::chunked::tests::test_parse_chunked_payload_chunk_extension", "h1::decoder::tests::test_conn_close", "h1::codec::tests::test_http_request_chunked_payload_and_next_message", "error::tests::test_payload_error", "h1::decoder::tests::hrs_unknown_transfer_encoding", "h1::decoder::tests::hrs_content_length_plus", "h1::decoder::tests::hrs_cl_and_te_http10", "body::message_body::tests::test_string", "h1::decoder::tests::test_conn_close_1_0", "h1::decoder::tests::test_conn_other_1_0", "h1::decoder::tests::test_conn_default_1_0", "h1::decoder::tests::test_conn_keep_alive_1_1", "h1::decoder::tests::test_conn_default_1_1", "body::message_body::tests::boxing_equivalence", "h1::decoder::tests::hrs_multiple_content_length", "h1::decoder::tests::test_headers_multi_value", "h1::decoder::tests::test_http_request_parser_utf8", "h1::decoder::tests::test_http_request_bad_status_line", "h1::decoder::tests::test_headers_content_length_err_2", "h1::decoder::tests::test_http_request_parser_bad_method", "h1::decoder::tests::test_conn_upgrade", "h1::decoder::tests::test_headers_split_field", "h1::decoder::tests::test_http_request_upgrade_h2c", "h1::decoder::tests::test_http_request_upgrade_websocket", "h1::chunked::tests::test_http_request_chunked_payload_and_next_message", "h1::decoder::tests::test_http_request_parser_bad_version", "h1::decoder::tests::test_invalid_name", "h1::decoder::tests::test_conn_other_1_1", "body::utils::test::test_to_bytes", "h1::decoder::tests::test_conn_upgrade_connect_method", "h1::decoder::tests::test_parse", "h1::dispatcher_tests::http_msg_creates_msg", "h1::decoder::tests::test_parse_partial", "h1::decoder::tests::test_parse_body", "h1::dispatcher_tests::pipelining_ok_then_bad", "h1::decoder::tests::test_invalid_header", "h1::decoder::tests::test_response_http10_read_until_eof", "h1::decoder::tests::test_parse_body_crlf", "h1::dispatcher_tests::late_request", "h1::dispatcher_tests::oneshot_connection", "h1::dispatcher_tests::upgrade_handling", "h1::decoder::tests::test_http_request_parser_two_slashes", "h1::decoder::tests::test_headers_content_length_err_1", "h1::decoder::tests::transfer_encoding_agrees", "h1::decoder::tests::test_parse_partial_eof", "h1::dispatcher_tests::pipelining_ok_then_ok", "h1::dispatcher_tests::req_parse_err", "header::map::tests::drain_iter", "header::map::tests::iter_and_into_iter_same_order", "header::map::tests::get_all_and_remove_same_order", "h1::decoder::tests::test_conn_keep_alive_1_0", "header::map::tests::contains", "h1::encoder::tests::test_extra_headers", "header::map::tests::insert", "header::map::tests::create", "h1::encoder::tests::test_chunked_te", "header::shared::extended::tests::test_fmt_extended_value_with_encoding", "header::shared::extended::tests::test_parse_extended_value_with_encoding", "header::map::tests::entries_into_iter", "header::map::tests::get_all_iteration_order_matches_insertion_order", "body::sized_stream::tests::stream_string_error", "header::map::tests::entries_iter", "header::shared::extended::tests::test_parse_extended_value_partially_formatted_blank", "header::shared::extended::tests::test_parse_extended_value_with_encoding_and_language_tag", "header::shared::extended::tests::test_parse_extended_value_partially_formatted", "header::shared::quality::tests::display_output", "header::shared::http_date::tests::date_header", "header::shared::extended::tests::test_parse_extended_value_missing_language_tag_and_encoding", "h1::dispatcher_tests::keep_alive_timeout", "header::shared::charset::tests::test_parse", "header::shared::extended::tests::test_fmt_extended_value_with_encoding_and_language_tag", "h1::dispatcher_tests::keep_alive_follow_up_req", "header::shared::quality::tests::negative_quality - should panic", "body::message_body::tests::test_bytes", "h1::encoder::tests::test_no_content_length", "header::shared::quality::tests::q_helper", "header::shared::charset::tests::test_display", "header::shared::quality_item::tests::test_fuzzing_bugs", "h1::dispatcher_tests::expect_handling", "h1::dispatcher_tests::expect_eager", "header::shared::quality::tests::quality_out_of_bounds - should panic", "h1::payload::tests::test_unread_data", "header::shared::quality_item::tests::test_quality_item_from_str3", "header::shared::quality_item::tests::test_quality_item_from_str2", "header::utils::tests::comma_delimited_parsing", "helpers::tests::test_status_line", "helpers::tests::write_content_length_camel_case", "helpers::tests::test_write_content_length", "header::shared::quality_item::tests::test_quality_item_ordering", "h1::encoder::tests::test_camel_case", "header::shared::quality_item::tests::test_quality_item_from_str6", "http_message::tests::test_chunked", "http_message::tests::test_content_type", "header::shared::quality_item::tests::test_quality_item_fmt_q_1", "header::shared::quality_item::tests::test_quality_item_from_str1", "requests::request::tests::test_basics", "http_message::tests::test_encoding_error", "responses::builder::tests::response_builder_header_append_kv", "http_message::tests::test_mime_type", "header::shared::quality_item::tests::test_quality_item_from_str5", "keep_alive::tests::from_impls", "header::shared::quality_item::tests::test_quality_item_from_str4", "header::shared::quality_item::tests::test_quality_item_fmt_q_0", "header::shared::quality_item::tests::test_quality_item_fmt_q_05", "header::shared::quality_item::tests::test_quality_item_fmt_q_0001", "responses::builder::tests::test_force_close", "ws::frame::tests::test_parse_frame_mask", "ws::frame::tests::test_parse_frame_max_size", "ws::frame::tests::test_parse_length0", "responses::builder::tests::test_upgrade", "ws::frame::tests::test_parse_frame_no_mask", "ws::frame::tests::test_empty_close_frame", "ws::frame::tests::test_parse_length2", "ws::frame::tests::test_ping_frame", "ws::frame::tests::test_parse_length4", "ws::frame::tests::test_pong_frame", "ws::proto::test::test_from_opcode", "ws::mask::tests::test_apply_mask", "ws::proto::test::test_from_opcode_debug - should panic", "ws::proto::test::test_from_opcode_display", "responses::builder::tests::test_content_type", "responses::builder::tests::test_basic_builder", "ws::proto::test::test_hash_key", "ws::proto::test::close_code_from_u16", "responses::builder::tests::response_builder_header_append_typed", "responses::builder::tests::test_into_builder", "ws::tests::test_handshake", "ws::frame::tests::test_parse_frame_max_size_recoverability", "responses::response::tests::test_debug", "ws::frame::tests::test_close_frame", "responses::builder::tests::response_builder_header_insert_typed", "ws::frame::tests::test_parse", "http_message::tests::test_encoding", "http_message::tests::test_mime_type_error", "responses::builder::tests::response_builder_header_insert_kv", "ws::tests::test_ws_error_http_response", "ws::proto::test::test_to_opcode", "ws::proto::test::close_code_into_u16", "responses::response::tests::test_into_response", "responses::head::tests::camel_case_headers", "config::tests::test_date_service_update", "with_query_parameter", "connection_close", "h1_expect", "h1_v2", "h2_handshake_timeout", "h2_ping_pong", "h2_head_binary", "h2_1", "h2", "h2_response_http_error_handling", "h2_head_empty", "h2_body2", "h2_body_chunked_explicit", "h2_head_binary2", "h2_service_error", "h2_on_connect", "h2_body_length", "h2_headers", "h2_body", "h2_content_length", "h1_1", "alpn_h1", "alpn_h2", "alpn_h2_1", "h1", "h2_body1", "h1_headers", "slow_request_408", "http10_keepalive_default_close", "http1_keepalive", "h1_body", "http1_malformed_request", "h1_head_binary2", "h1_basic", "h1_on_connect", "not_modified_spec_h1", "http10_keepalive", "content_length", "http1_keepalive_disabled", "http1_keepalive_close", "chunked_payload", "h1_2", "h1_head_empty", "http1_keepalive_timeout", "expect_continue_h1", "expect_continue", "simple", "actix-http/src/body/utils.rs - body::utils::to_bytes (line 15)", "actix-http/src/body/message_body.rs - body::message_body::MessageBody (line 27)", "actix-http/src/body/size.rs - body::size::BodySize::is_eof (line 30)", "actix-http/src/header/shared/quality.rs - header::shared::quality::q (line 156)", "actix-http/src/header/shared/quality.rs - header::shared::quality::q (line 171)", "actix-http/src/header/shared/quality_item.rs - header::shared::quality_item::QualityItem (line 21)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::append_header (line 106)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder (line 19)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::new (line 47)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::status (line 63)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::insert_header (line 79)", "actix-http/src/header/map.rs - header::map::HeaderMap::is_empty (line 182)", "actix-http/src/header/map.rs - header::map::HeaderMap::len (line 140)", "actix-http/src/extensions.rs - extensions::Extensions::clear (line 106)", "actix-http/src/header/map.rs - header::map::HeaderMap::insert (line 346)", "actix-http/src/extensions.rs - extensions::Extensions::get (line 60)", "actix-http/src/header/map.rs - header::map::HeaderMap::insert (line 363)", "actix-http/src/header/map.rs - header::map::HeaderMap::get_all (line 294)", "actix-http/src/header/map.rs - header::map::HeaderMap (line 16)", "actix-http/src/header/shared/quality.rs - header::shared::quality::Quality (line 24)", "actix-http/src/header/map.rs - header::map::HeaderMap::remove (line 415)", "actix-http/src/header/map.rs - header::map::HeaderMap::reserve (line 483)", "actix-http/src/header/map.rs - header::map::HeaderMap::clear (line 199)", "actix-http/src/extensions.rs - extensions::Extensions::get_mut (line 74)", "actix-http/src/header/map.rs - header::map::HeaderMap::get_mut (line 265)", "actix-http/src/header/map.rs - header::map::HeaderMap::iter (line 503)", "actix-http/src/header/map.rs - header::map::HeaderMap::remove (line 434)", "actix-http/src/header/map.rs - header::map::HeaderMap::new (line 77)", "actix-http/src/header/map.rs - header::map::HeaderMap::contains_key (line 323)", "actix-http/src/header/map.rs - header::map::HeaderMap::keys (line 535)", "actix-http/src/header/map.rs - header::map::HeaderMap::with_capacity (line 94)", "actix-http/src/header/map.rs - header::map::HeaderMap::get (line 232)", "actix-http/src/header/map.rs - header::map::HeaderMap::drain (line 563)", "actix-http/src/header/map.rs - header::map::HeaderMap::capacity (line 463)", "actix-http/src/extensions.rs - extensions::Extensions::remove (line 90)", "actix-http/src/extensions.rs - extensions::Extensions::insert (line 30)", "actix-http/src/header/map.rs - header::map::HeaderMap::len_keys (line 163)", "actix-http/src/extensions.rs - extensions::Extensions::contains (line 46)", "actix-http/src/header/map.rs - header::map::HeaderMap::append (line 385)" ]
[]
[ "h1_service_error", "h1_body_chunked_explicit", "h1_head_binary", "h1_body_length", "h1_response_http_error_handling", "h1_body_chunked_implicit" ]
2022-07-01T07:23:42Z
85c9b1a263366d279d544cddf407d00989372269
diff --git a/actix-router/CHANGES.md b/actix-router/CHANGES.md --- a/actix-router/CHANGES.md +++ b/actix-router/CHANGES.md @@ -1,8 +1,11 @@ # Changes ## Unreleased - 2021-xx-xx +- `PathDeserializer` now decodes all percent encoded characters in dynamic segments. [#2566] - Minimum supported Rust version (MSRV) is now 1.54. +[#2566]: https://github.com/actix/actix-net/pull/2566 + ## 0.5.0-beta.3 - 2021-12-17 - Minimum supported Rust version (MSRV) is now 1.52. diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -2,7 +2,11 @@ use serde::de::{self, Deserializer, Error as DeError, Visitor}; use serde::forward_to_deserialize_any; use crate::path::{Path, PathIter}; -use crate::ResourcePath; +use crate::{Quoter, ResourcePath}; + +thread_local! { + static FULL_QUOTER: Quoter = Quoter::new(b"+/%", b""); +} macro_rules! unsupported_type { ($trait_fn:ident, $name:expr) => { diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -10,16 +14,13 @@ macro_rules! unsupported_type { where V: Visitor<'de>, { - Err(de::value::Error::custom(concat!( - "unsupported type: ", - $name - ))) + Err(de::Error::custom(concat!("unsupported type: ", $name))) } }; } macro_rules! parse_single_value { - ($trait_fn:ident, $visit_fn:ident, $tp:tt) => { + ($trait_fn:ident, $visit_fn:ident, $tp:expr) => { fn $trait_fn<V>(self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor<'de>, diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -33,18 +34,39 @@ macro_rules! parse_single_value { .as_str(), )) } else { - let v = self.path[0].parse().map_err(|_| { - de::value::Error::custom(format!( - "can not parse {:?} to a {}", - &self.path[0], $tp - )) + let decoded = FULL_QUOTER + .with(|q| q.requote(self.path[0].as_bytes())) + .unwrap_or_else(|| self.path[0].to_owned()); + + let v = decoded.parse().map_err(|_| { + de::Error::custom(format!("can not parse {:?} to a {}", &self.path[0], $tp)) })?; + visitor.$visit_fn(v) } } }; } +macro_rules! parse_value { + ($trait_fn:ident, $visit_fn:ident, $tp:tt) => { + fn $trait_fn<V>(self, visitor: V) -> Result<V::Value, Self::Error> + where + V: Visitor<'de>, + { + let decoded = FULL_QUOTER + .with(|q| q.requote(self.value.as_bytes())) + .unwrap_or_else(|| self.value.to_owned()); + + let v = decoded.parse().map_err(|_| { + de::value::Error::custom(format!("can not parse {:?} to a {}", self.value, $tp)) + })?; + + visitor.$visit_fn(v) + } + }; +} + pub struct PathDeserializer<'de, T: ResourcePath> { path: &'de Path<T>, } diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -172,23 +194,6 @@ impl<'de, T: ResourcePath + 'de> Deserializer<'de> for PathDeserializer<'de, T> } } - fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> - where - V: Visitor<'de>, - { - if self.path.segment_count() != 1 { - Err(de::value::Error::custom( - format!( - "wrong number of parameters: {} expected 1", - self.path.segment_count() - ) - .as_str(), - )) - } else { - visitor.visit_str(&self.path[0]) - } - } - fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where V: Visitor<'de>, diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -215,6 +220,7 @@ impl<'de, T: ResourcePath + 'de> Deserializer<'de> for PathDeserializer<'de, T> parse_single_value!(deserialize_u64, visit_u64, "u64"); parse_single_value!(deserialize_f32, visit_f32, "f32"); parse_single_value!(deserialize_f64, visit_f64, "f64"); + parse_single_value!(deserialize_str, visit_string, "String"); parse_single_value!(deserialize_string, visit_string, "String"); parse_single_value!(deserialize_byte_buf, visit_string, "String"); parse_single_value!(deserialize_char, visit_char, "char"); diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -279,20 +285,6 @@ impl<'de> Deserializer<'de> for Key<'de> { } } -macro_rules! parse_value { - ($trait_fn:ident, $visit_fn:ident, $tp:tt) => { - fn $trait_fn<V>(self, visitor: V) -> Result<V::Value, Self::Error> - where - V: Visitor<'de>, - { - let v = self.value.parse().map_err(|_| { - de::value::Error::custom(format!("can not parse {:?} to a {}", self.value, $tp)) - })?; - visitor.$visit_fn(v) - } - }; -} - struct Value<'de> { value: &'de str, }
actix__actix-web-2566
2,566
[ "2248" ]
3.0
actix/actix-web
2022-01-04T13:10:51Z
diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -497,6 +489,7 @@ mod tests { use super::*; use crate::path::Path; use crate::router::Router; + use crate::ResourceDef; #[derive(Deserialize)] struct MyStruct { diff --git a/actix-router/src/de.rs b/actix-router/src/de.rs --- a/actix-router/src/de.rs +++ b/actix-router/src/de.rs @@ -657,6 +650,53 @@ mod tests { assert!(format!("{:?}", s).contains("can not parse")); } + #[test] + fn deserialize_path_decode_string() { + let rdef = ResourceDef::new("/{key}"); + + let mut path = Path::new("/%25"); + rdef.capture_match_info(&mut path); + let de = PathDeserializer::new(&path); + let segment: String = serde::Deserialize::deserialize(de).unwrap(); + assert_eq!(segment, "%"); + + let mut path = Path::new("/%2F"); + rdef.capture_match_info(&mut path); + let de = PathDeserializer::new(&path); + let segment: String = serde::Deserialize::deserialize(de).unwrap(); + assert_eq!(segment, "/") + } + + #[test] + fn deserialize_path_decode_seq() { + let rdef = ResourceDef::new("/{key}/{value}"); + + let mut path = Path::new("/%25/%2F"); + rdef.capture_match_info(&mut path); + let de = PathDeserializer::new(&path); + let segment: (String, String) = serde::Deserialize::deserialize(de).unwrap(); + assert_eq!(segment.0, "%"); + assert_eq!(segment.1, "/"); + } + + #[test] + fn deserialize_path_decode_map() { + #[derive(Deserialize)] + struct Vals { + key: String, + value: String, + } + + let rdef = ResourceDef::new("/{key}/{value}"); + + let mut path = Path::new("/%25/%2F"); + rdef.capture_match_info(&mut path); + let de = PathDeserializer::new(&path); + let vals: Vals = serde::Deserialize::deserialize(de).unwrap(); + assert_eq!(vals.key, "%"); + assert_eq!(vals.value, "/"); + } + // #[test] // fn test_extract_path_decode() { // let mut router = Router::<()>::default(); diff --git a/src/types/path.rs b/src/types/path.rs --- a/src/types/path.rs +++ b/src/types/path.rs @@ -285,6 +285,18 @@ mod tests { assert_eq!(res[1], "32".to_owned()); } + #[actix_rt::test] + async fn paths_decoded() { + let resource = ResourceDef::new("/{key}/{value}"); + let mut req = TestRequest::with_uri("/na%2Bme/us%2Fer%251").to_srv_request(); + resource.capture_match_info(req.match_info_mut()); + + let (req, mut pl) = req.into_parts(); + let path_items = Path::<MyStruct>::from_request(&req, &mut pl).await.unwrap(); + assert_eq!(path_items.key, "na+me"); + assert_eq!(path_items.value, "us/er%1"); + } + #[actix_rt::test] async fn test_custom_err_handler() { let (req, mut pl) = TestRequest::with_uri("/name/user1/")
[RFC] percent-encoding in URL path paramters # The problem When extracting URL path parameters from `Path` extractor, the user is expected to be aware of percent-encoding because he would get some encoded characters. To date, all chars are decoded except for `/`, `+`, `%`. This behavior is quite surprising for the user because of the lack of documentation and is also quite unusual for a web framework - percent-encoding is a different level of abstraction that the user should not be concerned about (`Query` extractor deals with this correctly). The whole reason for this behavior is that the router stores URL as a single string with slash separated segments and matches a single regex against it. This is why `/` need to be escaped, to not change semantics. Related: #182 #209 #556 #1157 # The proposal What i think is a proper implementation is to store the url path and the matching pattern (`ResourceDef`) as array of segments with each pattern segment matches a single url path segment. This has the benefit of simplifying code by offloading uand even making `regex` an optional dependency, but it also would not allow patterns, such as `"/user/u{id:.*}"`, that span multiple segments. Path tail patterns (e.g. `"/files/{path:.*}"`) can be implemented as a special case but they should then be de-serialized into `Vec<_>` not `String`. An alternative easier implementation is to percent decode the matched url parameters when de-serializing `Path`, but then multi-segment matches should also be prohibited.
b3e84b5c4bf32fd8aeac8c938f9906ce730a7458
[ "de::tests::deserialize_path_decode_string", "de::tests::deserialize_path_decode_map", "de::tests::deserialize_path_decode_seq" ]
[ "de::tests::test_extract_enum_value", "de::tests::test_extract_enum", "resource::tests::build_path_tail", "resource::tests::duplicate_segment_name - should panic", "resource::tests::invalid_dynamic_segment_delimiter - should panic", "resource::tests::multi_pattern_capture_segment_values", "de::tests::test_request_extract", "de::tests::test_extract_errors", "resource::tests::dynamic_prefix_proper_segmentation", "resource::tests::equivalence", "quoter::tests::quoter_no_modification", "resource::tests::dynamic_set_prefix", "quoter::tests::hex_encoding", "resource::tests::dynamic_tail", "resource::tests::invalid_custom_regex_for_tail - should panic", "resource::tests::invalid_dynamic_segment_name - should panic", "resource::tests::invalid_unnamed_tail_segment - should panic", "resource::tests::match_methods_agree", "resource::tests::multi_pattern_build_path", "resource::tests::invalid_too_many_dynamic_segments - should panic", "resource::tests::build_path_list", "resource::tests::parse_static", "resource::tests::newline_patterns_and_paths", "de::tests::test_extract_path_single", "quoter::tests::custom_quoter", "resource::tests::parse_tail", "resource::tests::build_path_map", "resource::tests::prefix_empty", "resource::tests::prefix_static", "url::tests::invalid_utf8", "resource::tests::static_tail", "url::tests::protected_chars", "resource::tests::prefix_dynamic", "url::tests::non_protected_ascii", "router::tests::test_recognizer_2", "url::tests::parse_url", "router::tests::test_recognizer_with_prefix", "url::tests::valid_utf8_multibyte", "resource::tests::prefix_trailing_slash", "resource::tests::parse_urlencoded_param", "resource::tests::prefix_plus_tail_match_disallowed - should panic", "router::tests::test_recognizer_1", "resource::tests::dynamic_set", "resource::tests::parse_param", "resource::tests::join", "actix-router/src/resource.rs - resource::ResourceDef (line 203)", "actix-router/src/resource.rs - resource::ResourceDef (line 189)", "actix-router/src/resource.rs - resource::ResourceDef::pattern (line 417)", "actix-router/src/resource.rs - resource::ResourceDef::resource_path_from_iter (line 811)", "actix-router/src/resource.rs - resource::ResourceDef::id (line 339)", "actix-router/src/resource.rs - resource::ResourceDef (line 53)", "actix-router/src/resource.rs - resource::ResourceDef (line 116)", "actix-router/src/resource.rs - resource::ResourceDef::set_id (line 354)", "actix-router/src/resource.rs - resource::ResourceDef::is_prefix (line 401)", "actix-router/src/resource.rs - resource::ResourceDef (line 89)", "actix-router/src/resource.rs - resource::ResourceDef::name (line 367)", "actix-router/src/resource.rs - resource::ResourceDef::find_match (line 574)", "actix-router/src/resource.rs - resource::ResourceDef::root_prefix (line 316)", "actix-router/src/resource.rs - resource::ResourceDef::new (line 261)", "actix-router/src/resource.rs - resource::ResourceDef::join (line 501)", "actix-router/src/resource.rs - resource::ResourceDef::capture_match_info_fn (line 654)", "actix-router/src/resource.rs - resource::ResourceDef::resource_path_from_map (line 837)", "actix-router/src/resource.rs - resource::ResourceDef::pattern_iter (line 434)", "actix-router/src/resource.rs - resource::ResourceDef::is_match (line 529)", "actix-router/src/resource.rs - resource::ResourceDef::capture_match_info (line 623)", "actix-router/src/resource.rs - resource::ResourceDef (line 167)", "actix-router/src/resource.rs - resource::ResourceDef::prefix (line 294)", "actix-router/src/resource.rs - resource::ResourceDef (line 150)", "actix-router/src/resource.rs - resource::ResourceDef::set_name (line 384)", "error::internal::tests::test_internal_error", "error::response_error::tests::test_error_casting", "error::tests::test_query_payload_error", "error::tests::test_json_payload_error", "error::tests::test_readlines_error", "error::internal::tests::test_error_helpers", "error::tests::test_urlencoded_error", "app::tests::can_be_returned_from_fn", "guard::tests::aggregate_all", "guard::tests::aggregate_any", "guard::tests::function_guard", "guard::tests::header_match", "guard::tests::host_from_header", "guard::tests::host_scheme", "guard::tests::host_without_header", "guard::tests::mega_nesting", "http::header::accept::test_parse_and_format::test1", "http::header::accept::test_parse_and_format::test2", "guard::tests::method_guards", "http::header::accept_encoding::test_parse_and_format::implicit_quality", "http::header::accept::test_parse_and_format::test3", "http::header::accept_encoding::test_parse_and_format::no_headers", "http::header::accept_encoding::test_parse_and_format::only_gzip_no_identity", "http::header::accept::tests::ranking_precedence", "guard::tests::nested_not", "http::header::accept_encoding::test_parse_and_format::order_of_appearance", "http::header::accept::test_parse_and_format::test_fuzzing1", "http::header::accept_encoding::test_parse_and_format::empty_header", "http::header::accept::test_parse_and_format::test4", "http::header::accept_encoding::test_parse_and_format::implicit_quality_out_of_order", "http::header::accept_encoding::tests::detect_identity_acceptable", "http::header::accept_encoding::tests::encoding_negotiation", "http::header::accept_encoding::tests::preference_selection", "http::header::accept_charset::test_parse_and_format::test1", "http::header::accept_encoding::tests::ranking_precedence", "http::header::accept_encoding::test_parse_and_format::any", "http::header::accept::tests::preference_selection", "http::header::accept_language::test_parse_and_format::empty_header", "http::header::accept_language::test_parse_and_format::example_from_rfc", "http::header::accept_language::test_parse_and_format::has_wildcard", "http::header::accept_language::test_parse_and_format::no_headers", "http::header::allow::test_parse_and_format::test1", "http::header::accept_language::tests::ranking_precedence", "http::header::accept_language::tests::preference_selection", "http::header::accept_language::test_parse_and_format::not_ordered_by_weight", "http::header::allow::test_parse_and_format::test2", "http::header::allow::test_parse_and_format::test3", "http::header::cache_control::test_parse_and_format::argument", "http::header::cache_control::test_parse_and_format::bad_syntax", "http::header::cache_control::test_parse_and_format::empty_header", "http::header::cache_control::test_parse_and_format::extension", "http::header::cache_control::test_parse_and_format::multiple_headers", "http::header::cache_control::test_parse_and_format::no_headers", "http::header::cache_control::test_parse_and_format::parse_quote_form", "http::header::content_disposition::tests::from_raw_with_mixed_case", "http::header::content_disposition::tests::from_raw_with_unicode", "http::header::content_disposition::tests::test_disposition_methods", "http::header::content_disposition::tests::test_display_space_tab", "http::header::content_disposition::tests::test_display_extended", "http::header::content_disposition::tests::test_display_quote", "http::header::content_disposition::tests::test_display_control_characters", "http::header::content_disposition::tests::test_from_raw_extended", "http::header::content_disposition::tests::test_from_raw_only_disp", "http::header::content_disposition::tests::test_from_raw_basic", "http::header::content_disposition::tests::test_from_raw_param_name_missing", "http::header::content_disposition::tests::test_from_raw_param_value_missing", "http::header::content_disposition::tests::test_from_raw_extra_whitespace", "http::header::content_disposition::tests::test_from_raw_semicolon", "http::header::content_disposition::tests::test_from_raw_unnecessary_percent_decode", "http::header::content_disposition::tests::test_from_raw_escape", "http::header::content_disposition::tests::test_param_methods", "http::header::content_disposition::tests::test_from_raw_unordered", "http::header::content_language::test_parse_and_format::test1", "http::header::content_language::test_parse_and_format::test2", "http::header::content_range::test_parse_and_format::test_blank", "http::header::content_range::test_parse_and_format::test_bytes", "http::header::content_range::test_parse_and_format::test_bytes_many_dashes", "http::header::content_range::test_parse_and_format::test_bytes_many_slashes", "http::header::content_range::test_parse_and_format::test_bytes_unknown_len", "http::header::content_range::test_parse_and_format::test_bytes_many_spaces", "http::header::content_range::test_parse_and_format::test_bytes_unknown_range", "http::header::content_range::test_parse_and_format::test_end_less_than_start", "http::header::content_range::test_parse_and_format::test_no_len", "http::header::content_range::test_parse_and_format::test_only_unit", "http::header::content_range::test_parse_and_format::test_unregistered", "http::header::content_type::test_parse_and_format::test1", "http::header::entity::tests::test_cmp", "http::header::entity::tests::test_etag_fmt", "http::header::date::test_parse_and_format::test1", "http::header::entity::tests::test_etag_parse_failures", "http::header::entity::tests::test_etag_parse_success", "http::header::etag::test_parse_and_format::test1", "http::header::etag::test_parse_and_format::test10", "http::header::etag::test_parse_and_format::test11", "http::header::etag::test_parse_and_format::test12", "http::header::etag::test_parse_and_format::test13", "http::header::etag::test_parse_and_format::test14", "http::header::etag::test_parse_and_format::test15", "http::header::etag::test_parse_and_format::test2", "http::header::etag::test_parse_and_format::test3", "http::header::etag::test_parse_and_format::test4", "http::header::etag::test_parse_and_format::test5", "http::header::etag::test_parse_and_format::test6", "http::header::etag::test_parse_and_format::test7", "http::header::etag::test_parse_and_format::test8", "http::header::etag::test_parse_and_format::test9", "http::header::expires::test_parse_and_format::test1", "http::header::if_match::test_parse_and_format::test1", "http::header::if_match::test_parse_and_format::test2", "http::header::if_match::test_parse_and_format::test3", "http::header::if_modified_since::test_parse_and_format::test1", "http::header::if_none_match::test_parse_and_format::test1", "http::header::if_none_match::test_parse_and_format::test2", "http::header::if_none_match::test_parse_and_format::test3", "http::header::if_none_match::test_parse_and_format::test4", "http::header::if_none_match::test_parse_and_format::test5", "http::header::if_none_match::tests::test_if_none_match", "http::header::if_range::test_parse_and_format::test1", "http::header::if_range::test_parse_and_format::test2", "http::header::if_range::test_parse_and_format::test3", "http::header::if_unmodified_since::test_parse_and_format::test1", "http::header::range::tests::test_byte_range_spec_to_satisfiable_range", "http::header::last_modified::test_parse_and_format::test1", "http::header::range::tests::test_fmt", "http::header::range::tests::test_parse_bytes_range_valid", "http::header::range::tests::test_parse_invalid", "http::header::range::tests::test_parse_unregistered_range_valid", "info::tests::forwarded_case_sensitivity", "info::tests::forwarded_for_ipv6", "info::tests::forwarded_for_multiple", "info::tests::forwarded_for_quoted", "info::tests::forwarded_header", "info::tests::forwarded_weird_whitespace", "info::tests::host_from_server_hostname", "info::tests::host_from_uri", "info::tests::host_header", "info::tests::info_default", "info::tests::scheme_from_uri", "info::tests::x_forwarded_for_header", "info::tests::x_forwarded_host_header", "info::tests::x_forwarded_proto_header", "middleware::default_headers::tests::invalid_header_name - should panic", "middleware::default_headers::tests::invalid_header_value - should panic", "request::tests::test_debug", "request::tests::test_match_name", "request::tests::test_no_request_cookies", "request::tests::test_request_cookies", "request::tests::test_request_query", "resource::tests::can_be_returned_from_fn", "request::tests::test_url_for_static", "response::builder::tests::response_builder_header_append_kv", "response::builder::tests::response_builder_header_insert_kv", "response::builder::tests::response_builder_header_append_typed", "response::builder::tests::test_content_type", "response::builder::tests::test_force_close", "response::builder::tests::response_builder_header_insert_typed", "response::builder::tests::test_basic_builder", "response::http_codes::tests::test_build", "response::builder::tests::test_upgrade", "response::response::tests::test_debug", "request::tests::test_url_for_external", "rmap::tests::external_resource_with_name", "request::tests::test_url_for", "rmap::tests::external_resource_with_no_name", "rmap::tests::short_circuit", "middleware::tests::common_combinations", "rmap::tests::url_for", "rmap::tests::url_for_parser", "scope::tests::can_be_returned_from_fn", "rmap::tests::extract_matched_name", "rmap::tests::bug_fix_issue_1582_debug_print_exits", "rmap::tests::extract_matched_pattern", "service::tests::test_fmt_debug", "types::query::tests::test_tuple_panic - should panic", "src/data.rs - data::Data (line 52)", "src/error/internal.rs - error::internal::InternalError (line 19)", "src/guard.rs - guard::Connect (line 301)", "src/guard.rs - guard::Any (line 142)", "src/guard.rs - guard::Not (line 241)", "src/guard.rs - guard::Put (line 297)", "src/app.rs - app::App<T>::configure (line 166)", "src/guard.rs - guard (line 34)", "src/app.rs - app::App<T>::external_resource (line 293)", "src/guard.rs - guard::Get (line 295)", "src/extract.rs - extract::Method (line 275)", "src/guard.rs - guard::Header (line 306)", "src/app.rs - app::App<T>::default_service (line 240)", "src/app.rs - app::App<T>::wrap_fn (line 398)", "src/guard.rs - guard::All (line 192)", "src/guard.rs - guard::Trace (line 303)", "src/guard.rs - guard::Head (line 299)", "src/guard.rs - guard::Patch (line 302)", "src/guard.rs - guard::Post (line 296)", "src/guard.rs - guard::Options (line 300)", "src/config.rs - config::ServiceConfig (line 172)", "src/extract.rs - extract::Option<T> (line 85)", "src/guard.rs - guard::Delete (line 298)", "src/app.rs - app::App<T>::default_service (line 256)", "src/extract.rs - extract::Uri (line 254)", "src/http/header/accept.rs - http::header::accept::Accept (line 34)", "src/data.rs - data::Data (line 60)", "src/guard.rs - guard::fn_guard (line 102)", "src/app.rs - app::App<T>::app_data (line 65)", "src/extract.rs - extract::Result<T,T::Error> (line 175)", "src/guard.rs - guard::Host (line 364)", "src/guard.rs - guard::Host (line 351)", "src/app.rs - app::App<T>::wrap (line 335)", "src/http/header/accept_encoding.rs - http::header::accept_encoding::AcceptEncoding (line 27)", "src/http/header/content_language.rs - http::header::content_language::ContentLanguage (line 23)", "src/http/header/etag.rs - http::header::etag::ETag (line 27)", "src/http/header/content_disposition.rs - http::header::content_disposition::ContentDisposition (line 255)", "src/http/header/content_language.rs - http::header::content_language::ContentLanguage (line 35)", "src/http/header/if_none_match.rs - http::header::if_none_match::IfNoneMatch (line 38)", "src/http/header/cache_control.rs - http::header::cache_control::CacheControl (line 34)", "src/app.rs - app::App<T>::route (line 199)", "src/http/header/accept_language.rs - http::header::accept_language::AcceptLanguage (line 32)", "src/http/header/allow.rs - http::header::allow::Allow (line 24)", "src/http/header/if_match.rs - http::header::if_match::IfMatch (line 28)", "src/http/header/accept_charset.rs - http::header::accept_charset::AcceptCharset (line 21)", "src/http/header/accept.rs - http::header::accept::Accept (line 46)", "src/http/header/accept_encoding.rs - http::header::accept_encoding::AcceptEncoding (line 37)", "src/http/header/accept.rs - http::header::accept::Accept (line 58)", "src/http/header/accept_language.rs - http::header::accept_language::AcceptLanguage (line 44)", "src/http/header/cache_control.rs - http::header::cache_control::CacheControl (line 26)", "src/http/header/accept_charset.rs - http::header::accept_charset::AcceptCharset (line 44)", "src/middleware/compress.rs - middleware::compress::Compress (line 59) - compile", "src/http/header/if_range.rs - http::header::if_range::IfRange (line 38)", "src/http/header/content_type.rs - http::header::content_type::ContentType (line 29)", "src/http/header/content_disposition.rs - http::header::content_disposition::DispositionParam (line 74)", "src/request.rs - request::HttpRequest::app_data (line 288) - compile", "src/http/header/expires.rs - http::header::expires::Expires (line 23)", "src/http/header/if_modified_since.rs - http::header::if_modified_since::IfModifiedSince (line 22)", "src/http/header/date.rs - http::header::date::Date (line 20)", "src/http/header/if_none_match.rs - http::header::if_none_match::IfNoneMatch (line 30)", "src/http/header/accept_charset.rs - http::header::accept_charset::AcceptCharset (line 31)", "src/http/header/content_type.rs - http::header::content_type::ContentType (line 39)", "src/http/header/etag.rs - http::header::etag::ETag (line 37)", "src/lib.rs - (line 4) - compile", "src/http/header/if_unmodified_since.rs - http::header::if_unmodified_since::IfUnmodifiedSince (line 22)", "src/http/header/allow.rs - http::header::allow::Allow (line 34)", "src/http/header/if_range.rs - http::header::if_range::IfRange (line 50)", "src/http/header/if_match.rs - http::header::if_match::IfMatch (line 36)", "src/request_data.rs - request_data::ReqData (line 25) - compile", "src/response/builder.rs - response::builder::HttpResponseBuilder::del_cookie (line 260)", "src/http/header/last_modified.rs - http::header::last_modified::LastModified (line 21)", "src/middleware/condition.rs - middleware::condition::Condition (line 17)", "src/request.rs - request::HttpRequest (line 398)", "src/request.rs - request::HttpRequest::url_for (line 195)", "src/resource.rs - resource::Resource<T,B>::route (line 146)", "src/middleware/logger.rs - middleware::logger::Logger (line 47)", "src/middleware/logger.rs - middleware::logger::Logger::custom_request_replace (line 128)", "src/middleware/err_handlers.rs - middleware::err_handlers::ErrorHandlers (line 39)", "src/http/header/range.rs - http::header::range::Range (line 44)", "src/info.rs - info::ConnectionInfo (line 40)", "src/resource.rs - resource::Resource<T,B>::to (line 217)", "src/middleware/compress.rs - middleware::compress::Compress (line 50)", "src/route.rs - route::Route::guard (line 118)", "src/resource.rs - resource::Resource<T,B>::wrap_fn (line 296)", "src/response/customize_responder.rs - response::customize_responder::CustomizeResponder<R>::insert_header (line 69)", "src/middleware/default_headers.rs - middleware::default_headers::DefaultHeaders (line 29)", "src/response/customize_responder.rs - response::customize_responder::CustomizeResponder<R>::append_header (line 101)", "src/route.rs - route::Route::method (line 97)", "src/route.rs - route::Route::service (line 195)", "src/resource.rs - resource::Resource<T,B>::app_data (line 172)", "src/resource.rs - resource::Resource<T,B>::to (line 229)", "src/resource.rs - resource::Resource<T,B>::guard (line 98)", "src/middleware/compat.rs - middleware::compat::Compat (line 23)", "src/server.rs - server::HttpServer (line 38) - compile", "src/response/responder.rs - response::responder::Responder::customize (line 29)", "src/server.rs - server::HttpServer<F,I,S,B>::run (line 627) - compile", "src/response/customize_responder.rs - response::customize_responder::CustomizeResponder<R>::with_status (line 42)", "src/resource.rs - resource::Resource<T,B>::route (line 131)", "src/response/builder.rs - response::builder::HttpResponseBuilder::cookie (line 230)", "src/response/builder.rs - response::builder::HttpResponseBuilder::insert_header (line 62)", "src/response/builder.rs - response::builder::HttpResponseBuilder::append_header (line 85)", "src/resource.rs - resource::Resource (line 35)", "src/info.rs - info::PeerAddr (line 218)", "src/test/test_utils.rs - test::test_utils::read_body (line 159)", "src/types/form.rs - types::form::Form (line 63)", "src/test/test_request.rs - test::test_request::TestRequest (line 32)", "src/test/test_utils.rs - test::test_utils::call_and_read_body (line 106)", "src/types/either.rs - types::either::Either (line 30)", "src/test/test_utils.rs - test::test_utils::read_body_json (line 200)", "src/types/header.rs - types::header::Header (line 18)", "src/types/path.rs - types::path::Path (line 37)", "src/test/test_utils.rs - test::test_utils::call_service (line 70)", "src/test/test_utils.rs - test::test_utils::call_and_read_body_json (line 261)", "src/test/test_utils.rs - test::test_utils::init_service (line 19)", "src/types/either.rs - types::either::Either (line 58)", "src/types/form.rs - types::form::Form (line 38)", "src/types/path.rs - types::path::Path (line 21)", "src/types/json.rs - types::json::Json (line 40)", "src/types/payload.rs - types::payload::Bytes (line 83)", "src/scope.rs - scope::Scope<T,B>::app_data (line 131)", "src/types/json.rs - types::json::Json (line 61)", "src/route.rs - route::Route::to (line 137)", "src/types/payload.rs - types::payload::String (line 131)", "src/route.rs - route::Route::to (line 158)", "src/types/query.rs - types::query::Query (line 22)", "src/types/payload.rs - types::payload::Payload (line 28)", "src/scope.rs - scope::Scope<T,B>::configure (line 179)", "src/scope.rs - scope::Scope<T,B>::route (line 256)", "src/service.rs - service::WebService::guard (line 540)", "src/scope.rs - scope::Scope<T,B>::wrap_fn (line 344)", "src/scope.rs - scope::Scope<T,B>::service (line 226)", "src/scope.rs - scope::Scope<T,B>::guard (line 104)", "src/scope.rs - scope::Scope (line 42)", "src/test/test_request.rs - test::test_request::TestRequest::param (line 155)", "src/web.rs - web::scope (line 65)", "src/web.rs - web::method (line 120)", "src/types/form.rs - types::form::FormConfig (line 205)", "src/types/query.rs - types::query::QueryConfig (line 144)", "src/web.rs - web::to (line 134)", "src/types/json.rs - types::json::JsonConfig (line 203)", "src/web.rs - web::trace (line 117)", "src/web.rs - web::get (line 111)", "src/types/query.rs - types::query::Query<T>::from_query (line 73)", "src/web.rs - web::service (line 157)", "src/web.rs - web::patch (line 114)", "src/types/path.rs - types::path::PathConfig (line 132)", "src/web.rs - web::resource (line 36)", "src/web.rs - web::post (line 112)", "src/web.rs - web::put (line 113)", "src/service.rs - service::services (line 627)", "src/web.rs - web::delete (line 115)", "src/web.rs - web::head (line 116)" ]
[ "app::tests::test_router_wrap_fn", "app::tests::test_external_resource", "app::tests::test_extension", "app::tests::test_router_wrap", "app::tests::test_wrap_fn", "app::tests::test_data_factory", "app::tests::test_default_resource", "app::tests::test_data_factory_errors", "app_service::tests::test_drop_data", "app::tests::test_wrap", "config::tests::test_data", "data::tests::test_app_data_extractor", "data::tests::test_data_from_arc", "data::tests::test_data_extractor", "data::tests::test_data_from_dyn_arc", "middleware::default_headers::tests::no_override_existing", "middleware::condition::tests::test_handler_disabled", "info::tests::conn_info_extract", "extract::tests::test_option", "middleware::default_headers::tests::adding_default_headers", "middleware::logger::tests::test_closure_logger_in_middleware", "data::tests::test_dyn_data_into_arc", "middleware::logger::tests::test_default_format", "middleware::compat::tests::test_scope_middleware", "middleware::default_headers::tests::adding_content_type", "middleware::logger::tests::test_custom_closure_log", "data::tests::test_route_data_extractor", "data::tests::test_get_ref_from_dyn_data", "middleware::logger::tests::test_logger_exclude_regex", "data::tests::test_override_data", "middleware::err_handlers::tests::add_header_error_handler", "info::tests::remote_address", "config::tests::test_external_resource", "extract::tests::test_method", "middleware::logger::tests::test_logger", "middleware::logger::tests::test_escape_percent", "info::tests::real_ip_from_socket_addr", "middleware::err_handlers::tests::changes_body_type", "middleware::compat::tests::test_condition_scope_middleware", "middleware::compress::tests::prevents_double_compressing", "error::macros::tests::test_any_casting", "middleware::normalize::tests::no_path", "request::tests::test_drop_http_request_pool", "middleware::logger::tests::test_request_time_format", "middleware::err_handlers::tests::add_header_error_handler_async", "middleware::logger::tests::test_remote_addr_format", "middleware::normalize::tests::keep_trailing_slash_unchanged", "request::tests::test_extensions_dropped", "middleware::compat::tests::test_resource_scope_middleware", "middleware::condition::tests::test_handler_enabled", "extract::tests::test_concurrent", "extract::tests::test_result", "info::tests::peer_addr_extract", "middleware::normalize::tests::should_normalize_no_trail", "request::tests::test_data", "extract::tests::test_uri", "middleware::normalize::tests::ensure_root_trailing_slash_with_query", "middleware::normalize::tests::test_in_place_normalization", "request::tests::extract_path_pattern_complex", "request::tests::test_cascading_data", "middleware::logger::tests::test_url_path", "config::tests::test_service", "resource::tests::test_data_default_service", "resource::tests::test_resource_guards", "route::tests::test_route", "route::tests::test_service_handler", "response::responder::tests::test_result_responder", "request_data::tests::req_data_internal_mutability", "response::customize_responder::tests::tuple_responder_with_status_code", "scope::tests::test_middleware", "response::responder::tests::test_responder", "scope::tests::test_default_resource", "response::customize_responder::tests::customize_responder", "resource::tests::test_default_resource", "resource::tests::test_middleware", "resource::tests::test_middleware_app_data", "scope::tests::dynamic_scopes", "scope::tests::test_default_resource_propagation", "resource::tests::test_to", "resource::tests::test_pattern", "middleware::normalize::tests::test_wrap", "response::responder::tests::test_option_responder", "request::tests::test_overwrite_data", "response::builder::tests::test_json", "middleware::normalize::tests::trim_root_trailing_slashes_with_query", "scope::tests::test_nested2_scope_with_variable_segment", "scope::tests::test_middleware_body_type", "scope::tests::test_nested_scope_with_variable_segment", "scope::tests::test_scope_root2", "response::builder::tests::test_serde_json_in_body", "scope::tests::test_scope_guard", "scope::tests::test_override_app_data", "middleware::normalize::tests::ensure_trailing_slash", "resource::tests::test_data", "request_data::tests::req_data_extractor", "resource::tests::test_middleware_fn", "scope::tests::test_middleware_app_data", "request::tests::extract_path_pattern", "scope::tests::test_scope", "middleware::normalize::tests::trim_trailing_slashes", "resource::tests::test_middleware_body_type", "scope::tests::test_scope_root", "middleware::normalize::tests::should_normalize_nothing", "scope::tests::test_scope_variable_segment", "scope::tests::test_scope_route_without_leading_slash", "scope::tests::test_nested_scope_root", "scope::tests::test_nested_scope", "scope::tests::test_scope_config_2", "scope::tests::test_scope_root3", "scope::tests::test_middleware_fn", "scope::tests::test_nested_scope_filter", "scope::tests::test_nested_scope_no_slash", "scope::tests::test_override_data_default_service", "scope::tests::test_override_data", "scope::tests::test_scope_route", "scope::tests::test_scope_config", "scope::tests::test_url_for_nested", "test::test_utils::tests::test_request_response_form", "service::tests::test_service_data", "service::tests::test_service", "test::test_request::tests::test_async_with_block", "scope::tests::test_url_for_external", "test::test_request::tests::test_basics", "test::test_request::tests::test_send_request", "service::tests::test_services_vec", "service::tests::test_services_macro", "test::test_request::tests::test_server_data", "types::json::tests::test_json_body", "test::tests::assert_body_works_for_service_and_regular_response", "types::either::tests::test_either_extract_recursive_fallback", "types::json::tests::test_json_with_no_content_type", "types::either::tests::test_either_extract_fallback", "types::header::tests::test_header_extract", "types::json::tests::test_responder", "types::payload::tests::test_message_body", "types::json::tests::test_with_json_and_bad_content_type", "types::payload::tests::test_config_recall_locations", "types::query::tests::test_request_extract", "types::json::tests::test_with_config_in_data_wrapper", "types::json::tests::test_custom_error_responder", "types::json::tests::test_extract", "types::json::tests::test_with_json_and_bad_custom_content_type", "test::test_utils::tests::test_response_json", "types::payload::tests::test_payload_config", "test::test_utils::tests::test_request_methods", "types::path::tests::test_request_extract", "types::json::tests::test_with_json_and_good_custom_content_type", "types::path::tests::test_tuple_extract", "types::either::tests::test_either_extract_recursive_fallback_inner", "types::path::tests::test_extract_path_single", "types::query::tests::test_custom_error_responder", "types::either::tests::test_either_extract_first_try", "types::form::tests::test_form", "types::readlines::tests::test_readlines", "types::form::tests::test_urlencoded", "types::path::tests::paths_decoded", "types::form::tests::test_with_config_in_data_wrapper", "types::form::tests::test_responder", "types::payload::tests::test_bytes", "types::query::tests::test_service_request_extract", "test::test_utils::tests::test_response", "test::test_utils::tests::test_body_json", "types::form::tests::test_urlencoded_error", "types::path::tests::test_custom_err_handler", "test::test_utils::tests::test_request_response_json", "types::payload::tests::test_string", "result: FAILED. 174 passed;", "deny_identity_coding_no_decompress", "negotiate_encoding_gzip", "deny_identity_coding", "client_encoding_prefers_brotli", "gzip_no_decompress", "negotiate_encoding_zstd", "manual_custom_coding", "negotiate_encoding_identity", "negotiate_encoding_br", "test_macro_naming_conflict", "error_cause_should_be_propagated_to_middlewares", "test_start", "test_start_ssl", "test_accept_encoding_no_match", "body_gzip_large", "plus_rustls::test_reading_deflate_encoding_large_random_rustls", "test_body_brotli", "test_body", "test_body_chunked_implicit", "test_body_deflate", "test_body_br_streaming", "test_body_zstd_streaming", "test_brotli_encoding", "test_body_zstd", "test_body_gzip_large_random", "test_brotli_encoding_large_openssl", "test_brotli_encoding_large", "test_gzip_encoding_large", "test_zstd_encoding_large", "test_server_cookies", "test_reading_gzip_encoding_large_random", "test_reading_deflate_encoding_large_random", "test_no_chunking", "test_head_binary", "test_reading_deflate_encoding_large", "test_gzip_encoding", "test_normalize", "test_slow_request", "test_data_drop", "test_zstd_encoding", "test_encoding", "test_reading_deflate_encoding", "src/middleware/normalize.rs - middleware::normalize::NormalizePath (line 57)" ]
[]
2022-01-04T15:19:31Z
9d1f75d349dd6ad8451b8d2dbc619561868dba4d
diff --git a/actix-web/CHANGES.md b/actix-web/CHANGES.md --- a/actix-web/CHANGES.md +++ b/actix-web/CHANGES.md @@ -5,6 +5,7 @@ ### Changed - Updated `zstd` dependency to `0.13`. +- Compression middleware now prefers brotli over zstd over gzip. ### Fixed diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -149,7 +149,7 @@ impl AcceptEncoding { /// Extracts the most preferable encoding, accounting for [q-factor weighting]. /// - /// If no q-factors are provided, the first encoding is chosen. Note that items without + /// If no q-factors are provided, we prefer brotli > zstd > gzip. Note that items without /// q-factors are given the maximum preference value. /// /// As per the spec, returns [`Preference::Any`] if acceptable list is empty. Though, if this is diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -167,6 +167,7 @@ impl AcceptEncoding { let mut max_item = None; let mut max_pref = Quality::ZERO; + let mut max_rank = 0; // uses manual max lookup loop since we want the first occurrence in the case of same // preference but `Iterator::max_by_key` would give us the last occurrence diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -174,9 +175,13 @@ impl AcceptEncoding { for pref in &self.0 { // only change if strictly greater // equal items, even while unsorted, still have higher preference if they appear first - if pref.quality > max_pref { + + let rank = encoding_rank(pref); + + if (pref.quality, rank) > (max_pref, max_rank) { max_pref = pref.quality; max_item = Some(pref.item.clone()); + max_rank = rank; } } diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -203,6 +208,8 @@ impl AcceptEncoding { /// Returns a sorted list of encodings from highest to lowest precedence, accounting /// for [q-factor weighting]. /// + /// If no q-factors are provided, we prefer brotli > zstd > gzip. + /// /// [q-factor weighting]: https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2 pub fn ranked(&self) -> Vec<Preference<Encoding>> { self.ranked_items().map(|q| q.item).collect() diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -210,21 +217,44 @@ impl AcceptEncoding { fn ranked_items(&self) -> impl Iterator<Item = QualityItem<Preference<Encoding>>> { if self.0.is_empty() { - return vec![].into_iter(); + return Vec::new().into_iter(); } let mut types = self.0.clone(); // use stable sort so items with equal q-factor retain listed order types.sort_by(|a, b| { - // sort by q-factor descending - b.quality.cmp(&a.quality) + // sort by q-factor descending then server ranking descending + + b.quality + .cmp(&a.quality) + .then(encoding_rank(b).cmp(&encoding_rank(a))) }); types.into_iter() } } +/// Returns server-defined encoding ranking. +fn encoding_rank(qv: &QualityItem<Preference<Encoding>>) -> u8 { + // ensure that q=0 items are never sorted above identity encoding + // invariant: sorting methods calling this fn use first-on-equal approach + if qv.quality == Quality::ZERO { + return 0; + } + + match qv.item { + Preference::Specific(Encoding::Known(ContentEncoding::Brotli)) => 5, + Preference::Specific(Encoding::Known(ContentEncoding::Zstd)) => 4, + Preference::Specific(Encoding::Known(ContentEncoding::Gzip)) => 3, + Preference::Specific(Encoding::Known(ContentEncoding::Deflate)) => 2, + Preference::Any => 0, + Preference::Specific(Encoding::Known(ContentEncoding::Identity)) => 0, + Preference::Specific(Encoding::Known(_)) => 1, + Preference::Specific(Encoding::Unknown(_)) => 1, + } +} + /// Returns true if "identity" is an acceptable encoding. /// /// Internal algorithm relies on item list being in descending order of quality.
actix__actix-web-3189
3,189
Since equally weighted q-values are not discriminated according to order (it's left up to the origin), I do think we should preference brotli if it is enabled 👍🏻
[ "3187" ]
4.4
actix/actix-web
2023-11-15T08:24:32Z
diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -377,11 +407,11 @@ mod tests { ); assert_eq!( test.negotiate([Encoding::gzip(), Encoding::brotli(), Encoding::identity()].iter()), - Some(Encoding::gzip()) + Some(Encoding::brotli()) ); assert_eq!( test.negotiate([Encoding::brotli(), Encoding::gzip(), Encoding::identity()].iter()), - Some(Encoding::gzip()) + Some(Encoding::brotli()) ); } diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -398,6 +428,9 @@ mod tests { let test = accept_encoding!("br", "gzip", "*"); assert_eq!(test.ranked(), vec![enc("br"), enc("gzip"), enc("*")]); + + let test = accept_encoding!("gzip", "br", "*"); + assert_eq!(test.ranked(), vec![enc("br"), enc("gzip"), enc("*")]); } #[test] diff --git a/actix-web/src/http/header/accept_encoding.rs b/actix-web/src/http/header/accept_encoding.rs --- a/actix-web/src/http/header/accept_encoding.rs +++ b/actix-web/src/http/header/accept_encoding.rs @@ -420,5 +453,8 @@ mod tests { let test = accept_encoding!("br", "gzip", "*"); assert_eq!(test.preference().unwrap(), enc("br")); + + let test = accept_encoding!("gzip", "br", "*"); + assert_eq!(test.preference().unwrap(), enc("br")); } } diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -96,7 +96,7 @@ async fn negotiate_encoding_gzip() { let req = srv .post("/static") - .insert_header((header::ACCEPT_ENCODING, "gzip,br,zstd")) + .insert_header((header::ACCEPT_ENCODING, "gzip, br;q=0.8, zstd;q=0.5")) .send(); let mut res = req.await.unwrap(); diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -109,7 +109,7 @@ async fn negotiate_encoding_gzip() { let mut res = srv .post("/static") .no_decompress() - .insert_header((header::ACCEPT_ENCODING, "gzip,br,zstd")) + .insert_header((header::ACCEPT_ENCODING, "gzip, br;q=0.8, zstd;q=0.5")) .send() .await .unwrap(); diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -123,9 +123,25 @@ async fn negotiate_encoding_gzip() { async fn negotiate_encoding_br() { let srv = test_server!(); + // check that brotli content-encoding header is returned + + let req = srv + .post("/static") + .insert_header((header::ACCEPT_ENCODING, "br, zstd, gzip")) + .send(); + + let mut res = req.await.unwrap(); + assert_eq!(res.status(), StatusCode::OK); + assert_eq!(res.headers().get(header::CONTENT_ENCODING).unwrap(), "br"); + + let bytes = res.body().await.unwrap(); + assert_eq!(bytes, Bytes::from_static(LOREM)); + + // check that brotli is preferred even when later in (q-less) list + let req = srv .post("/static") - .insert_header((header::ACCEPT_ENCODING, "br,zstd,gzip")) + .insert_header((header::ACCEPT_ENCODING, "gzip, zstd, br")) .send(); let mut res = req.await.unwrap(); diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -135,10 +151,12 @@ async fn negotiate_encoding_br() { let bytes = res.body().await.unwrap(); assert_eq!(bytes, Bytes::from_static(LOREM)); + // check that returned content is actually brotli encoded + let mut res = srv .post("/static") .no_decompress() - .insert_header((header::ACCEPT_ENCODING, "br,zstd,gzip")) + .insert_header((header::ACCEPT_ENCODING, "br, zstd, gzip")) .send() .await .unwrap(); diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -154,7 +172,7 @@ async fn negotiate_encoding_zstd() { let req = srv .post("/static") - .insert_header((header::ACCEPT_ENCODING, "zstd,gzip,br")) + .insert_header((header::ACCEPT_ENCODING, "zstd, gzip, br;q=0.8")) .send(); let mut res = req.await.unwrap(); diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -167,7 +185,7 @@ async fn negotiate_encoding_zstd() { let mut res = srv .post("/static") .no_decompress() - .insert_header((header::ACCEPT_ENCODING, "zstd,gzip,br")) + .insert_header((header::ACCEPT_ENCODING, "zstd, gzip, br;q=0.8")) .send() .await .unwrap(); diff --git a/actix-web/tests/compression.rs b/actix-web/tests/compression.rs --- a/actix-web/tests/compression.rs +++ b/actix-web/tests/compression.rs @@ -207,7 +225,7 @@ async fn gzip_no_decompress() { // don't decompress response body .no_decompress() // signal that we want a compressed body - .insert_header((header::ACCEPT_ENCODING, "gzip,br,zstd")) + .insert_header((header::ACCEPT_ENCODING, "gzip, br;q=0.8, zstd;q=0.5")) .send(); let mut res = req.await.unwrap();
`.negotiate()` prefers `gzip` over `brotli` If I enable `actix_web::middleware::Compress` middleware, it's serving `gzip`, even though `brotli` feature is on. ## Expected Behavior I am expecting it to pick the best compression method supported by Browser, and between brotli and gzip, brotli is better (my site compresses to ~196KB with brotli and ~250kb with gzip). ## Current Behavior In the 4.4 release and on main, if you look at the test cases, `gzip` is given higher priority over `brotli`. https://github.com/actix/actix-web/blob/e50bceb91493087d4059e605d94c13a11b09e747/actix-web/src/http/header/accept_encoding.rs#L378-L385 ## Possible Solution Based on https://news.ycombinator.com/item?id=19678985 I recommend `brotli` > `zstd` > `gzip` as the priority in which one should pick the compression Algo to use if browser supports all three. Since every browser that supports `brotli` or `zstd` also supports `gzip`, with current implementation of giving `gzip` priority over the two means we are compiling support for `brotli` and `zstd` for no real benefit. Happy to send a PR if my proposal is accepted. ## Steps to Reproduce (for bugs) The test linked above demonstrates the problem. ## Context I am trying to optimise a [`fastn`](https://github.com/fastn-stack/fastn/) powered website: [`fastn.com`](https://fastn.com). Currently it is implemented as SSG, deployed on Vercel, and Vercel uses brotli and about 190KB is downloaded for a test page, and when I power it by running `fastn serve` on a Heroku instance, and enable compression middleware, it serves gzipped content, and browser downloads ~250KB of content. ## Your Environment - Rust Version (I.e, output of `rustc -V`): 1.73.0 - Actix Web Version: 4.4 Site is deployed on Heroku. [Code in question](https://github.com/fastn-stack/fastn/blob/85f972eb49818423cab055e43dafe71c5af9cc05/fastn-core/src/commands/serve.rs#L737).
561cc440b2405746d3de01f6983c9c8616a370fb
[ "http::header::accept_encoding::tests::ranking_precedence", "http::header::accept_encoding::tests::preference_selection", "http::header::accept_encoding::tests::encoding_negotiation" ]
[ "error::response_error::tests::test_error_casting", "error::tests::test_urlencoded_error", "error::tests::test_readlines_error", "error::tests::test_json_payload_error", "error::tests::test_query_payload_error", "error::internal::tests::test_internal_error", "error::internal::tests::test_error_helpers", "handler::tests::arg_number", "guard::host::tests::host_from_header", "guard::host::tests::host_without_header", "guard::tests::function_guard", "guard::host::tests::host_scheme", "guard::tests::header_match", "guard::tests::aggregate_any", "guard::tests::nested_not", "guard::tests::aggregate_all", "guard::tests::mega_nesting", "guard::tests::method_guards", "http::header::accept::test_parse_and_format::test_fuzzing1", "guard::acceptable::tests::test_acceptable", "guard::acceptable::tests::test_acceptable_star", "http::header::accept::tests::preference_selection", "http::header::accept::tests::ranking_precedence", "http::header::accept_encoding::test_parse_and_format::any", "http::header::accept::test_parse_and_format::test1", "http::header::accept_charset::test_parse_and_format::test1", "http::header::accept_encoding::test_parse_and_format::implicit_quality_out_of_order", "http::header::accept::test_parse_and_format::test2", "http::header::accept::test_parse_and_format::test4", "http::header::accept::test_parse_and_format::test3", "http::header::accept_encoding::test_parse_and_format::implicit_quality", "http::header::accept_encoding::test_parse_and_format::empty_header", "http::header::accept_encoding::test_parse_and_format::no_headers", "http::header::accept_encoding::tests::detect_identity_acceptable", "http::header::accept_encoding::test_parse_and_format::order_of_appearance", "http::header::accept_encoding::test_parse_and_format::only_gzip_no_identity", "http::header::accept_language::test_parse_and_format::example_from_rfc", "http::header::accept_language::test_parse_and_format::has_wildcard", "http::header::allow::test_parse_and_format::test2", "http::header::accept_language::tests::preference_selection", "http::header::cache_control::test_parse_and_format::extension", "http::header::cache_control::test_parse_and_format::no_headers", "http::header::allow::test_parse_and_format::test1", "http::header::accept_language::test_parse_and_format::no_headers", "http::header::accept_language::test_parse_and_format::not_ordered_by_weight", "http::header::allow::test_parse_and_format::test3", "http::header::cache_control::test_parse_and_format::bad_syntax", "http::header::accept_language::tests::ranking_precedence", "http::header::cache_control::test_parse_and_format::argument", "http::header::content_disposition::tests::from_raw_with_unicode", "http::header::content_disposition::tests::from_raw_with_mixed_case", "http::header::cache_control::test_parse_and_format::multiple_headers", "http::header::cache_control::test_parse_and_format::parse_quote_form", "http::header::content_disposition::tests::test_from_raw_basic", "http::header::content_disposition::tests::test_from_raw_only_disp", "http::header::content_disposition::tests::test_from_raw_param_name_missing", "http::header::content_disposition::tests::test_from_raw_extended", "http::header::content_disposition::tests::test_from_raw_extra_whitespace", "http::header::content_disposition::tests::test_disposition_methods", "http::header::content_disposition::tests::test_from_raw_param_value_missing", "http::header::cache_control::test_parse_and_format::empty_header", "http::header::content_disposition::tests::test_param_methods", "http::header::content_disposition::tests::test_from_raw_escape", "http::header::content_disposition::tests::test_from_raw_unnecessary_percent_decode", "http::header::accept_language::test_parse_and_format::empty_header", "http::header::content_disposition::tests::test_from_raw_semicolon", "http::header::content_length::tests::ordering", "http::header::content_disposition::tests::test_from_raw_unordered", "http::header::content_language::test_parse_and_format::test1", "http::header::content_length::tests::equality", "http::header::content_length::tests::bad_header_plus - should panic", "http::header::content_length::tests::bad_multiple_value - should panic", "http::header::content_length::tests::bad_header", "http::header::content_length::tests::missing_header", "http::header::content_language::test_parse_and_format::test2", "http::header::content_range::test_parse_and_format::test_bytes_many_dashes", "http::header::content_range::test_parse_and_format::test_bytes_many_spaces", "http::header::content_type::test_parse_and_format::test_image_star", "http::header::content_range::test_parse_and_format::test_bytes_unknown_len", "http::header::content_range::test_parse_and_format::test_bytes_many_slashes", "http::header::entity::tests::test_cmp", "http::header::content_type::test_parse_and_format::test_text_html", "http::header::entity::tests::test_etag_parse_failures", "http::header::entity::tests::test_etag_fmt", "http::header::entity::tests::test_etag_parse_success", "http::header::etag::test_parse_and_format::test1", "http::header::content_range::test_parse_and_format::test_only_unit", "http::header::content_range::test_parse_and_format::test_bytes", "http::header::etag::test_parse_and_format::test10", "http::header::content_length::tests::good_header", "http::header::etag::test_parse_and_format::test12", "http::header::etag::test_parse_and_format::test14", "http::header::content_disposition::tests::test_display_space_tab", "http::header::content_disposition::tests::test_display_quote", "http::header::content_disposition::tests::test_display_extended", "http::header::content_disposition::tests::test_display_control_characters", "http::header::content_range::test_parse_and_format::test_bytes_unknown_range", "http::header::content_range::test_parse_and_format::test_unregistered", "http::header::content_range::test_parse_and_format::test_end_less_than_start", "http::header::content_range::test_parse_and_format::test_no_len", "http::header::content_range::test_parse_and_format::test_blank", "http::header::etag::test_parse_and_format::test15", "http::header::date::test_parse_and_format::test1", "http::header::etag::test_parse_and_format::test3", "http::header::etag::test_parse_and_format::test7", "http::header::etag::test_parse_and_format::test6", "http::header::etag::test_parse_and_format::test4", "http::header::etag::test_parse_and_format::test11", "http::header::etag::test_parse_and_format::test13", "http::header::if_match::test_parse_and_format::test2", "http::header::etag::test_parse_and_format::test5", "http::header::if_match::test_parse_and_format::test1", "http::header::etag::test_parse_and_format::test2", "http::header::etag::test_parse_and_format::test9", "http::header::if_match::test_parse_and_format::test3", "http::header::if_none_match::test_parse_and_format::test2", "app::tests::can_be_returned_from_fn", "http::header::etag::test_parse_and_format::test8", "http::header::if_none_match::test_parse_and_format::test4", "http::header::if_none_match::tests::test_if_none_match", "http::header::if_none_match::test_parse_and_format::test3", "http::header::if_range::test_parse_and_format::test1", "http::header::last_modified::test_parse_and_format::test1", "http::header::if_none_match::test_parse_and_format::test1", "http::header::if_modified_since::test_parse_and_format::test1", "http::header::if_range::test_parse_and_format::test3", "http::header::expires::test_parse_and_format::test1", "http::header::if_unmodified_since::test_parse_and_format::test1", "http::header::if_none_match::test_parse_and_format::test5", "http::header::if_range::test_parse_and_format::test2", "http::header::range::tests::test_fmt", "http::header::range::tests::test_byte_range_spec_to_satisfiable_range", "http::header::range::tests::test_parse_invalid", "http::header::range::tests::test_parse_bytes_range_valid", "info::tests::host_from_uri", "info::tests::host_from_server_hostname", "info::tests::scheme_from_uri", "info::tests::forwarded_for_quoted", "info::tests::host_header", "info::tests::forwarded_case_sensitivity", "info::tests::forwarded_weird_whitespace", "info::tests::forwarded_for_multiple", "http::header::range::tests::test_parse_unregistered_range_valid", "info::tests::info_default", "info::tests::forwarded_for_ipv6", "info::tests::x_forwarded_proto_header", "info::tests::x_forwarded_host_header", "info::tests::x_forwarded_for_header", "info::tests::forwarded_header", "middleware::condition::tests::compat_with_builtin_middleware", "middleware::default_headers::tests::invalid_header_value - should panic", "middleware::default_headers::tests::invalid_header_name - should panic", "request::tests::authorization_header_hidden_in_debug", "request::tests::cookie_header_hidden_in_debug", "request::tests::other_header_visible_in_debug", "request::tests::proxy_authorization_header_hidden_in_debug", "request::tests::test_debug", "request::tests::test_request_query", "request::tests::test_no_request_cookies", "resource::tests::can_be_returned_from_fn", "request::tests::test_match_name", "middleware::tests::common_combinations", "request::tests::test_request_cookies", "request::tests::test_url_for_static", "request::tests::test_url_for", "request::tests::test_url_for_external", "response::http_codes::tests::test_build", "response::builder::tests::test_force_close", "response::builder::tests::test_basic_builder", "response::builder::tests::response_builder_header_insert_kv", "response::builder::tests::response_builder_header_insert_typed", "response::builder::tests::response_builder_header_append_kv", "response::builder::tests::test_upgrade", "response::builder::tests::test_content_type", "response::builder::tests::response_builder_header_append_typed", "response::response::tests::test_debug", "rmap::tests::short_circuit", "rmap::tests::url_for_override_within_map", "scope::tests::can_be_returned_from_fn", "response::response::cookie_tests::removal_cookies", "service::tests::test_fmt_debug", "rmap::tests::external_resource_with_name", "rmap::tests::external_resource_with_no_name", "rmap::tests::url_for", "rmap::tests::url_for_parser", "rmap::tests::extract_matched_name", "rmap::tests::bug_fix_issue_1582_debug_print_exits", "rmap::tests::extract_matched_pattern", "types::query::tests::test_tuple_panic - should panic", "actix-web/src/guard/mod.rs - guard::GuardContext<'a>::header (line 99)", "actix-web/src/error/internal.rs - error::internal::InternalError (line 19)", "actix-web/src/data.rs - data::Data (line 49)", "actix-web/src/guard/mod.rs - guard::Any (line 172)", "actix-web/src/guard/mod.rs - guard::Trace (line 351)", "actix-web/src/guard/mod.rs - guard::Get (line 343)", "actix-web/src/guard/mod.rs - guard::Patch (line 350)", "actix-web/src/guard/mod.rs - guard::Delete (line 346)", "actix-web/src/guard/acceptable.rs - guard::acceptable::Acceptable (line 10)", "actix-web/src/http/header/accept.rs - http::header::accept::Accept (line 33)", "actix-web/src/guard/mod.rs - guard::Connect (line 349)", "actix-web/src/guard/host.rs - guard::host::Host (line 46)", "actix-web/src/guard/mod.rs - guard (line 37)", "actix-web/src/extract.rs - extract::Method (line 292)", "actix-web/src/guard/mod.rs - guard::Post (line 344)", "actix-web/src/guard/mod.rs - guard::fn_guard (line 132)", "actix-web/src/guard/mod.rs - guard::Not (line 274)", "actix-web/src/extract.rs - extract::Uri (line 271)", "actix-web/src/guard/mod.rs - guard::Head (line 347)", "actix-web/src/guard/mod.rs - guard::Options (line 348)", "actix-web/src/guard/mod.rs - guard::Put (line 345)", "actix-web/src/guard/mod.rs - guard::Header (line 354)", "actix-web/src/extract.rs - extract::Result<T,E> (line 192)", "actix-web/src/extract.rs - extract::Option<T> (line 104)", "actix-web/src/guard/mod.rs - guard::All (line 223)", "actix-web/src/app.rs - app::App<T>::wrap_fn (line 384)", "actix-web/src/app.rs - app::App<T>::route (line 208)", "actix-web/src/app.rs - app::App<T>::app_data (line 67)", "actix-web/src/app.rs - app::App<T>::default_service (line 253)", "actix-web/src/app.rs - app::App<T>::wrap (line 325)", "actix-web/src/app.rs - app::App<T>::configure (line 168)", "actix-web/src/config.rs - config::ServiceConfig (line 181)", "actix-web/src/data.rs - data::Data (line 57)", "actix-web/src/guard/host.rs - guard::host::Host (line 24)", "actix-web/src/app.rs - app::App<T>::external_resource (line 286)", "actix-web/src/http/header/accept.rs - http::header::accept::Accept (line 45)", "actix-web/src/http/header/accept_charset.rs - http::header::accept_charset::AcceptCharset (line 31)", "actix-web/src/http/header/cache_control.rs - http::header::cache_control::CacheControl (line 34)", "actix-web/src/http/header/accept_charset.rs - http::header::accept_charset::AcceptCharset (line 21)", "actix-web/src/http/header/if_none_match.rs - http::header::if_none_match::IfNoneMatch (line 38)", "actix-web/src/http/header/allow.rs - http::header::allow::Allow (line 24)", "actix-web/src/http/header/content_disposition.rs - http::header::content_disposition::ContentDisposition (line 256)", "actix-web/src/http/header/date.rs - http::header::date::Date (line 21)", "actix-web/src/http/header/cache_control.rs - http::header::cache_control::CacheControl (line 26)", "actix-web/src/http/header/etag.rs - http::header::etag::ETag (line 37)", "actix-web/src/http/header/if_match.rs - http::header::if_match::IfMatch (line 28)", "actix-web/src/http/header/accept_encoding.rs - http::header::accept_encoding::AcceptEncoding (line 27)", "actix-web/src/http/header/allow.rs - http::header::allow::Allow (line 34)", "actix-web/src/http/header/content_disposition.rs - http::header::content_disposition::ContentDisposition::attachment (line 318)", "actix-web/src/http/header/accept_encoding.rs - http::header::accept_encoding::AcceptEncoding (line 37)", "actix-web/src/http/header/if_match.rs - http::header::if_match::IfMatch (line 36)", "actix-web/src/http/header/if_range.rs - http::header::if_range::IfRange (line 36)", "actix-web/src/http/header/if_modified_since.rs - http::header::if_modified_since::IfModifiedSince (line 22)", "actix-web/src/http/header/accept_language.rs - http::header::accept_language::AcceptLanguage (line 44)", "actix-web/src/http/header/expires.rs - http::header::expires::Expires (line 23)", "actix-web/src/http/header/accept_language.rs - http::header::accept_language::AcceptLanguage (line 32)", "actix-web/src/http/header/etag.rs - http::header::etag::ETag (line 27)", "actix-web/src/http/header/content_disposition.rs - http::header::content_disposition::DispositionParam (line 75)", "actix-web/src/http/header/if_none_match.rs - http::header::if_none_match::IfNoneMatch (line 30)", "actix-web/src/http/header/content_type.rs - http::header::content_type::ContentType (line 31)", "actix-web/src/http/header/accept.rs - http::header::accept::Accept (line 57)", "actix-web/src/http/header/accept_charset.rs - http::header::accept_charset::AcceptCharset (line 44)", "actix-web/src/middleware/mod.rs - middleware (line 122)", "actix-web/src/http/header/last_modified.rs - http::header::last_modified::LastModified (line 21)", "actix-web/src/http/header/range.rs - http::header::range::Range (line 44)", "actix-web/src/http/header/if_range.rs - http::header::if_range::IfRange (line 48)", "actix-web/src/http/header/content_length.rs - http::header::content_length::ContentLength (line 30)", "actix-web/src/http/header/if_unmodified_since.rs - http::header::if_unmodified_since::IfUnmodifiedSince (line 22)", "actix-web/src/http/header/content_language.rs - http::header::content_language::ContentLanguage (line 23)", "actix-web/src/redirect.rs - redirect::Redirect (line 33)", "actix-web/src/middleware/compress.rs - middleware::compress::Compress (line 60) - compile", "actix-web/src/request_data.rs - request_data::ReqData (line 28) - compile", "actix-web/src/lib.rs - (line 4) - compile", "actix-web/src/request.rs - request::HttpRequest::app_data (line 288) - compile", "actix-web/src/redirect.rs - redirect::Redirect (line 20)", "actix-web/src/middleware/err_handlers.rs - middleware::err_handlers::ErrorHandlers (line 81)", "actix-web/src/info.rs - info::ConnectionInfo (line 36)", "actix-web/src/middleware/err_handlers.rs - middleware::err_handlers::ErrorHandlers (line 151)", "actix-web/src/http/header/content_language.rs - http::header::content_language::ContentLanguage (line 35)", "actix-web/src/middleware/condition.rs - middleware::condition::Condition (line 21)", "actix-web/src/middleware/logger.rs - middleware::logger::Logger::custom_request_replace (line 149)", "actix-web/src/redirect.rs - redirect::Redirect::using_status_code (line 134)", "actix-web/src/middleware/compress.rs - middleware::compress::Compress (line 51)", "actix-web/src/redirect.rs - redirect::Redirect::to (line 86)", "actix-web/src/redirect.rs - redirect::Redirect::new (line 67)", "actix-web/src/middleware/default_headers.rs - middleware::default_headers::DefaultHeaders (line 28)", "actix-web/src/middleware/logger.rs - middleware::logger::Logger (line 47)", "actix-web/src/middleware/compat.rs - middleware::compat::Compat (line 23)", "actix-web/src/request.rs - request::HttpRequest (line 405)", "actix-web/src/middleware/err_handlers.rs - middleware::err_handlers::ErrorHandlers (line 111)", "actix-web/src/middleware/logger.rs - middleware::logger::Logger::custom_response_replace (line 194)", "actix-web/src/info.rs - info::PeerAddr (line 213)", "actix-web/src/middleware/err_handlers.rs - middleware::err_handlers::ErrorHandlers (line 56)", "actix-web/src/resource.rs - resource::Resource<T>::put (line 408)", "actix-web/src/rt.rs - rt (line 9) - compile", "actix-web/src/response/builder.rs - response::builder::HttpResponseBuilder::cookie (line 242)", "actix-web/src/middleware/mod.rs - middleware (line 25)", "actix-web/src/response/builder.rs - response::builder::HttpResponseBuilder::insert_header (line 53)", "actix-web/src/response/customize_responder.rs - response::customize_responder::CustomizeResponder<R>::insert_header (line 68)", "actix-web/src/route.rs - route::Route::guard (line 145)", "actix-web/src/response/customize_responder.rs - response::customize_responder::CustomizeResponder<R>::append_header (line 100)", "actix-web/src/response/builder.rs - response::builder::HttpResponseBuilder::cookie (line 226)", "actix-web/src/resource.rs - resource::Resource<T>::get (line 406)", "actix-web/src/resource.rs - resource::Resource<T>::head (line 411)", "actix-web/src/resource.rs - resource::Resource<T>::patch (line 409)", "actix-web/src/resource.rs - resource::Resource<T>::to (line 236)", "actix-web/src/resource.rs - resource::Resource<T>::to (line 224)", "actix-web/src/resource.rs - resource::Resource<T>::route (line 154)", "actix-web/src/resource.rs - resource::Resource<T>::post (line 407)", "actix-web/src/resource.rs - resource::Resource<T>::trace (line 412)", "actix-web/src/response/builder.rs - response::builder::HttpResponseBuilder::append_header (line 76)", "actix-web/src/server.rs - server::HttpServer (line 53) - compile", "actix-web/src/response/customize_responder.rs - response::customize_responder::CustomizeResponder<R>::with_status (line 41)", "actix-web/src/response/responder.rs - response::responder::Responder::customize (line 50)", "actix-web/src/route.rs - route::Route::method (line 124)", "actix-web/src/request.rs - request::HttpRequest::url_for (line 195)", "actix-web/src/resource.rs - resource::Resource<T>::app_data (line 179)", "actix-web/src/resource.rs - resource::Resource<T>::default_service (line 340)", "actix-web/src/resource.rs - resource::Resource<T>::delete (line 410)", "actix-web/src/resource.rs - resource::Resource<T>::guard (line 108)", "actix-web/src/resource.rs - resource::Resource<T>::route (line 139)", "actix-web/src/resource.rs - resource::Resource (line 36)", "actix-web/src/route.rs - route::Route::service (line 222)", "actix-web/src/rt.rs - rt (line 41) - compile", "actix-web/src/scope.rs - scope::Scope<T>::app_data (line 119)", "actix-web/src/server.rs - server::HttpServer<F,I,S,B>::bind (line 374)", "actix-web/src/scope.rs - scope::Scope (line 39)", "actix-web/src/types/either.rs - types::either::Either (line 58)", "actix-web/src/test/test_utils.rs - test::test_utils::call_and_read_body (line 115)", "actix-web/src/test/test_request.rs - test::test_request::TestRequest (line 33)", "actix-web/src/test/test_utils.rs - test::test_utils::init_service (line 19)", "actix-web/src/test/test_utils.rs - test::test_utils::read_body (line 166)", "actix-web/src/route.rs - route::Route::to (line 164)", "actix-web/src/types/path.rs - types::path::Path (line 25)", "actix-web/src/test/test_utils.rs - test::test_utils::call_service (line 70)", "actix-web/src/types/json.rs - types::json::Json (line 39)", "actix-web/src/types/header.rs - types::header::Header (line 18)", "actix-web/src/types/form.rs - types::form::Form (line 38)", "actix-web/src/test/test_utils.rs - test::test_utils::call_and_read_body_json (line 284)", "actix-web/src/test/test_utils.rs - test::test_utils::read_body_json (line 215)", "actix-web/src/service.rs - service::ServiceRequest::extract (line 116)", "actix-web/src/types/path.rs - types::path::Path (line 41)", "actix-web/src/types/either.rs - types::either::Either (line 30)", "actix-web/src/types/json.rs - types::json::Json (line 60)", "actix-web/src/types/payload.rs - types::payload::Bytes (line 149)", "actix-web/src/types/payload.rs - types::payload::Payload::to_bytes (line 109)", "actix-web/src/types/form.rs - types::form::Form (line 61)", "actix-web/src/types/payload.rs - types::payload::Payload::to_bytes_limited (line 72)", "actix-web/src/types/payload.rs - types::payload::Payload (line 28)", "actix-web/src/scope.rs - scope::Scope<T>::route (line 248)", "actix-web/src/route.rs - route::Route::to (line 185)", "actix-web/src/types/query.rs - types::query::Query (line 22)", "actix-web/src/types/payload.rs - types::payload::String (line 197)", "actix-web/src/test/test_request.rs - test::test_request::TestRequest::param (line 159)", "actix-web/src/scope.rs - scope::Scope<T>::service (line 218)", "actix-web/src/scope.rs - scope::Scope<T>::guard (line 92)", "actix-web/src/scope.rs - scope::Scope<T>::configure (line 167)", "actix-web/src/service.rs - service::WebService::guard (line 565)", "actix-web/src/service.rs - service::services (line 649)", "actix-web/src/types/form.rs - types::form::FormConfig (line 203)", "actix-web/src/types/path.rs - types::path::PathConfig (line 104)", "actix-web/src/web.rs - web::delete (line 129)", "actix-web/src/web.rs - web::resource (line 49)", "actix-web/src/types/query.rs - types::query::Query<T>::from_query (line 73)", "actix-web/src/web.rs - web::get (line 125)", "actix-web/src/web.rs - web::head (line 130)", "actix-web/src/web.rs - web::put (line 127)", "actix-web/src/web.rs - web::patch (line 128)", "actix-web/src/web.rs - web::method (line 134)", "actix-web/src/web.rs - web::post (line 126)", "actix-web/src/web.rs - web::service (line 171)", "actix-web/src/web.rs - web::to (line 148)", "actix-web/src/web.rs - web::redirect (line 193)", "actix-web/src/types/json.rs - types::json::JsonConfig (line 201)", "actix-web/src/web.rs - web::trace (line 131)", "actix-web/src/types/query.rs - types::query::QueryConfig (line 144)", "actix-web/src/web.rs - web::scope (line 79)" ]
[ "data::tests::test_override_data", "data::tests::test_data_extractor", "config::tests::nested_service_configure", "data::tests::test_get_ref_from_dyn_data", "data::tests::test_dyn_data_into_arc", "data::tests::test_app_data_extractor", "app::tests::test_data_factory", "config::tests::registers_default_service", "app::tests::test_router_wrap_fn", "app::tests::test_wrap_fn", "config::tests::test_service", "config::tests::test_external_resource", "data::tests::test_route_data_extractor", "app::tests::test_extension", "app::tests::test_data_factory_errors", "app::tests::test_wrap", "middleware::default_headers::tests::no_override_existing", "data::tests::test_data_from_arc", "app::tests::test_router_wrap", "app::tests::test_external_resource", "middleware::compat::tests::test_condition_scope_middleware", "middleware::compress::tests::retains_previously_set_vary_header", "middleware::compat::tests::test_scope_middleware", "middleware::condition::tests::test_handler_disabled", "info::tests::peer_addr_extract", "extract::tests::test_uri", "middleware::compat::tests::test_resource_scope_middleware", "extract::tests::test_concurrent", "app_service::tests::test_drop_data", "middleware::default_headers::tests::adding_default_headers", "middleware::logger::tests::test_custom_closure_req_log", "extract::tests::test_result", "middleware::logger::tests::test_default_format", "middleware::logger::tests::test_logger", "middleware::err_handlers::tests::default_error_handler", "middleware::err_handlers::tests::changes_body_type", "middleware::err_handlers::tests::error_thrown", "middleware::err_handlers::tests::default_handlers_separate_client_server", "middleware::condition::tests::test_handler_enabled", "middleware::err_handlers::tests::add_header_error_handler", "middleware::default_headers::tests::adding_content_type", "middleware::compat::tests::compat_noop_is_noop", "middleware::logger::tests::test_url_path", "extract::tests::test_option", "middleware::compress::tests::prevents_compression_jpeg", "info::tests::conn_info_extract", "middleware::err_handlers::tests::default_handlers_specialization", "data::tests::test_data_from_dyn_arc", "middleware::compress::tests::prevents_double_compressing", "info::tests::remote_address", "middleware::logger::tests::test_remote_addr_format", "app::tests::test_default_resource", "extract::tests::test_method", "error::macros::tests::test_any_casting", "middleware::err_handlers::tests::add_header_error_handler_async", "middleware::logger::tests::test_escape_percent", "config::tests::test_data", "middleware::logger::tests::test_logger_exclude_regex", "middleware::logger::tests::test_closure_logger_in_middleware", "middleware::logger::tests::test_custom_closure_response_log", "info::tests::real_ip_from_socket_addr", "middleware::logger::tests::test_request_time_format", "request_data::tests::req_data_internal_mutability", "request::tests::test_data", "request::tests::extract_path_pattern", "request::tests::test_cascading_data", "request::tests::url_for_closest_named_resource", "resource::tests::test_default_resource", "resource::tests::test_middleware", "resource::tests::test_middleware_app_data", "request::tests::test_overwrite_data", "resource::tests::test_data_default_service", "resource::tests::test_pattern", "resource::tests::test_middleware_fn", "middleware::normalize::tests::ensure_root_trailing_slash_with_query", "middleware::normalize::tests::should_normalize_nothing", "middleware::normalize::tests::ensure_trailing_slash", "middleware::normalize::tests::keep_trailing_slash_unchanged", "redirect::tests::relative_redirects", "resource::tests::test_data", "redirect::tests::as_responder", "request_data::tests::req_data_extractor", "middleware::normalize::tests::trim_trailing_slashes", "resource::tests::test_resource_guards", "response::responder::tests::test_result_responder", "response::customize_responder::tests::customize_responder", "middleware::normalize::tests::test_wrap", "response::customize_responder::tests::tuple_responder_with_status_code", "request::tests::test_drop_http_request_pool", "redirect::tests::absolute_redirects", "response::responder::tests::test_option_responder", "middleware::normalize::tests::trim_root_trailing_slashes_with_query", "request::tests::test_app_data_dropped", "middleware::normalize::tests::test_in_place_normalization", "resource::tests::test_middleware_body_type", "redirect::tests::temporary_redirects", "response::responder::tests::test_responder", "response::builder::tests::test_json", "scope::tests::dynamic_scopes", "scope::tests::test_override_app_data", "scope::tests::test_scope", "scope::tests::test_scope_config_2", "request::tests::extract_path_pattern_complex", "middleware::normalize::tests::no_path", "middleware::normalize::tests::should_normalize_no_trail", "route::tests::test_route", "scope::tests::test_middleware_body_type", "scope::tests::test_override_data_default_service", "response::builder::tests::test_serde_json_in_body", "resource::tests::test_to", "route::tests::test_service_handler", "route::tests::route_middleware", "scope::tests::test_nested_scope_no_slash", "scope::tests::test_nested_scope_with_variable_segment", "scope::tests::test_nested_scope_root", "scope::tests::test_default_resource", "scope::tests::test_middleware_app_data", "scope::tests::test_middleware", "scope::tests::test_default_resource_propagation", "scope::tests::test_nested_scope", "scope::tests::test_nested2_scope_with_variable_segment", "scope::tests::test_scope_config", "scope::tests::test_middleware_fn", "scope::tests::test_override_data", "test::test_request::tests::test_send_request", "scope::tests::test_scope_root2", "types::either::tests::test_either_extract_recursive_fallback", "test::test_request::tests::test_basics", "scope::tests::test_url_for_nested", "test::test_request::tests::test_server_data", "scope::tests::test_scope_route", "types::either::tests::test_either_extract_first_try", "test::test_utils::tests::test_response", "test::test_utils::tests::test_request_methods", "test::test_utils::tests::test_response_json", "test::test_utils::tests::test_body_json", "scope::tests::test_scope_variable_segment", "scope::tests::test_scope_guard", "types::either::tests::test_either_extract_fallback", "types::either::tests::test_either_extract_recursive_fallback_inner", "test::test_utils::tests::test_try_body_json_error", "test::test_utils::tests::test_try_response_json_error", "scope::tests::test_nested_scope_filter", "test::test_request::tests::test_async_with_block", "scope::tests::test_scope_route_without_leading_slash", "scope::tests::test_scope_root", "scope::tests::test_scope_root3", "test::test_utils::tests::test_request_response_form", "service::tests::test_service", "types::json::tests::test_custom_error_responder", "service::tests::test_services_vec", "service::tests::cloning_request_panics - should panic", "service::tests::test_service_data", "scope::tests::test_url_for_external", "service::tests::test_services_macro", "test::test_utils::tests::return_opaque_types", "test::test_utils::tests::test_request_response_json", "types::header::tests::test_header_extract", "test::tests::assert_body_works_for_service_and_regular_response", "types::json::tests::test_json_with_no_content_type", "types::json::tests::test_json_ignoring_content_type", "types::form::tests::test_responder", "types::form::tests::test_urlencoded", "types::form::tests::test_with_config_in_data_wrapper", "types::json::tests::test_with_config_in_data_wrapper", "types::json::tests::test_extract", "types::json::tests::test_responder", "types::form::tests::test_form", "types::json::tests::test_with_json_and_bad_custom_content_type", "types::readlines::tests::test_readlines", "types::form::tests::test_urlencoded_error", "types::json::tests::test_with_json_and_bad_content_type", "types::json::tests::test_with_json_and_good_custom_content_type", "types::json::tests::test_json_body", "types::query::tests::test_request_extract", "types::query::tests::test_service_request_extract", "types::query::tests::test_custom_error_responder", "types::path::tests::paths_decoded", "types::path::tests::test_request_extract", "types::path::tests::test_extract_path_single", "types::payload::tests::test_message_body", "types::payload::tests::payload_to_bytes", "types::payload::tests::test_string", "types::payload::tests::test_payload_config", "types::payload::tests::test_bytes", "types::payload::tests::test_config_recall_locations", "types::path::tests::test_custom_err_handler", "types::path::tests::test_tuple_extract", "deny_identity_coding_no_decompress", "manual_custom_coding", "negotiate_encoding_gzip", "negotiate_encoding_identity", "deny_identity_coding", "negotiate_encoding_br", "negotiate_encoding_zstd", "gzip_no_decompress", "client_encoding_prefers_brotli", "test_macro_naming_conflict", "error_cause_should_be_propagated_to_middlewares", "test_start_ssl", "test_start", "test_body_deflate", "test_body_brotli", "body_gzip_large", "test_accept_encoding_no_match", "test_body_br_streaming", "plus_rustls::test_reading_deflate_encoding_large_random_rustls", "test_body_zstd_streaming", "test_body_gzip_large_random", "test_body_chunked_implicit", "test_brotli_encoding_large_openssl", "test_encoding", "test_body", "test_body_zstd", "test_brotli_encoding_large", "test_slow_request", "test_server_cookies", "test_data_drop", "test_head_binary", "test_reading_deflate_encoding_large", "test_reading_deflate_encoding_large_random", "test_reading_gzip_encoding_large_random", "test_zstd_encoding", "test_brotli_encoding", "test_no_chunking", "test_gzip_encoding_large", "test_normalize", "test_gzip_encoding", "test_reading_deflate_encoding", "test_zstd_encoding_large", "actix-web/src/middleware/normalize.rs - middleware::normalize::NormalizePath (line 52)" ]
[]
2023-11-20T07:24:05Z
87f627cd5d33fe71833c24803174dcec5806fea2
diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -3,6 +3,13 @@ ## Unreleased - 2021-xx-xx +## 3.0.3 - 2022-03-08 +### Fixed +- Allow spaces between header name and colon when parsing responses. [#2684] + +[#2684]: https://github.com/actix/actix-web/issues/2684 + + ## 3.0.2 - 2022-03-05 ### Fixed - Fix encoding camel-case header names with more than one hyphen. [#2683] diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-http" -version = "3.0.2" +version = "3.0.3" authors = [ "Nikolay Kim <fafhrd91@gmail.com>", "Rob Ede <robjtede@icloud.com>", diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -293,22 +293,35 @@ impl MessageType for ResponseHead { let mut headers: [HeaderIndex; MAX_HEADERS] = EMPTY_HEADER_INDEX_ARRAY; let (len, ver, status, h_len) = { - let mut parsed: [httparse::Header<'_>; MAX_HEADERS] = EMPTY_HEADER_ARRAY; + // SAFETY: + // Create an uninitialized array of `MaybeUninit`. The `assume_init` is safe because the + // type we are claiming to have initialized here is a bunch of `MaybeUninit`s, which + // do not require initialization. + let mut parsed = unsafe { + MaybeUninit::<[MaybeUninit<httparse::Header<'_>>; MAX_HEADERS]>::uninit() + .assume_init() + }; + + let mut res = httparse::Response::new(&mut []); + + let mut config = httparse::ParserConfig::default(); + config.allow_spaces_after_header_name_in_responses(true); - let mut res = httparse::Response::new(&mut parsed); - match res.parse(src)? { + match config.parse_response_with_uninit_headers(&mut res, src, &mut parsed)? { httparse::Status::Complete(len) => { let version = if res.version.unwrap() == 1 { Version::HTTP_11 } else { Version::HTTP_10 }; + let status = StatusCode::from_u16(res.code.unwrap()) .map_err(|_| ParseError::Status)?; HeaderIndex::record(src, res.headers, &mut headers); (len, version, status, res.headers.len()) } + httparse::Status::Partial => { return if src.len() >= MAX_BUFFER_SIZE { error!("MAX_BUFFER_SIZE unprocessed data reached, closing"); diff --git a/actix-http/src/h1/decoder.rs b/actix-http/src/h1/decoder.rs --- a/actix-http/src/h1/decoder.rs +++ b/actix-http/src/h1/decoder.rs @@ -360,9 +373,6 @@ pub(crate) const EMPTY_HEADER_INDEX: HeaderIndex = HeaderIndex { pub(crate) const EMPTY_HEADER_INDEX_ARRAY: [HeaderIndex; MAX_HEADERS] = [EMPTY_HEADER_INDEX; MAX_HEADERS]; -pub(crate) const EMPTY_HEADER_ARRAY: [httparse::Header<'static>; MAX_HEADERS] = - [httparse::EMPTY_HEADER; MAX_HEADERS]; - impl HeaderIndex { pub(crate) fn record( bytes: &[u8], diff --git a/actix-multipart/Cargo.toml b/actix-multipart/Cargo.toml --- a/actix-multipart/Cargo.toml +++ b/actix-multipart/Cargo.toml @@ -14,7 +14,7 @@ name = "actix_multipart" path = "src/lib.rs" [dependencies] -actix-utils = "3.0.0" +actix-utils = "3" actix-web = { version = "4.0.0", default-features = false } bytes = "1" diff --git a/actix-web/CHANGES.md b/actix-web/CHANGES.md --- a/actix-web/CHANGES.md +++ b/actix-web/CHANGES.md @@ -15,7 +15,7 @@ - Updated `cookie` to `0.16`. [#2555] - Updated `language-tags` to `0.3`. - Updated `rand` to `0.8`. -- Updated `rustls` to `0.20.0`. [#2414] +- Updated `rustls` to `0.20`. [#2414] - Updated `tokio` to `1`. ### Added diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -71,9 +71,9 @@ actix-service = "2" actix-utils = "3" actix-tls = { version = "3", default-features = false, optional = true } -actix-http = { version = "3.0.0", features = ["http2", "ws"] } -actix-router = "0.5.0" -actix-web-codegen = { version = "4.0.0", optional = true } +actix-http = { version = "3", features = ["http2", "ws"] } +actix-router = "0.5" +actix-web-codegen = { version = "4", optional = true } ahash = "0.7" bytes = "1" diff --git a/awc/CHANGES.md b/awc/CHANGES.md --- a/awc/CHANGES.md +++ b/awc/CHANGES.md @@ -3,6 +3,103 @@ ## Unreleased - 2021-xx-xx +## 3.0.0 - 2022-03-07 +### Dependencies +- Updated `actix-*` to Tokio v1-based versions. [#1813] +- Updated `bytes` to `1.0`. [#1813] +- Updated `cookie` to `0.16`. [#2555] +- Updated `rand` to `0.8`. +- Updated `rustls` to `0.20`. [#2414] +- Updated `tokio` to `1`. + +### Added +- `trust-dns` crate feature to enable `trust-dns-resolver` as client DNS resolver; disabled by default. [#1969] +- `cookies` crate feature; enabled by default. [#2619] +- `compress-brotli` crate feature; enabled by default. [#2250] +- `compress-gzip` crate feature; enabled by default. [#2250] +- `compress-zstd` crate feature; enabled by default. [#2250] +- `client::Connector::handshake_timeout()` for customizing TLS connection handshake timeout. [#2081] +- `client::ConnectorService` as `client::Connector::finish` method's return type [#2081] +- `client::ConnectionIo` trait alias [#2081] +- `Client::headers()` to get default mut reference of `HeaderMap` of client object. [#2114] +- `ClientResponse::timeout()` for set the timeout of collecting response body. [#1931] +- `ClientBuilder::local_address()` for binding to a local IP address for this client. [#2024] +- `ClientRequest::insert_header()` method which allows using typed and untyped headers. [#1869] +- `ClientRequest::append_header()` method which allows using typed and untyped headers. [#1869] +- `ClientBuilder::add_default_header()` (and deprecate `ClientBuilder::header()`). [#2510] + +### Changed +- `client::Connector` type now only has one generic type for `actix_service::Service`. [#2063] +- `client::error::ConnectError` Resolver variant contains `Box<dyn std::error::Error>` type. [#1905] +- `client::ConnectorConfig` default timeout changed to 5 seconds. [#1905] +- `ConnectorService` type is renamed to `BoxConnectorService`. [#2081] +- Fix http/https encoding when enabling `compress` feature. [#2116] +- Rename `TestResponse::{header => append_header, set => insert_header}`. These methods now take a `TryIntoHeaderPair`. [#2094] +- `ClientBuilder::connector()` method now takes `Connector<T, U>` type. [#2008] +- Basic auth now accepts blank passwords as an empty string instead of an `Option`. [#2050] +- Relax default timeout for `Connector` to 5 seconds (up from 1 second). [#1905] +- `*::send_json()` and `*::send_form()` methods now receive `impl Serialize`. [#2553] +- `FrozenClientRequest::extra_header()` now uses receives an `impl TryIntoHeaderPair`. [#2553] +- Rename `Connector::{ssl => openssl}()`. [#2503] +- `ClientRequest::send_body` now takes an `impl MessageBody`. [#2546] +- Rename `MessageBody => ResponseBody` to avoid conflicts with `MessageBody` trait. [#2546] +- Minimum supported Rust version (MSRV) is now 1.54. + +### Fixed +- Send headers along with redirected requests. [#2310] +- Improve `Client` instantiation efficiency when using `openssl` by only building connectors once. [#2503] +- Remove unnecessary `Unpin` bounds on `*::send_stream`. [#2553] +- `impl Future` for `ResponseBody` no longer requires the body type be `Unpin`. [#2546] +- `impl Future` for `JsonBody` no longer requires the body type be `Unpin`. [#2546] +- `impl Stream` for `ClientResponse` no longer requires the body type be `Unpin`. [#2546] + +### Removed +- `compress` crate feature. [#2250] +- `ClientRequest::set`; use `ClientRequest::insert_header`. [#1869] +- `ClientRequest::set_header`; use `ClientRequest::insert_header`. [#1869] +- `ClientRequest::set_header_if_none`; use `ClientRequest::insert_header_if_none`. [#1869] +- `ClientRequest::header`; use `ClientRequest::append_header`. [#1869] +- Deprecated methods on `ClientRequest`: `if_true`, `if_some`. [#2148] +- `ClientBuilder::default` function [#2008] + +### Security +- `cookie` upgrade addresses [`RUSTSEC-2020-0071`]. + +[`RUSTSEC-2020-0071`]: https://rustsec.org/advisories/RUSTSEC-2020-0071.html + +[#1813]: https://github.com/actix/actix-web/pull/1813 +[#1869]: https://github.com/actix/actix-web/pull/1869 +[#1905]: https://github.com/actix/actix-web/pull/1905 +[#1905]: https://github.com/actix/actix-web/pull/1905 +[#1931]: https://github.com/actix/actix-web/pull/1931 +[#1969]: https://github.com/actix/actix-web/pull/1969 +[#1969]: https://github.com/actix/actix-web/pull/1969 +[#1981]: https://github.com/actix/actix-web/pull/1981 +[#2008]: https://github.com/actix/actix-web/pull/2008 +[#2024]: https://github.com/actix/actix-web/pull/2024 +[#2050]: https://github.com/actix/actix-web/pull/2050 +[#2063]: https://github.com/actix/actix-web/pull/2063 +[#2081]: https://github.com/actix/actix-web/pull/2081 +[#2081]: https://github.com/actix/actix-web/pull/2081 +[#2094]: https://github.com/actix/actix-web/pull/2094 +[#2114]: https://github.com/actix/actix-web/pull/2114 +[#2116]: https://github.com/actix/actix-web/pull/2116 +[#2148]: https://github.com/actix/actix-web/pull/2148 +[#2250]: https://github.com/actix/actix-web/pull/2250 +[#2310]: https://github.com/actix/actix-web/pull/2310 +[#2414]: https://github.com/actix/actix-web/pull/2414 +[#2425]: https://github.com/actix/actix-web/pull/2425 +[#2474]: https://github.com/actix/actix-web/pull/2474 +[#2503]: https://github.com/actix/actix-web/pull/2503 +[#2510]: https://github.com/actix/actix-web/pull/2510 +[#2546]: https://github.com/actix/actix-web/pull/2546 +[#2553]: https://github.com/actix/actix-web/pull/2553 +[#2555]: https://github.com/actix/actix-web/pull/2555 + + +<details> +<summary>3.0.0 Pre-Releases</summary> + ## 3.0.0-beta.21 - 2022-02-16 - No significant changes since `3.0.0-beta.20`. diff --git a/awc/CHANGES.md b/awc/CHANGES.md --- a/awc/CHANGES.md +++ b/awc/CHANGES.md @@ -170,6 +267,7 @@ [#1813]: https://github.com/actix/actix-web/pull/1813 +</details> ## 2.0.3 - 2020-11-29 ### Fixed diff --git a/awc/Cargo.toml b/awc/Cargo.toml --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "awc" -version = "3.0.0-beta.21" +version = "3.0.0" authors = [ "Nikolay Kim <fafhrd91@gmail.com>", "fakeshadow <24548779@qq.com>", diff --git a/awc/Cargo.toml b/awc/Cargo.toml --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -59,11 +59,11 @@ dangerous-h2c = [] [dependencies] actix-codec = "0.5" -actix-service = "2.0.0" -actix-http = { version = "3.0.0", features = ["http2", "ws"] } +actix-service = "2" +actix-http = { version = "3", features = ["http2", "ws"] } actix-rt = { version = "2.1", default-features = false } actix-tls = { version = "3", features = ["connect", "uri"] } -actix-utils = "3.0.0" +actix-utils = "3" ahash = "0.7" base64 = "0.13" diff --git a/awc/src/client/connector.rs b/awc/src/client/connector.rs --- a/awc/src/client/connector.rs +++ b/awc/src/client/connector.rs @@ -246,7 +246,12 @@ where /// /// The default limit size is 100. pub fn limit(mut self, limit: usize) -> Self { - self.config.limit = limit; + if limit == 0 { + self.config.limit = u32::MAX as usize; + } else { + self.config.limit = limit; + } + self } diff --git a/awc/src/client/h1proto.rs b/awc/src/client/h1proto.rs --- a/awc/src/client/h1proto.rs +++ b/awc/src/client/h1proto.rs @@ -83,12 +83,12 @@ where false }; - framed.send((head, body.size()).into()).await?; - let mut pin_framed = Pin::new(&mut framed); // special handle for EXPECT request. let (do_send, mut res_head) = if is_expect { + pin_framed.send((head, body.size()).into()).await?; + let head = poll_fn(|cx| pin_framed.as_mut().poll_next(cx)) .await .ok_or(ConnectError::Disconnected)??; diff --git a/awc/src/client/h1proto.rs b/awc/src/client/h1proto.rs --- a/awc/src/client/h1proto.rs +++ b/awc/src/client/h1proto.rs @@ -97,13 +97,17 @@ where // and current head would be used as final response head. (head.status == StatusCode::CONTINUE, Some(head)) } else { + pin_framed.feed((head, body.size()).into()).await?; + (true, None) }; if do_send { // send request body match body.size() { - BodySize::None | BodySize::Sized(0) => {} + BodySize::None | BodySize::Sized(0) => { + poll_fn(|cx| pin_framed.as_mut().flush(cx)).await?; + } _ => send_body(body, pin_framed.as_mut()).await?, }; diff --git a/awc/src/connect.rs b/awc/src/connect.rs --- a/awc/src/connect.rs +++ b/awc/src/connect.rs @@ -30,17 +30,35 @@ pub type BoxConnectorService = Rc< pub type BoxedSocket = Box<dyn ConnectionIo>; +/// Combined HTTP and WebSocket request type received by connection service. pub enum ConnectRequest { + /// Standard HTTP request. + /// + /// Contains the request head, body type, and optional pre-resolved socket address. Client(RequestHeadType, AnyBody, Option<net::SocketAddr>), + + /// Tunnel used by WebSocket connection requests. + /// + /// Contains the request head and optional pre-resolved socket address. Tunnel(RequestHead, Option<net::SocketAddr>), } +/// Combined HTTP response & WebSocket tunnel type returned from connection service. pub enum ConnectResponse { + /// Standard HTTP response. Client(ClientResponse), + + /// Tunnel used for WebSocket communication. + /// + /// Contains response head and framed HTTP/1.1 codec. Tunnel(ResponseHead, Framed<BoxedSocket, ClientCodec>), } impl ConnectResponse { + /// Unwraps type into HTTP response. + /// + /// # Panics + /// Panics if enum variant is not `Client`. pub fn into_client_response(self) -> ClientResponse { match self { ConnectResponse::Client(res) => res, diff --git a/awc/src/connect.rs b/awc/src/connect.rs --- a/awc/src/connect.rs +++ b/awc/src/connect.rs @@ -50,6 +68,10 @@ impl ConnectResponse { } } + /// Unwraps type into WebSocket tunnel response. + /// + /// # Panics + /// Panics if enum variant is not `Tunnel`. pub fn into_tunnel_response(self) -> (ResponseHead, Framed<BoxedSocket, ClientCodec>) { match self { ConnectResponse::Tunnel(head, framed) => (head, framed), diff --git a/awc/src/connect.rs b/awc/src/connect.rs --- a/awc/src/connect.rs +++ b/awc/src/connect.rs @@ -136,30 +158,37 @@ where ConnectRequestProj::Connection { fut, req } => { let connection = ready!(fut.poll(cx))?; let req = req.take().unwrap(); + match req { ConnectRequest::Client(head, body, ..) => { // send request let fut = ConnectRequestFuture::Client { fut: connection.send_request(head, body), }; + self.set(fut); } + ConnectRequest::Tunnel(head, ..) => { // send request let fut = ConnectRequestFuture::Tunnel { fut: connection.open_tunnel(RequestHeadType::from(head)), }; + self.set(fut); } } + self.poll(cx) } + ConnectRequestProj::Client { fut } => { let (head, payload) = ready!(fut.as_mut().poll(cx))?; Poll::Ready(Ok(ConnectResponse::Client(ClientResponse::new( head, payload, )))) } + ConnectRequestProj::Tunnel { fut } => { let (head, framed) = ready!(fut.as_mut().poll(cx))?; let framed = framed.into_map_io(|io| Box::new(io) as _); diff --git a/awc/src/lib.rs b/awc/src/lib.rs --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -1,22 +1,25 @@ //! `awc` is an asynchronous HTTP and WebSocket client library. //! -//! # Making a GET request +//! # `GET` Requests //! ```no_run //! # #[actix_rt::main] //! # async fn main() -> Result<(), awc::error::SendRequestError> { +//! // create client //! let mut client = awc::Client::default(); -//! let response = client.get("http://www.rust-lang.org") // <- Create request builder -//! .insert_header(("User-Agent", "Actix-web")) -//! .send() // <- Send http request -//! .await?; //! -//! println!("Response: {:?}", response); +//! // construct request +//! let req = client.get("http://www.rust-lang.org") +//! .insert_header(("User-Agent", "awc/3.0")); +//! +//! // send request and await response +//! let res = req.send().await?; +//! println!("Response: {:?}", res); //! # Ok(()) //! # } //! ``` //! -//! # Making POST requests -//! ## Raw body contents +//! # `POST` Requests +//! ## Raw Body //! ```no_run //! # #[actix_rt::main] //! # async fn main() -> Result<(), awc::error::SendRequestError> { diff --git a/awc/src/lib.rs b/awc/src/lib.rs --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -28,32 +31,32 @@ //! # } //! ``` //! -//! ## Forms +//! ## JSON //! ```no_run //! # #[actix_rt::main] //! # async fn main() -> Result<(), awc::error::SendRequestError> { -//! let params = [("foo", "bar"), ("baz", "quux")]; +//! let request = serde_json::json!({ +//! "lang": "rust", +//! "body": "json" +//! }); //! //! let mut client = awc::Client::default(); //! let response = client.post("http://httpbin.org/post") -//! .send_form(&params) +//! .send_json(&request) //! .await?; //! # Ok(()) //! # } //! ``` //! -//! ## JSON +//! ## URL Encoded Form //! ```no_run //! # #[actix_rt::main] //! # async fn main() -> Result<(), awc::error::SendRequestError> { -//! let request = serde_json::json!({ -//! "lang": "rust", -//! "body": "json" -//! }); +//! let params = [("foo", "bar"), ("baz", "quux")]; //! //! let mut client = awc::Client::default(); //! let response = client.post("http://httpbin.org/post") -//! .send_json(&request) +//! .send_form(&params) //! .await?; //! # Ok(()) //! # } diff --git a/awc/src/lib.rs b/awc/src/lib.rs --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -76,11 +79,12 @@ //! //! [iana-encodings]: https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding //! -//! # WebSocket support +//! # WebSockets //! ```no_run //! # #[actix_rt::main] //! # async fn main() -> Result<(), Box<dyn std::error::Error>> { -//! use futures_util::{sink::SinkExt, stream::StreamExt}; +//! use futures_util::{sink::SinkExt as _, stream::StreamExt as _}; +//! //! let (_resp, mut connection) = awc::Client::new() //! .ws("ws://echo.websocket.org") //! .connect() diff --git a/awc/src/lib.rs b/awc/src/lib.rs --- a/awc/src/lib.rs +++ b/awc/src/lib.rs @@ -89,8 +93,9 @@ //! connection //! .send(awc::ws::Message::Text("Echo".into())) //! .await?; +//! //! let response = connection.next().await.unwrap()?; -//! # assert_eq!(response, awc::ws::Frame::Text("Echo".as_bytes().into())); +//! assert_eq!(response, awc::ws::Frame::Text("Echo".into())); //! # Ok(()) //! # } //! ``` diff --git a/awc/src/middleware/redirect.rs b/awc/src/middleware/redirect.rs --- a/awc/src/middleware/redirect.rs +++ b/awc/src/middleware/redirect.rs @@ -161,7 +161,8 @@ where | StatusCode::SEE_OTHER | StatusCode::TEMPORARY_REDIRECT | StatusCode::PERMANENT_REDIRECT - if *max_redirect_times > 0 => + if *max_redirect_times > 0 + && res.headers().contains_key(header::LOCATION) => { let reuse_body = res.head().status == StatusCode::TEMPORARY_REDIRECT || res.head().status == StatusCode::PERMANENT_REDIRECT; diff --git a/awc/src/middleware/redirect.rs b/awc/src/middleware/redirect.rs --- a/awc/src/middleware/redirect.rs +++ b/awc/src/middleware/redirect.rs @@ -245,26 +246,32 @@ where } fn build_next_uri(res: &ClientResponse, prev_uri: &Uri) -> Result<Uri, SendRequestError> { - let uri = res - .headers() - .get(header::LOCATION) - .map(|value| { - // try to parse the location to a full uri - let uri = Uri::try_from(value.as_bytes()) - .map_err(|e| SendRequestError::Url(InvalidUrl::HttpError(e.into())))?; - if uri.scheme().is_none() || uri.authority().is_none() { - let uri = Uri::builder() - .scheme(prev_uri.scheme().cloned().unwrap()) - .authority(prev_uri.authority().cloned().unwrap()) - .path_and_query(value.as_bytes()) - .build()?; - Ok::<_, SendRequestError>(uri) - } else { - Ok(uri) - } - }) - // TODO: this error type is wrong. - .ok_or(SendRequestError::Url(InvalidUrl::MissingScheme))??; + // responses without this header are not processed + let location = res.headers().get(header::LOCATION).unwrap(); + + // try to parse the location and resolve to a full URI but fall back to default if it fails + let uri = Uri::try_from(location.as_bytes()).unwrap_or_else(|_| Uri::default()); + + let uri = if uri.scheme().is_none() || uri.authority().is_none() { + let builder = Uri::builder() + .scheme(prev_uri.scheme().cloned().unwrap()) + .authority(prev_uri.authority().cloned().unwrap()); + + // when scheme or authority is missing treat the location value as path and query + // recover error where location does not have leading slash + let path = if location.as_bytes().starts_with(b"/") { + location.as_bytes().to_owned() + } else { + [b"/", location.as_bytes()].concat() + }; + + builder + .path_and_query(path) + .build() + .map_err(|err| SendRequestError::Url(InvalidUrl::HttpError(err)))? + } else { + uri + }; Ok(uri) } diff --git a/awc/src/request.rs b/awc/src/request.rs --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -505,7 +505,7 @@ impl fmt::Debug for ClientRequest { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!( f, - "\nClientRequest {:?} {}:{}", + "\nClientRequest {:?} {} {}", self.head.version, self.head.method, self.head.uri )?; writeln!(f, " headers:")?;
actix__actix-web-2684
2,684
This issue is caused by redirect service does not proper fall through when Location header value does not contain full length uri. (with sheme and authority) I did not test all the 1700 websites provided by issue but from testing a couple of hundreds of it there is no `Invalid URL: URL parse error: invalid format` error appears anymore. By the way, I am happy to contribute either of the changes (handle infinite limit differently, with or without builder interface change; or docs change), but I would need some direction on which way to go. cc @fakeshadow No limit should just go. awc does not offer protocol specific setting and it's already a problem in it's own. Namely awc does not do any form of connection multiplexing at all which is anti-pattern for http2.
[ "2102", "2514" ]
4.0
actix/actix-web
2022-03-07T23:43:39Z
diff --git a/actix-http-test/Cargo.toml b/actix-http-test/Cargo.toml --- a/actix-http-test/Cargo.toml +++ b/actix-http-test/Cargo.toml @@ -29,13 +29,13 @@ default = [] openssl = ["tls-openssl", "awc/openssl"] [dependencies] -actix-service = "2.0.0" +actix-service = "2" actix-codec = "0.5" actix-tls = "3" -actix-utils = "3.0.0" +actix-utils = "3" actix-rt = "2.2" actix-server = "2" -awc = { version = "3.0.0-beta.21", default-features = false } +awc = { version = "3", default-features = false } base64 = "0.13" bytes = "1" diff --git a/actix-http-test/Cargo.toml b/actix-http-test/Cargo.toml --- a/actix-http-test/Cargo.toml +++ b/actix-http-test/Cargo.toml @@ -51,5 +51,5 @@ tls-openssl = { version = "0.10.9", package = "openssl", optional = true } tokio = { version = "1.8.4", features = ["sync"] } [dev-dependencies] -actix-web = { version = "4.0.0", default-features = false, features = ["cookies"] } -actix-http = "3.0.0" +actix-web = { version = "4", default-features = false, features = ["cookies"] } +actix-http = "3" diff --git a/actix-http/README.md b/actix-http/README.md --- a/actix-http/README.md +++ b/actix-http/README.md @@ -3,11 +3,11 @@ > HTTP primitives for the Actix ecosystem. [![crates.io](https://img.shields.io/crates/v/actix-http?label=latest)](https://crates.io/crates/actix-http) -[![Documentation](https://docs.rs/actix-http/badge.svg?version=3.0.2)](https://docs.rs/actix-http/3.0.2) +[![Documentation](https://docs.rs/actix-http/badge.svg?version=3.0.3)](https://docs.rs/actix-http/3.0.3) [![Version](https://img.shields.io/badge/rustc-1.54+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.54.0.html) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-http.svg) <br /> -[![dependency status](https://deps.rs/crate/actix-http/3.0.2/status.svg)](https://deps.rs/crate/actix-http/3.0.2) +[![dependency status](https://deps.rs/crate/actix-http/3.0.3/status.svg)](https://deps.rs/crate/actix-http/3.0.3) [![Download](https://img.shields.io/crates/d/actix-http.svg)](https://crates.io/crates/actix-http) [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) diff --git a/actix-test/Cargo.toml b/actix-test/Cargo.toml --- a/actix-test/Cargo.toml +++ b/actix-test/Cargo.toml @@ -29,13 +29,13 @@ openssl = ["tls-openssl", "actix-http/openssl", "awc/openssl"] [dependencies] actix-codec = "0.5" -actix-http = "3.0.0" +actix-http = "3" actix-http-test = "3.0.0-beta.13" actix-rt = "2.1" -actix-service = "2.0.0" -actix-utils = "3.0.0" -actix-web = { version = "4.0.0", default-features = false, features = ["cookies"] } -awc = { version = "3.0.0-beta.21", default-features = false, features = ["cookies"] } +actix-service = "2" +actix-utils = "3" +actix-web = { version = "4", default-features = false, features = ["cookies"] } +awc = { version = "3", default-features = false, features = ["cookies"] } futures-core = { version = "0.3.7", default-features = false, features = ["std"] } futures-util = { version = "0.3.7", default-features = false, features = [] } diff --git a/actix-web-actors/Cargo.toml b/actix-web-actors/Cargo.toml --- a/actix-web-actors/Cargo.toml +++ b/actix-web-actors/Cargo.toml @@ -28,7 +28,7 @@ tokio = { version = "1.13.1", features = ["sync"] } [dev-dependencies] actix-rt = "2.2" actix-test = "0.1.0-beta.13" -awc = { version = "3.0.0-beta.21", default-features = false } +awc = { version = "3", default-features = false } env_logger = "0.9" futures-util = { version = "0.3.7", default-features = false } diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -100,9 +100,9 @@ time = { version = "0.3", default-features = false, features = ["formatting"] } url = "2.1" [dev-dependencies] -actix-files = "0.6.0" +actix-files = "0.6" actix-test = { version = "0.1.0-beta.13", features = ["openssl", "rustls"] } -awc = { version = "3.0.0-beta.21", features = ["openssl"] } +awc = { version = "3", features = ["openssl"] } brotli = "3.3.3" const-str = "0.3" diff --git a/awc/Cargo.toml b/awc/Cargo.toml --- a/awc/Cargo.toml +++ b/awc/Cargo.toml @@ -93,13 +93,13 @@ tls-rustls = { package = "rustls", version = "0.20.0", optional = true, features trust-dns-resolver = { version = "0.20.0", optional = true } [dev-dependencies] -actix-http = { version = "3.0.0", features = ["openssl"] } +actix-http = { version = "3", features = ["openssl"] } actix-http-test = { version = "3.0.0-beta.13", features = ["openssl"] } actix-server = "2" actix-test = { version = "0.1.0-beta.13", features = ["openssl", "rustls"] } actix-tls = { version = "3", features = ["openssl", "rustls"] } -actix-utils = "3.0.0" -actix-web = { version = "4.0.0", features = ["openssl"] } +actix-utils = "3" +actix-web = { version = "4", features = ["openssl"] } brotli = "3.3.3" const-str = "0.3" diff --git a/awc/README.md b/awc/README.md --- a/awc/README.md +++ b/awc/README.md @@ -3,9 +3,9 @@ > Async HTTP and WebSocket client library. [![crates.io](https://img.shields.io/crates/v/awc?label=latest)](https://crates.io/crates/awc) -[![Documentation](https://docs.rs/awc/badge.svg?version=3.0.0-beta.21)](https://docs.rs/awc/3.0.0-beta.21) +[![Documentation](https://docs.rs/awc/badge.svg?version=3.0.0)](https://docs.rs/awc/3.0.0) ![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/awc) -[![Dependency Status](https://deps.rs/crate/awc/3.0.0-beta.21/status.svg)](https://deps.rs/crate/awc/3.0.0-beta.21) +[![Dependency Status](https://deps.rs/crate/awc/3.0.0/status.svg)](https://deps.rs/crate/awc/3.0.0) [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) ## Documentation & Resources diff --git a/awc/src/middleware/redirect.rs b/awc/src/middleware/redirect.rs --- a/awc/src/middleware/redirect.rs +++ b/awc/src/middleware/redirect.rs @@ -287,10 +294,13 @@ mod tests { use actix_web::{web, App, Error, HttpRequest, HttpResponse}; use super::*; - use crate::{http::header::HeaderValue, ClientBuilder}; + use crate::{ + http::{header::HeaderValue, StatusCode}, + ClientBuilder, + }; #[actix_rt::test] - async fn test_basic_redirect() { + async fn basic_redirect() { let client = ClientBuilder::new() .disable_redirects() .wrap(Redirect::new().max_redirect_times(10)) diff --git a/awc/src/middleware/redirect.rs b/awc/src/middleware/redirect.rs --- a/awc/src/middleware/redirect.rs +++ b/awc/src/middleware/redirect.rs @@ -315,6 +325,44 @@ mod tests { assert_eq!(res.status().as_u16(), 400); } + #[actix_rt::test] + async fn redirect_relative_without_leading_slash() { + let client = ClientBuilder::new().finish(); + + let srv = actix_test::start(|| { + App::new() + .service(web::resource("/").route(web::to(|| async { + HttpResponse::Found() + .insert_header(("location", "abc/")) + .finish() + }))) + .service( + web::resource("/abc/") + .route(web::to(|| async { HttpResponse::Accepted().finish() })), + ) + }); + + let res = client.get(srv.url("/")).send().await.unwrap(); + assert_eq!(res.status(), StatusCode::ACCEPTED); + } + + #[actix_rt::test] + async fn redirect_without_location() { + let client = ClientBuilder::new() + .disable_redirects() + .wrap(Redirect::new().max_redirect_times(10)) + .finish(); + + let srv = actix_test::start(|| { + App::new().service(web::resource("/").route(web::to(|| async { + Ok::<_, Error>(HttpResponse::Found().finish()) + }))) + }); + + let res = client.get(srv.url("/")).send().await.unwrap(); + assert_eq!(res.status(), StatusCode::FOUND); + } + #[actix_rt::test] async fn test_redirect_limit() { let client = ClientBuilder::new() diff --git a/awc/src/middleware/redirect.rs b/awc/src/middleware/redirect.rs --- a/awc/src/middleware/redirect.rs +++ b/awc/src/middleware/redirect.rs @@ -328,14 +376,14 @@ mod tests { .service(web::resource("/").route(web::to(|| async { Ok::<_, Error>( HttpResponse::Found() - .append_header(("location", "/test")) + .insert_header(("location", "/test")) .finish(), ) }))) .service(web::resource("/test").route(web::to(|| async { Ok::<_, Error>( HttpResponse::Found() - .append_header(("location", "/test2")) + .insert_header(("location", "/test2")) .finish(), ) }))) diff --git a/awc/src/middleware/redirect.rs b/awc/src/middleware/redirect.rs --- a/awc/src/middleware/redirect.rs +++ b/awc/src/middleware/redirect.rs @@ -345,8 +393,15 @@ mod tests { }); let res = client.get(srv.url("/")).send().await.unwrap(); - - assert_eq!(res.status().as_u16(), 302); + assert_eq!(res.status(), StatusCode::FOUND); + assert_eq!( + res.headers() + .get(header::LOCATION) + .unwrap() + .to_str() + .unwrap(), + "/test2" + ); } #[actix_rt::test]
awc: "Invalid URL: URL parse error: invalid format" error on some websites ## Expected Behavior awc being able to successfully download the websites that work with curl and Firefox. ## Current Behavior On some websites, e.g. http://viralnugget.com, awc fails with the following error: > Invalid URL: URL parse error: invalid format 1620 out of the top million websites are affected. List of all affected websites: [invalid-format-domain-list.txt.gz](https://github.com/actix/actix-web/files/6179185/invalid-format-domain-list.txt.gz) ## Steps to Reproduce (for bugs) 1. `git clone https://github.com/Shnatsel/rust-http-clients-smoke-test` 2. `cd rust-http-clients-smoke-test/awc` 3. `cargo build --release` 4. `target/release/awc-smoke-test viralnugget.com` ## Context I am testing a bunch of HTTP clients on the top million websites according to the [Feb 3 Tranco list](https://tranco-list.eu/list/3G6L). There is a very similar issue in another HTTP client: https://github.com/adamreichold/zeptohttpc/issues/6 ## Your Environment Linux, Ubuntu 20.04 LTS * Rust Version (I.e, output of `rustc -V`): rustc 1.47.0 (18bf6b4f0 2020-10-07) * Actix Web Version: awc 3.0.0-beta.3 awc connection pool with limit = 0 always times out ## Expected Behavior The documentation for `awc` states that `.limit(0)` means the connector has no limit. However, it seems that after this change: https://github.com/actix/actix-web/pull/1994 The limit = 0 case stopped being handled differently, and instead now a semaphore with 0 permits is created, leading to the client not working. Looks like a regression. ## Current Behavior Requests always time out. ## Possible Solution I would say making the builder interface more idiomatic by accepting an Option would be good, then handle the None case separately if we want to keep that functionality. Otherwise, if we always want to have a limit I would change the documentation. ## Steps to Reproduce (for bugs) Create an awc::Client with limit = 0. ## Your Environment Latest beta version of awc (3.0.0-beta.13) on rustc 1.51.0.
8e76a1c77588c4a8214838c7248e7167b13508b1
[ "middleware::redirect::tests::redirect_relative_without_leading_slash", "middleware::redirect::tests::redirect_without_location", "client_brotli_encoding", "client_gzip_encoding_large", "client_brotli_encoding_large_random", "client_gzip_encoding", "client_gzip_encoding_large_random" ]
[ "client::pool::test::test_pool_authority_key", "request::tests::client_query", "middleware::redirect::tests::test_remove_sensitive_headers", "responses::response_body::tests::read_body", "responses::json_body::tests::read_json_body", "builder::tests::client_bearer_auth", "client::pool::test::test_pool_limit", "request::tests::test_debug", "client::pool::test::test_pool_drop", "test::tests::test_basics", "request::tests::test_basics", "request::tests::test_client_header_override", "request::tests::client_bearer_auth", "ws::tests::test_header_override", "client::connection::test::test_h2_connection_drop", "ws::tests::test_debug", "ws::tests::basics", "request::tests::test_client_header", "builder::tests::client_basic_auth", "ws::tests::bearer_auth", "ws::tests::basic_auth", "client::pool::test::test_pool_lifetime", "request::tests::client_basic_auth", "client::pool::test::test_pool_keep_alive", "middleware::redirect::tests::basic_redirect", "middleware::redirect::tests::test_redirect_limit", "middleware::redirect::tests::test_redirect_cross_origin_headers", "client::connector::tests::h2c_connector", "middleware::redirect::tests::test_redirect_status_kind_301_302_303", "middleware::redirect::tests::test_redirect_status_kind_307_308", "middleware::redirect::tests::test_redirect_headers", "body_streaming_implicit", "client_unread_response", "json", "connection_wait_queue_force_close", "connection_wait_queue", "no_decompress", "client_deflate_encoding", "connection_reuse", "response_timeout", "simple", "with_query_parameter", "local_address", "client_deflate_encoding_large_random", "connection_force_close", "timeout_override", "client_streaming_explicit", "form", "connection_server_close", "client_basic_auth", "client_bearer_auth", "client_cookie_handling", "timeout", "test_connection_window_size", "test_connection_reuse_h2", "test_simple", "awc/src/request.rs - request::ClientRequest::append_header (line 178) - compile", "awc/src/responses/response.rs - responses::response::ClientResponse<S>::json (line 192) - compile", "awc/src/ws.rs - ws (line 7) - compile", "awc/src/request.rs - request::ClientRequest (line 30) - compile", "awc/src/lib.rs - (line 4) - compile", "awc/src/request.rs - request::ClientRequest::cookie (line 252) - compile", "awc/src/responses/response.rs - responses::response::ClientResponse<S>::body (line 166) - compile", "awc/src/client/mod.rs - client::Client (line 38)" ]
[]
[]
2022-03-08T16:51:43Z
da4c849f6221be0c3a551da6a4a7570ef693b0f3
diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -1,6 +1,10 @@ # Changes ## Unreleased - 2021-xx-xx +### Fixed +- Encode correctly camel case header with n+2 hyphens [#2683] + +[#2683]: https://github.com/actix/actix-web/issues/2683 ## 3.0.1 - 2022-03-04 diff --git a/actix-http/CHANGES.md b/actix-http/CHANGES.md --- a/actix-http/CHANGES.md +++ b/actix-http/CHANGES.md @@ -750,10 +754,10 @@ - Remove `ResponseError` impl for `actix::actors::resolver::ResolverError` due to deprecate of resolver actor. [#1813] - Remove `ConnectError::SslHandshakeError` and re-export of `HandshakeError`. - due to the removal of this type from `tokio-openssl` crate. openssl handshake + due to the removal of this type from `tokio-openssl` crate. openssl handshake error would return as `ConnectError::SslError`. [#1813] - Remove `actix-threadpool` dependency. Use `actix_rt::task::spawn_blocking`. - Due to this change `actix_threadpool::BlockingError` type is moved into + Due to this change `actix_threadpool::BlockingError` type is moved into `actix_http::error` module. [#1878] [#1813]: https://github.com/actix/actix-web/pull/1813 diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -517,6 +517,7 @@ unsafe fn write_camel_case(value: &[u8], buf: *mut u8, len: usize) { if let Some(c @ b'a'..=b'z') = iter.next() { buffer[index] = c & 0b1101_1111; } + index += 1; } index += 1;
actix__actix-web-2683
2,683
I'm gonna try to work on this, just to be clear, the correct ways should be: A-B-C becomes A-B-C, A-B-C-D becomes A-B-C-D right? so, they remain the same as the original values
[ "2674" ]
4.0
actix/actix-web
2022-03-05T12:02:02Z
diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -528,7 +529,7 @@ mod tests { use std::rc::Rc; use bytes::Bytes; - use http::header::AUTHORIZATION; + use http::header::{AUTHORIZATION, UPGRADE_INSECURE_REQUESTS}; use super::*; use crate::{ diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -559,6 +560,9 @@ mod tests { head.headers .insert(CONTENT_TYPE, HeaderValue::from_static("plain/text")); + head.headers + .insert(UPGRADE_INSECURE_REQUESTS, HeaderValue::from_static("1")); + let mut head = RequestHeadType::Owned(head); let _ = head.encode_headers( diff --git a/actix-http/src/h1/encoder.rs b/actix-http/src/h1/encoder.rs --- a/actix-http/src/h1/encoder.rs +++ b/actix-http/src/h1/encoder.rs @@ -574,6 +578,7 @@ mod tests { assert!(data.contains("Connection: close\r\n")); assert!(data.contains("Content-Type: plain/text\r\n")); assert!(data.contains("Date: date\r\n")); + assert!(data.contains("Upgrade-Insecure-Requests: 1\r\n")); let _ = head.encode_headers( &mut bytes,
AWC camel cases headers with more than one hyphen incorrectly ## Expected Behavior The headers should be camel cased correctly ## Current Behavior The headers are not camel cased correctly (`A-B-C` becomes `A-BCc`, `A-B-C-D` becomes `A-BCD-d`). ## Possible Solution https://github.com/actix/actix-web/blob/e7a05f98925dcd8461845b67fa5769b24aa88961/actix-http/src/h1/encoder.rs#L514-L523 At line 518 I believe `index` should be incremented because the iterator was advanced. ## Steps to Reproduce (for bugs) ```rs #[tokio::main] async fn main() { let client = awc::Client::new(); let body = client .get("http://httpbin.org/get") .camel_case() .insert_header(("A-B-C", "")) .insert_header(("A-B-C-D", "")) .send() .await .unwrap() .body() .await .unwrap(); println!("{}", String::from_utf8_lossy(&body)); } ``` ## Context <!--- How has this issue affected you? What are you trying to accomplish? --> <!--- Providing context helps us come up with a solution that is most useful in the real world --> ## Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> - Rust Version (I.e, output of `rustc -V`): `rustc 1.59.0 (9d1b2106e 2022-02-23)` - Actix Web Version: `awc 3.0.0-beta.21`
8e76a1c77588c4a8214838c7248e7167b13508b1
[ "h1::encoder::tests::test_camel_case" ]
[ "body::sized_stream::tests::stream_string_error", "body::either::tests::type_parameter_inference", "body::body_stream::tests::stream_delayed_error", "body::message_body::tests::boxing_equivalence", "body::body_stream::tests::skips_empty_chunks", "body::message_body::tests::none_body_combinators", "body::message_body::tests::test_unit", "body::body_stream::tests::stream_string_error", "config::tests::test_date", "error::tests::test_from", "config::tests::test_date_len", "error::tests::test_into_response", "body::utils::test::test_to_bytes", "error::tests::test_payload_error", "config::tests::test_date_camel_case", "body::body_stream::tests::read_to_bytes", "body::message_body::tests::test_static_bytes", "config::tests::test_date_service_drop", "error::tests::test_error_http_response", "body::boxed::tests::nested_boxed_body", "error::tests::test_as_response", "body::message_body::tests::complete_body_combinators_poll", "extensions::tests::test_clear", "body::sized_stream::tests::read_to_bytes", "body::message_body::tests::test_string", "body::message_body::tests::test_vec", "body::sized_stream::tests::stream_boxed_error", "extensions::tests::test_extend", "extensions::tests::test_composition", "h1::chunked::tests::hrs_chunk_extension_invalid", "body::message_body::tests::test_body_casting", "h1::chunked::tests::hrs_chunk_size_overflow", "body::message_body::tests::test_bytes", "body::sized_stream::tests::skips_empty_chunks", "body::body_stream::tests::stream_boxed_error", "h1::decoder::tests::test_conn_keep_alive_1_0", "h1::decoder::tests::hrs_content_length_plus", "h1::decoder::tests::test_headers_multi_value", "h1::decoder::tests::test_headers_split_field", "h1::decoder::tests::test_http_request_bad_status_line", "h1::decoder::tests::test_http_request_parser_bad_method", "h1::decoder::tests::test_conn_default_1_0", "h1::decoder::tests::test_http_request_parser_bad_version", "h1::decoder::tests::test_http_request_upgrade_h2c", "h1::decoder::tests::test_http_request_upgrade_websocket", "h1::decoder::tests::hrs_multiple_content_length", "h1::decoder::tests::test_invalid_name", "h1::decoder::tests::test_invalid_header", "h1::decoder::tests::test_parse", "h1::decoder::tests::test_parse_body_crlf", "h1::decoder::tests::test_conn_close", "h1::codec::tests::test_http_request_chunked_payload_and_next_message", "h1::decoder::tests::test_parse_partial_eof", "h1::chunked::tests::test_request_chunked", "h1::chunked::tests::test_http_request_chunked_payload_chunks", "h1::chunked::tests::test_parse_chunked_payload_chunk_extension", "h1::decoder::tests::test_conn_upgrade_connect_method", "h1::decoder::tests::hrs_unknown_transfer_encoding", "error::tests::test_error_display", "h1::chunked::tests::test_http_request_chunked_payload", "h1::chunked::tests::chunk_extension_quoted", "h1::decoder::tests::test_conn_close_1_0", "extensions::tests::test_extensions", "h1::chunked::tests::test_http_request_chunked_payload_and_next_message", "h1::decoder::tests::test_parse_body", "h1::decoder::tests::test_http_request_parser_utf8", "h1::decoder::tests::transfer_encoding_agrees", "h1::dispatcher_tests::late_request", "h1::decoder::tests::test_conn_upgrade", "h1::decoder::tests::hrs_multiple_transfer_encoding", "h1::decoder::tests::test_conn_other_1_1", "h1::encoder::tests::test_chunked_te", "h1::dispatcher_tests::upgrade_handling", "h1::dispatcher_tests::pipelining_ok_then_bad", "h1::dispatcher_tests::req_parse_err", "h1::decoder::tests::test_conn_other_1_0", "h1::encoder::tests::test_no_content_length", "h1::decoder::tests::test_http_request_parser_two_slashes", "h1::dispatcher_tests::http_msg_creates_msg", "header::map::tests::contains", "h1::dispatcher_tests::keep_alive_follow_up_req", "h1::dispatcher_tests::oneshot_connection", "h1::dispatcher_tests::expect_eager", "h1::decoder::tests::test_headers_content_length_err_1", "h1::decoder::tests::test_conn_keep_alive_1_1", "h1::payload::tests::test_unread_data", "h1::decoder::tests::test_response_http10_read_until_eof", "h1::decoder::tests::test_parse_post", "h1::dispatcher_tests::pipelining_ok_then_ok", "h1::encoder::tests::test_extra_headers", "h1::decoder::tests::test_conn_default_1_1", "h1::decoder::tests::test_parse_partial", "body::message_body::tests::complete_body_combinators", "extensions::tests::test_integers", "body::body_stream::tests::stream_immediate_error", "extensions::tests::test_remove", "h1::decoder::tests::test_headers_content_length_err_2", "header::shared::extended::tests::test_parse_extended_value_partially_formatted", "header::shared::extended::tests::test_parse_extended_value_with_encoding_and_language_tag", "header::shared::charset::tests::test_display", "header::shared::extended::tests::test_fmt_extended_value_with_encoding_and_language_tag", "header::shared::extended::tests::test_parse_extended_value_missing_language_tag_and_encoding", "header::map::tests::get_all_iteration_order_matches_insertion_order", "header::shared::extended::tests::test_parse_extended_value_with_encoding", "header::shared::extended::tests::test_parse_extended_value_partially_formatted_blank", "h1::dispatcher_tests::handler_drop_payload", "header::map::tests::insert", "header::shared::quality::tests::negative_quality - should panic", "h1::dispatcher_tests::keep_alive_timeout", "header::map::tests::create", "header::map::tests::drain_iter", "header::map::tests::iter_and_into_iter_same_order", "header::map::tests::get_all_and_remove_same_order", "header::shared::quality::tests::quality_out_of_bounds - should panic", "header::shared::quality::tests::display_output", "header::shared::http_date::tests::date_header", "header::shared::quality::tests::q_helper", "header::shared::quality_item::tests::test_quality_item_from_str1", "header::shared::quality_item::tests::test_quality_item_from_str2", "header::shared::quality_item::tests::test_quality_item_from_str3", "helpers::tests::test_status_line", "helpers::tests::test_write_content_length", "header::shared::quality_item::tests::test_quality_item_from_str6", "header::shared::quality_item::tests::test_quality_item_ordering", "http_message::tests::test_content_type", "http_message::tests::test_encoding", "header::shared::quality_item::tests::test_fuzzing_bugs", "header::shared::charset::tests::test_parse", "http_message::tests::test_chunked", "responses::builder::tests::response_builder_header_append_kv", "header::shared::quality_item::tests::test_quality_item_from_str5", "header::shared::quality_item::tests::test_quality_item_fmt_q_1", "header::shared::quality_item::tests::test_quality_item_fmt_q_05", "helpers::tests::write_content_length_camel_case", "header::shared::quality_item::tests::test_quality_item_from_str4", "header::shared::quality_item::tests::test_quality_item_fmt_q_0001", "http_message::tests::test_mime_type_error", "header::utils::tests::comma_delimited_parsing", "header::map::tests::entries_into_iter", "http_message::tests::test_encoding_error", "header::map::tests::entries_iter", "h1::dispatcher_tests::expect_handling", "http_message::tests::test_mime_type", "responses::builder::tests::test_force_close", "responses::response::tests::test_debug", "responses::builder::tests::response_builder_header_insert_kv", "keep_alive::tests::from_impls", "ws::frame::tests::test_empty_close_frame", "responses::builder::tests::test_upgrade", "ws::frame::tests::test_parse_frame_max_size", "responses::builder::tests::response_builder_header_append_typed", "header::shared::extended::tests::test_fmt_extended_value_with_encoding", "requests::request::tests::test_basics", "ws::frame::tests::test_parse_length4", "ws::frame::tests::test_parse_frame_no_mask", "ws::frame::tests::test_parse", "ws::frame::tests::test_parse_length2", "ws::tests::test_handshake", "responses::builder::tests::test_into_builder", "ws::proto::test::test_from_opcode_debug - should panic", "ws::mask::tests::test_apply_mask", "ws::proto::test::close_code_into_u16", "ws::proto::test::test_hash_key", "ws::frame::tests::test_ping_frame", "ws::proto::test::test_to_opcode", "ws::frame::tests::test_pong_frame", "ws::proto::test::test_from_opcode_display", "responses::builder::tests::test_content_type", "ws::frame::tests::test_close_frame", "ws::proto::test::test_from_opcode", "responses::builder::tests::response_builder_header_insert_typed", "ws::frame::tests::test_parse_frame_mask", "ws::frame::tests::test_parse_length0", "ws::tests::test_ws_error_http_response", "header::shared::quality_item::tests::test_quality_item_fmt_q_0", "responses::builder::tests::test_basic_builder", "ws::proto::test::close_code_from_u16", "responses::response::tests::test_into_response", "body::message_body::tests::test_static_str", "body::message_body::tests::test_bytes_mut", "config::tests::test_date_service_update", "responses::head::tests::camel_case_headers", "with_query_parameter", "connection_close", "h1_expect", "h1_v2", "h2_handshake_timeout", "h2_ping_pong", "h2_service_error", "h2_1", "h2_head_empty", "h2_head_binary2", "h2_body_chunked_explicit", "h2", "h2_head_binary", "h2_response_http_error_handling", "h2_body_length", "h2_body2", "h2_on_connect", "h2_headers", "h2_body", "h2_content_length", "alpn_h1", "h1", "alpn_h2_1", "h1_1", "alpn_h2", "h1_service_error", "h2_body1", "http1_malformed_request", "h1_body_length", "h1_basic", "h1_body_chunked_explicit", "h1_body_chunked_implicit", "h1_2", "h1_headers", "h1_head_binary", "h1_head_empty", "h1_body", "http1_keepalive", "h1_response_http_error_handling", "http1_keepalive_close", "h1_on_connect", "http10_keepalive_default_close", "content_length", "http1_keepalive_disabled", "slow_request_408", "h1_head_binary2", "http10_keepalive", "chunked_payload", "http1_keepalive_timeout", "not_modified_spec_h1", "expect_continue_h1", "expect_continue", "simple", "actix-http/src/body/message_body.rs - body::message_body::MessageBody (line 27)", "actix-http/src/body/utils.rs - body::utils::to_bytes (line 15)", "actix-http/src/body/size.rs - body::size::BodySize::is_eof (line 30)", "actix-http/src/header/shared/quality.rs - header::shared::quality::q (line 171)", "actix-http/src/header/map.rs - header::map::HeaderMap::new (line 77)", "actix-http/src/header/shared/quality.rs - header::shared::quality::q (line 156)", "actix-http/src/header/map.rs - header::map::HeaderMap::with_capacity (line 94)", "actix-http/src/header/map.rs - header::map::HeaderMap::len_keys (line 163)", "actix-http/src/header/shared/quality.rs - header::shared::quality::Quality (line 24)", "actix-http/src/extensions.rs - extensions::Extensions::get (line 60)", "actix-http/src/header/map.rs - header::map::HeaderMap (line 16)", "actix-http/src/extensions.rs - extensions::Extensions::get_mut (line 74)", "actix-http/src/header/map.rs - header::map::HeaderMap::clear (line 199)", "actix-http/src/extensions.rs - extensions::Extensions::contains (line 46)", "actix-http/src/header/map.rs - header::map::HeaderMap::is_empty (line 182)", "actix-http/src/header/map.rs - header::map::HeaderMap::len (line 140)", "actix-http/src/extensions.rs - extensions::Extensions::clear (line 106)", "actix-http/src/header/map.rs - header::map::HeaderMap::remove (line 434)", "actix-http/src/header/map.rs - header::map::HeaderMap::insert (line 346)", "actix-http/src/extensions.rs - extensions::Extensions::insert (line 30)", "actix-http/src/header/map.rs - header::map::HeaderMap::drain (line 563)", "actix-http/src/header/shared/quality_item.rs - header::shared::quality_item::QualityItem (line 21)", "actix-http/src/header/map.rs - header::map::HeaderMap::get_mut (line 265)", "actix-http/src/header/map.rs - header::map::HeaderMap::insert (line 363)", "actix-http/src/header/map.rs - header::map::HeaderMap::contains_key (line 323)", "actix-http/src/header/map.rs - header::map::HeaderMap::get_all (line 294)", "actix-http/src/header/map.rs - header::map::HeaderMap::remove (line 415)", "actix-http/src/header/map.rs - header::map::HeaderMap::get (line 232)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder (line 19)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::insert_header (line 79)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::status (line 63)", "actix-http/src/extensions.rs - extensions::Extensions::remove (line 90)", "actix-http/src/header/map.rs - header::map::HeaderMap::reserve (line 483)", "actix-http/src/header/map.rs - header::map::HeaderMap::append (line 385)", "actix-http/src/header/map.rs - header::map::HeaderMap::keys (line 535)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::append_header (line 106)", "actix-http/src/header/map.rs - header::map::HeaderMap::capacity (line 463)", "actix-http/src/header/map.rs - header::map::HeaderMap::iter (line 503)", "actix-http/src/responses/builder.rs - responses::builder::ResponseBuilder::new (line 47)" ]
[]
[]
2022-03-05T22:24:21Z
d57f11445da31eb1183c34d78a93f8b601c2333e
diff --git a/src/config/mod.rs b/src/config/mod.rs --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -796,6 +796,9 @@ impl Config { }, None => bail!("No role"), }; + if role_name.contains('#') { + bail!("Unable to save role with arguments") + } if role_name == TEMP_ROLE_NAME { role_name = Text::new("Role name:") .with_validator(|input: &str| { diff --git a/src/config/role.rs b/src/config/role.rs --- a/src/config/role.rs +++ b/src/config/role.rs @@ -124,15 +124,15 @@ impl Role { if names.contains(&name.to_string()) { Some(name.to_string()) } else { - let parts: Vec<&str> = name.split(':').collect(); + let parts: Vec<&str> = name.split('#').collect(); let parts_len = parts.len(); if parts_len < 2 { return None; } - let prefix = format!("{}:", parts[0]); + let prefix = format!("{}#", parts[0]); names .iter() - .find(|v| v.starts_with(&prefix) && v.split(':').count() == parts_len) + .find(|v| v.starts_with(&prefix) && v.split('#').count() == parts_len) .cloned() } } diff --git a/src/config/role.rs b/src/config/role.rs --- a/src/config/role.rs +++ b/src/config/role.rs @@ -329,7 +329,7 @@ impl RoleLike for Role { fn complete_prompt_args(prompt: &str, name: &str) -> String { let mut prompt = prompt.to_string(); - for (i, arg) in name.split(':').skip(1).enumerate() { + for (i, arg) in name.split('#').skip(1).enumerate() { prompt = prompt.replace(&format!("__ARG{}__", i + 1), arg); } prompt
sigoden__aichat-830
830
[ "828" ]
0.21
sigoden/aichat
2024-09-04T06:14:13Z
diff --git a/src/config/role.rs b/src/config/role.rs --- a/src/config/role.rs +++ b/src/config/role.rs @@ -407,11 +407,11 @@ mod tests { #[test] fn test_merge_prompt_name() { assert_eq!( - complete_prompt_args("convert __ARG1__", "convert:foo"), + complete_prompt_args("convert __ARG1__", "convert#foo"), "convert foo" ); assert_eq!( - complete_prompt_args("convert __ARG1__ to __ARG2__", "convert:foo:bar"), + complete_prompt_args("convert __ARG1__ to __ARG2__", "convert#foo#bar"), "convert foo to bar" ); } diff --git a/src/config/role.rs b/src/config/role.rs --- a/src/config/role.rs +++ b/src/config/role.rs @@ -419,8 +419,8 @@ mod tests { #[test] fn test_match_name() { let names = vec![ - "convert:yaml:json".into(), - "convert:yaml".into(), + "convert#yaml#json".into(), + "convert#yaml".into(), "convert".into(), ]; assert_eq!( diff --git a/src/config/role.rs b/src/config/role.rs --- a/src/config/role.rs +++ b/src/config/role.rs @@ -428,22 +428,22 @@ mod tests { Some("convert".to_string()) ); assert_eq!( - Role::match_name(&names, "convert:yaml"), - Some("convert:yaml".to_string()) + Role::match_name(&names, "convert#yaml"), + Some("convert#yaml".to_string()) ); assert_eq!( - Role::match_name(&names, "convert:json"), - Some("convert:yaml".to_string()) + Role::match_name(&names, "convert#json"), + Some("convert#yaml".to_string()) ); assert_eq!( - Role::match_name(&names, "convert:yaml:json"), - Some("convert:yaml:json".to_string()) + Role::match_name(&names, "convert#yaml#json"), + Some("convert#yaml#json".to_string()) ); assert_eq!( - Role::match_name(&names, "convert:json:yaml"), - Some("convert:yaml:json".to_string()) + Role::match_name(&names, "convert#json#yaml"), + Some("convert#yaml#json".to_string()) ); - assert_eq!(Role::match_name(&names, "convert:yaml:json:simple"), None,); + assert_eq!(Role::match_name(&names, "convert#yaml#json#simple"), None,); } #[test]
`:` in `roles/convert:json:toml.md` is invalid file identifier On Windows and the finder app on macOS, `:` is not a valid name. Suggestion: use valid identifiers that can be used on both macOS and windows, for example `{}`
d57f11445da31eb1183c34d78a93f8b601c2333e
[ "config::role::tests::test_merge_prompt_name", "config::role::tests::test_match_name" ]
[ "config::role::tests::test_parse_structure_prompt1", "config::role::tests::test_parse_structure_prompt2", "config::role::tests::test_parse_structure_prompt3", "rag::bm25::tests::test_tokenize", "client::stream::tests::test_json_stream_array", "client::stream::tests::test_json_stream_ndjson", "rag::splitter::tests::test_split_text", "rag::splitter::tests::test_chunk_header", "rag::splitter::tests::test_create_document", "rag::splitter::tests::test_markdown_splitter", "rag::splitter::tests::test_html_splitter", "render::markdown::tests::test_detect_code_block", "repl::completer::test_split_line", "utils::path::tests::test_parse_glob", "utils::render_prompt::tests::test_render", "utils::tests::test_safe_join_path", "utils::tests::test_fuzzy_match", "rag::bm25::tests::test_bm25", "repl::tests::test_process_command_line", "repl::tests::test_split_files_text", "render::markdown::tests::no_wrap_code", "render::markdown::tests::wrap_all", "render::markdown::tests::no_theme", "render::markdown::tests::test_render" ]
[]
[]
2024-09-03T22:19:34Z
737580bb87f3b1d2f040dd7a4ddacca3595915a0
diff --git a/src/cli.rs b/src/cli.rs --- a/src/cli.rs +++ b/src/cli.rs @@ -73,12 +73,7 @@ pub struct Cli { impl Cli { pub fn text(&self) -> Option<String> { - let text = self - .text - .iter() - .map(|x| x.trim().to_string()) - .collect::<Vec<String>>() - .join(" "); + let text = self.text.to_vec().join(" "); if text.is_empty() { return None; } diff --git a/src/config/input.rs b/src/config/input.rs --- a/src/config/input.rs +++ b/src/config/input.rs @@ -91,7 +91,7 @@ impl Input { } for (path, contents) in files { texts.push(format!( - "============ PATH: {path} ============\n\n{contents}\n" + "============ PATH: {path} ============\n{contents}\n" )); } let (role, with_session, with_agent) = resolve_role(&config.read(), role); diff --git a/src/repl/mod.rs b/src/repl/mod.rs --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -280,7 +280,7 @@ impl Repl { Some(args) => match args.split_once(['\n', ' ']) { Some((name, text)) => { let role = self.config.read().retrieve_role(name.trim())?; - let input = Input::from_str(&self.config, text.trim(), Some(role)); + let input = Input::from_str(&self.config, text, Some(role)); ask(&self.config, self.abort_signal.clone(), input, false).await?; } None => { diff --git a/src/repl/mod.rs b/src/repl/mod.rs --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -718,8 +718,9 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec<String>, &str) { word.to_string() } }; + let chars: Vec<char> = line.chars().collect(); - for (i, char) in line.chars().enumerate() { + for (i, char) in chars.iter().cloned().enumerate() { match unbalance { Some(ub_char) if ub_char == char => { word.push(char); diff --git a/src/repl/mod.rs b/src/repl/mod.rs --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -730,12 +731,15 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec<String>, &str) { } None => match char { ' ' | '\t' | '\r' | '\n' => { + if char == '\r' && chars.get(i + 1) == Some(&'\n') { + continue; + } if let Some('\\') = prev_char.filter(|_| !is_win) { word.push(char); } else if !word.is_empty() { if word == "--" { word.clear(); - text_starts_at = Some(i); + text_starts_at = Some(i + 1); break; } words.push(unquote_word(&word)); diff --git a/src/repl/mod.rs b/src/repl/mod.rs --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -763,7 +767,7 @@ fn split_files_text(line: &str, is_win: bool) -> (Vec<String>, &str) { words.push(unquote_word(&word)); } let text = match text_starts_at { - Some(start) => line[start..].trim(), + Some(start) => &line[start..], None => "", };
sigoden__aichat-1056
1,056
[ "1055" ]
0.25
sigoden/aichat
2024-12-14T06:50:17Z
diff --git a/src/repl/mod.rs b/src/repl/mod.rs --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -807,6 +811,10 @@ mod tests { split_files_text("file.txt -- hello", false), (vec!["file.txt".into()], "hello") ); + assert_eq!( + split_files_text("file.txt -- \thello", false), + (vec!["file.txt".into()], "\thello") + ); assert_eq!( split_files_text("file.txt --\nhello", false), (vec!["file.txt".into()], "hello")
Unable to define a grammar check that keeps indentation. **Describe the bug** When passing a string via argument, or STDIN, whitespace is trimmed in my role. **To Reproduce** I edited the grammar role example, and tried to make it work with code comments and indentation (I pipe strings from my editor to aichat, and need it to keep the formatting). This is my role: ```markdown --- model: claude:claude-3-5-sonnet-latest temperature: 0 top_p: 0 --- Your task is to take the text provided and rewrite it into a clear, grammatically correct version while preserving the original meaning as closely as possible. Correct any spelling mistakes, punctuation errors, verb tense issues, word choice problems, and other grammatical mistakes. It is possible that what you get is not just text, but markdown, code comments, HTML, or something like that. In any case, I want you to only edit the text, not the function (that is, do not spell check the function or variable names, only the comments). The rest should be returned as-is, including indentation and any other extra white-space before text. ``` When I call it via stdin/args it does not work as expected however: ```shell $ echo ' this is a problem' | aichat --role grammar This is a problem. $ aichat --role grammar --code ' this is a porblem' This is a problem. ``` I assume I'm doing something wrong with `aichat`, or with my role definition, sorry if this is documented somehwere that I'm not aware of. **Expected behavior** The grammar check should preserve white-space. **Configuration** ``` aichat --info model claude:claude-3-5-sonnet-latest max_output_tokens 8192 (current model) temperature - top_p - dry_run false stream true save false keybindings emacs wrap no wrap_code false function_calling true use_tools - agent_prelude - save_session - compress_threshold 4000 rag_reranker_model - rag_top_k 5 highlight true light_theme false config_file /Users/denis/.dotfiles/aichat/config.yaml env_file /Users/denis/.dotfiles/aichat/.env roles_dir /Users/denis/.dotfiles/aichat/roles sessions_dir /Users/denis/.dotfiles/aichat/sessions rags_dir /Users/denis/.dotfiles/aichat/rags functions_dir /Users/denis/.dotfiles/aichat/functions messages_file /Users/denis/.dotfiles/aichat/messages.md ``` **Environment (please complete the following information):** - macOS 15.1 - aichat 0.24.0 - alacritty 0.14.0
737580bb87f3b1d2f040dd7a4ddacca3595915a0
[ "repl::tests::test_split_files_text" ]
[ "config::role::tests::test_merge_prompt_name", "config::role::tests::test_parse_structure_prompt1", "config::role::tests::test_parse_structure_prompt2", "config::role::tests::test_parse_structure_prompt3", "config::role::tests::test_match_name", "client::stream::tests::test_json_stream_ndjson", "rag::splitter::tests::test_split_text", "rag::splitter::tests::test_markdown_splitter", "rag::splitter::tests::test_create_document", "client::stream::tests::test_json_stream_array", "rag::splitter::tests::test_chunk_header", "render::markdown::tests::test_detect_code_block", "rag::splitter::tests::test_html_splitter", "repl::completer::test_split_line", "utils::path::tests::test_parse_glob", "utils::tests::test_fuzzy_match", "utils::tests::test_safe_join_path", "utils::render_prompt::tests::test_render", "repl::tests::test_process_command_line", "render::markdown::tests::no_theme", "render::markdown::tests::test_render", "render::markdown::tests::wrap_all", "render::markdown::tests::no_wrap_code" ]
[]
[]
2024-12-13T23:00:49Z
927b864844fa70a33a9abf557f9f813f831c54e1
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## 0.14.0-dev +### Fixed + +- Vi inline search/semantic selection expanding across newlines + ## 0.13.1 ### Added diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -540,15 +540,15 @@ impl<T> Term<T> { let wide = Flags::WIDE_CHAR | Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; while let Some(cell) = iter.prev() { + if cell.point.column == last_column && !cell.flags.contains(Flags::WRAPLINE) { + break; + } + point = cell.point; if !cell.flags.intersects(wide) && needles.contains(cell.c) { return Ok(point); } - - if point.column == last_column && !cell.flags.contains(Flags::WRAPLINE) { - break; - } } Err(point) diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -562,6 +562,11 @@ impl<T> Term<T> { let wide = Flags::WIDE_CHAR | Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; let last_column = self.columns() - 1; + // Immediately stop if start point in on line break. + if point.column == last_column && !self.grid[point].flags.contains(Flags::WRAPLINE) { + return Err(point); + } + for cell in self.grid.iter_from(point) { point = cell.point;
alacritty__alacritty-7600
7,600
Seems like somehow 845a5d8a8d47c233c4ed8177ecbb20b05b22118b broke this.
[ "7587" ]
1.70
alacritty/alacritty
2024-01-09T23:39:16Z
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -1129,4 +1134,25 @@ mod tests { let end = Point::new(Line(0), Column(3)); assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); } + + #[test] + fn newline_breaking_semantic() { + #[rustfmt::skip] + let term = mock_term("\ + test abc\r\n\ + def test\ + "); + + // Start at last character. + let start = term.semantic_search_left(Point::new(Line(0), Column(7))); + let end = term.semantic_search_right(Point::new(Line(0), Column(7))); + assert_eq!(start, Point::new(Line(0), Column(5))); + assert_eq!(end, Point::new(Line(0), Column(7))); + + // Start at first character. + let start = term.semantic_search_left(Point::new(Line(1), Column(0))); + let end = term.semantic_search_right(Point::new(Line(1), Column(0))); + assert_eq!(start, Point::new(Line(1), Column(0))); + assert_eq!(end, Point::new(Line(1), Column(2))); + } }
Spurious char from previous line in double click selection Since alacritty `0.13.0` selecting a word / line with a double click will also select the last character of the previous line if it is non-whitespace. ![image](https://github.com/alacritty/alacritty/assets/1280142/098351c6-5b78-4838-ac40-0231990f7cf5) (double click on `bbb` will select `X\nbbb`) ![image](https://github.com/alacritty/alacritty/assets/1280142/727b7dba-e0da-4192-bbdf-399953ff24df) (double click on `bbb` will correctly select `bbb`) This is especially annoying for shell configs that print the date / command duration at the end of the previous line and took me a while to figure out where these spurious char was coming from. ### System OS: Arch Linux Version: `0.13.0` and `0.13.1 (fe2a3c56)` (affected) Linux/BSD: sway (Wayland) ### Logs ``` [0.000000647s] [INFO ] [alacritty] Welcome to Alacritty [0.000027276s] [INFO ] [alacritty] Version 0.13.1 (fe2a3c56) [0.000030789s] [INFO ] [alacritty] Running on Wayland [0.000284642s] [INFO ] [alacritty] Configuration files loaded from: "/home/user/.config/alacritty/alacritty.toml" ".config/alacritty/themes/iterm-black-bg.toml" [0.020153768s] [INFO ] [alacritty] Using EGL 1.5 [0.020188141s] [DEBUG] [alacritty] Picked GL Config: buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 }) alpha_size: 8 num_samples: 0 hardware_accelerated: true supports_transparency: Some(true) config_api: Api(OPENGL | GLES1 | GLES2 | GLES3) srgb_capable: true [0.022885544s] [INFO ] [alacritty] Window scale factor: 1 [0.023746219s] [DEBUG] [alacritty] Loading "Hack" font [0.031184536s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.033490671s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.035980153s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.038732463s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.041431187s] [INFO ] [alacritty] Running on Mesa Intel(R) Xe Graphics (TGL GT2) [0.041440256s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.2-arch1.2, shader_version 4.60 [0.041445048s] [INFO ] [alacritty] Using OpenGL 3.3 renderer [0.045855281s] [DEBUG] [alacritty] Enabled debug logging for OpenGL [0.045991480s] [DEBUG] [alacritty] Filling glyph cache with common glyphs [0.054647581s] [INFO ] [alacritty] Cell size: 10 x 19 [0.054672523s] [INFO ] [alacritty] Padding: 0 x 0 [0.054676411s] [INFO ] [alacritty] Width: 800, Height: 600 [0.054709278s] [INFO ] [alacritty] PTY dimensions: 31 x 80 [0.057172494s] [INFO ] [alacritty] Initialisation complete [0.058873356s] [DEBUG] [alacritty_terminal] New num_cols is 239 and num_lines is 23 [0.058954826s] [INFO ] [alacritty] Padding: 0 x 0 [0.058959145s] [INFO ] [alacritty] Width: 2396, Height: 439 [0.099895515s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.102891420s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.106041474s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.108768348s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } [0.110237303s] [INFO ] [alacritty] Font size changed to 32.0 px [0.110254513s] [INFO ] [alacritty] Cell size: 19 x 38 [0.110264506s] [DEBUG] [alacritty_terminal] New num_cols is 252 and num_lines is 23 [0.116651914s] [INFO ] [alacritty] Padding: 0 x 0 [0.116671044s] [INFO ] [alacritty] Width: 4792, Height: 878 [2.320997216s] [INFO ] [alacritty] Goodbye ``` (log of a different window)
5e6b92db85b3ea7ffd06a7a5ae0d2d62ad5946a6
[ "term::search::tests::newline_breaking_semantic" ]
[ "grid::storage::tests::grow_after_zero", "grid::storage::tests::grow_before_zero", "grid::storage::tests::indexing", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::initialize", "grid::storage::tests::rotate", "grid::storage::tests::rotate_wrap_zero", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow", "index::tests::add_none_clamp", "index::tests::add_grid_clamp", "grid::storage::tests::with_capacity", "grid::tests::shrink_reflow_twice", "grid::tests::shrink_reflow_empty_cell_inside_line", "index::tests::add", "index::tests::add_wrap", "index::tests::sub", "grid::tests::test_iter", "index::tests::location_ordering", "grid::storage::tests::truncate_invisible_lines", "index::tests::sub_grid_clamp", "grid::storage::tests::shrink_after_zero", "index::tests::sub_wrap", "grid::tests::grow_reflow", "selection::tests::between_adjacent_cells_left_to_right", "grid::storage::tests::shrink_then_grow", "grid::tests::grow_reflow_disabled", "index::tests::sub_clamp", "grid::tests::scroll_up", "grid::storage::tests::shrink_before_zero", "grid::tests::grow_reflow_multiline", "index::tests::sub_none_clamp", "grid::tests::scroll_down", "grid::storage::tests::truncate_invisible_lines_beginning", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "grid::tests::scroll_down_with_history", "grid::storage::tests::shrink_before_and_after_zero", "selection::tests::between_adjacent_cells_right_to_left", "index::tests::add_clamp", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::single_cell_left_to_right", "selection::tests::simple_selection", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::search::tests::empty_match", "term::tests::clearing_scrollback_resets_display_offset", "term::tests::clearing_viewport_keeps_history_position", "term::search::tests::include_linebreak_right", "term::search::tests::no_match_right", "term::search::tests::regex_left", "term::search::tests::regex_right", "term::search::tests::reverse_search_dead_recovery", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::search::tests::singlecell_fullwidth", "term::search::tests::include_linebreak_left", "term::tests::damage_cursor_movements", "term::search::tests::nested_regex", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::empty_match_multibyte", "term::search::tests::wrap_around_to_another_end", "term::tests::clear_saved_lines", "term::tests::block_selection_works", "term::cell::tests::cell_size_is_below_cap", "term::search::tests::no_match_left", "term::search::tests::end_on_fullwidth", "term::search::tests::wrapping", "term::search::tests::skip_dead_cell", "term::tests::input_line_drawing_character", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grid_serde", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::tests::scroll_display_page_up", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_word", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_semantic", "vi_mode::tests::scroll_simple", "vi_mode::tests::scroll_word", "term::tests::shrink_lines_updates_inactive_cursor_pos", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "term::tests::grow_lines_updates_active_cursor_pos", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_first_occupied", "tty::unix::test_get_pw_entry", "vi_mode::tests::scroll_over_bottom", "term::tests::semantic_selection_works", "term::tests::parse_cargo_version", "term::search::tests::nfa_compile_error", "term::tests::simple_selection_works", "term::tests::line_selection_works", "vi_mode::tests::motion_bracket", "term::tests::shrink_lines_updates_active_cursor_pos", "term::search::tests::fullwidth", "term::tests::scroll_display_page_down", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "term::tests::window_title", "vi_mode::tests::motion_semantic_left_end", "term::search::tests::anchored_empty", "term::search::tests::empty_match_multiline", "term::search::tests::end_on_multibyte_unicode", "vi_mode::tests::motion_semantic_left_start", "term::search::tests::multibyte_unicode", "term::tests::damage_public_usage", "term::search::tests::wide_without_spacer", "vi_mode::tests::semantic_wide", "term::search::tests::leading_spacer", "term::search::tests::greed_is_good", "term::search::tests::multiline", "term::tests::full_damage", "term::search::tests::runtime_cache_error", "clear_underline", "alt_reset", "selective_erasure", "fish_cc", "indexed_256_colors", "deccolm_reset", "vttest_insert", "saved_cursor_alt", "delete_chars_reset", "vim_simple_edit", "delete_lines", "saved_cursor", "tmux_git_log", "insert_blank_reset", "erase_in_line", "hyperlinks", "scroll_up_reset", "tmux_htop", "vttest_scroll", "vttest_origin_mode_2", "colored_underline", "erase_chars_reset", "newline_with_cursor_beyond_scroll_region", "zsh_tab_completion", "wrapline_alt_toggle", "vttest_tab_clear_set", "colored_reset", "grid_reset", "vttest_origin_mode_1", "zerowidth", "issue_855", "csi_rep", "decaln_reset", "ll", "sgr", "tab_rendering", "region_scroll_down", "underline", "vttest_cursor_movement_1", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2429)" ]
[]
[]
2024-01-15T12:57:01Z
e07bf6f24a7fa7438dd757d6e761c100dd920d68
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -43,35 +43,36 @@ impl RegexSearch { let max_size = config.get_cache_capacity(); let thompson_config = ThompsonConfig::new().nfa_size_limit(Some(max_size)); - // Create DFAs to find start/end in left-to-right search. - let right_fdfa = LazyDfa::new( + // Create DFAs to find start/end in right-to-left search. + let left_rdfa = LazyDfa::new( search, config.clone(), syntax_config, thompson_config.clone(), Direction::Right, - false, + true, )?; - let right_rdfa = LazyDfa::new( + let has_empty = left_rdfa.dfa.get_nfa().has_empty(); + let left_fdfa = LazyDfa::new( search, config.clone(), syntax_config, thompson_config.clone(), Direction::Left, - true, + has_empty, )?; - // Create DFAs to find start/end in right-to-left search. - let left_fdfa = LazyDfa::new( + // Create DFAs to find start/end in left-to-right search. + let right_fdfa = LazyDfa::new( search, config.clone(), syntax_config, thompson_config.clone(), - Direction::Left, - false, + Direction::Right, + has_empty, )?; - let left_rdfa = - LazyDfa::new(search, config, syntax_config, thompson_config, Direction::Right, true)?; + let right_rdfa = + LazyDfa::new(search, config, syntax_config, thompson_config, Direction::Left, true)?; Ok(RegexSearch { left_fdfa, left_rdfa, right_fdfa, right_rdfa }) } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -82,6 +83,8 @@ impl RegexSearch { struct LazyDfa { dfa: DFA, cache: Cache, + direction: Direction, + match_all: bool, } impl LazyDfa { diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -91,13 +94,13 @@ impl LazyDfa { syntax: SyntaxConfig, mut thompson: ThompsonConfig, direction: Direction, - reverse: bool, + match_all: bool, ) -> Result<Self, Box<BuildError>> { thompson = match direction { Direction::Left => thompson.reverse(true), Direction::Right => thompson.reverse(false), }; - config = if reverse { + config = if match_all { config.match_kind(MatchKind::All) } else { config.match_kind(MatchKind::LeftmostFirst) diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -109,7 +112,7 @@ impl LazyDfa { let cache = dfa.create_cache(); - Ok(Self { dfa, cache }) + Ok(Self { direction, cache, dfa, match_all }) } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -229,10 +232,8 @@ impl<T> Term<T> { end: Point, ) -> Option<Match> { // Find start and end of match. - let match_start = - self.regex_search(start, end, Direction::Left, false, &mut regex.left_fdfa)?; - let match_end = - self.regex_search(match_start, start, Direction::Right, true, &mut regex.left_rdfa)?; + let match_start = self.regex_search(start, end, &mut regex.left_fdfa)?; + let match_end = self.regex_search(match_start, start, &mut regex.left_rdfa)?; Some(match_start..=match_end) } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -247,10 +248,8 @@ impl<T> Term<T> { end: Point, ) -> Option<Match> { // Find start and end of match. - let match_end = - self.regex_search(start, end, Direction::Right, false, &mut regex.right_fdfa)?; - let match_start = - self.regex_search(match_end, start, Direction::Left, true, &mut regex.right_rdfa)?; + let match_end = self.regex_search(start, end, &mut regex.right_fdfa)?; + let match_start = self.regex_search(match_end, start, &mut regex.right_rdfa)?; Some(match_start..=match_end) } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -258,15 +257,8 @@ impl<T> Term<T> { /// Find the next regex match. /// /// This will always return the side of the first match which is farthest from the start point. - fn regex_search( - &self, - start: Point, - end: Point, - direction: Direction, - anchored: bool, - regex: &mut LazyDfa, - ) -> Option<Point> { - match self.regex_search_internal(start, end, direction, anchored, regex) { + fn regex_search(&self, start: Point, end: Point, regex: &mut LazyDfa) -> Option<Point> { + match self.regex_search_internal(start, end, regex) { Ok(regex_match) => regex_match, Err(err) => { warn!("Regex exceeded complexity limit"); diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -283,8 +275,6 @@ impl<T> Term<T> { &self, start: Point, end: Point, - direction: Direction, - anchored: bool, regex: &mut LazyDfa, ) -> Result<Option<Point>, Box<dyn Error>> { let topmost_line = self.topmost_line(); diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -292,13 +282,13 @@ impl<T> Term<T> { let last_column = self.last_column(); // Advance the iterator. - let next = match direction { + let next = match regex.direction { Direction::Right => GridIterator::next, Direction::Left => GridIterator::prev, }; // Get start state for the DFA. - let regex_anchored = if anchored { Anchored::Yes } else { Anchored::No }; + let regex_anchored = if regex.match_all { Anchored::Yes } else { Anchored::No }; let input = Input::new(&[]).anchored(regex_anchored); let mut state = regex.dfa.start_state_forward(&mut regex.cache, &input).unwrap(); diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -308,7 +298,7 @@ impl<T> Term<T> { let mut done = false; let mut cell = iter.cell(); - self.skip_fullwidth(&mut iter, &mut cell, direction); + self.skip_fullwidth(&mut iter, &mut cell, regex.direction); let mut c = cell.c; let mut point = iter.point(); diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -332,7 +322,7 @@ impl<T> Term<T> { // Pass char to DFA as individual bytes. for i in 0..utf8_len { // Inverse byte order when going left. - let byte = match direction { + let byte = match regex.direction { Direction::Right => buf[i], Direction::Left => buf[utf8_len - i - 1], }; diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -409,7 +399,7 @@ impl<T> Term<T> { // Check for completion before potentially skipping over fullwidth characters. done = iter.point() == end; - self.skip_fullwidth(&mut iter, &mut cell, direction); + self.skip_fullwidth(&mut iter, &mut cell, regex.direction); let wrapped = cell.flags.contains(Flags::WRAPLINE); c = cell.c;
alacritty__alacritty-7281
7,281
This is likely due to the leftmost search for the pattern causing `;*` to match empty strings and ending in a dead state thereafter. I'm not sure if this can be solved without switching to a backtracking regex parser, but since users can relatively easily work around this, I don't think it's a big issue.
[ "7276" ]
1.70
alacritty/alacritty
2023-10-09T06:38:32Z
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -1109,4 +1099,16 @@ mod tests { let end = Point::new(Line(0), Column(17)); assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); } + + #[test] + fn anchored_empty() { + #[rustfmt::skip] + let term = mock_term("rust"); + + // Bottom to top. + let mut regex = RegexSearch::new(";*|rust").unwrap(); + let start = Point::new(Line(0), Column(0)); + let end = Point::new(Line(0), Column(3)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); + } }
Regex `;*|rust` doesn't match anything in `rustfmt` string The bug is present on master and on v0.12.3. It's enough to search for the following regex. The `;+|rust` works just fine.
5e6b92db85b3ea7ffd06a7a5ae0d2d62ad5946a6
[ "term::search::tests::anchored_empty" ]
[ "grid::storage::tests::grow_after_zero", "grid::storage::tests::grow_before_zero", "grid::storage::tests::indexing", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::initialize", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_multiline", "grid::tests::grow_reflow_disabled", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_twice", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::scroll_down_with_history", "index::tests::add", "grid::tests::test_iter", "index::tests::add_clamp", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_clamp", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::line_selection", "selection::tests::rotate_in_region_up", "selection::tests::semantic_selection", "selection::tests::selection_bigger_then_smaller", "selection::tests::single_cell_left_to_right", "selection::tests::rotate_in_region_up_block", "term::cell::tests::cell_size_is_below_cap", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works_with_wrapline", "selection::tests::simple_selection", "selection::tests::simple_is_empty", "term::search::tests::end_on_fullwidth", "term::cell::tests::line_length_works", "term::search::tests::include_linebreak_left", "term::tests::damage_cursor_movements", "term::tests::clearing_scrollback_resets_display_offset", "term::search::tests::singlecell_fullwidth", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::wrapping_into_fullwidth", "term::tests::damage_public_usage", "term::tests::input_line_drawing_character", "term::tests::clearing_viewport_keeps_history_position", "term::tests::line_selection_works", "term::tests::parse_cargo_version", "term::tests::scroll_display_page_down", "term::tests::scroll_display_page_up", "term::tests::semantic_selection_works", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::simple_selection_works", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "term::tests::window_title", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_word", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_semantic", "term::tests::block_selection_works", "term::search::tests::no_match_right", "vi_mode::tests::scroll_simple", "vi_mode::tests::simple_wide", "vi_mode::tests::semantic_wide", "term::search::tests::no_match_left", "vi_mode::tests::word_wide", "term::search::tests::skip_dead_cell", "term::search::tests::wrapping", "term::search::tests::wrap_around_to_another_end", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::search::tests::empty_match_multiline", "term::search::tests::include_linebreak_right", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::search::tests::leading_spacer", "vi_mode::tests::scroll_word", "term::tests::shrink_lines_updates_active_cursor_pos", "term::search::tests::greed_is_good", "term::search::tests::fullwidth", "term::search::tests::empty_match", "term::tests::grid_serde", "term::search::tests::nested_regex", "term::tests::full_damage", "term::search::tests::multiline", "term::search::tests::wide_without_spacer", "term::search::tests::empty_match_multibyte", "term::tests::grow_lines_updates_active_cursor_pos", "term::search::tests::multibyte_unicode", "term::search::tests::end_on_multibyte_unicode", "term::search::tests::nfa_compile_error", "term::search::tests::regex_right", "term::search::tests::regex_left", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::clear_saved_lines", "term::search::tests::runtime_cache_error", "ll", "insert_blank_reset", "erase_chars_reset", "erase_in_line", "delete_lines", "alt_reset", "selective_erasure", "decaln_reset", "vttest_origin_mode_2", "fish_cc", "newline_with_cursor_beyond_scroll_region", "csi_rep", "vttest_cursor_movement_1", "clear_underline", "wrapline_alt_toggle", "scroll_up_reset", "region_scroll_down", "vttest_scroll", "hyperlinks", "tmux_git_log", "zsh_tab_completion", "vttest_origin_mode_1", "vttest_tab_clear_set", "sgr", "vttest_insert", "delete_chars_reset", "tmux_htop", "grid_reset", "saved_cursor_alt", "underline", "colored_reset", "colored_underline", "indexed_256_colors", "tab_rendering", "zerowidth", "vim_simple_edit", "deccolm_reset", "issue_855", "saved_cursor", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2160)" ]
[]
[]
2023-10-09T13:38:32Z
77aa9f42bac4377efe26512d71098d21b9b547fd
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Cut off wide characters in preedit string - Scrolling on touchscreens - Double clicking on CSD titlebar not always maximizing a window on Wayland +- Excessive memory usage when using regexes with a large number of possible states ### Removed diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -485,7 +485,7 @@ impl LazyRegex { /// Execute a function with the compiled regex DFAs as parameter. pub fn with_compiled<T, F>(&self, f: F) -> Option<T> where - F: FnMut(&RegexSearch) -> T, + F: FnMut(&mut RegexSearch) -> T, { self.0.borrow_mut().compiled().map(f) } diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -514,7 +514,7 @@ impl LazyRegexVariant { /// /// If the regex is not already compiled, this will compile the DFAs and store them for future /// access. - fn compiled(&mut self) -> Option<&RegexSearch> { + fn compiled(&mut self) -> Option<&mut RegexSearch> { // Check if the regex has already been compiled. let regex = match self { Self::Compiled(regex_search) => return Some(regex_search), diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -41,7 +41,7 @@ impl<'a> RenderableContent<'a> { config: &'a UiConfig, display: &'a mut Display, term: &'a Term<T>, - search_state: &'a SearchState, + search_state: &'a mut SearchState, ) -> Self { let search = search_state.dfas().map(|dfas| HintMatches::visible_regex_matches(term, dfas)); let focused_match = search_state.focused_match(); diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -486,7 +486,7 @@ impl<'a> HintMatches<'a> { } /// Create from regex matches on term visable part. - fn visible_regex_matches<T>(term: &Term<T>, dfas: &RegexSearch) -> Self { + fn visible_regex_matches<T>(term: &Term<T>, dfas: &mut RegexSearch) -> Self { let matches = hint::visible_regex_match_iter(term, dfas).collect::<Vec<_>>(); Self::new(matches) } diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -90,7 +90,8 @@ impl HintState { // Apply post-processing and search for sub-matches if necessary. if hint.post_processing { - self.matches.extend(matches.flat_map(|rm| { + let mut matches = matches.collect::<Vec<_>>(); + self.matches.extend(matches.drain(..).flat_map(|rm| { HintPostProcessor::new(term, regex, rm).collect::<Vec<_>>() })); } else { diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -289,7 +290,7 @@ impl HintLabels { /// Iterate over all visible regex matches. pub fn visible_regex_match_iter<'a, T>( term: &'a Term<T>, - regex: &'a RegexSearch, + regex: &'a mut RegexSearch, ) -> impl Iterator<Item = Match> + 'a { let viewport_start = Line(-(term.grid().display_offset() as i32)); let viewport_end = viewport_start + term.bottommost_line(); diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -344,7 +345,7 @@ pub fn visible_unique_hyperlinks_iter<T>(term: &Term<T>) -> impl Iterator<Item = fn regex_match_at<T>( term: &Term<T>, point: Point, - regex: &RegexSearch, + regex: &mut RegexSearch, post_processing: bool, ) -> Option<Match> { let regex_match = visible_regex_match_iter(term, regex).find(|rm| rm.contains(&point))?; diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -450,7 +451,7 @@ fn hyperlink_at<T>(term: &Term<T>, point: Point) -> Option<(Hyperlink, Match)> { /// Iterator over all post-processed matches inside an existing hint match. struct HintPostProcessor<'a, T> { /// Regex search DFAs. - regex: &'a RegexSearch, + regex: &'a mut RegexSearch, /// Terminal reference. term: &'a Term<T>, diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -467,7 +468,7 @@ struct HintPostProcessor<'a, T> { impl<'a, T> HintPostProcessor<'a, T> { /// Create a new iterator for an unprocessed match. - fn new(term: &'a Term<T>, regex: &'a RegexSearch, regex_match: Match) -> Self { + fn new(term: &'a Term<T>, regex: &'a mut RegexSearch, regex_match: Match) -> Self { let mut post_processor = Self { next_match: None, start: *regex_match.start(), diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -759,7 +759,7 @@ impl Display { scheduler: &mut Scheduler, message_buffer: &MessageBuffer, config: &UiConfig, - search_state: &SearchState, + search_state: &mut SearchState, ) { // Collect renderable content before the terminal is dropped. let mut content = RenderableContent::new(config, self, &terminal, search_state); diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -154,8 +154,8 @@ impl SearchState { } /// Active search dfas. - pub fn dfas(&self) -> Option<&RegexSearch> { - self.dfas.as_ref() + pub fn dfas(&mut self) -> Option<&mut RegexSearch> { + self.dfas.as_mut() } /// Search regex text if a search is active. diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -637,7 +637,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon fn search_next(&mut self, origin: Point, direction: Direction, side: Side) -> Option<Match> { self.search_state .dfas - .as_ref() + .as_mut() .and_then(|dfas| self.terminal.search_next(dfas, origin, direction, side, None)) } diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -913,7 +913,7 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> { /// Jump to the first regex match from the search origin. fn goto_match(&mut self, mut limit: Option<usize>) { - let dfas = match &self.search_state.dfas { + let dfas = match &mut self.search_state.dfas { Some(dfas) => dfas, None => return, }; diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -398,7 +398,7 @@ impl WindowContext { scheduler, &self.message_buffer, &self.config, - &self.search_state, + &mut self.search_state, ); } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -1,10 +1,11 @@ use std::cmp::max; +use std::error::Error; use std::mem; use std::ops::RangeInclusive; -pub use regex_automata::dfa::dense::BuildError; -use regex_automata::dfa::dense::{Builder, Config, DFA}; -use regex_automata::dfa::Automaton; +use log::{debug, warn}; +use regex_automata::hybrid::dfa::{Builder, Cache, Config, DFA}; +pub use regex_automata::hybrid::BuildError; use regex_automata::nfa::thompson::Config as ThompsonConfig; use regex_automata::util::syntax::Config as SyntaxConfig; use regex_automata::{Anchored, Input}; diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -17,38 +18,59 @@ use crate::term::Term; /// Used to match equal brackets, when performing a bracket-pair selection. const BRACKET_PAIRS: [(char, char); 4] = [('(', ')'), ('[', ']'), ('{', '}'), ('<', '>')]; -/// Maximum DFA size to prevent pathological regexes taking down the entire system. -const MAX_DFA_SIZE: usize = 100_000_000; - pub type Match = RangeInclusive<Point>; /// Terminal regex search state. #[derive(Clone, Debug)] pub struct RegexSearch { - dfa: DFA<Vec<u32>>, - rdfa: DFA<Vec<u32>>, + fdfa: LazyDfa, + rdfa: LazyDfa, } impl RegexSearch { /// Build the forward and backward search DFAs. pub fn new(search: &str) -> Result<RegexSearch, Box<BuildError>> { // Setup configs for both DFA directions. + // + // Bounds are based on Regex's meta engine: + // https://github.com/rust-lang/regex/blob/061ee815ef2c44101dba7b0b124600fcb03c1912/regex-automata/src/meta/wrappers.rs#L581-L599 let has_uppercase = search.chars().any(|c| c.is_uppercase()); let syntax_config = SyntaxConfig::new().case_insensitive(!has_uppercase); - let config = Config::new().dfa_size_limit(Some(MAX_DFA_SIZE)); + let config = + Config::new().minimum_cache_clear_count(Some(3)).minimum_bytes_per_state(Some(10)); + let max_size = config.get_cache_capacity(); + let mut thompson_config = ThompsonConfig::new().nfa_size_limit(Some(max_size)); // Create Regex DFA for left-to-right search. - let dfa = Builder::new().configure(config.clone()).syntax(syntax_config).build(search)?; + let fdfa = Builder::new() + .configure(config.clone()) + .syntax(syntax_config) + .thompson(thompson_config.clone()) + .build(search)?; // Create Regex DFA for right-to-left search. - let thompson_config = ThompsonConfig::new().reverse(true); + thompson_config = thompson_config.reverse(true); let rdfa = Builder::new() .configure(config) .syntax(syntax_config) .thompson(thompson_config) .build(search)?; - Ok(RegexSearch { dfa, rdfa }) + Ok(RegexSearch { fdfa: fdfa.into(), rdfa: rdfa.into() }) + } +} + +/// Runtime-evaluated DFA. +#[derive(Clone, Debug)] +struct LazyDfa { + dfa: DFA, + cache: Cache, +} + +impl From<DFA> for LazyDfa { + fn from(dfa: DFA) -> Self { + let cache = dfa.create_cache(); + Self { dfa, cache } } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -56,7 +78,7 @@ impl<T> Term<T> { /// Get next search match in the specified direction. pub fn search_next( &self, - regex: &RegexSearch, + regex: &mut RegexSearch, mut origin: Point, direction: Direction, side: Side, diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -75,7 +97,7 @@ impl<T> Term<T> { /// Find the next match to the right of the origin. fn next_match_right( &self, - regex: &RegexSearch, + regex: &mut RegexSearch, origin: Point, side: Side, max_lines: Option<usize>, diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -114,7 +136,7 @@ impl<T> Term<T> { /// Find the next match to the left of the origin. fn next_match_left( &self, - regex: &RegexSearch, + regex: &mut RegexSearch, origin: Point, side: Side, max_lines: Option<usize>, diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -163,14 +185,14 @@ impl<T> Term<T> { /// The origin is always included in the regex. pub fn regex_search_left( &self, - regex: &RegexSearch, + regex: &mut RegexSearch, start: Point, end: Point, ) -> Option<Match> { // Find start and end of match. - let match_start = self.regex_search(start, end, Direction::Left, false, &regex.rdfa)?; + let match_start = self.regex_search(start, end, Direction::Left, false, &mut regex.rdfa)?; let match_end = - self.regex_search(match_start, start, Direction::Right, true, &regex.dfa)?; + self.regex_search(match_start, start, Direction::Right, true, &mut regex.fdfa)?; Some(match_start..=match_end) } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -180,14 +202,14 @@ impl<T> Term<T> { /// The origin is always included in the regex. pub fn regex_search_right( &self, - regex: &RegexSearch, + regex: &mut RegexSearch, start: Point, end: Point, ) -> Option<Match> { // Find start and end of match. - let match_end = self.regex_search(start, end, Direction::Right, false, &regex.dfa)?; + let match_end = self.regex_search(start, end, Direction::Right, false, &mut regex.fdfa)?; let match_start = - self.regex_search(match_end, start, Direction::Left, true, &regex.rdfa)?; + self.regex_search(match_end, start, Direction::Left, true, &mut regex.rdfa)?; Some(match_start..=match_end) } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -201,8 +223,29 @@ impl<T> Term<T> { end: Point, direction: Direction, anchored: bool, - regex: &impl Automaton, + regex: &mut LazyDfa, ) -> Option<Point> { + match self.regex_search_internal(start, end, direction, anchored, regex) { + Ok(regex_match) => regex_match, + Err(err) => { + warn!("Regex exceeded complexity limit"); + debug!(" {err}"); + None + }, + } + } + + /// Find the next regex match. + /// + /// To automatically log regex complexity errors, use [`Self::regex_search`] instead. + fn regex_search_internal( + &self, + start: Point, + end: Point, + direction: Direction, + anchored: bool, + regex: &mut LazyDfa, + ) -> Result<Option<Point>, Box<dyn Error>> { let topmost_line = self.topmost_line(); let screen_lines = self.screen_lines() as i32; let last_column = self.last_column(); diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -216,8 +259,7 @@ impl<T> Term<T> { // Get start state for the DFA. let regex_anchored = if anchored { Anchored::Yes } else { Anchored::No }; let input = Input::new(&[]).anchored(regex_anchored); - let start_state = regex.start_state_forward(&input).unwrap(); - let mut state = start_state; + let mut state = regex.dfa.start_state_forward(&mut regex.cache, &input).unwrap(); let mut iter = self.grid.iter_from(start); let mut last_wrapped = false; diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -244,19 +286,18 @@ impl<T> Term<T> { Direction::Left => buf[utf8_len - i - 1], }; - // Since we get the state from the DFA, it doesn't need to be checked. - state = unsafe { regex.next_state_unchecked(state, byte) }; + state = regex.dfa.next_state(&mut regex.cache, state, byte)?; // Matches require one additional BYTE of lookahead, so we check the match state for // the first byte of every new character to determine if the last character was a // match. - if i == 0 && regex.is_match_state(state) { + if i == 0 && state.is_match() { regex_match = Some(last_point); } } // Abort on dead states. - if regex.is_dead_state(state) { + if state.is_dead() { break; } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -264,8 +305,8 @@ impl<T> Term<T> { if point == end || done { // When reaching the end-of-input, we need to notify the parser that no look-ahead // is possible and check if the current state is still a match. - state = regex.next_eoi_state(state); - if regex.is_match_state(state) { + state = regex.dfa.next_eoi_state(&mut regex.cache, state)?; + if state.is_match() { regex_match = Some(point); } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -303,12 +344,12 @@ impl<T> Term<T> { None => { // When reaching the end-of-input, we need to notify the parser that no // look-ahead is possible and check if the current state is still a match. - state = regex.next_eoi_state(state); - if regex.is_match_state(state) { + state = regex.dfa.next_eoi_state(&mut regex.cache, state)?; + if state.is_match() { regex_match = Some(last_point); } - state = start_state; + state = regex.dfa.start_state_forward(&mut regex.cache, &input)?; }, } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -316,7 +357,7 @@ impl<T> Term<T> { last_wrapped = wrapped; } - regex_match + Ok(regex_match) } /// Advance a grid iterator over fullwidth characters. diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -478,7 +519,7 @@ pub struct RegexIter<'a, T> { point: Point, end: Point, direction: Direction, - regex: &'a RegexSearch, + regex: &'a mut RegexSearch, term: &'a Term<T>, done: bool, } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -489,7 +530,7 @@ impl<'a, T> RegexIter<'a, T> { end: Point, direction: Direction, term: &'a Term<T>, - regex: &'a RegexSearch, + regex: &'a mut RegexSearch, ) -> Self { Self { point: start, done: false, end, direction, term, regex } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -505,7 +546,7 @@ impl<'a, T> RegexIter<'a, T> { } /// Get the next match in the specified direction. - fn next_match(&self) -> Option<Match> { + fn next_match(&mut self) -> Option<Match> { match self.direction { Direction::Right => self.term.regex_search_right(self.regex, self.point, self.end), Direction::Left => self.term.regex_search_left(self.regex, self.point, self.end),
alacritty__alacritty-7204
7,204
Going to remove high priority from this since it shouldn't cause complete destruction anymore. But I still think we can probably do better. Potentially a lazily evaluated regex might perform more reasonably.
[ "7097" ]
1.65
alacritty/alacritty
2023-09-09T05:15:52Z
diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -578,8 +578,8 @@ mod tests { "ftp://ftp.example.org", ] { let term = mock_term(regular_url); - let regex = RegexSearch::new(URL_REGEX).unwrap(); - let matches = visible_regex_match_iter(&term, &regex).collect::<Vec<_>>(); + let mut regex = RegexSearch::new(URL_REGEX).unwrap(); + let matches = visible_regex_match_iter(&term, &mut regex).collect::<Vec<_>>(); assert_eq!( matches.len(), 1, diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -599,8 +599,8 @@ mod tests { "mailto:", ] { let term = mock_term(url_like); - let regex = RegexSearch::new(URL_REGEX).unwrap(); - let matches = visible_regex_match_iter(&term, &regex).collect::<Vec<_>>(); + let mut regex = RegexSearch::new(URL_REGEX).unwrap(); + let matches = visible_regex_match_iter(&term, &mut regex).collect::<Vec<_>>(); assert!( matches.is_empty(), "Should not match url in string {url_like}, but instead got: {matches:?}" diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -638,11 +639,11 @@ mod tests { fn closed_bracket_does_not_result_in_infinite_iterator() { let term = mock_term(" ) "); - let search = RegexSearch::new("[^/ ]").unwrap(); + let mut search = RegexSearch::new("[^/ ]").unwrap(); let count = HintPostProcessor::new( &term, - &search, + &mut search, Point::new(Line(0), Column(1))..=Point::new(Line(0), Column(1)), ) .take(1) diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -694,9 +695,9 @@ mod tests { // The Term returned from this call will have a viewport starting at 0 and ending at 4096. // That's good enough for this test, since it only cares about visible content. let term = mock_term(&content); - let regex = RegexSearch::new("match!").unwrap(); + let mut regex = RegexSearch::new("match!").unwrap(); // The interator should match everything in the viewport. - assert_eq!(visible_regex_match_iter(&term, &regex).count(), 4096); + assert_eq!(visible_regex_match_iter(&term, &mut regex).count(), 4096); } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -561,12 +602,12 @@ mod tests { "); // Check regex across wrapped and unwrapped lines. - let regex = RegexSearch::new("Ala.*123").unwrap(); + let mut regex = RegexSearch::new("Ala.*123").unwrap(); let start = Point::new(Line(1), Column(0)); let end = Point::new(Line(4), Column(2)); let match_start = Point::new(Line(1), Column(0)); let match_end = Point::new(Line(2), Column(2)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -581,12 +622,12 @@ mod tests { "); // Check regex across wrapped and unwrapped lines. - let regex = RegexSearch::new("Ala.*123").unwrap(); + let mut regex = RegexSearch::new("Ala.*123").unwrap(); let start = Point::new(Line(4), Column(2)); let end = Point::new(Line(1), Column(0)); let match_start = Point::new(Line(1), Column(0)); let match_end = Point::new(Line(2), Column(2)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -598,16 +639,16 @@ mod tests { "); // Greedy stopped at linebreak. - let regex = RegexSearch::new("Ala.*critty").unwrap(); + let mut regex = RegexSearch::new("Ala.*critty").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(25)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); // Greedy stopped at dead state. - let regex = RegexSearch::new("Ala[^y]*critty").unwrap(); + let mut regex = RegexSearch::new("Ala[^y]*critty").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(15)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -619,10 +660,10 @@ mod tests { third\ "); - let regex = RegexSearch::new("nothing").unwrap(); + let mut regex = RegexSearch::new("nothing").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(2), Column(4)); - assert_eq!(term.regex_search_right(&regex, start, end), None); + assert_eq!(term.regex_search_right(&mut regex, start, end), None); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -634,10 +675,10 @@ mod tests { third\ "); - let regex = RegexSearch::new("nothing").unwrap(); + let mut regex = RegexSearch::new("nothing").unwrap(); let start = Point::new(Line(2), Column(4)); let end = Point::new(Line(0), Column(0)); - assert_eq!(term.regex_search_left(&regex, start, end), None); + assert_eq!(term.regex_search_left(&mut regex, start, end), None); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -649,12 +690,12 @@ mod tests { "); // Make sure the cell containing the linebreak is not skipped. - let regex = RegexSearch::new("te.*123").unwrap(); + let mut regex = RegexSearch::new("te.*123").unwrap(); let start = Point::new(Line(1), Column(0)); let end = Point::new(Line(0), Column(0)); let match_start = Point::new(Line(0), Column(0)); let match_end = Point::new(Line(0), Column(9)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -666,11 +707,11 @@ mod tests { "); // Make sure the cell containing the linebreak is not skipped. - let regex = RegexSearch::new("te.*123").unwrap(); + let mut regex = RegexSearch::new("te.*123").unwrap(); let start = Point::new(Line(0), Column(2)); let end = Point::new(Line(1), Column(9)); let match_start = Point::new(Line(1), Column(0)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -678,10 +719,10 @@ mod tests { let term = mock_term("alacritty"); // Make sure dead state cell is skipped when reversing. - let regex = RegexSearch::new("alacrit").unwrap(); + let mut regex = RegexSearch::new("alacrit").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(6)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -689,68 +730,68 @@ mod tests { let term = mock_term("zooo lense"); // Make sure the reverse DFA operates the same as a forward DFA. - let regex = RegexSearch::new("zoo").unwrap(); + let mut regex = RegexSearch::new("zoo").unwrap(); let start = Point::new(Line(0), Column(9)); let end = Point::new(Line(0), Column(0)); let match_start = Point::new(Line(0), Column(0)); let match_end = Point::new(Line(0), Column(2)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); } #[test] fn multibyte_unicode() { let term = mock_term("testвосибing"); - let regex = RegexSearch::new("te.*ing").unwrap(); + let mut regex = RegexSearch::new("te.*ing").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(11)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); - let regex = RegexSearch::new("te.*ing").unwrap(); + let mut regex = RegexSearch::new("te.*ing").unwrap(); let start = Point::new(Line(0), Column(11)); let end = Point::new(Line(0), Column(0)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(end..=start)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=start)); } #[test] fn end_on_multibyte_unicode() { let term = mock_term("testвосиб"); - let regex = RegexSearch::new("te.*и").unwrap(); + let mut regex = RegexSearch::new("te.*и").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(8)); let match_end = Point::new(Line(0), Column(7)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=match_end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=match_end)); } #[test] fn fullwidth() { let term = mock_term("a🦇x🦇"); - let regex = RegexSearch::new("[^ ]*").unwrap(); + let mut regex = RegexSearch::new("[^ ]*").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(5)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); - let regex = RegexSearch::new("[^ ]*").unwrap(); + let mut regex = RegexSearch::new("[^ ]*").unwrap(); let start = Point::new(Line(0), Column(5)); let end = Point::new(Line(0), Column(0)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(end..=start)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=start)); } #[test] fn singlecell_fullwidth() { let term = mock_term("🦇"); - let regex = RegexSearch::new("🦇").unwrap(); + let mut regex = RegexSearch::new("🦇").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(1)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=end)); - let regex = RegexSearch::new("🦇").unwrap(); + let mut regex = RegexSearch::new("🦇").unwrap(); let start = Point::new(Line(0), Column(1)); let end = Point::new(Line(0), Column(0)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(end..=start)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=start)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -761,16 +802,16 @@ mod tests { let end = Point::new(Line(0), Column(4)); // Ensure ending without a match doesn't loop indefinitely. - let regex = RegexSearch::new("x").unwrap(); - assert_eq!(term.regex_search_right(&regex, start, end), None); + let mut regex = RegexSearch::new("x").unwrap(); + assert_eq!(term.regex_search_right(&mut regex, start, end), None); - let regex = RegexSearch::new("x").unwrap(); + let mut regex = RegexSearch::new("x").unwrap(); let match_end = Point::new(Line(0), Column(5)); - assert_eq!(term.regex_search_right(&regex, start, match_end), None); + assert_eq!(term.regex_search_right(&mut regex, start, match_end), None); // Ensure match is captured when only partially inside range. - let regex = RegexSearch::new("jarr🦇").unwrap(); - assert_eq!(term.regex_search_right(&regex, start, end), Some(start..=match_end)); + let mut regex = RegexSearch::new("jarr🦇").unwrap(); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(start..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -781,17 +822,17 @@ mod tests { xxx\ "); - let regex = RegexSearch::new("xxx").unwrap(); + let mut regex = RegexSearch::new("xxx").unwrap(); let start = Point::new(Line(0), Column(2)); let end = Point::new(Line(1), Column(2)); let match_start = Point::new(Line(1), Column(0)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=end)); - let regex = RegexSearch::new("xxx").unwrap(); + let mut regex = RegexSearch::new("xxx").unwrap(); let start = Point::new(Line(1), Column(0)); let end = Point::new(Line(0), Column(0)); let match_end = Point::new(Line(0), Column(2)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(end..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(end..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -802,19 +843,19 @@ mod tests { xx🦇\ "); - let regex = RegexSearch::new("🦇x").unwrap(); + let mut regex = RegexSearch::new("🦇x").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(1), Column(3)); let match_start = Point::new(Line(0), Column(0)); let match_end = Point::new(Line(0), Column(2)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end)); - let regex = RegexSearch::new("x🦇").unwrap(); + let mut regex = RegexSearch::new("x🦇").unwrap(); let start = Point::new(Line(1), Column(2)); let end = Point::new(Line(0), Column(0)); let match_start = Point::new(Line(1), Column(1)); let match_end = Point::new(Line(1), Column(3)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -826,33 +867,33 @@ mod tests { "); term.grid[Line(0)][Column(3)].flags.insert(Flags::LEADING_WIDE_CHAR_SPACER); - let regex = RegexSearch::new("🦇x").unwrap(); + let mut regex = RegexSearch::new("🦇x").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(1), Column(3)); let match_start = Point::new(Line(0), Column(3)); let match_end = Point::new(Line(1), Column(2)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end)); - let regex = RegexSearch::new("🦇x").unwrap(); + let mut regex = RegexSearch::new("🦇x").unwrap(); let start = Point::new(Line(1), Column(3)); let end = Point::new(Line(0), Column(0)); let match_start = Point::new(Line(0), Column(3)); let match_end = Point::new(Line(1), Column(2)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); - let regex = RegexSearch::new("x🦇").unwrap(); + let mut regex = RegexSearch::new("x🦇").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(1), Column(3)); let match_start = Point::new(Line(0), Column(2)); let match_end = Point::new(Line(1), Column(1)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end)); - let regex = RegexSearch::new("x🦇").unwrap(); + let mut regex = RegexSearch::new("x🦇").unwrap(); let start = Point::new(Line(1), Column(3)); let end = Point::new(Line(0), Column(0)); let match_start = Point::new(Line(0), Column(2)); let match_end = Point::new(Line(1), Column(1)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); } #[test] diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -863,12 +904,12 @@ mod tests { term.grid[Line(0)][Column(1)].c = '字'; term.grid[Line(0)][Column(1)].flags = Flags::WIDE_CHAR; - let regex = RegexSearch::new("test").unwrap(); + let mut regex = RegexSearch::new("test").unwrap(); let start = Point::new(Line(0), Column(0)); let end = Point::new(Line(0), Column(1)); - let mut iter = RegexIter::new(start, end, Direction::Right, &term, &regex); + let mut iter = RegexIter::new(start, end, Direction::Right, &term, &mut regex); assert_eq!(iter.next(), None); } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -881,19 +922,34 @@ mod tests { "); // Bottom to top. - let regex = RegexSearch::new("abc").unwrap(); + let mut regex = RegexSearch::new("abc").unwrap(); let start = Point::new(Line(1), Column(0)); let end = Point::new(Line(0), Column(2)); let match_start = Point::new(Line(0), Column(0)); let match_end = Point::new(Line(0), Column(2)); - assert_eq!(term.regex_search_right(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_right(&mut regex, start, end), Some(match_start..=match_end)); // Top to bottom. - let regex = RegexSearch::new("def").unwrap(); + let mut regex = RegexSearch::new("def").unwrap(); let start = Point::new(Line(0), Column(2)); let end = Point::new(Line(1), Column(0)); let match_start = Point::new(Line(1), Column(0)); let match_end = Point::new(Line(1), Column(2)); - assert_eq!(term.regex_search_left(&regex, start, end), Some(match_start..=match_end)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); + } + + #[test] + fn nfa_compile_error() { + assert!(RegexSearch::new("[0-9A-Za-z]{9999999}").is_err()); + } + + #[test] + fn runtime_cache_error() { + let term = mock_term(&str::repeat("i", 9999)); + + let mut regex = RegexSearch::new("[0-9A-Za-z]{9999}").unwrap(); + let start = Point::new(Line(0), Column(0)); + let end = Point::new(Line(0), Column(9999)); + assert_eq!(term.regex_search_right(&mut regex, start, end), None); } }
Hint regex with large chars amount. Hanging and continues memory consumption ### Problem With the `Qm[0-9A-Za-z]{44}` as a hint regex pattern, Alacritty hangs upon activating Hints and memory consumption starts to growth continuously. ```yml # ... rest of the config hints: enabled: - regex: 'Qm[0-9A-Za-z]{44}' action: Copy binding: key: U mods: Control|Shift ``` But no issues with `sha256:([0-9a-f]{64})` pattern. ```yml # ... rest of the config hints: enabled: - regex: 'sha256:([0-9a-f]{64})' action: Copy binding: key: U mods: Control|Shift ``` No any hangs, hints highlighted almost immediately ### System Version: 0.12.2 OS: Ubuntu 20.04 Compositor: compton WM: xmonad ### Logs Crashes: NONE Font/Terminal size: [screenshot](https://github.com/alacritty/alacritty/assets/29537473/e70f66a4-9ef0-4e26-b012-0c8c985db0b0) Keyboard and bindings: After activating Hints with the mentioned pattern Alacritty hangs and stops reporting any events with `--report-events` option
77aa9f42bac4377efe26512d71098d21b9b547fd
[ "term::search::tests::runtime_cache_error" ]
[ "grid::storage::tests::indexing", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::rotate", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::storage::tests::grow_before_zero", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::shrink_reflow_disabled", "grid::storage::tests::grow_after_zero", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::shrink_reflow_twice", "index::tests::add", "index::tests::add_clamp", "grid::tests::test_iter", "grid::storage::tests::initialize", "index::tests::add_none_clamp", "grid::tests::shrink_reflow", "index::tests::add_wrap", "index::tests::add_grid_clamp", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_clamp", "grid::tests::scroll_down_with_history", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::range_intersection", "selection::tests::line_selection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::simple_is_empty", "selection::tests::semantic_selection", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::cell_size_is_below_cap", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::search::tests::no_match_left", "term::search::tests::no_match_right", "term::search::tests::end_on_fullwidth", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::leading_spacer", "term::search::tests::singlecell_fullwidth", "term::search::tests::include_linebreak_right", "term::search::tests::include_linebreak_left", "term::search::tests::end_on_multibyte_unicode", "term::search::tests::regex_left", "term::search::tests::skip_dead_cell", "term::tests::block_selection_works", "term::search::tests::wrap_around_to_another_end", "term::search::tests::wrapping", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::regex_right", "term::tests::damage_cursor_movements", "term::tests::damage_public_usage", "term::search::tests::fullwidth", "term::tests::clearing_scrollback_resets_display_offset", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::tests::clearing_viewport_keeps_history_position", "term::search::tests::multibyte_unicode", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::search::tests::wide_without_spacer", "term::tests::input_line_drawing_character", "term::tests::parse_cargo_version", "term::tests::line_selection_works", "term::tests::clear_saved_lines", "term::tests::semantic_selection_works", "term::tests::simple_selection_works", "term::tests::scroll_display_page_up", "term::tests::scroll_display_page_down", "term::search::tests::nested_regex", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_first_occupied", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "term::tests::window_title", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_semantic", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_simple", "vi_mode::tests::scroll_word", "term::tests::shrink_lines_updates_inactive_cursor_pos", "vi_mode::tests::motion_word", "term::tests::full_damage", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::tests::grid_serde", "term::search::tests::nfa_compile_error", "clear_underline", "decaln_reset", "delete_chars_reset", "fish_cc", "deccolm_reset", "erase_chars_reset", "csi_rep", "erase_in_line", "alt_reset", "delete_lines", "colored_underline", "indexed_256_colors", "insert_blank_reset", "ll", "selective_erasure", "colored_reset", "issue_855", "hyperlinks", "newline_with_cursor_beyond_scroll_region", "scroll_up_reset", "saved_cursor", "saved_cursor_alt", "tmux_git_log", "region_scroll_down", "tmux_htop", "vim_simple_edit", "tab_rendering", "sgr", "vttest_cursor_movement_1", "vttest_insert", "underline", "vttest_tab_clear_set", "grid_reset", "vttest_origin_mode_2", "wrapline_alt_toggle", "zsh_tab_completion", "vttest_scroll", "vttest_origin_mode_1", "zerowidth", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2158)" ]
[]
[]
2023-09-17T11:59:29Z
437f42f8d30fb6d4843738fbd46bb801679443a7
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Strip trailing whitespaces when yanking from a block selection - Display area keeps history position when viewport is cleared - Commands spawn from the current directory of the foreground shell in Unix-like systems +- Remove trailing newline from strings taken from hints or simple/semantic selections ### Fixed diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -17,7 +17,7 @@ use crate::config::Config; use crate::event::{Event, EventListener}; use crate::grid::{Dimensions, Grid, GridIterator, Scroll}; use crate::index::{self, Boundary, Column, Direction, Line, Point, Side}; -use crate::selection::{Selection, SelectionRange}; +use crate::selection::{Selection, SelectionRange, SelectionType}; use crate::term::cell::{Cell, Flags, LineLength}; use crate::term::color::{Colors, Rgb}; use crate::vi_mode::{ViModeCursor, ViMotion}; diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -348,24 +348,30 @@ impl<T> Term<T> { /// Convert the active selection to a String. pub fn selection_to_string(&self) -> Option<String> { let selection_range = self.selection.as_ref().and_then(|s| s.to_range(self))?; - let SelectionRange { start, end, is_block } = selection_range; + let SelectionRange { start, end, .. } = selection_range; let mut res = String::new(); - if is_block { - for line in (start.line.0..end.line.0).map(Line::from) { - res += self - .line_to_string(line, start.column..end.column, start.column.0 != 0) - .trim_end(); - - // If the last column is included, newline is appended automatically. - if end.column != self.columns() - 1 { - res += "\n"; + match self.selection.as_ref() { + Some(Selection { ty: SelectionType::Block, .. }) => { + for line in (start.line.0..end.line.0).map(Line::from) { + res += self + .line_to_string(line, start.column..end.column, start.column.0 != 0) + .trim_end(); + + // If the last column is included, newline is appended automatically. + if end.column != self.columns() - 1 { + res += "\n"; + } } - } - res += self.line_to_string(end.line, start.column..end.column, true).trim_end(); - } else { - res = self.bounds_to_string(start, end); + res += self.line_to_string(end.line, start.column..end.column, true).trim_end(); + }, + Some(Selection { ty: SelectionType::Lines, .. }) => { + res = self.bounds_to_string(start, end) + "\n"; + }, + _ => { + res = self.bounds_to_string(start, end); + }, } Some(res) diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -382,7 +388,7 @@ impl<T> Term<T> { res += &self.line_to_string(line, start_col..end_col, line == end.line); } - res + res.strip_suffix('\n').map(str::to_owned).unwrap_or(res) } /// Convert a single line in the grid to a String.
alacritty__alacritty-5722
5,722
It does not, please provide more information on how to reproduce this. see https://www.loom.com/share/79882dd3fbc241ff9ac41fa3b922fcdc when the url length same as screen width , the "%A" will add Interesting, that's kinda what I suspected but I'm not able to reproduce it. Which version of Alacritty are you using? Can you maybe try the latest master?
[ "5697" ]
1.56
alacritty/alacritty
2021-12-27T13:59:53Z
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -2103,7 +2109,7 @@ mod tests { ); selection.update(Point { line: Line(2), column: Column(2) }, Side::Right); term.selection = Some(selection); - assert_eq!(term.selection_to_string(), Some("aaa\n\naaa\n".into())); + assert_eq!(term.selection_to_string(), Some("aaa\n\naaa".into())); } /// Check that the grid can be serialized back and forth losslessly.
macos click url add "%0A" (newline) macos click url add "%0A" (newline) ![image](https://user-images.githubusercontent.com/69608605/146624855-028d482f-d02c-46f4-8794-776925c62dd8.png) ![image](https://user-images.githubusercontent.com/69608605/146624863-084a3886-cbce-4dff-bd71-61af8150a8ca.png) click this add "%0A" ``` https://open-erp.meituan.com/batchBinding/preBinding?businessId=30&charset=utf-8&timestamp=1639791432156&state=test&developerId=106416&sign=52f350b7fd4a78049d0c0784b4717cfc80a395f7 [nodemon] clean exit - waiting for changes before restart ```
589c1e9c6b8830625162af14a9a7aee32c7aade0
[ "term::tests::selecting_empty_line" ]
[ "ansi::tests::parse_designate_g0_as_line_drawing", "ansi::tests::parse_invalid_legacy_rgb_colors", "ansi::tests::parse_control_attribute", "ansi::tests::parse_designate_g1_as_line_drawing_and_invoke", "ansi::tests::parse_invalid_number", "ansi::tests::parse_invalid_rgb_colors", "ansi::tests::parse_number_too_large", "ansi::tests::parse_terminal_identity_csi", "ansi::tests::parse_terminal_identity_esc", "ansi::tests::parse_truecolor_attr", "ansi::tests::parse_valid_legacy_rgb_colors", "ansi::tests::parse_valid_number", "ansi::tests::parse_valid_rgb_colors", "ansi::tests::parse_zsh_startup", "grid::storage::tests::indexing", "grid::storage::tests::grow_after_zero", "grid::storage::tests::rotate", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::grow_before_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::with_capacity", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::initialize", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::scroll_down_with_history", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::shrink_reflow_twice", "grid::tests::test_iter", "index::tests::add", "index::tests::add_clamp", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_clamp", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::color::tests::contrast", "term::tests::line_selection_works", "term::tests::input_line_drawing_character", "term::tests::semantic_selection_works", "term::tests::parse_cargo_version", "tty::unix::test_get_pw_entry", "term::search::tests::include_linebreak_left", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_left_end", "term::search::tests::fullwidth", "term::search::tests::leading_spacer", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_simple", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_word", "term::tests::window_title", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "term::tests::clearing_viewport_keeps_history_position", "term::tests::scroll_display_page_up", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::tests::scroll_display_page_down", "term::tests::clearing_scrollback_resets_display_offset", "term::tests::clear_saved_lines", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "vi_mode::tests::scroll_semantic", "term::tests::grid_serde", "term::search::tests::include_linebreak_right", "vi_mode::tests::scroll_word", "vi_mode::tests::scroll_simple", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_over_bottom", "term::search::tests::multibyte_unicode", "term::search::tests::no_match_right", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::no_match_left", "term::search::tests::wrap_around_to_another_end", "term::search::tests::skip_dead_cell", "term::search::tests::regex_left", "term::search::tests::wrapping", "term::search::tests::nested_regex", "term::search::tests::wide_without_spacer", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::singlecell_fullwidth", "term::search::tests::regex_right", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "selective_erasure", "clear_underline", "alt_reset", "decaln_reset", "csi_rep", "delete_chars_reset", "insert_blank_reset", "deccolm_reset", "fish_cc", "issue_855", "newline_with_cursor_beyond_scroll_region", "delete_lines", "indexed_256_colors", "ll", "erase_chars_reset", "saved_cursor", "vttest_origin_mode_2", "vttest_origin_mode_1", "zsh_tab_completion", "vttest_scroll", "tmux_git_log", "colored_reset", "vttest_cursor_movement_1", "scroll_up_reset", "tmux_htop", "vttest_tab_clear_set", "saved_cursor_alt", "vttest_insert", "vim_simple_edit", "underline", "wrapline_alt_toggle", "zerowidth", "sgr", "tab_rendering", "region_scroll_down", "grid_reset", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset" ]
[]
[]
2022-01-05T22:34:38Z
7e736c00f68ca133ca3380c1ddd78ba61ced1f8e
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Crash when hovering over a match emptied by post-processing - Crash when the vi cursor is on the scrollback and viewport clear is invoked - Freeze when the vi cursor is on the scrollback and scrollback clear is invoked +- Vi cursor on topmost of the display moving downward when scrolled into history with active output ### Removed diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -587,6 +587,8 @@ impl<T> Term<T> { // Scroll selection. self.selection = self.selection.take().and_then(|s| s.rotate(self, &region, lines as i32)); + self.grid.scroll_up(&region, lines); + // Scroll vi mode cursor. let viewport_top = Line(-(self.grid.display_offset() as i32)); let top = if region.start == 0 { viewport_top } else { region.start }; diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -594,9 +596,6 @@ impl<T> Term<T> { if (top <= *line) && region.end > *line { *line = max(*line - lines, top); } - - // Scroll from origin to bottom less number of lines. - self.grid.scroll_up(&region, lines); } fn deccolm(&mut self)
alacritty__alacritty-5653
5,653
[ "5652" ]
0.1
alacritty/alacritty
2021-12-02T19:38:28Z
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -2190,6 +2189,26 @@ mod tests { assert_eq!(term.grid, scrolled_grid); } + #[test] + fn vi_cursor_keep_pos_on_scrollback_buffer() { + let size = SizeInfo::new(5., 10., 1.0, 1.0, 0.0, 0.0, false); + let mut term = Term::new(&Config::default(), size, ()); + + // Create 11 lines of scrollback. + for _ in 0..20 { + term.newline(); + } + + // Enable vi mode. + term.toggle_vi_mode(); + + term.scroll_display(Scroll::Top); + term.vi_mode_cursor.point.line = Line(-11); + + term.linefeed(); + assert_eq!(term.vi_mode_cursor.point.line, Line(-12)); + } + #[test] fn grow_lines_updates_active_cursor_pos() { let mut size = SizeInfo::new(100.0, 10.0, 1.0, 1.0, 0.0, 0.0, false);
Vi cursor on topmost of the display moves downward when scrolled into history with active output ### Reproduction steps 1. Create a scrollback buffer(history). ```sh $ seq $LINES ``` 2. Run a repeated output command. ```sh $ ( declare -i n=0; while (( 1 )); do echo "$n"; n+=1; sleep 1; done ) ``` 3. Enable vi mode. 4. Move the vi cursor to topmost of the scrollback buffer or topmost of the display area on scrollback buffer. This is a movie in which I run steps above. https://user-images.githubusercontent.com/12132068/144487691-b3bcdd3f-2a64-4944-bfa9-a0dd184a73ec.mp4 ### System OS: Linux Version: alacritty 0.10.0-dev (8681f710) Linux/BSD: X11/Wayland, Xmonad
2c78d216ca2934595b0b56464fb84048cd979c8d
[ "term::tests::vi_cursor_keep_pos_on_scrollback_buffer" ]
[ "ansi::tests::parse_invalid_legacy_rgb_colors", "ansi::tests::parse_control_attribute", "ansi::tests::parse_designate_g1_as_line_drawing_and_invoke", "ansi::tests::parse_designate_g0_as_line_drawing", "ansi::tests::parse_invalid_number", "ansi::tests::parse_invalid_rgb_colors", "ansi::tests::parse_number_too_large", "ansi::tests::parse_terminal_identity_csi", "ansi::tests::parse_terminal_identity_esc", "ansi::tests::parse_truecolor_attr", "ansi::tests::parse_valid_legacy_rgb_colors", "ansi::tests::parse_valid_number", "ansi::tests::parse_valid_rgb_colors", "ansi::tests::parse_zsh_startup", "grid::storage::tests::indexing", "grid::storage::tests::grow_before_zero", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::grow_after_zero", "grid::storage::tests::rotate", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::initialize", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::scroll_down_with_history", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_twice", "grid::tests::test_iter", "index::tests::add", "grid::tests::shrink_reflow_empty_cell_inside_line", "index::tests::add_clamp", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_grid_clamp", "index::tests::sub_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::color::tests::contrast", "term::tests::line_selection_works", "term::tests::parse_cargo_version", "term::tests::input_line_drawing_character", "term::tests::selecting_empty_line", "term::tests::semantic_selection_works", "term::search::tests::include_linebreak_left", "vi_mode::tests::motion_bracket", "term::search::tests::fullwidth", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_first_occupied", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_word", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_right_start", "term::search::tests::include_linebreak_right", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "term::search::tests::multibyte_unicode", "term::tests::scroll_display_page_up", "term::tests::scroll_display_page_down", "vi_mode::tests::word_wide", "term::tests::window_title", "term::tests::clear_viewport_set_vi_cursor_into_viewport", "term::tests::clear_scrollback_set_vi_cursor_into_viewport", "vi_mode::tests::scroll_semantic", "term::tests::grid_serde", "term::tests::clear_saved_lines", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_simple", "term::search::tests::leading_spacer", "term::search::tests::wrap_around_to_another_end", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::wide_without_spacer", "term::search::tests::skip_dead_cell", "term::search::tests::no_match_right", "term::search::tests::singlecell_fullwidth", "term::search::tests::regex_left", "term::search::tests::no_match_left", "term::search::tests::wrapping", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::regex_right", "vi_mode::tests::scroll_word", "term::search::tests::nested_regex", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "selective_erasure", "clear_underline", "alt_reset", "decaln_reset", "deccolm_reset", "fish_cc", "ll", "insert_blank_reset", "csi_rep", "issue_855", "newline_with_cursor_beyond_scroll_region", "delete_lines", "erase_chars_reset", "delete_chars_reset", "tmux_git_log", "indexed_256_colors", "vttest_origin_mode_1", "vttest_origin_mode_2", "colored_reset", "saved_cursor", "underline", "vttest_scroll", "zsh_tab_completion", "vttest_insert", "saved_cursor_alt", "scroll_up_reset", "vttest_tab_clear_set", "tmux_htop", "vttest_cursor_movement_1", "vim_simple_edit", "sgr", "wrapline_alt_toggle", "zerowidth", "region_scroll_down", "tab_rendering", "grid_reset", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset" ]
[]
[]
2021-12-04T03:38:46Z
4c6a763850a5dec0fa34d15e356dcba19875690a
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Vi mode search starting in the line below the vi cursor - Invisible cursor with matching foreground/background colors - Crash when hovering over a match emptied by post-processing +- Crash when the vi cursor is on the scrollback and viewport clear is invoked +- Freeze when the vi cursor is on the scrollback and scrollback clear is invoked ### Removed diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1424,6 +1424,9 @@ impl<T: EventListener> Handler for Term<T> { self.grid.reset_region(..); } else { self.grid.clear_viewport(); + + self.vi_mode_cursor.point.line = + self.vi_mode_cursor.point.line.grid_clamp(self, Boundary::Cursor); } self.selection = None; diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1431,6 +1434,9 @@ impl<T: EventListener> Handler for Term<T> { ansi::ClearMode::Saved if self.history_size() > 0 => { self.grid.clear_history(); + self.vi_mode_cursor.point.line = + self.vi_mode_cursor.point.line.grid_clamp(self, Boundary::Cursor); + self.selection = self.selection.take().filter(|s| !s.intersects_range(..Line(0))); }, // We have no history to clear.
alacritty__alacritty-5607
5,607
[ "5544" ]
0.1
alacritty/alacritty
2021-11-13T04:20:57Z
diff --git a/alacritty_terminal/src/grid/mod.rs b/alacritty_terminal/src/grid/mod.rs --- a/alacritty_terminal/src/grid/mod.rs +++ b/alacritty_terminal/src/grid/mod.rs @@ -376,6 +376,9 @@ impl<T> Grid<T> { pub fn clear_history(&mut self) { // Explicitly purge all lines from history. self.raw.shrink_lines(self.history_size()); + + // Reset display offset. + self.display_offset = 0; } /// This is used only for initializing after loading ref-tests. diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -2118,6 +2124,50 @@ mod tests { assert_eq!(term.grid()[cursor].c, '▒'); } + #[test] + fn clear_viewport_set_vi_cursor_into_viewport() { + let size = SizeInfo::new(10.0, 20.0, 1.0, 1.0, 0.0, 0.0, false); + let mut term = Term::new(&Config::default(), size, ()); + + // Create 10 lines of scrollback. + for _ in 0..29 { + term.newline(); + } + + // Change the display area and the vi cursor position. + term.scroll_display(Scroll::Top); + term.vi_mode_cursor.point = Point::new(Line(-5), Column(3)); + + // Clear the viewport. + term.clear_screen(ansi::ClearMode::All); + + assert_eq!(term.grid.display_offset(), 0); + assert_eq!(term.vi_mode_cursor.point.line.0, 0); + assert_eq!(term.vi_mode_cursor.point.column.0, 3); + } + + #[test] + fn clear_scrollback_set_vi_cursor_into_viewport() { + let size = SizeInfo::new(10.0, 20.0, 1.0, 1.0, 0.0, 0.0, false); + let mut term = Term::new(&Config::default(), size, ()); + + // Create 10 lines of scrollback. + for _ in 0..29 { + term.newline(); + } + + // Change the display area and the vi cursor position. + term.scroll_display(Scroll::Top); + term.vi_mode_cursor.point = Point::new(Line(-5), Column(3)); + + // Clear the scrollback buffer. + term.clear_screen(ansi::ClearMode::Saved); + + assert_eq!(term.grid.display_offset(), 0); + assert_eq!(term.vi_mode_cursor.point.line.0, 0); + assert_eq!(term.vi_mode_cursor.point.column.0, 3); + } + #[test] fn clear_saved_lines() { let size = SizeInfo::new(21.0, 51.0, 3.0, 3.0, 0.0, 0.0, false);
Alacritty crashes when in vi mode and terminal clears Alacritty panics when receiving any clear ansi escape code (tested with `^[[2J` and `^[c`) when in vi mode near the top of a long buffer with the following message: ``` thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', alacritty/src/display/content.rs:66:85 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` ### Steps to reproduce ```shell $ yes # output a few thousand lines of output (seems to only happen with large scrollback buffer) $ sleep 5; clear # Delay clearing long enough to enter vi mode and jump to top of scrollback # ctrl+space, g # wait for clear to execute ``` ### System OS: Linux 5.14.11-arch1-1 Version: alacritty 0.9.0 (fed349aa), alacritty 0.10.0-dev (f90dd12e) Linux/BSD: Swaywm ### Logs ``` [2021-10-14 17:39:13.785011895] [INFO ] [alacritty] Welcome to Alacritty [2021-10-14 17:39:13.785059625] [INFO ] [alacritty] Configuration files loaded from: "/home/alex/.config/alacritty/alacritty.yml" [2021-10-14 17:39:13.790835891] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Book, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-14 17:39:13.791264364] [DEBUG] [alacritty] Estimated DPR: 1 [2021-10-14 17:39:13.791274062] [DEBUG] [alacritty] Estimated window size: None [2021-10-14 17:39:13.791277589] [DEBUG] [alacritty] Estimated cell size: 9 x 18 [2021-10-14 17:39:13.811619986] [INFO ] [alacritty] Device pixel ratio: 1 [2021-10-14 17:39:13.814423501] [INFO ] [alacritty] Initializing glyph cache... [2021-10-14 17:39:13.814771643] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Book, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-14 17:39:13.815199295] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-14 17:39:13.815601028] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Oblique, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-14 17:39:13.816009643] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Oblique, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-14 17:39:13.819742710] [INFO ] [alacritty] ... finished initializing glyph cache in 0.005309871s [2021-10-14 17:39:13.819753019] [INFO ] [alacritty] Cell size: 9 x 18 [2021-10-14 17:39:13.819757918] [INFO ] [alacritty] Padding: 0 x 0 [2021-10-14 17:39:13.819762146] [INFO ] [alacritty] Width: 800, Height: 600 [2021-10-14 17:39:13.819959466] [INFO ] [alacritty] PTY dimensions: 33 x 88 [2021-10-14 17:39:13.821683588] [INFO ] [alacritty] Initialisation complete [2021-10-14 17:39:13.831748993] [DEBUG] [alacritty_terminal] New num_cols is 210 and num_lines is 28 [2021-10-14 17:39:13.831882413] [INFO ] [alacritty] Padding: 0 x 0 [2021-10-14 17:39:13.831894346] [INFO ] [alacritty] Width: 1897, Height: 511 [2021-10-14 17:39:13.851039870] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-14 17:39:25.154252793] [DEBUG] [alacritty_terminal] Term::resize dimensions unchanged [2021-10-14 17:39:25.154300102] [INFO ] [alacritty] Padding: 0 x 0 [2021-10-14 17:39:25.154312765] [INFO ] [alacritty] Width: 1897, Height: 511 thread 'main' panicked at 'index out of bounds: the len is 28 but the index is 9999', /build/alacritty/src/alacritty/alacritty_terminal/src/term/search.rs:422:16 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
2c78d216ca2934595b0b56464fb84048cd979c8d
[ "term::tests::clear_scrollback_set_vi_cursor_into_viewport", "term::tests::clear_viewport_set_vi_cursor_into_viewport" ]
[ "ansi::tests::parse_control_attribute", "ansi::tests::parse_designate_g1_as_line_drawing_and_invoke", "ansi::tests::parse_designate_g0_as_line_drawing", "ansi::tests::parse_invalid_legacy_rgb_colors", "ansi::tests::parse_invalid_number", "ansi::tests::parse_invalid_rgb_colors", "ansi::tests::parse_number_too_large", "ansi::tests::parse_terminal_identity_csi", "ansi::tests::parse_terminal_identity_esc", "ansi::tests::parse_truecolor_attr", "ansi::tests::parse_valid_legacy_rgb_colors", "ansi::tests::parse_valid_number", "ansi::tests::parse_valid_rgb_colors", "ansi::tests::parse_zsh_startup", "grid::storage::tests::indexing", "grid::storage::tests::grow_after_zero", "grid::storage::tests::grow_before_zero", "grid::storage::tests::initialize", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::scroll_down_with_history", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_twice", "grid::tests::test_iter", "index::tests::add", "index::tests::add_clamp", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_clamp", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::block_is_empty", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::color::tests::contrast", "term::tests::input_line_drawing_character", "term::tests::line_selection_works", "term::tests::parse_cargo_version", "term::tests::selecting_empty_line", "term::tests::semantic_selection_works", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_high_middle_low", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_word", "vi_mode::tests::motion_semantic_right_start", "term::search::tests::include_linebreak_left", "term::tests::window_title", "vi_mode::tests::semantic_wide", "term::search::tests::leading_spacer", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "term::tests::scroll_display_page_up", "term::tests::scroll_display_page_down", "term::search::tests::fullwidth", "vi_mode::tests::scroll_simple", "vi_mode::tests::scroll_word", "term::search::tests::wrap_around_to_another_end", "term::tests::grid_serde", "term::search::tests::include_linebreak_right", "term::tests::clear_saved_lines", "vi_mode::tests::scroll_semantic", "term::search::tests::no_match_right", "term::search::tests::wide_without_spacer", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::regex_right", "term::search::tests::regex_left", "vi_mode::tests::scroll_over_bottom", "term::search::tests::no_match_left", "term::search::tests::wrapping", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::singlecell_fullwidth", "term::search::tests::multibyte_unicode", "vi_mode::tests::scroll_over_top", "term::search::tests::skip_dead_cell", "term::search::tests::nested_regex", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "selective_erasure", "clear_underline", "csi_rep", "newline_with_cursor_beyond_scroll_region", "delete_chars_reset", "decaln_reset", "ll", "alt_reset", "deccolm_reset", "fish_cc", "indexed_256_colors", "erase_chars_reset", "issue_855", "delete_lines", "vim_simple_edit", "scroll_up_reset", "insert_blank_reset", "colored_reset", "vttest_scroll", "tmux_git_log", "zsh_tab_completion", "vttest_tab_clear_set", "tmux_htop", "vttest_cursor_movement_1", "vttest_insert", "saved_cursor", "vttest_origin_mode_2", "underline", "vttest_origin_mode_1", "saved_cursor_alt", "zerowidth", "wrapline_alt_toggle", "sgr", "tab_rendering", "region_scroll_down", "grid_reset", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset" ]
[]
[]
2021-12-03T07:45:06Z
40bbdce6de8775b7bbc3f9a5731337d1dd05d195
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,10 +34,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `SpawnNewInstance` no longer inherits initial `--command` - Blinking cursor will timeout after `5` seconds by default - Deprecated `colors.search.bar`, use `colors.footer_bar` instead +- On macOS, Alacritty now reads `AppleFontSmoothing` from user defaults to control font smoothing ### Fixed -- Creating the IPC socket failing if WAYLAND_DISPLAY contains an absolute path +- Creating the IPC socket failing if `WAYLAND_DISPLAY` contains an absolute path - Crash when resetting the terminal while in vi mode - `font.glyph_offset` not live reloading - Failure when running on 10-bit color system diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +51,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Window flickering on resize on Wayland - Unnecessary config reload when using `/dev/null` as a config file - Windows `Open Alacritty Here` on root of drive displaying error +- On macOS, `font.use_thin_strokes` did not work since Big Sur +- On macOS, trying to load a disabled font would crash + +### Removed + +- `font.use_thin_strokes` config field; to use thin strokes on macOS, set + `AppleFontSmoothing` to 0 with `$ defaults write -g AppleFontSmoothing -int 0` ## 0.10.1 diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -383,9 +383,9 @@ dependencies = [ [[package]] name = "crossfont" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1299695a4c6417b7e4a6957bd963478406e148b7b0351e2f2ce31296b0518251" +checksum = "f66b1c1979c4362323f03ab6bf7fb522902bfc418e0c37319ab347f9561d980f" dependencies = [ "cocoa", "core-foundation 0.9.3", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -397,6 +397,8 @@ dependencies = [ "freetype-rs", "libc", "log", + "objc", + "once_cell", "pkg-config", "servo-fontconfig", "winapi 0.3.9", diff --git a/alacritty.yml b/alacritty.yml --- a/alacritty.yml +++ b/alacritty.yml @@ -172,12 +172,6 @@ # x: 0 # y: 0 - # Thin stroke font rendering (macOS only) - # - # Thin strokes are suitable for retina displays, but for non-retina screens - # it is recommended to set `use_thin_strokes` to `false`. - #use_thin_strokes: true - # Use built-in font for box drawing characters. # # If `true`, Alacritty will use a custom built-in font for box drawing diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -28,7 +28,7 @@ serde_json = "1" glutin = { version = "0.28.0", default-features = false, features = ["serde"] } notify = "4" parking_lot = "0.11.0" -crossfont = { version = "0.3.1", features = ["force_system_fontconfig"] } +crossfont = { version = "0.5.0", features = ["force_system_fontconfig"] } copypasta = { version = "0.8.0", default-features = false } libc = "0.2" unicode-width = "0.1" diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -22,6 +22,7 @@ pub struct Font { /// Glyph offset within character cell. pub glyph_offset: Delta<i8>, + #[config(removed = "set the AppleFontSmoothing user default instead")] pub use_thin_strokes: bool, /// Normal font face. diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -79,8 +80,8 @@ impl Default for Font { fn default() -> Font { Self { builtin_box_drawing: true, - use_thin_strokes: Default::default(), glyph_offset: Default::default(), + use_thin_strokes: Default::default(), bold_italic: Default::default(), italic: Default::default(), offset: Default::default(), diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -411,7 +411,7 @@ impl Display { // Guess the target window dimensions. debug!("Loading \"{}\" font", &config.font.normal().family); let font = &config.font; - let rasterizer = Rasterizer::new(estimated_scale_factor as f32, font.use_thin_strokes)?; + let rasterizer = Rasterizer::new(estimated_scale_factor as f32)?; let mut glyph_cache = GlyphCache::new(rasterizer, font)?; let metrics = glyph_cache.font_metrics(); let (cell_width, cell_height) = compute_cell_size(config, &metrics); diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -488,10 +488,6 @@ impl Display { let background_color = config.colors.primary.background; renderer.clear(background_color, config.window_opacity()); - // Set subpixel anti-aliasing. - #[cfg(target_os = "macos")] - crossfont::set_font_smoothing(config.font.use_thin_strokes); - // Disable shadows for transparent windows on macOS. #[cfg(target_os = "macos")] window.set_has_shadow(config.window_opacity() >= 1.0); diff --git a/alacritty/src/renderer/text/builtin_font.rs b/alacritty/src/renderer/text/builtin_font.rs --- a/alacritty/src/renderer/text/builtin_font.rs +++ b/alacritty/src/renderer/text/builtin_font.rs @@ -90,6 +90,7 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta<i8>) -> Raster left: 0, height: height as i32, width: width as i32, + advance: (0, 0), buffer, }; }, diff --git a/alacritty/src/renderer/text/builtin_font.rs b/alacritty/src/renderer/text/builtin_font.rs --- a/alacritty/src/renderer/text/builtin_font.rs +++ b/alacritty/src/renderer/text/builtin_font.rs @@ -479,7 +480,15 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta<i8>) -> Raster let top = height as i32 + metrics.descent as i32; let buffer = BitmapBuffer::Rgb(canvas.into_raw()); - RasterizedGlyph { character, top, left: 0, height: height as i32, width: width as i32, buffer } + RasterizedGlyph { + character, + top, + left: 0, + height: height as i32, + width: width as i32, + advance: (0, 0), + buffer, + } } #[repr(packed)] diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -210,10 +210,6 @@ impl WindowContext { self.display.window.set_title(config.window.identity.title.clone()); } - // Set subpixel anti-aliasing. - #[cfg(target_os = "macos")] - crossfont::set_font_smoothing(config.font.use_thin_strokes); - // Disable shadows for transparent windows on macOS. #[cfg(target_os = "macos")] self.display.window.set_has_shadow(config.window_opacity() >= 1.0); diff --git a/alacritty_config_derive/src/de_struct.rs b/alacritty_config_derive/src/de_struct.rs --- a/alacritty_config_derive/src/de_struct.rs +++ b/alacritty_config_derive/src/de_struct.rs @@ -135,14 +135,14 @@ fn field_deserializer(field_streams: &mut FieldStreams, field: &Field) -> Result config.#ident = serde::Deserialize::deserialize(unused).unwrap_or_default(); }); }, - "deprecated" => { - // Construct deprecation message and append optional attribute override. - let mut message = format!("Config warning: {} is deprecated", literal); + "deprecated" | "removed" => { + // Construct deprecation/removal message with optional attribute override. + let mut message = format!("Config warning: {} has been {}", literal, parsed.ident); if let Some(warning) = parsed.param { message = format!("{}; {}", message, warning.value()); } - // Append stream to log deprecation warning. + // Append stream to log deprecation/removal warning. match_assignment_stream.extend(quote! { log::warn!(target: #LOG_TARGET, #message); });
alacritty__alacritty-6186
6,186
What's the output of `alacritty -v`? Unfortunately, it doesn't provide more information: ``` [0.000636401s] [INFO ] [alacritty] Welcome to Alacritty [0.002597571s] [INFO ] [alacritty] Version 0.10.1 (2844606) [0.006755700s] [INFO ] [alacritty_config_derive] No config file found; using default thread 'main' panicked at 'A font must have a non-null family name.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Even tried rolling back to v0.10.0 or v0.9.0 … same issue. Haven't used Alacritty for a while on macOS, but it used to run smoothly on my machine. Huh, so you're actually not using a config file, that's strange. I'd suggest either updating to Monterey or testing the latest Alacritty development version, though I'd assume the latter wouldn't help. Is there anything noteworthy about your system and its fonts? Did you uninstall Menlo? What happens when you use the following config: ```yml font: normal: family: Menlo ``` > Huh, so you're actually not using a config file, that's strange. I'd suggest either updating to Monterey or testing the latest Alacritty development version, though I'd assume the latter wouldn't help. Unfortunately, updating is not an option for me: As Apple deems my MBP Late 2013 no longer worthy of OS updates, I'm stuck on Big Sur. > Is there anything noteworthy about your system and its fonts? Did you uninstall Menlo? What happens when you use the following config Nothing which comes to mind. Menlo is installed and working. This minimal config doesn't work either. Even tried 'Arial', just to make sure it's not about the font. You are running the precompiled binary from the releases page, right? Maybe there was an API change so compiling from source could fix it? Compiled alacritty from master, same result. ``` thread 'main' panicked at 'A font must have a non-null family name.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 ``` Tried replacing the value temporarily: ```diff pub fn family_name(&self) -> String { unsafe { + let value = self.get_string_attribute(kCTFontNameAttribute); - let value = self.get_string_attribute(kCTFontFamilyNameAttribute); value.expect("A font must have a non-null family name.") } } ``` But ran into the next issue just a couple of lines below: ``` thread 'main' panicked at 'A font must have a non-null style name.', /Users/frederic/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:237:19 ``` Unfortunately only the latest version of macOS is supported and even that I couldn't test myself. So you're on your own here. With an old OS version, your only chance might be to run old Alacritty software. But realistically running a bunch of old software is not a great idea. Best suggestion I can make is to try and run Linux of your old MBP. For whatever it's worth, I'm seeing this same bug on Monterey with a fresh installation from the Homebrew Cask and no existing config file. ``` %> RUST_BACKTRACE=full alacritty -v Created log file at "/var/folders/p5/ftgrlhrx2rx51pl63q_g_tnr0000gn/T/Alacritty-6600.log" [0.000002750s] [INFO ] [alacritty] Welcome to Alacritty [0.000189166s] [INFO ] [alacritty] Version 0.10.1 (2844606) [0.000273666s] [INFO ] [alacritty_config_derive] No config file found; using default thread 'main' panicked at 'A font must have a non-null family name.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 stack backtrace: 0: 0x102475794 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h98d8e939df2a84c8 1: 0x1023f2020 - core::fmt::write::ha8927896f8d44e8d 2: 0x1024740d4 - std::io::Write::write_fmt::h5be52fc0ae77f963 3: 0x10247481c - std::panicking::default_hook::{{closure}}::h7ab34c9d6fd8d067 4: 0x102473d50 - std::panicking::rust_panic_with_hook::h032de7ae9e9d479f 5: 0x10249b804 - std::panicking::begin_panic_handler::{{closure}}::ha7b561c0fbbe4ae5 6: 0x10249b770 - std::sys_common::backtrace::__rust_end_short_backtrace::h0ff1db7619f9e51e 7: 0x10249b73c - _rust_begin_unwind 8: 0x1024c6018 - core::panicking::panic_fmt::h660aa0926f67c6d3 9: 0x1023f54b4 - core::panicking::panic_display::hc04cee171cf72561 10: 0x1024c61a4 - core::option::expect_failed::haf361cdcf49747f5 11: 0x1023fc02c - crossfont::darwin::Descriptor::new::h28d0868403c38f97 12: 0x1023fc42c - crossfont::darwin::Descriptor::to_font::h2ff6e278cb100bf8 13: 0x1023fd124 - <crossfont::darwin::Rasterizer as crossfont::Rasterize>::load_font::h316f1df8ba823251 14: 0x102353784 - alacritty::renderer::GlyphCache::load_regular_font::h3ec511eab3a0fee0 15: 0x1022e2b40 - alacritty::display::Display::new::h5cb7876168b85782 16: 0x102325cf0 - alacritty::event::Processor::create_window::h593b9fd21348dc4b 17: 0x102377c98 - alacritty::main::h8e09a5c72dc3dd94 18: 0x102363cb8 - std::sys_common::backtrace::__rust_begin_short_backtrace::h86aab3470ec6110e 19: 0x102373138 - _main Deleted log file at "/var/folders/p5/ftgrlhrx2rx51pl63q_g_tnr0000gn/T/Alacritty-6600.log" ``` @sjml Have you managed to run it previously? > @sjml Have you managed to run it previously? Yes, I tried it out in December but ended up uninstalling before getting too deep into it. No config files were left over, though. Just tested and I get the same error with a fresh download from the website. Hm I don't actually have access to a macOS machine, but if someone is willing to look into what gets passed to [`<crossfont::darwin::Rasterizer as crossfont::Rasterize>::load_font`](https://github.com/alacritty/crossfont/blob/master/src/darwin/mod.rs#L135) that might already help. Happy take a look, but that's in a dependent project, not the central alacritty one, so the source doesn't come with this repository. Is there any dev-setup documentation to get it up and debuggable quickly? (Sorry, I know enough about Rust to write some code and do simple debugging, but haven't done anything with debugging dependencies as of yet.) This should do it: ```diff diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index 888c9490..f2554887 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -28,7 +28,7 @@ serde_json = "1" glutin = { version = "0.28.0", default-features = false, features = ["serde"] } notify = "4" parking_lot = "0.11.0" -crossfont = { version = "0.3.1", features = ["force_system_fontconfig"] } +crossfont = { path = "/path/to/crossfont/project/root", features = ["force_system_fontconfig"] } copypasta = { version = "0.7.0", default-features = false } libc = "0.2" unicode-width = "0.1" ``` Could someone provide `-vvv` log? > Could someone provide `-vvv` log? Looks like it's still trying to use Menlo... which is installed and working fine in other programs. :-/ ``` Created log file at "/var/folders/p5/ftgrlhrx2rx51pl63q_g_tnr0000gn/T/Alacritty-85887.log" [0.000072041s] [INFO ] [alacritty_config_derive] No config file found; using default [0.000480625s] [DEBUG] [alacritty] Using environment locale: en_US.UTF-8 [0.000642125s] [TRACE] [crossfont] Family: Menlo thread 'main' panicked at 'A font must have a non-null family name.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Deleted log file at "/var/folders/p5/ftgrlhrx2rx51pl63q_g_tnr0000gn/T/Alacritty-85887.log" ``` > Hm I don't actually have access to a macOS machine, but if someone is willing to look into what gets passed to [`<crossfont::darwin::Rasterizer as crossfont::Rasterize>::load_font`](https://github.com/alacritty/crossfont/blob/master/src/darwin/mod.rs#L135) that might already help. Looks like it's correctly trying to use the default... passing "Menlo" and a size of 22. (The `FontDesc` style member is just a binary blob, but let me know if it would be useful.) @sjml Which language is your OS in? > @sjml Which language is your OS in? English. Relevant environment variables: ``` LC_ALL=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LANG=en_US.UTF-8 ``` Pretty sure the issue is that one of the fallback fonts you have installed has a null family name and you hit that here: https://github.com/alacritty/crossfont/blob/master/src/darwin/mod.rs#L82 Could you try to check for that, just by logging all the descriptions? > Pretty sure the issue is that one of the fallback fonts you have installed has a null family name and you hit that here: https://github.com/alacritty/crossfont/blob/master/src/darwin/mod.rs#L82 > > Could you try to check for that, just by logging all the descriptions? I set the logging around the site you pointed to, but note that when I clone the crossfont repo to tag 0.3.1 (to match the dependency in alacritty's cargo file), [that function is very different](https://github.com/alacritty/crossfont/blob/f38f67a428055266592b17533b62a6e998350b9b/src/darwin/mod.rs#L73). If I try and build from master it doesn't compile. (Note too at least in 0.3.1 there are warnings about `family_name` and `display_name` being unused in the Descriptor, but that might just be because of the unsafe-ness around CF access?) In any case, when I add `println!("{}", descriptor.family_name);` at line 83, it only prints "Menlo" before the panic. @sjml You're printing it inside the `map` closure, right? Could you show me your diff real quick? Also make sure to print **before** the `to_font` conversion, otherwise you're never going to see the thing that actually causes a problem. I'd also recommend printing all of `descriptor` using `{:?}`, that way you'll get more useful data back. I think it's in the right spot. Here's my diff: ```diff diff --git a/src/darwin/mod.rs b/src/darwin/mod.rs index 84137c7..66882b5 100644 --- a/src/darwin/mod.rs +++ b/src/darwin/mod.rs @@ -80,6 +80,7 @@ impl Descriptor { .find(|d| d.font_name == "Menlo-Regular") .map(|descriptor| { let menlo = ct_new_from_descriptor(&descriptor.ct_descriptor, size); + println!("{:?}", descriptor); // TODO fixme, hardcoded en for english. let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()]) ``` Realizing that might not be the map closure you meant... let me know if there's a better spot! Sorry to be the n00b here. Here's the output with the better formatter: ``` Descriptor { family_name: "Menlo", font_name: "Menlo-Regular", style_name: "Regular", display_name: "Menlo Regular", font_path: "/System/Library/Fonts/Menlo.ttc", ct_descriptor: "<CTFontDescriptor: 0x600002603000>{attributes = { NSFontNameAttribute = "Menlo-Regular"; }>}" } thread 'main' panicked at 'A font must have a non-null family name.', /Users/shane/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Yeah that diff doesn't look right, there should be a `map` somewhere below `fallbacks`. You need to check the descriptor in that map. I don't think it's the primary font that is causing the issue here, I think you both have a fallback font installed on your system that does not have a valid family name. > Yeah that diff doesn't look right, there should be a `map` somewhere below `fallbacks`. You need to check the descriptor in that map. I tried moving it here, but then the panic happens before anything prints. (Please correct my Rust if needed; I am at the high end of "beginner" on this language.) ```diff diff --git a/src/darwin/mod.rs b/src/darwin/mod.rs index 84137c7..1cf2288 100644 --- a/src/darwin/mod.rs +++ b/src/darwin/mod.rs @@ -81,11 +81,12 @@ impl Descriptor { .map(|descriptor| { let menlo = ct_new_from_descriptor(&descriptor.ct_descriptor, size); + // TODO fixme, hardcoded en for english. let mut fallbacks = cascade_list_for_languages(&menlo, &["en".to_owned()]) .into_iter() .filter(|desc| !desc.font_path.as_os_str().is_empty()) - .map(|desc| desc.to_font(size, false)) + .map(|desc| {println!("{:?}", desc); desc.to_font(size, false)}) .collect::<Vec<_>>(); // TODO, we can't use apple's proposed ``` > I don't think it's the primary font that is causing the issue here, I think you both have a fallback font installed on your system that does not have a valid family name. Oh, I'm 100% with you that this is likely something screwy on my system, but where would it be getting defined as a fallback, though? There's no alacritty config file, so it wouldn't be from there. And as far as I know there's not a way to change the macOS fallback fonts without disabling SIP, which hasn't been done on this machine. > I tried moving it here, but then the panic happens before anything prints. Huh, okay. Would probably take a little more effort to troubleshoot this then. Looking through the fonts you have installed might still give some clues though, maybe you can find something odd. To be sure, I just uninstalled all non-system fonts from both `~/Library/Fonts` and `/Library/Fonts`, leaving only the protected ones in `/System/Library/Fonts`, but am still having the panic, so I'm starting to think maybe it's not a problem with the installed fonts... :-/ OK I think I have some more information that might be relevant. I did some tweaks to the `core-text` crate to investigate what was happening when it couldn't get a family name. Specifically, I added a log [here](https://github.com/servo/core-foundation-rs/blob/e51cf4186de61bcc0a51d3c2d796d1ccfd9e88a9/core-text/src/font_descriptor.rs#L222) to print out the font name attribute if it couldn't get the family name. Right before the panic, what I got was `CourierNewPSMT`. That was indeed a font installed on my system, **but** it was disabled in Font Book. Once I re-enabled it and ran again, the list got much further, but this time it panicked right after `Kailasa` which, you guessed it, was disabled. So this might be an upstream bug in `core-text` where it's not properly able to query fonts that are installed but disabled. I'll investigate if there's anything more clever crossfont can do to not pay attention to disabled fonts. @sjml Looks like you're on to something. I have disabled fonts on my system as well (all the asian, cyrillic and hebrew fonts that ship with macOS, for example). Looks like we could query `kCTFontEnabledAttribute` but core-text doesn't provide an accessor to it. I hacked in an `is_enabled` method and an associated `get_number_attribute` and can confirm that if I filter the list at the end of `cascade_list_for_languages` with my `is_enabled` check, alacritty starts up just fine. So, @chrisduerr, I leave it to you how to proceed -- is this something you'd want bring into crossfont, or file an upstream bug with core-text? > @sjml Looks like you're on to something. I have disabled fonts on my system as well (all the asian, cyrillic and hebrew fonts that ship with macOS, for example). Definitely try re-enabling things and seeing if that gets it running, just to confirm. (I know you're on a resource-constrained system, but just for the sake of testing...) @sjml I think we can try to patch crossfont, though, patching core-text would also be fine. I think we already do something like that in crossfont. @sjml Re-enabled all fonts and even cleared the macOS font cache, still the same issue with v0.10.1. 🤷‍♂️ But I'm happy to test any patches you come up with. > @sjml I think we can try to patch crossfont, though, patching core-text would also be fine. I think we already do something like that in crossfont. Should I have a go at a PR? I'm happy to do it, but someone who knows the system better would likely do a quicker job of doing in a way that works well with what's already there... yeah, go ahead. we can always help you clean it up if something is wrong. @sjml Great work, thanks for looking into this. I'm not sure this is something that should be changed in core-text, since core-text is correctly returning a list of all fonts and loading that font is only a slightly related matter. That said, if they'd be willing to change something about this it would benefit more people than just Alacritty, so it might be worth it to raise the issue upstream at least. But I feel like this is likely going to land in crossfont. > I'm not sure this is something that should be changed in core-text Yeah, that was my instinct, too. The only thing that might be nice to have there is a method to tell if a font is disabled or not; I'm gonna plug a little special function into crossfont that does the same, but it's mostly by copy/pasting from core-text, so feels like that might be the better long term home for it. I'll make the PR shortly. Should I base on v0.3.1?
[ "6108" ]
1.57
alacritty/alacritty
2022-07-06T17:33:14Z
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -35,6 +35,8 @@ struct Test { enom_big: TestEnum, #[config(deprecated)] enom_error: TestEnum, + #[config(removed = "it's gone")] + gone: bool, } impl Default for Test { diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -48,6 +50,7 @@ impl Default for Test { enom_small: TestEnum::default(), enom_big: TestEnum::default(), enom_error: TestEnum::default(), + gone: false, } } } diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -90,6 +93,7 @@ fn config_deserialize() { enom_small: "one" enom_big: "THREE" enom_error: "HugaBuga" + gone: false "#, ) .unwrap(); diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -101,6 +105,7 @@ fn config_deserialize() { assert_eq!(test.enom_small, TestEnum::One); assert_eq!(test.enom_big, TestEnum::Three); assert_eq!(test.enom_error, Test::default().enom_error); + assert_eq!(test.gone, false); assert_eq!(test.nesting.field1, Test::default().nesting.field1); assert_eq!(test.nesting.field2, None); assert_eq!(test.nesting.field3, Test::default().nesting.field3); diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -116,8 +121,9 @@ fn config_deserialize() { ]); let warn_logs = logger.warn_logs.lock().unwrap(); assert_eq!(warn_logs.as_slice(), [ - "Config warning: field1 is deprecated; use field2 instead", - "Config warning: enom_error is deprecated", + "Config warning: field1 has been deprecated; use field2 instead", + "Config warning: enom_error has been deprecated", + "Config warning: gone has been removed; it's gone", ]); }
Crash on startup (macOS): 'A font must have a non-null family name.' Alacritty crashes on macOS on startup. No custom `alacritty.yml` is defined. ### System OS: macOS BigSur 11.6.6 (20G624) Version: alacritty 0.10.1 (2844606) ### Logs Crashes: ``` $ alacritty thread 'main' panicked at 'A font must have a non-null family name.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace $ RUST_BACKTRACE=1 alacritty thread 'main' panicked at 'A font must have a non-null family name.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/core-text-19.2.0/src/font_descriptor.rs:223:19 stack backtrace: 0: _rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic_display 3: core::option::expect_failed 4: crossfont::darwin::Descriptor::new 5: crossfont::darwin::Descriptor::to_font 6: <crossfont::darwin::Rasterizer as crossfont::Rasterize>::load_font 7: alacritty::renderer::GlyphCache::load_regular_font 8: alacritty::display::Display::new 9: alacritty::event::Processor::create_window 10: alacritty::main note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. ```
578e08486dfcdee0b2cd0e7a66752ff50edc46b8
[ "config_deserialize" ]
[]
[]
[]
2024-06-24T03:21:09Z
8a26dee0a9167777709935789b95758e36885617
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,27 @@ The sections should follow the order `Packaging`, `Added`, `Changed`, `Fixed` an The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.10.1-rc1 + +### Added + + - Option `font.builtin_box_drawing` to disable the built-in font for drawing box characters + +### Changed + +- Builtin font thickness is now based on cell width instead of underline thickness + +### Fixed + +- OSC 4 not handling `?` +- `?` in OSC strings reporting default colors instead of modified ones +- OSC 104 not clearing colors when second parameter is empty +- Builtin font lines not contiguous when `font.offset` is used +- `font.glyph_offset` is no longer applied on builtin font +- Buili-in font arcs alignment +- Repeated permission prompts on M1 macs +- Colors being slightly off when using `colors.transparent_background_colors` + ## 0.10.0 ### Packaging diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "alacritty" -version = "0.10.0" +version = "0.10.1-rc1" dependencies = [ "alacritty_config_derive", "alacritty_terminal", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -56,7 +56,7 @@ dependencies = [ [[package]] name = "alacritty_terminal" -version = "0.16.0" +version = "0.16.1-rc1" dependencies = [ "alacritty_config_derive", "base64", diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -52,6 +52,8 @@ $(APP_NAME)-%: $(TARGET)-% @cp -fp $(APP_BINARY) $(APP_BINARY_DIR) @cp -fp $(COMPLETIONS) $(APP_COMPLETIONS_DIR) @touch -r "$(APP_BINARY)" "$(APP_DIR)/$(APP_NAME)" + @codesign --remove-signature "$(APP_DIR)/$(APP_NAME)" + @codesign --force --deep --sign - "$(APP_DIR)/$(APP_NAME)" @echo "Created '$(APP_NAME)' in '$(APP_DIR)'" dmg: $(DMG_NAME)-native ## Create an Alacritty.dmg diff --git a/alacritty.yml b/alacritty.yml --- a/alacritty.yml +++ b/alacritty.yml @@ -178,6 +178,13 @@ # it is recommended to set `use_thin_strokes` to `false`. #use_thin_strokes: true + # Use built-in font for box drawing characters. + # + # If `true`, Alacritty will use a custom built-in font for box drawing + # characters (Unicode points 2500 - 259f). + # + #builtin_box_drawing: true + # If `true`, bold text is drawn using the bright color variants. #draw_bold_text_with_bright_colors: false diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alacritty" -version = "0.10.0" +version = "0.10.1-rc1" authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"] license = "Apache-2.0" description = "A fast, cross-platform, OpenGL terminal emulator" diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [dependencies.alacritty_terminal] path = "../alacritty_terminal" -version = "0.16.0" +version = "0.16.1-rc1" default-features = false [dependencies.alacritty_config_derive] diff --git a/alacritty/res/text.f.glsl b/alacritty/res/text.f.glsl --- a/alacritty/res/text.f.glsl +++ b/alacritty/res/text.f.glsl @@ -18,7 +18,9 @@ void main() { } alphaMask = vec4(1.0); - color = vec4(bg.rgb, bg.a); + + // Premultiply background color by alpha. + color = vec4(bg.rgb * bg.a, bg.a); } else if ((int(fg.a) & COLORED) != 0) { // Color glyphs, like emojis. vec4 glyphColor = texture(mask, TexCoords); diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -14,7 +14,7 @@ use crate::config::ui_config::Delta; /// field in this struct. It might be nice in the future to have defaults for /// each value independently. Alternatively, maybe erroring when the user /// doesn't provide complete config is Ok. -#[derive(ConfigDeserialize, Default, Debug, Clone, PartialEq, Eq)] +#[derive(ConfigDeserialize, Debug, Clone, PartialEq, Eq)] pub struct Font { /// Extra spacing per character. pub offset: Delta<i8>, diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -38,6 +38,9 @@ pub struct Font { /// Font size in points. size: Size, + + /// Whether to use the built-in font for box drawing characters. + pub builtin_box_drawing: bool, } impl Font { diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -72,6 +75,22 @@ impl Font { } } +impl Default for Font { + fn default() -> Font { + Self { + builtin_box_drawing: true, + use_thin_strokes: Default::default(), + glyph_offset: Default::default(), + bold_italic: Default::default(), + italic: Default::default(), + offset: Default::default(), + normal: Default::default(), + bold: Default::default(), + size: Default::default(), + } + } +} + /// Description of the normal font. #[derive(ConfigDeserialize, Debug, Clone, PartialEq, Eq)] pub struct FontDescription { diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -12,7 +12,7 @@ use std::{f64, mem}; use glutin::dpi::{PhysicalPosition, PhysicalSize}; use glutin::event::ModifiersState; use glutin::event_loop::EventLoopWindowTarget; -#[cfg(not(any(target_os = "macos", windows)))] +#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] use glutin::platform::unix::EventLoopWindowTargetExtUnix; use glutin::window::CursorIcon; use log::{debug, info}; diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -1076,8 +1076,9 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { self.ctx.write_to_pty(text.into_bytes()); }, TerminalEvent::ColorRequest(index, format) => { - let text = format(self.ctx.display.colors[index]); - self.ctx.write_to_pty(text.into_bytes()); + let color = self.ctx.terminal().colors()[index] + .unwrap_or(self.ctx.display.colors[index]); + self.ctx.write_to_pty(format(color).into_bytes()); }, TerminalEvent::PtyWrite(text) => self.ctx.write_to_pty(text.into_bytes()), TerminalEvent::MouseCursorDirty => self.reset_mouse_cursor(), diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -151,7 +151,10 @@ impl<T: EventListener> Execute<T> for Action { ctx.display().hint_state.start(hint.clone()); ctx.mark_dirty(); }, - Action::ToggleViMode => ctx.toggle_vi_mode(), + Action::ToggleViMode => { + ctx.on_typing_start(); + ctx.toggle_vi_mode() + }, Action::ViMotion(motion) => { ctx.on_typing_start(); ctx.terminal_mut().vi_motion(*motion); diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -20,6 +20,8 @@ use std::string::ToString; use std::{fs, process}; use glutin::event_loop::EventLoop as GlutinEventLoop; +#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] +use glutin::platform::unix::EventLoopWindowTargetExtUnix; use log::info; #[cfg(windows)] use winapi::um::wincon::{AttachConsole, FreeConsole, ATTACH_PARENT_PROCESS}; diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -126,8 +128,6 @@ impl Drop for TemporaryFiles { /// Creates a window, the terminal state, PTY, I/O event loop, input processor, /// config change monitor, and runs the main display loop. fn alacritty(options: Options) -> Result<(), String> { - info!("Welcome to Alacritty"); - // Setup glutin event loop. let window_event_loop = GlutinEventLoop::<Event>::with_user_event(); diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -135,6 +135,14 @@ fn alacritty(options: Options) -> Result<(), String> { let log_file = logging::initialize(&options, window_event_loop.create_proxy()) .expect("Unable to initialize logger"); + info!("Welcome to Alacritty"); + info!("Version {}", env!("VERSION")); + + #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] + info!("Running on {}", if window_event_loop.is_x11() { "X11" } else { "Wayland" }); + #[cfg(not(any(feature = "x11", target_os = "macos", windows)))] + info!("Running on Wayland"); + // Load configuration file. let config = config::load(&options); log_config_path(&config); diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -1,10 +1,12 @@ //! Hand-rolled drawing of unicode [box drawing](http://www.unicode.org/charts/PDF/U2500.pdf) //! and [block elements](https://www.unicode.org/charts/PDF/U2580.pdf). -use std::{cmp, mem}; +use std::{cmp, mem, ops}; use crossfont::{BitmapBuffer, Metrics, RasterizedGlyph}; +use crate::config::ui_config::Delta; + // Colors which are used for filling shade variants. const COLOR_FILL_ALPHA_STEP_1: Pixel = Pixel { _r: 192, _g: 192, _b: 192 }; const COLOR_FILL_ALPHA_STEP_2: Pixel = Pixel { _r: 128, _g: 128, _b: 128 }; diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -14,19 +16,33 @@ const COLOR_FILL_ALPHA_STEP_3: Pixel = Pixel { _r: 64, _g: 64, _b: 64 }; const COLOR_FILL: Pixel = Pixel { _r: 255, _g: 255, _b: 255 }; /// Returns the rasterized glyph if the character is part of the built-in font. -pub fn builtin_glyph(character: char, metrics: &Metrics) -> Option<RasterizedGlyph> { - match character { +pub fn builtin_glyph( + character: char, + metrics: &Metrics, + offset: &Delta<i8>, + glyph_offset: &Delta<i8>, +) -> Option<RasterizedGlyph> { + let mut glyph = match character { // Box drawing characters and block elements. - '\u{2500}'..='\u{259f}' => Some(box_drawing(character, metrics)), - _ => None, - } + '\u{2500}'..='\u{259f}' => box_drawing(character, metrics, offset), + _ => return None, + }; + + // Since we want to ignore `glyph_offset` for the built-in font, subtract it to compensate its + // addition when loading glyphs in the renderer. + glyph.left -= glyph_offset.x as i32; + glyph.top -= glyph_offset.y as i32; + + Some(glyph) } -fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { - let height = metrics.line_height as usize; - let width = metrics.average_advance as usize; - let stroke_size = cmp::max(metrics.underline_thickness as usize, 1); - let heavy_stroke_size = stroke_size * 3; +fn box_drawing(character: char, metrics: &Metrics, offset: &Delta<i8>) -> RasterizedGlyph { + let height = (metrics.line_height as i32 + offset.y as i32) as usize; + let width = (metrics.average_advance as i32 + offset.x as i32) as usize; + // Use one eight of the cell width, since this is used as a step size for block elemenets. + let stroke_size = cmp::max((width as f32 / 8.).round() as usize, 1); + let heavy_stroke_size = stroke_size * 2; + // Certain symbols require larger canvas than the cell itself, since for proper contiguous // lines they require drawing on neighbour cells. So treat them specially early on and handle // 'normal' characters later. diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -52,7 +68,7 @@ fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { let from_x = 0.; let to_x = x_end + 1.; - for stroke_size in stroke_size..2 * stroke_size { + for stroke_size in 0..2 * stroke_size { let stroke_size = stroke_size as f32 / 2.; if character == '\u{2571}' || character == '\u{2573}' { let h = y_end - stroke_size as f32; diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -327,7 +343,9 @@ fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { // Mirror `X` axis. if character == '\u{256d}' || character == '\u{2570}' { let center = canvas.x_center() as usize; - let extra_offset = if width % 2 == 0 { 1 } else { 0 }; + + let extra_offset = if stroke_size % 2 == width % 2 { 0 } else { 1 }; + let buffer = canvas.buffer_mut(); for y in 1..height { let left = (y - 1) * width; diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -343,7 +361,9 @@ fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { // Mirror `Y` axis. if character == '\u{256d}' || character == '\u{256e}' { let center = canvas.y_center() as usize; - let extra_offset = if height % 2 == 0 { 1 } else { 0 }; + + let extra_offset = if stroke_size % 2 == height % 2 { 0 } else { 1 }; + let buffer = canvas.buffer_mut(); if extra_offset != 0 { let bottom_row = (height - 1) * width; diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -365,7 +385,7 @@ fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { '\u{2580}'..='\u{2587}' | '\u{2589}'..='\u{2590}' | '\u{2594}' | '\u{2595}' => { let width = width as f32; let height = height as f32; - let rect_width = match character { + let mut rect_width = match character { '\u{2589}' => width * 7. / 8., '\u{258a}' => width * 6. / 8., '\u{258b}' => width * 5. / 8., diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -377,7 +397,8 @@ fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { '\u{2595}' => width * 1. / 8., _ => width, }; - let (rect_height, y) = match character { + + let (mut rect_height, mut y) = match character { '\u{2580}' => (height * 4. / 8., height * 8. / 8.), '\u{2581}' => (height * 1. / 8., height * 1. / 8.), '\u{2582}' => (height * 2. / 8., height * 2. / 8.), diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -389,12 +410,18 @@ fn box_drawing(character: char, metrics: &Metrics) -> RasterizedGlyph { '\u{2594}' => (height * 1. / 8., height * 8. / 8.), _ => (height, height), }; + // Fix `y` coordinates. - let y = height - y; + y = height - y; + + // Ensure that resulted glyph will be visible and also round sizes instead of straight + // flooring them. + rect_width = cmp::max(rect_width.round() as i32, 1) as f32; + rect_height = cmp::max(rect_height.round() as i32, 1) as f32; let x = match character { '\u{2590}' => canvas.x_center(), - '\u{2595}' => width as f32 - width / 8., + '\u{2595}' => width as f32 - rect_width, _ => 0., }; diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -469,6 +496,28 @@ impl Pixel { } } +impl ops::Add for Pixel { + type Output = Pixel; + + fn add(self, rhs: Pixel) -> Self::Output { + let _r = self._r.saturating_add(rhs._r); + let _g = self._g.saturating_add(rhs._g); + let _b = self._b.saturating_add(rhs._b); + Pixel { _r, _g, _b } + } +} + +impl ops::Div<u8> for Pixel { + type Output = Pixel; + + fn div(self, rhs: u8) -> Self::Output { + let _r = self._r / rhs; + let _g = self._g / rhs; + let _b = self._b / rhs; + Pixel { _r, _g, _b } + } +} + /// Canvas which is used for simple line drawing operations. /// /// The coordinate system is the following: diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -702,6 +751,24 @@ impl Canvas { // Ensure the part closer to edges is properly filled. self.draw_h_line(0., self.y_center(), stroke_size as f32, stroke_size); self.draw_v_line(self.x_center(), 0., stroke_size as f32, stroke_size); + + // Fill the resulted arc, since it could have gaps in-between. + for y in 0..self.height { + let row = y * self.width; + let left = match self.buffer[row..row + self.width].iter().position(|p| p._r != 0) { + Some(left) => row + left, + _ => continue, + }; + let right = match self.buffer[row..row + self.width].iter().rposition(|p| p._r != 0) { + Some(right) => row + right, + _ => continue, + }; + + for index in left + 1..right { + self.buffer[index] = + self.buffer[index] + self.buffer[index - 1] / 2 + self.buffer[index + 1] / 2; + } + } } /// Fills the `Canvas` with the given `Color`. diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -132,11 +132,17 @@ pub struct GlyphCache { /// Font size. font_size: crossfont::Size, + /// Font offset. + font_offset: Delta<i8>, + /// Glyph offset. glyph_offset: Delta<i8>, /// Font metrics. metrics: crossfont::Metrics, + + /// Whether to use the built-in font for box drawing characters. + builtin_box_drawing: bool, } impl GlyphCache { diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -165,8 +171,10 @@ impl GlyphCache { bold_key: bold, italic_key: italic, bold_italic_key: bold_italic, + font_offset: font.offset, glyph_offset: font.glyph_offset, metrics, + builtin_box_drawing: font.builtin_box_drawing, }; cache.load_common_glyphs(loader); diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -268,7 +276,17 @@ impl GlyphCache { // Rasterize the glyph using the built-in font for special characters or the user's font // for everything else. - let rasterized = builtin_font::builtin_glyph(glyph_key.character, &self.metrics) + let rasterized = self + .builtin_box_drawing + .then(|| { + builtin_font::builtin_glyph( + glyph_key.character, + &self.metrics, + &self.font_offset, + &self.glyph_offset, + ) + }) + .flatten() .map_or_else(|| self.rasterizer.get_glyph(glyph_key), Ok); let glyph = match rasterized { diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -335,6 +353,7 @@ impl GlyphCache { ) -> Result<(), crossfont::Error> { // Update dpi scaling. self.rasterizer.update_dpr(dpr as f32); + self.font_offset = font.offset; // Recompute font keys. let (regular, bold, italic, bold_italic) = diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -355,6 +374,7 @@ impl GlyphCache { self.italic_key = italic; self.bold_italic_key = bold_italic; self.metrics = metrics; + self.builtin_box_drawing = font.builtin_box_drawing; self.clear_glyph_cache(loader); diff --git a/alacritty/windows/wix/alacritty.wxs b/alacritty/windows/wix/alacritty.wxs --- a/alacritty/windows/wix/alacritty.wxs +++ b/alacritty/windows/wix/alacritty.wxs @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="windows-1252"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> - <Product Name="Alacritty" Id="*" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.10.0" Manufacturer="Alacritty"> + <Product Name="Alacritty" Id="*" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.10.1-rc1" Manufacturer="Alacritty"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/> <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed."/> <Icon Id="AlacrittyIco" SourceFile=".\extra\windows\alacritty.ico"/> diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml --- a/alacritty_terminal/Cargo.toml +++ b/alacritty_terminal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alacritty_terminal" -version = "0.16.0" +version = "0.16.1-rc1" authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"] license = "Apache-2.0" description = "Library for writing terminal emulators" diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -972,17 +972,28 @@ where // Set color index. b"4" => { - if params.len() > 1 && params.len() % 2 != 0 { - for chunk in params[1..].chunks(2) { - let index = parse_number(chunk[0]); - let color = xparse_color(chunk[1]); - if let (Some(i), Some(c)) = (index, color) { - self.handler.set_color(i as usize, c); - return; - } + if params.len() <= 1 || params.len() % 2 == 0 { + unhandled(params); + return; + } + + for chunk in params[1..].chunks(2) { + let index = match parse_number(chunk[0]) { + Some(index) => index, + None => { + unhandled(params); + continue; + }, + }; + + if let Some(c) = xparse_color(chunk[1]) { + self.handler.set_color(index as usize, c); + } else if chunk[1] == b"?" { + self.handler.dynamic_color_sequence(index, index as usize, terminator); + } else { + unhandled(params); } } - unhandled(params); }, // Get/set Foreground, Background, Cursor colors. diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1053,7 +1064,7 @@ where // Reset color index. b"104" => { // Reset all color indexes when no parameters are given. - if params.len() == 1 { + if params.len() == 1 || params[1].is_empty() { for i in 0..256 { self.handler.reset_color(i); } diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -818,6 +818,10 @@ impl<T> Term<T> { cursor_cell.bg = bg; cursor_cell.flags = flags; } + + pub fn colors(&self) -> &Colors { + &self.colors + } } impl<T> Dimensions for Term<T> { diff --git a/extra/alacritty-msg.man b/extra/alacritty-msg.man --- a/extra/alacritty-msg.man +++ b/extra/alacritty-msg.man @@ -1,4 +1,4 @@ -.TH ALACRITTY-MSG "1" "October 2021" "alacritty 0.10.0" "User Commands" +.TH ALACRITTY-MSG "1" "October 2021" "alacritty 0.10.1-rc1" "User Commands" .SH NAME alacritty-msg \- Send messages to Alacritty .SH "SYNOPSIS" diff --git a/extra/alacritty.man b/extra/alacritty.man --- a/extra/alacritty.man +++ b/extra/alacritty.man @@ -1,4 +1,4 @@ -.TH ALACRITTY "1" "August 2018" "alacritty 0.10.0" "User Commands" +.TH ALACRITTY "1" "August 2018" "alacritty 0.10.1-rc1" "User Commands" .SH NAME Alacritty \- A fast, cross-platform, OpenGL terminal emulator .SH "SYNOPSIS" diff --git a/extra/osx/Alacritty.app/Contents/Info.plist b/extra/osx/Alacritty.app/Contents/Info.plist --- a/extra/osx/Alacritty.app/Contents/Info.plist +++ b/extra/osx/Alacritty.app/Contents/Info.plist @@ -15,7 +15,7 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>0.10.0</string> + <string>0.10.1-rc1</string> <key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string>
alacritty__alacritty-5870
5,870
[ "5840" ]
0.10
alacritty/alacritty
2022-02-10T01:07:06Z
diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -33,7 +33,7 @@ tasks: cargo clippy --all-targets - feature-wayland: | cd alacritty/alacritty - cargo test --no-default-features --features=wayland + RUSTFLAGS="-D warnings" cargo test --no-default-features --features=wayland - feature-x11: | cd alacritty/alacritty - cargo test --no-default-features --features=x11 + RUSTFLAGS="-D warnings" cargo test --no-default-features --features=x11 diff --git a/.builds/linux.yml b/.builds/linux.yml --- a/.builds/linux.yml +++ b/.builds/linux.yml @@ -36,7 +36,7 @@ tasks: cargo clippy --all-targets - feature-wayland: | cd alacritty/alacritty - cargo test --no-default-features --features=wayland + RUSTFLAGS="-D warnings" cargo test --no-default-features --features=wayland - feature-x11: | cd alacritty/alacritty - cargo test --no-default-features --features=x11 + RUSTFLAGS="-D warnings" cargo test --no-default-features --features=x11 diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -730,7 +797,7 @@ mod test { #[test] fn builtin_line_drawing_glyphs_coverage() { - // Dummy metrics values to test builtin glyphs coverage. + // Dummy metrics values to test built-in glyphs coverage. let metrics = Metrics { average_advance: 6., line_height: 16., diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs --- a/alacritty/src/renderer/builtin_font.rs +++ b/alacritty/src/renderer/builtin_font.rs @@ -741,13 +808,16 @@ mod test { strikeout_thickness: 2., }; + let offset = Default::default(); + let glyph_offset = Default::default(); + // Test coverage of box drawing characters. for character in '\u{2500}'..='\u{259f}' { - assert!(builtin_glyph(character, &metrics).is_some()); + assert!(builtin_glyph(character, &metrics, &offset, &glyph_offset).is_some()); } for character in ('\u{2450}'..'\u{2500}').chain('\u{25a0}'..'\u{2600}') { - assert!(builtin_glyph(character, &metrics).is_none()); + assert!(builtin_glyph(character, &metrics, &offset, &glyph_offset).is_none()); } } } diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1494,6 +1505,8 @@ mod tests { charset: StandardCharset, attr: Option<Attr>, identity_reported: bool, + color: Option<Rgb>, + reset_colors: Vec<usize>, } impl Handler for MockHandler { diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1517,6 +1530,14 @@ mod tests { fn reset_state(&mut self) { *self = Self::default(); } + + fn set_color(&mut self, _: usize, c: Rgb) { + self.color = Some(c); + } + + fn reset_color(&mut self, index: usize) { + self.reset_colors.push(index) + } } impl Default for MockHandler { diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1526,6 +1547,8 @@ mod tests { charset: StandardCharset::Ascii, attr: None, identity_reported: false, + color: None, + reset_colors: Vec::new(), } } } diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1724,4 +1747,62 @@ mod tests { fn parse_number_too_large() { assert_eq!(parse_number(b"321"), None); } + + #[test] + fn parse_osc4_set_color() { + let bytes: &[u8] = b"\x1b]4;0;#fff\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + assert_eq!(handler.color, Some(Rgb { r: 0xf0, g: 0xf0, b: 0xf0 })); + } + + #[test] + fn parse_osc104_reset_color() { + let bytes: &[u8] = b"\x1b]104;1;\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + assert_eq!(handler.reset_colors, vec![1]); + } + + #[test] + fn parse_osc104_reset_all_colors() { + let bytes: &[u8] = b"\x1b]104;\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + let expected: Vec<usize> = (0..256).collect(); + assert_eq!(handler.reset_colors, expected); + } + + #[test] + fn parse_osc104_reset_all_colors_no_semicolon() { + let bytes: &[u8] = b"\x1b]104\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + let expected: Vec<usize> = (0..256).collect(); + assert_eq!(handler.reset_colors, expected); + } }
Alacritty keeps asking for permissions ### System OS: MacOS 12.0.1 Version: 0.10.0 ### Expected Behavior Alacritty asks for permissions to access folders once and remembers. ### Actual Behavior Every keystroke in a protected MacOS folder (i.e. Desktop, Downloads, Documents) I get a prompt to give it access. This makes the terminal unusable. Pictures below. <img width="312" alt="Screen Shot 2022-01-31 at 2 30 26 PM" src="https://user-images.githubusercontent.com/22417141/151861069-6e4cd773-643f-4715-9b4b-25238ce74dc3.png"> I have given Alacritty permission to access the folders and subfolders in question. <img width="394" alt="Screen Shot 2022-01-31 at 2 30 35 PM" src="https://user-images.githubusercontent.com/22417141/151861071-186e9855-533b-4503-868e-1cd9f13c499d.png"> The permissions prompt appears every time I enter one of the above folders, perform any action, and even on each keystoke.
8a26dee0a9167777709935789b95758e36885617
[ "ansi::tests::parse_osc104_reset_all_colors" ]
[ "ansi::tests::parse_control_attribute", "ansi::tests::parse_designate_g0_as_line_drawing", "ansi::tests::parse_designate_g1_as_line_drawing_and_invoke", "ansi::tests::parse_invalid_legacy_rgb_colors", "ansi::tests::parse_invalid_number", "ansi::tests::parse_invalid_rgb_colors", "ansi::tests::parse_number_too_large", "ansi::tests::parse_osc104_reset_all_colors_no_semicolon", "ansi::tests::parse_osc104_reset_color", "ansi::tests::parse_osc4_set_color", "ansi::tests::parse_terminal_identity_esc", "ansi::tests::parse_terminal_identity_csi", "ansi::tests::parse_truecolor_attr", "ansi::tests::parse_valid_legacy_rgb_colors", "ansi::tests::parse_valid_number", "ansi::tests::parse_valid_rgb_colors", "ansi::tests::parse_zsh_startup", "grid::storage::tests::indexing", "grid::storage::tests::rotate", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::storage::tests::grow_after_zero", "grid::tests::scroll_up", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::shrink_reflow_twice", "grid::tests::test_iter", "index::tests::add", "index::tests::add_clamp", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "index::tests::location_ordering", "grid::storage::tests::grow_before_zero", "index::tests::sub", "index::tests::sub_clamp", "grid::tests::scroll_down_with_history", "index::tests::sub_grid_clamp", "grid::storage::tests::initialize", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::color::tests::contrast", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::no_match_left", "term::search::tests::include_linebreak_left", "term::search::tests::regex_right", "term::search::tests::singlecell_fullwidth", "term::search::tests::include_linebreak_right", "term::search::tests::fullwidth", "term::tests::block_selection_works", "term::search::tests::end_on_fullwidth", "term::tests::clear_saved_lines", "term::tests::clearing_scrollback_resets_display_offset", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::tests::clearing_viewport_keeps_history_position", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::search::tests::leading_spacer", "term::search::tests::regex_left", "term::search::tests::wide_without_spacer", "term::search::tests::wrapping", "term::tests::parse_cargo_version", "term::search::tests::wrap_around_to_another_end", "term::tests::input_line_drawing_character", "term::tests::line_selection_works", "term::tests::semantic_selection_works", "term::search::tests::skip_dead_cell", "term::tests::scroll_display_page_up", "term::tests::simple_selection_works", "term::tests::scroll_display_page_down", "term::search::tests::wrapping_into_fullwidth", "tty::unix::test_get_pw_entry", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "vi_mode::tests::motion_bracket", "term::search::tests::no_match_right", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_word", "term::tests::window_title", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_start_end", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_simple", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_semantic", "vi_mode::tests::scroll_word", "vi_mode::tests::scroll_over_top", "term::search::tests::nested_regex", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::shrink_lines_updates_active_cursor_pos", "term::search::tests::multibyte_unicode", "term::tests::grow_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grid_serde", "clear_underline", "csi_rep", "fish_cc", "erase_chars_reset", "deccolm_reset", "decaln_reset", "delete_chars_reset", "delete_lines", "alt_reset", "insert_blank_reset", "indexed_256_colors", "newline_with_cursor_beyond_scroll_region", "issue_855", "colored_reset", "selective_erasure", "ll", "scroll_up_reset", "saved_cursor", "saved_cursor_alt", "tmux_git_log", "underline", "sgr", "region_scroll_down", "tab_rendering", "tmux_htop", "vttest_insert", "vttest_cursor_movement_1", "vttest_origin_mode_2", "grid_reset", "vttest_origin_mode_1", "vttest_tab_clear_set", "wrapline_alt_toggle", "vttest_scroll", "zerowidth", "zsh_tab_completion", "vim_simple_edit", "vim_large_window_scroll", "history", "vim_24bitcolors_bce", "row_reset" ]
[]
[]
2022-02-10T00:17:22Z
60ef17e8e98b0ed219a145881d10ecd6b9f26e85
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - OSC 4 not handling `?` - `?` in OSC strings reporting default colors instead of modified ones +- OSC 104 not clearing colors when second parameter is empty ## 0.10.0 diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1064,7 +1064,7 @@ where // Reset color index. b"104" => { // Reset all color indexes when no parameters are given. - if params.len() == 1 { + if params.len() == 1 || params[1].is_empty() { for i in 0..256 { self.handler.reset_color(i); }
alacritty__alacritty-5788
5,788
Querying the current value with `?` simply isn't implemented, should be trivial to do though if someone is interested. I would also like support for this. An additional problem is that the colors currently reported by `\e]11;?\a` are the original term colors rather than the (potentially) modified ones. I'm looking into the issue with OSC 104 and it seems to happen here: https://github.com/alacritty/alacritty/blob/ed35d033aeae0fa054756dac7f91ea8527203a4e/alacritty_terminal/src/ansi.rs#L1055-L1059 `\e]104;\a` is parsed as `[['1', '0', '4'], []]`. Omitting the `;` will cause it to be parsed as `[['1', '0', '4']]` and behave as expected. Is this a issue with how the vte crates's parser or should we work around it? > An additional problem is that the colors currently reported by `\e]11;?\a` are the original term colors rather than the (potentially) modified ones. I can confirm this. ``` > echo -ne '\e]11;?\a'; cat ^[]11;rgb:ffff/ffff/ffff^G^C⏎ > printf '\e]11;#490101\a' > echo -ne '\e]11;?\a'; cat ^[]11;rgb:ffff/ffff/ffff^G^C⏎ ``` Should I open a separate bug report for OSC 11 not reporting the current value, but the initial value? Apologies if I've misunderstood what those commands are supposed to do, I'm going entirely off the descriptions in [foot's list of OSCs](https://codeberg.org/dnkl/foot#supported-oscs) since that's the clearest source I've found. > \e]104;\a is parsed as [['1', '0', '4'], []]. Omitting the ; will cause it to be parsed as [['1', '0', '4']] and behave as expected. Is this a issue with how the vte crates's parser or should we work around it? Why would the result by the VTE crate be problematic? It's returning the appropriate things. > Why would the result by the VTE crate be problematic? It's returning the appropriate things. I'm not familiar with these escape sequences so I got a bit confused. I'm working on it and will submit a PR soon. Let me know if you run into any troubles.
[ "5542" ]
1.56
alacritty/alacritty
2022-01-16T06:10:04Z
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1506,6 +1506,7 @@ mod tests { attr: Option<Attr>, identity_reported: bool, color: Option<Rgb>, + reset_colors: Vec<usize>, } impl Handler for MockHandler { diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1533,6 +1534,10 @@ mod tests { fn set_color(&mut self, _: usize, c: Rgb) { self.color = Some(c); } + + fn reset_color(&mut self, index: usize) { + self.reset_colors.push(index) + } } impl Default for MockHandler { diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1543,6 +1548,7 @@ mod tests { attr: None, identity_reported: false, color: None, + reset_colors: Vec::new(), } } } diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -1755,4 +1761,48 @@ mod tests { assert_eq!(handler.color, Some(Rgb { r: 0xf0, g: 0xf0, b: 0xf0 })); } + + #[test] + fn parse_osc104_reset_color() { + let bytes: &[u8] = b"\x1b]104;1;\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + assert_eq!(handler.reset_colors, vec![1]); + } + + #[test] + fn parse_osc104_reset_all_colors() { + let bytes: &[u8] = b"\x1b]104;\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + let expected: Vec<usize> = (0..256).collect(); + assert_eq!(handler.reset_colors, expected); + } + + #[test] + fn parse_osc104_reset_all_colors_no_semicolon() { + let bytes: &[u8] = b"\x1b]104\x1b\\"; + + let mut parser = Processor::new(); + let mut handler = MockHandler::default(); + + for byte in bytes { + parser.advance(&mut handler, *byte); + } + + let expected: Vec<usize> = (0..256).collect(); + assert_eq!(handler.reset_colors, expected); + } }
problems with OSC 4 and 104 [Documentation claims that OSC 4 and OSC 104 are supported](https://github.com/alacritty/alacritty/blob/master/docs/escape_support.md). However, testing reveals some issues. If the OSC is fully supported, we should be able to query the state of colors. Here's a working query using OSC 11: ``` > echo -ne '\e]11;?\a'; cat ^[]11;rgb:ffff/ffff/ffff^G^C⏎ ``` That tells me I have a white background. Attempting to learn the state of a color in my color palette using OSC 4 does not work, however: ``` > echo -ne '\e]4;1;?\a'; cat ^C⏎ ``` No information is returned. And in the log, we see: > [2021-10-13 11:37:43.348998800] [DEBUG] [alacritty_terminal] [unhandled osc_dispatch]: [['4',],['1',],['?',],] at line 947 Strangely, we are able to change the colors with OSC 4: ``` > printf '\e]4;3;#490101\a' ``` That sets my dark yellow to a dark red, easy to see with e.g. `neofetch`. However, attempting to undo this with OSC 104 does not work: ``` > printf '\e]104;\a' ``` My yellow remains red. The log reports: > [2021-10-13 11:45:18.472954361] [DEBUG] [alacritty_terminal] [unhandled osc_dispatch]: [['1','0','4',],[],] at line 947 Using a different ending has no effect on results: ``` > echo -ne '\e]11;?\e\\'; cat ^[]11;rgb:ffff/ffff/ffff^[\^C⏎ > echo -ne '\e]4;1;?\e\\'; cat ^C⏎ ``` I should be able to query my color palette with OSC 4, and reset my color palette using OSC 104. Currently I can only use OSC 4 to change colors. The above commands work fine in other shells such as iTerm2 or Foot. Similar commands for OSC 10, 11, 110, and 111 all work in Alacritty as expected. ### System OS: macOS Catalina 10.15.7 Version: alacritty 0.9.0 (fed349a) OS: Manjaro ARM Linux Version: alacritty 0.10.0-dev (b6e05d2d) DE: Wayland, sway ### Logs > alacritty -vv Created log file at "/tmp/Alacritty-25654.log" [2021-10-13 11:36:58.858691035] [INFO ] [alacritty] Welcome to Alacritty [2021-10-13 11:36:58.858972769] [INFO ] [alacritty] Configuration files loaded from: "/home/nelson/.config/alacritty/alacritty.yml" [2021-10-13 11:36:58.900859460] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-13 11:36:58.910606092] [DEBUG] [alacritty] Estimated DPR: 1 [2021-10-13 11:36:58.910720127] [DEBUG] [alacritty] Estimated window size: None [2021-10-13 11:36:58.910755125] [DEBUG] [alacritty] Estimated cell size: 9 x 20 [2021-10-13 11:36:59.019037732] [INFO ] [alacritty] Device pixel ratio: 1 [2021-10-13 11:36:59.049712562] [INFO ] [alacritty] Initializing glyph cache... [2021-10-13 11:36:59.054074182] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-13 11:36:59.063504963] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-13 11:36:59.073139607] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-13 11:36:59.082763169] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-13 11:36:59.430697721] [INFO ] [alacritty] ... finished initializing glyph cache in 0.380882498s [2021-10-13 11:36:59.430961080] [INFO ] [alacritty] Cell size: 9 x 20 [2021-10-13 11:36:59.431031076] [INFO ] [alacritty] Padding: 4 x 10 [2021-10-13 11:36:59.431070157] [INFO ] [alacritty] Width: 800, Height: 600 [2021-10-13 11:36:59.434250888] [INFO ] [alacritty] PTY dimensions: 29 x 88 [2021-10-13 11:36:59.452195504] [INFO ] [alacritty] Initialisation complete [2021-10-13 11:36:59.481600616] [DEBUG] [alacritty_terminal] New num_cols is 105 and num_lines is 51 [2021-10-13 11:36:59.490114743] [INFO ] [alacritty] Padding: 5 x 7 [2021-10-13 11:36:59.490217112] [INFO ] [alacritty] Width: 956, Height: 1035 [2021-10-13 11:36:59.645425319] [DEBUG] [alacritty_terminal] [unhandled osc_dispatch]: [['5','0',],['c','o','l','o','r','s','=','l','i','g','h','t',],] at line 947 [2021-10-13 11:37:05.464752222] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Normal", lcd_filter: 1 } [2021-10-13 11:37:43.348998800] [DEBUG] [alacritty_terminal] [unhandled osc_dispatch]: [['4',],['1',],['?',],] at line 947 [2021-10-13 11:45:18.472954361] [DEBUG] [alacritty_terminal] [unhandled osc_dispatch]: [['1','0','4',],[],] at line 947
589c1e9c6b8830625162af14a9a7aee32c7aade0
[ "ansi::tests::parse_osc104_reset_all_colors" ]
[ "ansi::tests::parse_invalid_legacy_rgb_colors", "ansi::tests::parse_designate_g0_as_line_drawing", "ansi::tests::parse_designate_g1_as_line_drawing_and_invoke", "ansi::tests::parse_control_attribute", "ansi::tests::parse_invalid_number", "ansi::tests::parse_number_too_large", "ansi::tests::parse_invalid_rgb_colors", "ansi::tests::parse_osc104_reset_all_colors_no_semicolon", "ansi::tests::parse_osc104_reset_color", "ansi::tests::parse_osc4_set_color", "ansi::tests::parse_terminal_identity_csi", "ansi::tests::parse_truecolor_attr", "ansi::tests::parse_terminal_identity_esc", "ansi::tests::parse_valid_legacy_rgb_colors", "ansi::tests::parse_valid_number", "ansi::tests::parse_valid_rgb_colors", "ansi::tests::parse_zsh_startup", "grid::storage::tests::indexing", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_before_zero", "grid::tests::grow_reflow", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::with_capacity", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::tests::grow_reflow_multiline", "grid::storage::tests::truncate_invisible_lines", "grid::tests::scroll_down", "grid::tests::grow_reflow_disabled", "grid::storage::tests::shrink_then_grow", "grid::tests::scroll_up", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::test_iter", "grid::tests::shrink_reflow_twice", "index::tests::add_clamp", "index::tests::add", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::location_ordering", "grid::tests::scroll_down_with_history", "index::tests::add_wrap", "index::tests::sub", "index::tests::sub_clamp", "grid::storage::tests::grow_after_zero", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::block_is_empty", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_selection", "selection::tests::line_selection", "grid::storage::tests::grow_before_zero", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "grid::storage::tests::initialize", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::color::tests::contrast", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::no_match_left", "term::search::tests::no_match_right", "term::search::tests::include_linebreak_left", "term::search::tests::regex_right", "term::search::tests::regex_left", "term::search::tests::fullwidth", "term::search::tests::singlecell_fullwidth", "term::search::tests::include_linebreak_right", "term::search::tests::end_on_fullwidth", "term::search::tests::skip_dead_cell", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::tests::clearing_scrollback_resets_display_offset", "term::tests::clearing_viewport_keeps_history_position", "term::tests::clear_saved_lines", "term::search::tests::leading_spacer", "term::tests::input_line_drawing_character", "term::tests::line_selection_works", "term::tests::parse_cargo_version", "term::tests::block_selection_works", "term::tests::scroll_display_page_down", "term::search::tests::wrap_around_to_another_end", "term::tests::semantic_selection_works", "term::search::tests::wide_without_spacer", "term::tests::simple_selection_works", "term::search::tests::wrapping", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "tty::unix::test_get_pw_entry", "term::tests::scroll_display_page_up", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_high_middle_low", "term::tests::window_title", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_word", "term::search::tests::wrapping_into_fullwidth", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_simple", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "vi_mode::tests::scroll_semantic", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_word", "term::search::tests::multibyte_unicode", "term::search::tests::nested_regex", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grid_serde", "clear_underline", "csi_rep", "erase_chars_reset", "delete_chars_reset", "fish_cc", "decaln_reset", "delete_lines", "alt_reset", "deccolm_reset", "indexed_256_colors", "newline_with_cursor_beyond_scroll_region", "ll", "issue_855", "selective_erasure", "insert_blank_reset", "colored_reset", "saved_cursor", "saved_cursor_alt", "scroll_up_reset", "tmux_git_log", "sgr", "underline", "tmux_htop", "region_scroll_down", "vttest_cursor_movement_1", "tab_rendering", "vttest_insert", "grid_reset", "vttest_tab_clear_set", "vttest_origin_mode_2", "vttest_origin_mode_1", "vttest_scroll", "wrapline_alt_toggle", "zsh_tab_completion", "zerowidth", "vim_simple_edit", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 1902)" ]
[]
[]
2022-01-20T23:57:59Z
22a447573bbd67c0a5d3946d58d6d61bac3b4ad2
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Notable changes to the `alacritty_terminal` crate are documented in its [CHANGELOG](./alacritty_terminal/CHANGELOG.md). +## 0.14.1-rc1 + +### Changed + +- Always emit `1` for the first parameter when having modifiers in kitty keyboard protocol + +### Fixed + +- Mouse/Vi cursor hint highlighting broken on the terminal cursor line +- Hint launcher opening arbitrary text, when terminal content changed while opening +- `SemanticRight`/`SemanticLeft` vi motions breaking with wide semantic escape characters +- `alacritty migrate` crashing with recursive toml imports +- Migrating nonexistent toml import breaking the entire migration +- Crash when pressing certain modifier keys on macOS 15+ +- First daemon mode window ignoring window options passed through CLI + ## 0.14.0 ### Packaging diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -32,7 +32,7 @@ dependencies = [ [[package]] name = "alacritty" -version = "0.14.0" +version = "0.14.1-rc1" dependencies = [ "ahash", "alacritty_config", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -92,7 +92,7 @@ dependencies = [ [[package]] name = "alacritty_terminal" -version = "0.24.1" +version = "0.24.2-rc1" dependencies = [ "base64", "bitflags 2.6.0", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -966,10 +966,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2096,23 +2097,23 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2121,21 +2122,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2143,9 +2145,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2156,9 +2158,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wayland-backend" diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2271,9 +2273,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -2536,9 +2538,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.30.4" +version = "0.30.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4225ddd8ab67b8b59a2fee4b34889ebf13c0460c1c3fa297c58e21eb87801b33" +checksum = "dba50bc8ef4b6f1a75c9274fb95aa9a8f63fbc66c56f391bd85cf68d51e7b1a3" dependencies = [ "ahash", "android-activity", diff --git a/INSTALL.md b/INSTALL.md --- a/INSTALL.md +++ b/INSTALL.md @@ -84,7 +84,7 @@ to build Alacritty. Here's an apt command that should install all of them. If something is still found to be missing, please open an issue. ```sh -apt install cmake pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3 +apt install cmake g++ pkg-config libfreetype6-dev libfontconfig1-dev libxcb-xfixes0-dev libxkbcommon-dev python3 ``` #### Arch Linux diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alacritty" -version = "0.14.0" +version = "0.14.1-rc1" authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"] license = "Apache-2.0" description = "A fast, cross-platform, OpenGL terminal emulator" diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.74.0" [dependencies.alacritty_terminal] path = "../alacritty_terminal" -version = "0.24.1" +version = "0.24.2-rc1" [dependencies.alacritty_config_derive] path = "../alacritty_config_derive" diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -41,7 +41,7 @@ tempfile = "3.12.0" toml = "0.8.2" toml_edit = "0.22.21" unicode-width = "0.1" -winit = { version = "0.30.4", default-features = false, features = ["rwh_06", "serde"] } +winit = { version = "0.30.7", default-features = false, features = ["rwh_06", "serde"] } [build-dependencies] gl_generator = "0.14.0" diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -5,6 +5,7 @@ use std::fmt::{self, Debug, Display}; use bitflags::bitflags; use serde::de::{self, Error as SerdeError, MapAccess, Unexpected, Visitor}; use serde::{Deserialize, Deserializer}; +use std::rc::Rc; use toml::Value as SerdeValue; use winit::event::MouseButton; use winit::keyboard::{ diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -96,7 +97,7 @@ pub enum Action { /// Regex keyboard hints. #[config(skip)] - Hint(Hint), + Hint(Rc<Hint>), /// Move vi mode cursor. #[config(skip)] diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -790,7 +791,7 @@ impl<'a> Deserialize<'a> for ModeWrapper { { struct ModeVisitor; - impl<'a> Visitor<'a> for ModeVisitor { + impl Visitor<'_> for ModeVisitor { type Value = ModeWrapper; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -844,7 +845,7 @@ impl<'a> Deserialize<'a> for MouseButtonWrapper { { struct MouseButtonVisitor; - impl<'a> Visitor<'a> for MouseButtonVisitor { + impl Visitor<'_> for MouseButtonVisitor { type Value = MouseButtonWrapper; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -956,7 +957,7 @@ impl<'a> Deserialize<'a> for RawBinding { { struct FieldVisitor; - impl<'a> Visitor<'a> for FieldVisitor { + impl Visitor<'_> for FieldVisitor { type Value = Field; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/config/bindings.rs b/alacritty/src/config/bindings.rs --- a/alacritty/src/config/bindings.rs +++ b/alacritty/src/config/bindings.rs @@ -1204,7 +1205,7 @@ impl<'a> de::Deserialize<'a> for ModsWrapper { { struct ModsVisitor; - impl<'a> Visitor<'a> for ModsVisitor { + impl Visitor<'_> for ModsVisitor { type Value = ModsWrapper; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/config/font.rs b/alacritty/src/config/font.rs --- a/alacritty/src/config/font.rs +++ b/alacritty/src/config/font.rs @@ -144,7 +144,7 @@ impl<'de> Deserialize<'de> for Size { D: Deserializer<'de>, { struct NumVisitor; - impl<'v> Visitor<'v> for NumVisitor { + impl Visitor<'_> for NumVisitor { type Value = Size; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -253,7 +253,7 @@ pub struct Hints { alphabet: HintsAlphabet, /// All configured terminal hints. - pub enabled: Vec<Hint>, + pub enabled: Vec<Rc<Hint>>, } impl Default for Hints { diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -274,7 +274,7 @@ impl Default for Hints { }); Self { - enabled: vec![Hint { + enabled: vec![Rc::new(Hint { content, action, persist: false, diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -288,7 +288,7 @@ impl Default for Hints { mods: ModsWrapper(ModifiersState::SHIFT | ModifiersState::CONTROL), mode: Default::default(), }), - }], + })], alphabet: Default::default(), } } diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -619,7 +619,7 @@ impl SerdeReplace for Program { } pub(crate) struct StringVisitor; -impl<'de> serde::de::Visitor<'de> for StringVisitor { +impl serde::de::Visitor<'_> for StringVisitor { type Value = String; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/alacritty/src/display/color.rs b/alacritty/src/display/color.rs --- a/alacritty/src/display/color.rs +++ b/alacritty/src/display/color.rs @@ -18,7 +18,7 @@ pub const DIM_FACTOR: f32 = 0.66; #[derive(Copy, Clone)] pub struct List([Rgb; COUNT]); -impl<'a> From<&'a Colors> for List { +impl From<&'_ Colors> for List { fn from(colors: &Colors) -> List { // Type inference fails without this annotation. let mut list = List([Rgb::default(); COUNT]); diff --git a/alacritty/src/display/color.rs b/alacritty/src/display/color.rs --- a/alacritty/src/display/color.rs +++ b/alacritty/src/display/color.rs @@ -235,7 +235,7 @@ impl<'de> Deserialize<'de> for Rgb { b: u8, } - impl<'a> Visitor<'a> for RgbVisitor { + impl Visitor<'_> for RgbVisitor { type Value = Rgb; fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/display/color.rs b/alacritty/src/display/color.rs --- a/alacritty/src/display/color.rs +++ b/alacritty/src/display/color.rs @@ -331,7 +331,7 @@ impl<'de> Deserialize<'de> for CellRgb { const EXPECTING: &str = "CellForeground, CellBackground, or hex color like #ff00ff"; struct CellRgbVisitor; - impl<'a> Visitor<'a> for CellRgbVisitor { + impl Visitor<'_> for CellRgbVisitor { type Value = CellRgb; fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -150,7 +150,7 @@ impl<'a> RenderableContent<'a> { } } -impl<'a> Iterator for RenderableContent<'a> { +impl Iterator for RenderableContent<'_> { type Item = RenderableCell; /// Gets the next renderable cell. diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -453,7 +453,7 @@ struct Hint<'a> { labels: &'a Vec<Vec<char>>, } -impl<'a> Hint<'a> { +impl Hint<'_> { /// Advance the hint iterator. /// /// If the point is within a hint, the keyboard shortcut character that should be displayed at diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -543,7 +543,7 @@ impl<'a> HintMatches<'a> { } } -impl<'a> Deref for HintMatches<'a> { +impl Deref for HintMatches<'_> { type Target = [Match]; fn deref(&self) -> &Self::Target { diff --git a/alacritty/src/display/damage.rs b/alacritty/src/display/damage.rs --- a/alacritty/src/display/damage.rs +++ b/alacritty/src/display/damage.rs @@ -193,9 +193,11 @@ impl FrameDamage { /// Check if a range is damaged. #[inline] pub fn intersects(&self, start: Point<usize>, end: Point<usize>) -> bool { + let start_line = &self.lines[start.line]; + let end_line = &self.lines[end.line]; self.full - || self.lines[start.line].left <= start.column - || self.lines[end.line].right >= end.column + || (start_line.left..=start_line.right).contains(&start.column) + || (end_line.left..=end_line.right).contains(&end.column) || (start.line + 1..end.line).any(|line| self.lines[line].is_damaged()) } } diff --git a/alacritty/src/display/damage.rs b/alacritty/src/display/damage.rs --- a/alacritty/src/display/damage.rs +++ b/alacritty/src/display/damage.rs @@ -249,7 +251,7 @@ impl<'a> RenderDamageIterator<'a> { } } -impl<'a> Iterator for RenderDamageIterator<'a> { +impl Iterator for RenderDamageIterator<'_> { type Item = Rect; fn next(&mut self) -> Option<Rect> { diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -1,6 +1,8 @@ +use std::borrow::Cow; use std::cmp::Reverse; use std::collections::HashSet; use std::iter; +use std::rc::Rc; use ahash::RandomState; use winit::keyboard::ModifiersState; diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -23,7 +25,7 @@ const HINT_SPLIT_PERCENTAGE: f32 = 0.5; /// Keyboard regex hint state. pub struct HintState { /// Hint currently in use. - hint: Option<Hint>, + hint: Option<Rc<Hint>>, /// Alphabet for hint labels. alphabet: String, diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -56,7 +58,7 @@ impl HintState { } /// Start the hint selection process. - pub fn start(&mut self, hint: Hint) { + pub fn start(&mut self, hint: Rc<Hint>) { self.hint = Some(hint); } diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -150,7 +152,7 @@ impl HintState { // Check if the selected label is fully matched. if label.len() == 1 { let bounds = self.matches[index].clone(); - let action = hint.action.clone(); + let hint = hint.clone(); // Exit hint mode unless it requires explicit dismissal. if hint.persist { diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -161,7 +163,7 @@ impl HintState { // Hyperlinks take precedence over regex matches. let hyperlink = term.grid()[*bounds.start()].hyperlink(); - Some(HintMatch { action, bounds, hyperlink }) + Some(HintMatch { bounds, hyperlink, hint }) } else { // Store character to preserve the selection. self.keys.push(c); diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -192,13 +194,14 @@ impl HintState { /// Hint match which was selected by the user. #[derive(PartialEq, Eq, Debug, Clone)] pub struct HintMatch { - /// Action for handling the text. - action: HintAction, - /// Terminal range matching the hint. bounds: Match, + /// OSC 8 hyperlink. hyperlink: Option<Hyperlink>, + + /// Hint which triggered this match. + hint: Rc<Hint>, } impl HintMatch { diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -210,7 +213,7 @@ impl HintMatch { #[inline] pub fn action(&self) -> &HintAction { - &self.action + &self.hint.action } #[inline] diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -221,6 +224,29 @@ impl HintMatch { pub fn hyperlink(&self) -> Option<&Hyperlink> { self.hyperlink.as_ref() } + + /// Get the text content of the hint match. + /// + /// This will always revalidate the hint text, to account for terminal content + /// changes since the [`HintMatch`] was constructed. The text of the hint might + /// be different from its original value, but it will **always** be a valid + /// match for this hint. + pub fn text<T>(&self, term: &Term<T>) -> Option<Cow<'_, str>> { + // Revalidate hyperlink match. + if let Some(hyperlink) = &self.hyperlink { + let (validated, bounds) = hyperlink_at(term, *self.bounds.start())?; + return (&validated == hyperlink && bounds == self.bounds) + .then(|| hyperlink.uri().into()); + } + + // Revalidate regex match. + let regex = self.hint.content.regex.as_ref()?; + let bounds = regex.with_compiled(|regex| { + regex_match_at(term, *self.bounds.start(), regex, self.hint.post_processing) + })??; + (bounds == self.bounds) + .then(|| term.bounds_to_string(*bounds.start(), *bounds.end()).into()) + } } /// Generator for creating new hint labels. diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -382,18 +408,14 @@ pub fn highlighted_at<T>( if let Some((hyperlink, bounds)) = hint.content.hyperlinks.then(|| hyperlink_at(term, point)).flatten() { - return Some(HintMatch { - bounds, - action: hint.action.clone(), - hyperlink: Some(hyperlink), - }); + return Some(HintMatch { bounds, hyperlink: Some(hyperlink), hint: hint.clone() }); } let bounds = hint.content.regex.as_ref().and_then(|regex| { regex.with_compiled(|regex| regex_match_at(term, point, regex, hint.post_processing)) }); if let Some(bounds) = bounds.flatten() { - return Some(HintMatch { bounds, action: hint.action.clone(), hyperlink: None }); + return Some(HintMatch { bounds, hint: hint.clone(), hyperlink: None }); } None diff --git a/alacritty/src/display/hint.rs b/alacritty/src/display/hint.rs --- a/alacritty/src/display/hint.rs +++ b/alacritty/src/display/hint.rs @@ -554,7 +576,7 @@ impl<'a, T> HintPostProcessor<'a, T> { } } -impl<'a, T> Iterator for HintPostProcessor<'a, T> { +impl<T> Iterator for HintPostProcessor<'_, T> { type Item = Match; fn next(&mut self) -> Option<Self::Item> { diff --git a/alacritty/src/display/meter.rs b/alacritty/src/display/meter.rs --- a/alacritty/src/display/meter.rs +++ b/alacritty/src/display/meter.rs @@ -57,7 +57,7 @@ impl<'a> Sampler<'a> { } } -impl<'a> Drop for Sampler<'a> { +impl Drop for Sampler<'_> { fn drop(&mut self) { self.meter.add_sample(self.alive_duration()); } diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -342,9 +342,13 @@ pub struct Display { /// Hint highlighted by the mouse. pub highlighted_hint: Option<HintMatch>, + /// Frames since hint highlight was created. + highlighted_hint_age: usize, /// Hint highlighted by the vi mode cursor. pub vi_highlighted_hint: Option<HintMatch>, + /// Frames since hint highlight was created. + vi_highlighted_hint_age: usize, pub raw_window_handle: RawWindowHandle, diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -516,6 +520,8 @@ impl Display { font_size, window, pending_renderer_update: Default::default(), + vi_highlighted_hint_age: Default::default(), + highlighted_hint_age: Default::default(), vi_highlighted_hint: Default::default(), highlighted_hint: Default::default(), hint_mouse_point: Default::default(), diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -759,7 +765,7 @@ impl Display { drop(terminal); // Invalidate highlighted hints if grid has changed. - self.validate_hints(display_offset); + self.validate_hint_highlights(display_offset); // Add damage from alacritty's UI elements overlapping terminal. diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -1017,9 +1023,10 @@ impl Display { }; let mut dirty = vi_highlighted_hint != self.vi_highlighted_hint; self.vi_highlighted_hint = vi_highlighted_hint; + self.vi_highlighted_hint_age = 0; // Force full redraw if the vi mode highlight was cleared. - if dirty && self.vi_highlighted_hint.is_none() { + if dirty { self.damage_tracker.frame().mark_fully_damaged(); } diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -1055,9 +1062,10 @@ impl Display { let mouse_highlight_dirty = self.highlighted_hint != highlighted_hint; dirty |= mouse_highlight_dirty; self.highlighted_hint = highlighted_hint; + self.highlighted_hint_age = 0; - // Force full redraw if the mouse cursor highlight was cleared. - if mouse_highlight_dirty && self.highlighted_hint.is_none() { + // Force full redraw if the mouse cursor highlight was changed. + if mouse_highlight_dirty { self.damage_tracker.frame().mark_fully_damaged(); } diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs --- a/alacritty/src/display/mod.rs +++ b/alacritty/src/display/mod.rs @@ -1331,16 +1339,24 @@ impl Display { } /// Check whether a hint highlight needs to be cleared. - fn validate_hints(&mut self, display_offset: usize) { + fn validate_hint_highlights(&mut self, display_offset: usize) { let frame = self.damage_tracker.frame(); - for (hint, reset_mouse) in - [(&mut self.highlighted_hint, true), (&mut self.vi_highlighted_hint, false)] - { + let hints = [ + (&mut self.highlighted_hint, &mut self.highlighted_hint_age, true), + (&mut self.vi_highlighted_hint, &mut self.vi_highlighted_hint_age, false), + ]; + for (hint, hint_age, reset_mouse) in hints { let (start, end) = match hint { Some(hint) => (*hint.bounds().start(), *hint.bounds().end()), - None => return, + None => continue, }; + // Ignore hints that were created this frame. + *hint_age += 1; + if *hint_age == 1 { + continue; + } + // Convert hint bounds to viewport coordinates. let start = term::point_to_viewport(display_offset, start).unwrap_or_default(); let end = term::point_to_viewport(display_offset, end).unwrap_or_else(|| { diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -140,14 +140,14 @@ impl Processor { pub fn create_initial_window( &mut self, event_loop: &ActiveEventLoop, + window_options: WindowOptions, ) -> Result<(), Box<dyn Error>> { - let options = match self.initial_window_options.take() { - Some(options) => options, - None => return Ok(()), - }; - - let window_context = - WindowContext::initial(event_loop, self.proxy.clone(), self.config.clone(), options)?; + let window_context = WindowContext::initial( + event_loop, + self.proxy.clone(), + self.config.clone(), + window_options, + )?; self.gl_config = Some(window_context.display.gl_context().config()); self.windows.insert(window_context.id(), window_context); diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -225,10 +225,12 @@ impl ApplicationHandler<Event> for Processor { return; } - if let Err(err) = self.create_initial_window(event_loop) { - self.initial_window_error = Some(err); - event_loop.exit(); - return; + if let Some(window_options) = self.initial_window_options.take() { + if let Err(err) = self.create_initial_window(event_loop, window_options) { + self.initial_window_error = Some(err); + event_loop.exit(); + return; + } } info!("Initialisation complete"); diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -276,7 +278,7 @@ impl ApplicationHandler<Event> for Processor { } // Handle events which don't mandate the WindowId. - match (&event.payload, event.window_id.as_ref()) { + match (event.payload, event.window_id.as_ref()) { // Process IPC config update. #[cfg(unix)] (EventType::IpcConfig(ipc_config), window_id) => { diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -315,7 +317,7 @@ impl ApplicationHandler<Event> for Processor { } // Load config and update each terminal. - if let Ok(config) = config::reload(path, &mut self.cli_options) { + if let Ok(config) = config::reload(&path, &mut self.cli_options) { self.config = Rc::new(config); // Restart config monitor if imports changed. diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -346,17 +348,17 @@ impl ApplicationHandler<Event> for Processor { if self.gl_config.is_none() { // Handle initial window creation in daemon mode. - if let Err(err) = self.create_initial_window(event_loop) { + if let Err(err) = self.create_initial_window(event_loop, options) { self.initial_window_error = Some(err); event_loop.exit(); } - } else if let Err(err) = self.create_window(event_loop, options.clone()) { + } else if let Err(err) = self.create_window(event_loop, options) { error!("Could not open window: {:?}", err); } }, // Process events affecting all windows. - (_, None) => { - let event = WinitEvent::UserEvent(event); + (payload, None) => { + let event = WinitEvent::UserEvent(Event::new(payload, None)); for window_context in self.windows.values_mut() { window_context.handle_event( #[cfg(target_os = "macos")] diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -405,7 +407,7 @@ impl ApplicationHandler<Event> for Processor { } } }, - (_, Some(window_id)) => { + (payload, Some(window_id)) => { if let Some(window_context) = self.windows.get_mut(window_id) { window_context.handle_event( #[cfg(target_os = "macos")] diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -413,7 +415,7 @@ impl ApplicationHandler<Event> for Processor { &self.proxy, &mut self.clipboard, &mut self.scheduler, - WinitEvent::UserEvent(event), + WinitEvent::UserEvent(Event::new(payload, *window_id)), ); } }, diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -1141,16 +1143,16 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon } let hint_bounds = hint.bounds(); - let text = match hint.hyperlink() { - Some(hyperlink) => hyperlink.uri().to_owned(), - None => self.terminal.bounds_to_string(*hint_bounds.start(), *hint_bounds.end()), + let text = match hint.text(self.terminal) { + Some(text) => text, + None => return, }; match &hint.action() { // Launch an external program. HintAction::Command(command) => { let mut args = command.args().to_vec(); - args.push(text); + args.push(text.into()); self.spawn_daemon(command.program(), &args); }, // Copy the text to the clipboard. diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs --- a/alacritty/src/input/keyboard.rs +++ b/alacritty/src/input/keyboard.rs @@ -280,7 +280,7 @@ fn build_sequence(key: KeyEvent, mods: ModifiersState, mode: TermMode) -> Vec<u8 let sequence_base = context .try_build_numpad(&key) .or_else(|| context.try_build_named_kitty(&key)) - .or_else(|| context.try_build_named_normal(&key)) + .or_else(|| context.try_build_named_normal(&key, associated_text.is_some())) .or_else(|| context.try_build_control_char_or_mod(&key, &mut modifiers)) .or_else(|| context.try_build_textual(&key, associated_text)); diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs --- a/alacritty/src/input/keyboard.rs +++ b/alacritty/src/input/keyboard.rs @@ -483,14 +483,23 @@ impl SequenceBuilder { } /// Try building from [`NamedKey`]. - fn try_build_named_normal(&self, key: &KeyEvent) -> Option<SequenceBase> { + fn try_build_named_normal( + &self, + key: &KeyEvent, + has_associated_text: bool, + ) -> Option<SequenceBase> { let named = match key.logical_key { Key::Named(named) => named, _ => return None, }; // The default parameter is 1, so we can omit it. - let one_based = if self.modifiers.is_empty() && !self.kitty_event_type { "" } else { "1" }; + let one_based = + if self.modifiers.is_empty() && !self.kitty_event_type && !has_associated_text { + "" + } else { + "1" + }; let (base, terminator) = match named { NamedKey::PageUp => ("5", SequenceTerminator::Normal('~')), NamedKey::PageDown => ("6", SequenceTerminator::Normal('~')), diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs --- a/alacritty/src/migrate/mod.rs +++ b/alacritty/src/migrate/mod.rs @@ -151,7 +151,15 @@ fn migrate_imports( // Migrate each import. for import in imports.into_iter().filter_map(|item| item.as_str()) { let normalized_path = config::normalize_import(path, import); - let migration = migrate_config(options, &normalized_path, recursion_limit)?; + + if !normalized_path.exists() { + if options.dry_run { + println!("Skipping migration for nonexistent path: {}", normalized_path.display()); + } + continue; + } + + let migration = migrate_config(options, &normalized_path, recursion_limit - 1)?; if options.dry_run { println!("{}", migration.success_message(true)); } diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs --- a/alacritty/src/migrate/mod.rs +++ b/alacritty/src/migrate/mod.rs @@ -244,7 +252,7 @@ enum Migration<'a> { Yaml((&'a Path, String)), } -impl<'a> Migration<'a> { +impl Migration<'_> { /// Get the success message for this migration. fn success_message(&self, import: bool) -> String { match self { diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs --- a/alacritty/src/renderer/text/gles2.rs +++ b/alacritty/src/renderer/text/gles2.rs @@ -346,7 +346,7 @@ pub struct RenderApi<'a> { dual_source_blending: bool, } -impl<'a> Drop for RenderApi<'a> { +impl Drop for RenderApi<'_> { fn drop(&mut self) { if !self.batch.is_empty() { self.render_batch(); diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs --- a/alacritty/src/renderer/text/gles2.rs +++ b/alacritty/src/renderer/text/gles2.rs @@ -354,7 +354,7 @@ impl<'a> Drop for RenderApi<'a> { } } -impl<'a> LoadGlyph for RenderApi<'a> { +impl LoadGlyph for RenderApi<'_> { fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph { Atlas::load_glyph(self.active_tex, self.atlas, self.current_atlas, rasterized) } diff --git a/alacritty/src/renderer/text/gles2.rs b/alacritty/src/renderer/text/gles2.rs --- a/alacritty/src/renderer/text/gles2.rs +++ b/alacritty/src/renderer/text/gles2.rs @@ -364,7 +364,7 @@ impl<'a> LoadGlyph for RenderApi<'a> { } } -impl<'a> TextRenderApi<Batch> for RenderApi<'a> { +impl TextRenderApi<Batch> for RenderApi<'_> { fn batch(&mut self) -> &mut Batch { self.batch } diff --git a/alacritty/src/renderer/text/glsl3.rs b/alacritty/src/renderer/text/glsl3.rs --- a/alacritty/src/renderer/text/glsl3.rs +++ b/alacritty/src/renderer/text/glsl3.rs @@ -215,7 +215,7 @@ pub struct RenderApi<'a> { program: &'a mut TextShaderProgram, } -impl<'a> TextRenderApi<Batch> for RenderApi<'a> { +impl TextRenderApi<Batch> for RenderApi<'_> { fn batch(&mut self) -> &mut Batch { self.batch } diff --git a/alacritty/src/renderer/text/glsl3.rs b/alacritty/src/renderer/text/glsl3.rs --- a/alacritty/src/renderer/text/glsl3.rs +++ b/alacritty/src/renderer/text/glsl3.rs @@ -261,7 +261,7 @@ impl<'a> TextRenderApi<Batch> for RenderApi<'a> { } } -impl<'a> LoadGlyph for RenderApi<'a> { +impl LoadGlyph for RenderApi<'_> { fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph { Atlas::load_glyph(self.active_tex, self.atlas, self.current_atlas, rasterized) } diff --git a/alacritty/src/renderer/text/glsl3.rs b/alacritty/src/renderer/text/glsl3.rs --- a/alacritty/src/renderer/text/glsl3.rs +++ b/alacritty/src/renderer/text/glsl3.rs @@ -271,7 +271,7 @@ impl<'a> LoadGlyph for RenderApi<'a> { } } -impl<'a> Drop for RenderApi<'a> { +impl Drop for RenderApi<'_> { fn drop(&mut self) { if !self.batch.is_empty() { self.render_batch(); diff --git a/alacritty/src/renderer/text/mod.rs b/alacritty/src/renderer/text/mod.rs --- a/alacritty/src/renderer/text/mod.rs +++ b/alacritty/src/renderer/text/mod.rs @@ -186,7 +186,7 @@ pub struct LoaderApi<'a> { current_atlas: &'a mut usize, } -impl<'a> LoadGlyph for LoaderApi<'a> { +impl LoadGlyph for LoaderApi<'_> { fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph { Atlas::load_glyph(self.active_tex, self.atlas, self.current_atlas, rasterized) } diff --git a/alacritty/src/string.rs b/alacritty/src/string.rs --- a/alacritty/src/string.rs +++ b/alacritty/src/string.rs @@ -106,7 +106,7 @@ impl<'a> StrShortener<'a> { } } -impl<'a> Iterator for StrShortener<'a> { +impl Iterator for StrShortener<'_> { type Item = char; fn next(&mut self) -> Option<Self::Item> { diff --git a/alacritty/windows/wix/alacritty.wxs b/alacritty/windows/wix/alacritty.wxs --- a/alacritty/windows/wix/alacritty.wxs +++ b/alacritty/windows/wix/alacritty.wxs @@ -1,5 +1,5 @@ <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui"> - <Package Name="Alacritty" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.14.0" Manufacturer="Alacritty" InstallerVersion="200"> + <Package Name="Alacritty" UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a7" Language="1033" Codepage="1252" Version="0.14.1-rc1" Manufacturer="Alacritty" InstallerVersion="200"> <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <Icon Id="AlacrittyIco" SourceFile=".\alacritty\windows\alacritty.ico" /> <WixVariable Id="WixUILicenseRtf" Value=".\alacritty\windows\wix\license.rtf" /> diff --git a/alacritty_terminal/CHANGELOG.md b/alacritty_terminal/CHANGELOG.md --- a/alacritty_terminal/CHANGELOG.md +++ b/alacritty_terminal/CHANGELOG.md @@ -8,6 +8,12 @@ sections should follow the order `Added`, `Changed`, `Deprecated`, `Fixed` and The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.24.2 + +### Fixed + +- Semantic escape search across wide characters + ## 0.24.1 ### Changed diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml --- a/alacritty_terminal/Cargo.toml +++ b/alacritty_terminal/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alacritty_terminal" -version = "0.24.1" +version = "0.24.2-rc1" authors = ["Christian Duerr <contact@christianduerr.com>", "Joe Wilm <joe@jwilm.com>"] license = "Apache-2.0" description = "Library for writing terminal emulators" diff --git a/alacritty_terminal/src/grid/mod.rs b/alacritty_terminal/src/grid/mod.rs --- a/alacritty_terminal/src/grid/mod.rs +++ b/alacritty_terminal/src/grid/mod.rs @@ -615,7 +615,7 @@ pub trait BidirectionalIterator: Iterator { fn prev(&mut self) -> Option<Self::Item>; } -impl<'a, T> BidirectionalIterator for GridIterator<'a, T> { +impl<T> BidirectionalIterator for GridIterator<'_, T> { fn prev(&mut self) -> Option<Self::Item> { let topmost_line = self.grid.topmost_line(); let last_column = self.grid.last_column(); diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -199,7 +199,7 @@ impl<'a> TermDamageIterator<'a> { } } -impl<'a> Iterator for TermDamageIterator<'a> { +impl Iterator for TermDamageIterator<'_> { type Item = LineDamageBounds; fn next(&mut self) -> Option<Self::Item> { diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -656,7 +656,7 @@ impl<'a, T> RegexIter<'a, T> { } } -impl<'a, T> Iterator for RegexIter<'a, T> { +impl<T> Iterator for RegexIter<'_, T> { type Item = Match; fn next(&mut self) -> Option<Self::Item> { diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs --- a/alacritty_terminal/src/vi_mode.rs +++ b/alacritty_terminal/src/vi_mode.rs @@ -265,14 +265,14 @@ fn semantic<T: EventListener>( } }; - // Make sure we jump above wide chars. - point = term.expand_wide(point, direction); - // Move to word boundary. if direction != side && !is_boundary(term, point, direction) { point = expand_semantic(point); } + // Make sure we jump above wide chars. + point = term.expand_wide(point, direction); + // Skip whitespace. let mut next_point = advance(term, point, direction); while !is_boundary(term, point, direction) && is_space(term, next_point) { diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs --- a/alacritty_terminal/src/vi_mode.rs +++ b/alacritty_terminal/src/vi_mode.rs @@ -283,6 +283,11 @@ fn semantic<T: EventListener>( // Assure minimum movement of one cell. if !is_boundary(term, point, direction) { point = advance(term, point, direction); + + // Skip over wide cell spacers. + if direction == Direction::Left { + point = term.expand_wide(point, direction); + } } // Move to word boundary. diff --git a/extra/osx/Alacritty.app/Contents/Info.plist b/extra/osx/Alacritty.app/Contents/Info.plist --- a/extra/osx/Alacritty.app/Contents/Info.plist +++ b/extra/osx/Alacritty.app/Contents/Info.plist @@ -15,7 +15,7 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>0.14.0</string> + <string>0.14.1-rc1</string> <key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string>
alacritty__alacritty-8356
8,356
[ "8314", "8268" ]
0.14
alacritty/alacritty
2024-12-14T09:10:33Z
diff --git a/alacritty/src/input/mod.rs b/alacritty/src/input/mod.rs --- a/alacritty/src/input/mod.rs +++ b/alacritty/src/input/mod.rs @@ -1136,7 +1136,7 @@ mod tests { inline_search_state: &'a mut InlineSearchState, } - impl<'a, T: EventListener> super::ActionContext<T> for ActionContext<'a, T> { + impl<T: EventListener> super::ActionContext<T> for ActionContext<'_, T> { fn search_next( &mut self, _origin: Point, diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -930,6 +930,11 @@ impl<T> Term<T> { &self.config.semantic_escape_chars } + #[cfg(test)] + pub(crate) fn set_semantic_escape_chars(&mut self, semantic_escape_chars: &str) { + self.config.semantic_escape_chars = semantic_escape_chars.into(); + } + /// Active terminal cursor style. /// /// While vi mode is active, this will automatically return the vi mode cursor style. diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs --- a/alacritty_terminal/src/vi_mode.rs +++ b/alacritty_terminal/src/vi_mode.rs @@ -820,4 +825,42 @@ mod tests { cursor = cursor.scroll(&term, -20); assert_eq!(cursor.point, Point::new(Line(19), Column(0))); } + + #[test] + fn wide_semantic_char() { + let mut term = term(); + term.set_semantic_escape_chars("-"); + term.grid_mut()[Line(0)][Column(0)].c = 'x'; + term.grid_mut()[Line(0)][Column(1)].c = 'x'; + term.grid_mut()[Line(0)][Column(2)].c = '-'; + term.grid_mut()[Line(0)][Column(2)].flags.insert(Flags::WIDE_CHAR); + term.grid_mut()[Line(0)][Column(3)].c = ' '; + term.grid_mut()[Line(0)][Column(3)].flags.insert(Flags::WIDE_CHAR_SPACER); + term.grid_mut()[Line(0)][Column(4)].c = 'x'; + term.grid_mut()[Line(0)][Column(5)].c = 'x'; + + // Test motion to the right. + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(0))); + cursor = cursor.motion(&mut term, ViMotion::SemanticRight); + assert_eq!(cursor.point, Point::new(Line(0), Column(2))); + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2))); + cursor = cursor.motion(&mut term, ViMotion::SemanticRight); + assert_eq!(cursor.point, Point::new(Line(0), Column(4))); + + // Test motion to the left. + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(5))); + cursor = cursor.motion(&mut term, ViMotion::SemanticLeft); + assert_eq!(cursor.point, Point::new(Line(0), Column(4))); + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(4))); + cursor = cursor.motion(&mut term, ViMotion::SemanticLeft); + assert_eq!(cursor.point, Point::new(Line(0), Column(2))); + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2))); + cursor = cursor.motion(&mut term, ViMotion::SemanticLeft); + assert_eq!(cursor.point, Point::new(Line(0), Column(0))); + } }
Semantic characters in Vi Mode and moving left ### System OS: Linux 6.11.9 (arch) Version: alacritty 0.14.0 (22a44757) Sway 1:1.10-1 ``` [0.000000942s] [INFO ] [alacritty] Welcome to Alacritty [0.000051958s] [INFO ] [alacritty] Version 0.14.0 (22a44757) [0.000061095s] [INFO ] [alacritty] Running on Wayland [0.000525696s] [INFO ] [alacritty] Configuration files loaded from: ".config/alacritty/alacritty.toml" ".config/alacritty/themes/themes/tokyo-night.toml" [0.032020983s] [INFO ] [alacritty] Using EGL 1.5 [0.032067079s] [DEBUG] [alacritty] Picked GL Config: buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 }) alpha_size: 8 num_samples: 0 hardware_accelerated: true supports_transparency: Some(true) config_api: Api(OPENGL | GLES1 | GLES2 | GLES3) srgb_capable: true [0.035075269s] [INFO ] [alacritty] Window scale factor: 1 [0.036997955s] [DEBUG] [alacritty] Loading "JetBrains Mono" font [0.048522765s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 } [0.052494282s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 } [0.056145538s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 } [0.061237837s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 18.1.8, DRM 3.59, 6.11.9-zen1-1-zen) [0.061260339s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 24.2.7-arch1.1, shader_version 4.60 [0.061267753s] [INFO ] [alacritty] Using OpenGL 3.3 renderer [0.068799656s] [DEBUG] [alacritty] Enabled debug logging for OpenGL [0.070534168s] [DEBUG] [alacritty] Filling glyph cache with common glyphs [0.080691745s] [INFO ] [alacritty] Cell size: 10 x 25 [0.080720799s] [INFO ] [alacritty] Padding: 0 x 0 [0.080725207s] [INFO ] [alacritty] Width: 800, Height: 600 [0.080761626s] [INFO ] [alacritty] PTY dimensions: 24 x 80 [0.084459059s] [INFO ] [alacritty] Initialisation complete [0.105657768s] [INFO ] [alacritty] Font size changed to 18.666666 px [0.105695439s] [INFO ] [alacritty] Cell size: 10 x 25 [0.105708323s] [DEBUG] [alacritty_terminal] New num_cols is 191 and num_lines is 40 [0.110029896s] [INFO ] [alacritty] Padding: 0 x 0 [0.110058470s] [INFO ] [alacritty] Width: 1916, Height: 1020 ``` When in Vi Mode [Shift]+[Ctrl]+[Space], moving to the left with [B] "SemanticLeft" does not work for all semantic characters: `this is a test-STAHP.STAHP—yes this is a test-move test•lets go` In the above, the characters to the left of "STAHP" causes the cursor to... stop. Moving forward with [E] is fine. The only way to move past those characters is to use the cursor keys. Please be so kind as to look into this if you have the time at hand to spare. With humble thanks. macOS specific keyboard input crashes alacritty 0.14.0 edit: changed the topic title to better reflect the issue given what others have commented regarding their own experience with crashing. I use a piece of software on macOS called [BetterTouchTool](https://folivora.ai/) and one of its features is being able to turn caps lock into a hyper key. Hyper key for the uninitiated is actually a simultaneous key press event for the actual modifier keys `Command|Shift|Control|Option`. I use the hyper key in combination with keyboard bindings within alacritty such that my hyper key essentially handles the standard bash / readline Ctrl-* key sequences--that is to say, Hyper-C acts as Ctrl-c and terminates a process. ``` [[keyboard.bindings]] chars = "\u0003" key = "C" mods = "Command|Shift|Control|Option" ``` Previously, (i.e. the past two years) this was working just fine. Expected behavior: The character sequence defined in the key binding is sent, the desired effect occurs, and the terminal continues to operate without issue. Actual behavior: Repeated (although sometimes on the first try) use of the hyper key crashes the terminal causing it to suddenly close. ### System OS: ``` > sw_vers ProductName: macOS ProductVersion: 15.0.1 BuildVersion: 24A348 ``` Version: ``` > alacritty --version alacritty 0.14.0 (22a4475) ``` ### Logs ``` [2.758060875s] [INFO ] [alacritty_winit_event] Event { window_id: Some(WindowId(5198973488)), payload: Frame } [2.758098667s] [INFO ] [alacritty_winit_event] About to wait [2.758120958s] [INFO ] [alacritty_winit_event] About to wait [2.765228375s] [INFO ] [alacritty_winit_event] About to wait [2.771734167s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) [2.771803708s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(ControlLeft), logical_key: Named(Control), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Control) } }, is_synthetic: false } [2.771818125s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(SHIFT | ALT | SUPER), pressed_mods: ModifiersKeys(0x0) }) [2.771874583s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(ShiftLeft), logical_key: Named(Shift), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Shift) } }, is_synthetic: false } [2.771896125s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(ALT | SUPER), pressed_mods: ModifiersKeys(0x0) }) [2.771950375s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(AltLeft), logical_key: Named(Alt), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Alt) } }, is_synthetic: false } [2.771962542s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(SUPER), pressed_mods: ModifiersKeys(0x0) }) [2.772015583s] [INFO ] [alacritty_winit_event] KeyboardInput { device_id: DeviceId(DeviceId), event: KeyEvent { physical_key: Code(SuperLeft), logical_key: Named(Super), text: None, location: Left, state: Released, repeat: false, platform_specific: KeyEventExtra { text_with_all_modifiers: None, key_without_modifiers: Named(Super) } }, is_synthetic: false } [2.772026875s] [INFO ] [alacritty_winit_event] ModifiersChanged(Modifiers { state: ModifiersState(0x0), pressed_mods: ModifiersKeys(0x0) }) [2.772066917s] [INFO ] [alacritty_winit_event] About to wait [2.772157250s] [INFO ] [alacritty_winit_event] About to wait *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid message sent to event "NSEvent: type=FlagsChanged loc=(0,744) time=3879.1 flags=0x100 win=0x135e20a30 winNum=1167 ctxt=0x0 keyCode=15"' *** First throw call stack: ( 0 CoreFoundation 0x00000001955b0ec0 __exceptionPreprocess + 176 1 libobjc.A.dylib 0x0000000195096cd8 objc_exception_throw + 88 2 Foundation 0x00000001967ad588 -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x0000000199225cec -[NSEvent charactersIgnoringModifiers] + 604 4 alacritty 0x0000000104969154 _ZN5winit13platform_impl5macos5event16create_key_event17h5ffd7f45014bc6b9E + 2508 5 alacritty 0x00000001049594a8 _ZN5winit13platform_impl5macos4view9WinitView13flags_changed17h58c32ee31fdc0f1bE + 344 6 AppKit 0x00000001991a80a8 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 484 7 AppKit 0x00000001991a7cf4 -[NSWindow(NSEventRouting) sendEvent:] + 284 8 AppKit 0x00000001999a53e0 -[NSApplication(NSEventRouting) sendEvent:] + 1212 9 alacritty 0x0000000104961a3c _ZN5winit13platform_impl5macos3app16WinitApplication10send_event17h9d7b11ed09e187deE + 1040 10 AppKit 0x00000001995b8984 -[NSApplication _handleEvent:] + 60 11 AppKit 0x0000000199073ba4 -[NSApplication run] + 520 12 alacritty 0x000000010469e090 _ZN5winit13platform_impl5macos13event_handler12EventHandler3set17ha6185e593ba31ad4E + 280 13 alacritty 0x000000010474d378 _ZN9alacritty4main17h290211ac615fedbeE + 7624 14 alacritty 0x00000001046c2060 _ZN3std3sys9backtrace28__rust_begin_short_backtrace17h86645a6c57eec1ecE + 12 15 alacritty 0x000000010468392c _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h7b27810acbbe86f2E + 16 16 alacritty 0x00000001048f1598 _ZN3std2rt19lang_start_internal17h9e88109c8deb8787E + 808 17 alacritty 0x000000010474de4c main + 52 18 dyld 0x00000001950d4274 start + 2840 ) libc++abi: terminating due to uncaught exception of type NSException [1] 14442 abort alacritty -vv --print-events ``` I cannot confirm if this hyper key issue applies to any other piece of software that adds this functionality (such as karabiner elements) or if this is an issue specific to how bettertouchtool implements hyperkey. For meanwhile, I've downgraded back to [alacritty 0.13.2](https://github.com/Homebrew/homebrew-cask/blob/ee57cb02e89536c4eb0624e7175705c947693ac7/Casks/a/alacritty.rb) which has resolved the issue. ``` curl 'https://raw.githubusercontent.com/Homebrew/homebrew-cask/ee57cb02e89536c4eb0624e7175705c947693ac7/Casks/a/alacritty.rb' -o alacritty.rb brew install -s alacritty.rb ``` Not sure if there's something I'm overlooking with the latest update. Appreciate any help.
22a447573bbd67c0a5d3946d58d6d61bac3b4ad2
[ "vi_mode::tests::wide_semantic_char" ]
[ "grid::storage::tests::indexing", "grid::storage::tests::rotate", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::scroll_down", "grid::tests::grow_reflow_multiline", "grid::storage::tests::grow_before_zero", "grid::storage::tests::grow_after_zero", "grid::tests::scroll_up", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::shrink_reflow_twice", "grid::tests::test_iter", "index::tests::add", "index::tests::add_clamp", "grid::storage::tests::initialize", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "grid::tests::scroll_down_with_history", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_clamp", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::rotate_in_region_down", "selection::tests::range_intersection", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::simple_is_empty", "selection::tests::semantic_selection", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::cell_size_is_below_cap", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::search::tests::fullwidth_semantic", "term::search::tests::inline_word_search", "term::search::tests::end_on_fullwidth", "term::search::tests::leading_spacer", "term::search::tests::empty_match_multibyte", "term::search::tests::empty_match", "term::search::tests::anchored_empty", "term::search::tests::newline_breaking_semantic", "term::search::tests::empty_match_multiline", "term::search::tests::end_on_multibyte_unicode", "term::search::tests::include_linebreak_left", "term::search::tests::include_linebreak_right", "term::search::tests::no_match_right", "term::search::tests::no_match_left", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::greed_is_good", "term::search::tests::skip_dead_cell", "term::search::tests::wrap_around_to_another_end", "term::search::tests::singlecell_fullwidth", "term::tests::block_selection_works", "term::search::tests::fullwidth", "term::search::tests::regex_right", "term::search::tests::wrapping", "term::tests::clearing_scrollback_resets_display_offset", "term::search::tests::wide_without_spacer", "term::tests::damage_cursor_movements", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::tests::clear_saved_lines", "term::search::tests::regex_left", "term::tests::clearing_viewport_keeps_history_position", "term::search::tests::multiline", "term::tests::input_line_drawing_character", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::search::tests::wrapping_into_fullwidth", "term::tests::line_selection_works", "term::tests::parse_cargo_version", "term::tests::damage_public_usage", "term::search::tests::multibyte_unicode", "term::tests::semantic_selection_works", "term::tests::simple_selection_works", "term::tests::scroll_display_page_up", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "term::tests::scroll_display_page_down", "tty::unix::test_get_pw_entry", "term::search::tests::nested_regex", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_high_middle_low", "term::tests::window_title", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_word", "vi_mode::tests::motion_start_end", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_semantic", "vi_mode::tests::semantic_wide", "vi_mode::tests::scroll_simple", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_word", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::tests::full_damage", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::search::tests::nfa_compile_error", "term::tests::grid_serde", "term::search::tests::runtime_cache_error", "clear_underline", "csi_rep", "fish_cc", "delete_chars_reset", "deccolm_reset", "decaln_reset", "erase_chars_reset", "delete_lines", "alt_reset", "erase_in_line", "colored_underline", "ll", "indexed_256_colors", "insert_blank_reset", "newline_with_cursor_beyond_scroll_region", "colored_reset", "issue_855", "hyperlinks", "selective_erasure", "scroll_up_reset", "saved_cursor", "tmux_git_log", "saved_cursor_alt", "sgr", "tmux_htop", "scroll_in_region_up_preserves_history", "region_scroll_down", "vim_simple_edit", "tab_rendering", "vttest_cursor_movement_1", "vttest_insert", "grid_reset", "underline", "vttest_tab_clear_set", "vttest_scroll", "vttest_origin_mode_2", "vttest_origin_mode_1", "wrapline_alt_toggle", "zerowidth", "zsh_tab_completion", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2432)" ]
[]
[]
2024-12-22T23:22:35Z
4f739a7e2b933f6828ebf64654c8a8c573bf0ec1
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - Mouse/Vi cursor hint highlighting broken on the terminal cursor line - Hint launcher opening arbitrary text, when terminal content changed while opening +- `SemanticRight`/`SemanticLeft` vi motions breaking with wide semantic escape characters ## 0.14.0 diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs --- a/alacritty_terminal/src/vi_mode.rs +++ b/alacritty_terminal/src/vi_mode.rs @@ -265,14 +265,14 @@ fn semantic<T: EventListener>( } }; - // Make sure we jump above wide chars. - point = term.expand_wide(point, direction); - // Move to word boundary. if direction != side && !is_boundary(term, point, direction) { point = expand_semantic(point); } + // Make sure we jump above wide chars. + point = term.expand_wide(point, direction); + // Skip whitespace. let mut next_point = advance(term, point, direction); while !is_boundary(term, point, direction) && is_space(term, next_point) { diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs --- a/alacritty_terminal/src/vi_mode.rs +++ b/alacritty_terminal/src/vi_mode.rs @@ -283,6 +283,11 @@ fn semantic<T: EventListener>( // Assure minimum movement of one cell. if !is_boundary(term, point, direction) { point = advance(term, point, direction); + + // Skip over wide cell spacers. + if direction == Direction::Left { + point = term.expand_wide(point, direction); + } } // Move to word boundary.
alacritty__alacritty-8315
8,315
I'd assume that you have those wide chars in semantic chars specified, since wide chars are not there by default. Yes. `[selection] semantic_escape_chars = ",│`|:\"' ()[]{}<>\t•-—-." ` It seems like `b` isn't the only binding affected. The `w` binding also does not work correctly.
[ "8314" ]
1.74
alacritty/alacritty
2024-11-20T09:21:31Z
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -930,6 +930,11 @@ impl<T> Term<T> { &self.config.semantic_escape_chars } + #[cfg(test)] + pub(crate) fn set_semantic_escape_chars(&mut self, semantic_escape_chars: &str) { + self.config.semantic_escape_chars = semantic_escape_chars.into(); + } + /// Active terminal cursor style. /// /// While vi mode is active, this will automatically return the vi mode cursor style. diff --git a/alacritty_terminal/src/vi_mode.rs b/alacritty_terminal/src/vi_mode.rs --- a/alacritty_terminal/src/vi_mode.rs +++ b/alacritty_terminal/src/vi_mode.rs @@ -820,4 +825,42 @@ mod tests { cursor = cursor.scroll(&term, -20); assert_eq!(cursor.point, Point::new(Line(19), Column(0))); } + + #[test] + fn wide_semantic_char() { + let mut term = term(); + term.set_semantic_escape_chars("-"); + term.grid_mut()[Line(0)][Column(0)].c = 'x'; + term.grid_mut()[Line(0)][Column(1)].c = 'x'; + term.grid_mut()[Line(0)][Column(2)].c = '-'; + term.grid_mut()[Line(0)][Column(2)].flags.insert(Flags::WIDE_CHAR); + term.grid_mut()[Line(0)][Column(3)].c = ' '; + term.grid_mut()[Line(0)][Column(3)].flags.insert(Flags::WIDE_CHAR_SPACER); + term.grid_mut()[Line(0)][Column(4)].c = 'x'; + term.grid_mut()[Line(0)][Column(5)].c = 'x'; + + // Test motion to the right. + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(0))); + cursor = cursor.motion(&mut term, ViMotion::SemanticRight); + assert_eq!(cursor.point, Point::new(Line(0), Column(2))); + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2))); + cursor = cursor.motion(&mut term, ViMotion::SemanticRight); + assert_eq!(cursor.point, Point::new(Line(0), Column(4))); + + // Test motion to the left. + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(5))); + cursor = cursor.motion(&mut term, ViMotion::SemanticLeft); + assert_eq!(cursor.point, Point::new(Line(0), Column(4))); + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(4))); + cursor = cursor.motion(&mut term, ViMotion::SemanticLeft); + assert_eq!(cursor.point, Point::new(Line(0), Column(2))); + + let mut cursor = ViModeCursor::new(Point::new(Line(0), Column(2))); + cursor = cursor.motion(&mut term, ViMotion::SemanticLeft); + assert_eq!(cursor.point, Point::new(Line(0), Column(0))); + } }
Semantic characters in Vi Mode and moving left ### System OS: Linux 6.11.9 (arch) Version: alacritty 0.14.0 (22a44757) Sway 1:1.10-1 ``` [0.000000942s] [INFO ] [alacritty] Welcome to Alacritty [0.000051958s] [INFO ] [alacritty] Version 0.14.0 (22a44757) [0.000061095s] [INFO ] [alacritty] Running on Wayland [0.000525696s] [INFO ] [alacritty] Configuration files loaded from: ".config/alacritty/alacritty.toml" ".config/alacritty/themes/themes/tokyo-night.toml" [0.032020983s] [INFO ] [alacritty] Using EGL 1.5 [0.032067079s] [DEBUG] [alacritty] Picked GL Config: buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 }) alpha_size: 8 num_samples: 0 hardware_accelerated: true supports_transparency: Some(true) config_api: Api(OPENGL | GLES1 | GLES2 | GLES3) srgb_capable: true [0.035075269s] [INFO ] [alacritty] Window scale factor: 1 [0.036997955s] [DEBUG] [alacritty] Loading "JetBrains Mono" font [0.048522765s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 } [0.052494282s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 } [0.056145538s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold Italic, load_flags: LoadFlag(FORCE_AUTOHINT | TARGET_LIGHT | TARGET_MONO), render_mode: "Lcd", lcd_filter: 1 } [0.061237837s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 18.1.8, DRM 3.59, 6.11.9-zen1-1-zen) [0.061260339s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 24.2.7-arch1.1, shader_version 4.60 [0.061267753s] [INFO ] [alacritty] Using OpenGL 3.3 renderer [0.068799656s] [DEBUG] [alacritty] Enabled debug logging for OpenGL [0.070534168s] [DEBUG] [alacritty] Filling glyph cache with common glyphs [0.080691745s] [INFO ] [alacritty] Cell size: 10 x 25 [0.080720799s] [INFO ] [alacritty] Padding: 0 x 0 [0.080725207s] [INFO ] [alacritty] Width: 800, Height: 600 [0.080761626s] [INFO ] [alacritty] PTY dimensions: 24 x 80 [0.084459059s] [INFO ] [alacritty] Initialisation complete [0.105657768s] [INFO ] [alacritty] Font size changed to 18.666666 px [0.105695439s] [INFO ] [alacritty] Cell size: 10 x 25 [0.105708323s] [DEBUG] [alacritty_terminal] New num_cols is 191 and num_lines is 40 [0.110029896s] [INFO ] [alacritty] Padding: 0 x 0 [0.110058470s] [INFO ] [alacritty] Width: 1916, Height: 1020 ``` When in Vi Mode [Shift]+[Ctrl]+[Space], moving to the left with [B] "SemanticLeft" does not work for all semantic characters: `this is a test-STAHP.STAHP—yes this is a test-move test•lets go` In the above, the characters to the left of "STAHP" causes the cursor to... stop. Moving forward with [E] is fine. The only way to move past those characters is to use the cursor keys. Please be so kind as to look into this if you have the time at hand to spare. With humble thanks.
4f739a7e2b933f6828ebf64654c8a8c573bf0ec1
[ "vi_mode::tests::wide_semantic_char" ]
[ "grid::storage::tests::indexing", "grid::storage::tests::rotate", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::storage::tests::grow_before_zero", "grid::tests::shrink_reflow", "grid::storage::tests::grow_after_zero", "grid::tests::scroll_up", "grid::tests::shrink_reflow_disabled", "grid::tests::shrink_reflow_twice", "grid::storage::tests::initialize", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::test_iter", "index::tests::add_none_clamp", "index::tests::add", "index::tests::location_ordering", "index::tests::add_clamp", "index::tests::add_wrap", "index::tests::add_grid_clamp", "index::tests::sub", "index::tests::sub_clamp", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "grid::tests::scroll_down_with_history", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::selection_bigger_then_smaller", "selection::tests::rotate_in_region_up_block", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::cell_size_is_below_cap", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::search::tests::fullwidth_semantic", "term::search::tests::inline_word_search", "term::search::tests::leading_spacer", "term::search::tests::end_on_fullwidth", "term::search::tests::anchored_empty", "term::search::tests::empty_match", "term::search::tests::end_on_multibyte_unicode", "term::search::tests::empty_match_multiline", "term::search::tests::empty_match_multibyte", "term::search::tests::include_linebreak_right", "term::search::tests::include_linebreak_left", "term::search::tests::newline_breaking_semantic", "term::search::tests::greed_is_good", "term::search::tests::no_match_left", "term::search::tests::no_match_right", "term::search::tests::singlecell_fullwidth", "term::search::tests::multiline", "term::search::tests::fullwidth", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::skip_dead_cell", "term::tests::block_selection_works", "term::search::tests::wrapping", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::regex_right", "term::search::tests::regex_left", "term::tests::clearing_viewport_keeps_history_position", "term::tests::clearing_scrollback_resets_display_offset", "term::search::tests::wrap_around_to_another_end", "term::search::tests::nested_regex", "term::search::tests::wide_without_spacer", "term::tests::damage_public_usage", "term::tests::damage_cursor_movements", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::tests::line_selection_works", "term::tests::parse_cargo_version", "term::tests::input_line_drawing_character", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::tests::scroll_display_page_down", "term::tests::scroll_display_page_up", "term::search::tests::multibyte_unicode", "term::tests::semantic_selection_works", "term::tests::clear_saved_lines", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "term::tests::simple_selection_works", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_bracket", "term::tests::window_title", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_first_occupied", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_semantic", "vi_mode::tests::semantic_wide", "vi_mode::tests::scroll_simple", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_word", "vi_mode::tests::motion_word", "term::tests::full_damage", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::search::tests::nfa_compile_error", "term::tests::grid_serde", "term::search::tests::runtime_cache_error", "clear_underline", "deccolm_reset", "decaln_reset", "delete_chars_reset", "erase_chars_reset", "delete_lines", "alt_reset", "erase_in_line", "csi_rep", "fish_cc", "colored_underline", "hyperlinks", "ll", "indexed_256_colors", "insert_blank_reset", "issue_855", "selective_erasure", "newline_with_cursor_beyond_scroll_region", "scroll_up_reset", "saved_cursor_alt", "saved_cursor", "tmux_git_log", "sgr", "tmux_htop", "colored_reset", "vim_simple_edit", "vttest_cursor_movement_1", "underline", "tab_rendering", "vttest_insert", "scroll_in_region_up_preserves_history", "region_scroll_down", "vttest_origin_mode_1", "vttest_origin_mode_2", "grid_reset", "vttest_tab_clear_set", "vttest_scroll", "wrapline_alt_toggle", "zsh_tab_completion", "zerowidth", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2432)" ]
[]
[]
2024-11-22T01:07:12Z
c74b5fa857a133298f0207c499c47cb95b27c78c
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - Broken search with words broken across line boundary on the first character - Config import changes not being live reloaded - Cursor color requests with default cursor colors +- Fullwidth semantic escape characters ## 0.13.2 diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -516,7 +516,14 @@ impl<T> Term<T> { #[must_use] pub fn semantic_search_left(&self, point: Point) -> Point { match self.inline_search_left(point, self.semantic_escape_chars()) { - Ok(point) => self.grid.iter_from(point).next().map_or(point, |cell| cell.point), + // If we found a match, reverse for at least one cell, skipping over wide cell spacers. + Ok(point) => { + let wide_spacer = Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; + self.grid + .iter_from(point) + .find(|cell| !cell.flags.intersects(wide_spacer)) + .map_or(point, |cell| cell.point) + }, Err(point) => point, } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -538,7 +545,7 @@ impl<T> Term<T> { let mut iter = self.grid.iter_from(point); let last_column = self.columns() - 1; - let wide = Flags::WIDE_CHAR | Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; + let wide_spacer = Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; while let Some(cell) = iter.prev() { if cell.point.column == last_column && !cell.flags.contains(Flags::WRAPLINE) { break; diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -546,7 +553,7 @@ impl<T> Term<T> { point = cell.point; - if !cell.flags.intersects(wide) && needles.contains(cell.c) { + if !cell.flags.intersects(wide_spacer) && needles.contains(cell.c) { return Ok(point); } } diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -559,7 +566,7 @@ impl<T> Term<T> { // Limit the starting point to the last line in the history point.line = max(point.line, self.topmost_line()); - let wide = Flags::WIDE_CHAR | Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; + let wide_spacer = Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER; let last_column = self.columns() - 1; // Immediately stop if start point in on line break. diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -570,7 +577,7 @@ impl<T> Term<T> { for cell in self.grid.iter_from(point) { point = cell.point; - if !cell.flags.intersects(wide) && needles.contains(cell.c) { + if !cell.flags.intersects(wide_spacer) && needles.contains(cell.c) { return Ok(point); }
alacritty__alacritty-8190
8,190
You can just comment under existing issues, there's no need to create new ones. I've checked out the characters you mention specifically and it seems like fullwidth characters can't be used as semantic escape chars. Thanks for clearing that up. Many thanks for an exceptional piece of software.
[ "8188" ]
1.74
alacritty/alacritty
2024-09-21T21:00:01Z
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -1171,4 +1178,16 @@ mod tests { let match_end = Point::new(Line(1), Column(2)); assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); } + + #[test] + fn fullwidth_semantic() { + #[rustfmt::skip] + let mut term = mock_term("test-x-test"); + term.config.semantic_escape_chars = "-".into(); + + let start = term.semantic_search_left(Point::new(Line(0), Column(6))); + let end = term.semantic_search_right(Point::new(Line(0), Column(6))); + assert_eq!(start, Point::new(Line(0), Column(6))); + assert_eq!(end, Point::new(Line(0), Column(6))); + } }
alacritty not honouring [semantic_escape_chars] setting I hope I am not over-stepping any github/alacritty rules. My previous ticket has been closed, and I cannot find a way to reopen it (just joined yesterday). Please feel free to delete this ticket if need be. `semantic_escape_chars = ",│`|:\"' ()[]{}<>\t•-—-."` Here's a video of what happens after [Ctrl] + [Shift] + [Space] https://github.com/user-attachments/assets/0657d09d-544f-46e6-8964-1e58f977de26
4f739a7e2b933f6828ebf64654c8a8c573bf0ec1
[ "term::search::tests::fullwidth_semantic" ]
[ "grid::storage::tests::indexing", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::grow_after_zero", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::rotate", "grid::storage::tests::grow_before_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::initialize", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::scroll_down_with_history", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_empty_cell_inside_line", "grid::tests::shrink_reflow_twice", "grid::tests::shrink_reflow_disabled", "grid::tests::test_iter", "index::tests::add", "index::tests::add_clamp", "index::tests::add_grid_clamp", "index::tests::add_none_clamp", "index::tests::add_wrap", "index::tests::location_ordering", "index::tests::sub", "index::tests::sub_clamp", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::rotate_in_region_down", "selection::tests::range_intersection", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "selection::tests::single_cell_right_to_left", "term::cell::tests::cell_size_is_below_cap", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::tests::block_selection_works", "term::search::tests::newline_breaking_semantic", "term::search::tests::inline_word_search", "term::search::tests::skip_dead_cell", "term::search::tests::wrap_around_to_another_end", "term::tests::damage_cursor_movements", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::end_on_fullwidth", "term::search::tests::singlecell_fullwidth", "term::search::tests::no_match_left", "term::search::tests::no_match_right", "term::search::tests::wrapping", "term::search::tests::wrapping_into_fullwidth", "term::search::tests::leading_spacer", "term::tests::input_line_drawing_character", "term::tests::line_selection_works", "term::tests::semantic_selection_works", "term::tests::parse_cargo_version", "term::tests::simple_selection_works", "term::tests::clearing_viewport_keeps_history_position", "term::tests::window_title", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_bracket", "term::tests::clearing_scrollback_resets_display_offset", "vi_mode::tests::motion_first_occupied", "term::tests::damage_public_usage", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_left_start", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_right_start", "term::tests::scroll_display_page_down", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "vi_mode::tests::motion_word", "term::tests::scroll_display_page_up", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_word", "term::tests::clear_saved_lines", "vi_mode::tests::scroll_over_bottom", "term::tests::grid_serde", "vi_mode::tests::scroll_semantic", "vi_mode::tests::scroll_simple", "vi_mode::tests::scroll_over_top", "term::search::tests::empty_match_multibyte", "term::search::tests::anchored_empty", "term::search::tests::empty_match_multiline", "term::search::tests::empty_match", "term::search::tests::end_on_multibyte_unicode", "term::search::tests::regex_right", "term::search::tests::include_linebreak_right", "term::search::tests::include_linebreak_left", "term::search::tests::multiline", "term::search::tests::wide_without_spacer", "term::search::tests::greed_is_good", "term::search::tests::regex_left", "term::search::tests::fullwidth", "term::search::tests::multibyte_unicode", "term::search::tests::nested_regex", "term::tests::full_damage", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::shrink_lines_updates_active_cursor_pos", "term::search::tests::nfa_compile_error", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::search::tests::runtime_cache_error", "selective_erasure", "clear_underline", "erase_chars_reset", "fish_cc", "indexed_256_colors", "deccolm_reset", "insert_blank_reset", "decaln_reset", "alt_reset", "ll", "issue_855", "delete_chars_reset", "csi_rep", "newline_with_cursor_beyond_scroll_region", "delete_lines", "erase_in_line", "scroll_up_reset", "vim_simple_edit", "hyperlinks", "colored_reset", "saved_cursor_alt", "vttest_cursor_movement_1", "vttest_origin_mode_1", "vttest_insert", "vttest_origin_mode_2", "colored_underline", "zsh_tab_completion", "vttest_tab_clear_set", "vttest_scroll", "tmux_git_log", "tmux_htop", "saved_cursor", "wrapline_alt_toggle", "zerowidth", "sgr", "tab_rendering", "underline", "scroll_in_region_up_preserves_history", "region_scroll_down", "vim_large_window_scroll", "grid_reset", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2427)" ]
[]
[]
2024-09-22T16:10:01Z
5e6b92db85b3ea7ffd06a7a5ae0d2d62ad5946a6
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - Leaking FDs when closing windows on Unix systems - Config emitting errors for nonexistent import paths - Kitty keyboard protocol reporting shifted key codes +- Broken search with words broken across line boundary on the first character ## 0.13.2 diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs --- a/alacritty/src/renderer/text/glyph_cache.rs +++ b/alacritty/src/renderer/text/glyph_cache.rs @@ -187,14 +187,9 @@ impl GlyphCache { /// /// This will fail when the glyph could not be rasterized. Usually this is due to the glyph /// not being present in any font. - pub fn get<L: ?Sized>( - &mut self, - glyph_key: GlyphKey, - loader: &mut L, - show_missing: bool, - ) -> Glyph + pub fn get<L>(&mut self, glyph_key: GlyphKey, loader: &mut L, show_missing: bool) -> Glyph where - L: LoadGlyph, + L: LoadGlyph + ?Sized, { // Try to load glyph from cache. if let Some(glyph) = self.cache.get(&glyph_key) { diff --git a/alacritty/src/renderer/text/glyph_cache.rs b/alacritty/src/renderer/text/glyph_cache.rs --- a/alacritty/src/renderer/text/glyph_cache.rs +++ b/alacritty/src/renderer/text/glyph_cache.rs @@ -242,9 +237,9 @@ impl GlyphCache { /// Load glyph into the atlas. /// /// This will apply all transforms defined for the glyph cache to the rasterized glyph before - pub fn load_glyph<L: ?Sized>(&self, loader: &mut L, mut glyph: RasterizedGlyph) -> Glyph + pub fn load_glyph<L>(&self, loader: &mut L, mut glyph: RasterizedGlyph) -> Glyph where - L: LoadGlyph, + L: LoadGlyph + ?Sized, { glyph.left += i32::from(self.glyph_offset.x); glyph.top += i32::from(self.glyph_offset.y); diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1445,15 +1445,15 @@ impl<T: EventListener> Handler for Term<T> { /// edition, in LINE FEED mode, /// /// > The execution of the formatter functions LINE FEED (LF), FORM FEED - /// (FF), LINE TABULATION (VT) cause only movement of the active position in - /// the direction of the line progression. + /// > (FF), LINE TABULATION (VT) cause only movement of the active position in + /// > the direction of the line progression. /// /// In NEW LINE mode, /// /// > The execution of the formatter functions LINE FEED (LF), FORM FEED - /// (FF), LINE TABULATION (VT) cause movement to the line home position on - /// the following line, the following form, etc. In the case of LF this is - /// referred to as the New Line (NL) option. + /// > (FF), LINE TABULATION (VT) cause movement to the line home position on + /// > the following line, the following form, etc. In the case of LF this is + /// > referred to as the New Line (NL) option. /// /// Additionally, ECMA-48 4th edition says that this option is deprecated. /// ECMA-48 5th edition only mentions this option (without explanation) diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -2187,7 +2187,7 @@ impl<T: EventListener> Handler for Term<T> { fn set_title(&mut self, title: Option<String>) { trace!("Setting title to '{:?}'", title); - self.title = title.clone(); + self.title.clone_from(&title); let title_event = match title { Some(title) => Event::Title(title), diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -293,12 +293,12 @@ impl<T> Term<T> { let mut state = regex.dfa.start_state_forward(&mut regex.cache, &input).unwrap(); let mut iter = self.grid.iter_from(start); - let mut last_wrapped = false; let mut regex_match = None; let mut done = false; let mut cell = iter.cell(); self.skip_fullwidth(&mut iter, &mut cell, regex.direction); + let mut last_wrapped = cell.flags.contains(Flags::WRAPLINE); let mut c = cell.c; let mut point = iter.point();
alacritty__alacritty-8069
8,069
The provided video cannot be played back. @chrisduerr , I can play it back. Do you use firefox? If so, videos in github with firefox is a known bug. Try downloading video or using another browser :shrug: Even without video, try to create a long line with like 30 or 40 entries of the same word and try backward-searching this word. Search will break
[ "8060" ]
1.70
alacritty/alacritty
2024-06-29T07:36:44Z
diff --git a/alacritty_terminal/src/term/search.rs b/alacritty_terminal/src/term/search.rs --- a/alacritty_terminal/src/term/search.rs +++ b/alacritty_terminal/src/term/search.rs @@ -1155,4 +1155,20 @@ mod tests { assert_eq!(start, Point::new(Line(1), Column(0))); assert_eq!(end, Point::new(Line(1), Column(2))); } + + #[test] + fn inline_word_search() { + #[rustfmt::skip] + let term = mock_term("\ + word word word word w\n\ + ord word word word\ + "); + + let mut regex = RegexSearch::new("word").unwrap(); + let start = Point::new(Line(1), Column(4)); + let end = Point::new(Line(0), Column(0)); + let match_start = Point::new(Line(0), Column(20)); + let match_end = Point::new(Line(1), Column(2)); + assert_eq!(term.regex_search_left(&mut regex, start, end), Some(match_start..=match_end)); + } }
Bug: backward search on single line goes in cycles When using backward search, it sometimes goes in cycles without moving a cursor to some search result. In example video, before resizing, everything works fine, but after resizing, it cycles only on several last elements on the line, instead of cycling through all occurrences https://github.com/alacritty/alacritty/assets/37012324/34cbb259-9d3d-4de5-83df-f92ca66735ba ### System OS: Linux, Wayland, Sway Version: alacritty 0.13.2 ### Logs No logs
5e6b92db85b3ea7ffd06a7a5ae0d2d62ad5946a6
[ "term::search::tests::inline_word_search" ]
[ "grid::storage::tests::indexing", "grid::storage::tests::indexing_above_inner_len - should panic", "grid::storage::tests::rotate", "grid::storage::tests::rotate_wrap_zero", "grid::storage::tests::shrink_after_zero", "grid::storage::tests::shrink_before_and_after_zero", "grid::storage::tests::shrink_then_grow", "grid::storage::tests::shrink_before_zero", "grid::storage::tests::truncate_invisible_lines", "grid::storage::tests::truncate_invisible_lines_beginning", "grid::storage::tests::with_capacity", "grid::tests::grow_reflow", "grid::tests::grow_reflow_disabled", "grid::tests::grow_reflow_multiline", "grid::tests::scroll_down", "grid::tests::scroll_up", "grid::tests::shrink_reflow", "grid::tests::shrink_reflow_disabled", "grid::storage::tests::grow_before_zero", "grid::storage::tests::grow_after_zero", "grid::tests::shrink_reflow_empty_cell_inside_line", "index::tests::add_clamp", "index::tests::add_grid_clamp", "grid::tests::test_iter", "grid::tests::shrink_reflow_twice", "index::tests::add_none_clamp", "index::tests::add", "index::tests::location_ordering", "index::tests::sub_clamp", "index::tests::add_wrap", "index::tests::sub", "index::tests::sub_grid_clamp", "index::tests::sub_none_clamp", "index::tests::sub_wrap", "grid::tests::scroll_down_with_history", "selection::tests::across_adjacent_lines_upward_final_cell_exclusive", "selection::tests::between_adjacent_cells_left_to_right", "selection::tests::between_adjacent_cells_right_to_left", "selection::tests::block_is_empty", "grid::storage::tests::initialize", "selection::tests::block_selection", "selection::tests::line_selection", "selection::tests::range_intersection", "selection::tests::rotate_in_region_down", "selection::tests::rotate_in_region_up", "selection::tests::rotate_in_region_up_block", "selection::tests::selection_bigger_then_smaller", "selection::tests::semantic_selection", "selection::tests::simple_is_empty", "selection::tests::simple_selection", "selection::tests::single_cell_left_to_right", "term::cell::tests::cell_size_is_below_cap", "selection::tests::single_cell_right_to_left", "term::cell::tests::line_length_works", "term::cell::tests::line_length_works_with_wrapline", "term::search::tests::end_on_fullwidth", "term::search::tests::leading_spacer", "term::search::tests::empty_match_multibyte", "term::search::tests::empty_match", "term::search::tests::include_linebreak_left", "term::search::tests::anchored_empty", "term::search::tests::end_on_multibyte_unicode", "term::search::tests::include_linebreak_right", "term::search::tests::no_match_right", "term::search::tests::no_match_left", "term::search::tests::greed_is_good", "term::search::tests::empty_match_multiline", "term::search::tests::reverse_search_dead_recovery", "term::search::tests::skip_dead_cell", "term::search::tests::singlecell_fullwidth", "term::search::tests::fullwidth", "term::search::tests::regex_left", "term::search::tests::wrapping", "term::search::tests::wrap_around_to_another_end", "term::search::tests::multiline", "term::tests::block_selection_works", "term::search::tests::multibyte_unicode", "term::search::tests::wide_without_spacer", "term::tests::clearing_viewport_keeps_history_position", "term::tests::damage_cursor_movements", "term::search::tests::wrapping_into_fullwidth", "term::tests::clear_saved_lines", "term::tests::clearing_viewport_with_vi_mode_keeps_history_position", "term::search::tests::nested_regex", "term::tests::clearing_scrollback_sets_vi_cursor_into_viewport", "term::search::tests::newline_breaking_semantic", "term::tests::parse_cargo_version", "term::tests::line_selection_works", "term::tests::input_line_drawing_character", "term::tests::clearing_scrollback_resets_display_offset", "term::tests::damage_public_usage", "term::tests::scroll_display_page_down", "term::tests::scroll_display_page_up", "term::tests::simple_selection_works", "term::tests::semantic_selection_works", "term::tests::vi_cursor_keep_pos_on_scrollback_buffer", "term::search::tests::regex_right", "tty::unix::test_get_pw_entry", "vi_mode::tests::motion_bracket", "vi_mode::tests::motion_first_occupied", "term::tests::window_title", "vi_mode::tests::motion_high_middle_low", "vi_mode::tests::motion_semantic_left_end", "vi_mode::tests::motion_semantic_right_end", "vi_mode::tests::motion_semantic_left_start", "vi_mode::tests::motion_semantic_right_start", "vi_mode::tests::motion_simple", "vi_mode::tests::motion_start_end", "vi_mode::tests::scroll_over_bottom", "vi_mode::tests::scroll_over_top", "vi_mode::tests::scroll_semantic", "vi_mode::tests::semantic_wide", "vi_mode::tests::simple_wide", "vi_mode::tests::word_wide", "vi_mode::tests::scroll_word", "vi_mode::tests::scroll_simple", "term::tests::full_damage", "vi_mode::tests::motion_word", "term::tests::shrink_lines_updates_inactive_cursor_pos", "term::tests::shrink_lines_updates_active_cursor_pos", "term::tests::grow_lines_updates_inactive_cursor_pos", "term::tests::grow_lines_updates_active_cursor_pos", "term::search::tests::nfa_compile_error", "term::tests::grid_serde", "term::search::tests::runtime_cache_error", "fish_cc", "alt_reset", "deccolm_reset", "delete_chars_reset", "csi_rep", "erase_chars_reset", "decaln_reset", "clear_underline", "issue_855", "delete_lines", "ll", "colored_reset", "erase_in_line", "newline_with_cursor_beyond_scroll_region", "colored_underline", "hyperlinks", "scroll_up_reset", "selective_erasure", "indexed_256_colors", "sgr", "tmux_git_log", "tmux_htop", "insert_blank_reset", "saved_cursor_alt", "saved_cursor", "tab_rendering", "vim_simple_edit", "vttest_cursor_movement_1", "vttest_insert", "vttest_tab_clear_set", "vttest_origin_mode_1", "region_scroll_down", "vttest_origin_mode_2", "vttest_scroll", "zerowidth", "zsh_tab_completion", "underline", "wrapline_alt_toggle", "scroll_in_region_up_preserves_history", "grid_reset", "vim_large_window_scroll", "vim_24bitcolors_bce", "history", "row_reset", "alacritty_terminal/src/term/mod.rs - term::test::mock_term (line 2427)" ]
[]
[]
2024-07-05T13:08:08Z
c354f58f421c267cc1472414eaaa9f738509ede0
diff --git a/CHANGELOG.md b/CHANGELOG.md --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Autokey no longer working with alacritty on X11 - Freeze when moving window between monitors on Xfwm - Mouse cursor not changing on Wayland when cursor theme uses legacy cursor icon names +- Config keys are available under proper names ### Changed diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs --- a/alacritty_config_derive/src/serde_replace.rs +++ b/alacritty_config_derive/src/serde_replace.rs @@ -44,7 +44,10 @@ pub fn derive_recursive<T>( ) -> TokenStream2 { let GenericsStreams { unconstrained, constrained, .. } = crate::generics_streams(&generics.params); - let replace_arms = match_arms(&fields); + let replace_arms = match match_arms(&fields) { + Err(e) => return e.to_compile_error(), + Ok(replace_arms) => replace_arms, + }; quote! { #[allow(clippy::extra_unused_lifetimes)] diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs --- a/alacritty_config_derive/src/serde_replace.rs +++ b/alacritty_config_derive/src/serde_replace.rs @@ -75,7 +78,7 @@ pub fn derive_recursive<T>( } /// Create SerdeReplace recursive match arms. -fn match_arms<T>(fields: &Punctuated<Field, T>) -> TokenStream2 { +fn match_arms<T>(fields: &Punctuated<Field, T>) -> Result<TokenStream2, syn::Error> { let mut stream = TokenStream2::default(); let mut flattened_arm = None; diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs --- a/alacritty_config_derive/src/serde_replace.rs +++ b/alacritty_config_derive/src/serde_replace.rs @@ -88,19 +91,42 @@ fn match_arms<T>(fields: &Punctuated<Field, T>) -> TokenStream2 { let flatten = field .attrs .iter() + .filter(|attr| (*attr).path().is_ident("config")) .filter_map(|attr| attr.parse_args::<Attr>().ok()) .any(|parsed| parsed.ident.as_str() == "flatten"); if flatten && flattened_arm.is_some() { - return Error::new(ident.span(), MULTIPLE_FLATTEN_ERROR).to_compile_error(); + return Err(Error::new(ident.span(), MULTIPLE_FLATTEN_ERROR)); } else if flatten { flattened_arm = Some(quote! { _ => alacritty_config::SerdeReplace::replace(&mut self.#ident, value)?, }); } else { + // Extract all `#[config(alias = "...")]` attribute values. + let aliases = field + .attrs + .iter() + .filter(|attr| (*attr).path().is_ident("config")) + .filter_map(|attr| attr.parse_args::<Attr>().ok()) + .filter(|parsed| parsed.ident.as_str() == "alias") + .map(|parsed| { + let value = parsed + .param + .ok_or_else(|| format!("Field \"{}\" has no alias value", ident))? + .value(); + + if value.trim().is_empty() { + return Err(format!("Field \"{}\" has an empty alias value", ident)); + } + + Ok(value) + }) + .collect::<Result<Vec<String>, String>>() + .map_err(|msg| Error::new(ident.span(), msg))?; + stream.extend(quote! { - #literal => alacritty_config::SerdeReplace::replace(&mut self.#ident, next_value)?, - }); + #(#aliases)|* | #literal => alacritty_config::SerdeReplace::replace(&mut + self.#ident, next_value)?, }); } } diff --git a/alacritty_config_derive/src/serde_replace.rs b/alacritty_config_derive/src/serde_replace.rs --- a/alacritty_config_derive/src/serde_replace.rs +++ b/alacritty_config_derive/src/serde_replace.rs @@ -109,5 +135,5 @@ fn match_arms<T>(fields: &Punctuated<Field, T>) -> TokenStream2 { stream.extend(flattened_arm); } - stream + Ok(stream) }
alacritty__alacritty-7729
7,729
The problem is [here](https://github.com/alacritty/alacritty/blob/master/alacritty_config_derive/src/serde_replace.rs#L51). This is what's generated when I look with `cargo expand`: ```rust #[allow(clippy::extra_unused_lifetimes)] impl<'de> alacritty_config::SerdeReplace for InvertedCellColors { fn replace( &mut self, value: toml::Value, ) -> Result<(), Box<dyn std::error::Error>> { match value.as_table() { Some(table) => { for (field, next_value) in table { let next_value = next_value.clone(); let value = value.clone(); match field.as_str() { "foreground" => { alacritty_config::SerdeReplace::replace( &mut self.foreground, next_value, )? } "background" => { alacritty_config::SerdeReplace::replace( &mut self.background, next_value, )? } _ => { let error = { let res = ::alloc::fmt::format( format_args!("Field \"{0}\" does not exist", field), ); res }; return Err(error.into()); } } } } None => *self = serde::Deserialize::deserialize(value)?, } Ok(()) } } ``` The `alias=cursor` is not used in the replace
[ "7720" ]
1.72
alacritty/alacritty
2024-02-14T03:46:11Z
diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -23,7 +23,7 @@ impl Default for TestEnum { #[derive(ConfigDeserialize)] struct Test { - #[config(alias = "noalias")] + #[config(alias = "field1_alias")] #[config(deprecated = "use field2 instead")] field1: usize, #[config(deprecated = "shouldn't be hit")] diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -39,6 +39,9 @@ struct Test { enom_error: TestEnum, #[config(removed = "it's gone")] gone: bool, + #[config(alias = "multiple_alias1")] + #[config(alias = "multiple_alias2")] + multiple_alias_field: usize, } impl Default for Test { diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -53,6 +56,7 @@ impl Default for Test { enom_big: TestEnum::default(), enom_error: TestEnum::default(), gone: false, + multiple_alias_field: 0, } } } diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -70,6 +74,7 @@ struct Test2<T: Default> { #[derive(ConfigDeserialize, Default)] struct Test3 { + #[config(alias = "flatty_alias")] flatty: usize, } diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -189,6 +194,33 @@ fn replace_derive() { assert_eq!(test.nesting.newtype, NewType(9)); } +#[test] +fn replace_derive_using_alias() { + let mut test = Test::default(); + + assert_ne!(test.field1, 9); + + let value = toml::from_str("field1_alias=9").unwrap(); + test.replace(value).unwrap(); + + assert_eq!(test.field1, 9); +} + +#[test] +fn replace_derive_using_multiple_aliases() { + let mut test = Test::default(); + + let toml_value = toml::from_str("multiple_alias1=6").unwrap(); + test.replace(toml_value).unwrap(); + + assert_eq!(test.multiple_alias_field, 6); + + let toml_value = toml::from_str("multiple_alias1=7").unwrap(); + test.replace(toml_value).unwrap(); + + assert_eq!(test.multiple_alias_field, 7); +} + #[test] fn replace_flatten() { let mut test = Test::default(); diff --git a/alacritty_config_derive/tests/config.rs b/alacritty_config_derive/tests/config.rs --- a/alacritty_config_derive/tests/config.rs +++ b/alacritty_config_derive/tests/config.rs @@ -198,3 +230,15 @@ fn replace_flatten() { assert_eq!(test.flatten.flatty, 7); } + +#[test] +fn replace_flatten_using_alias() { + let mut test = Test::default(); + + assert_ne!(test.flatten.flatty, 7); + + let value = toml::from_str("flatty_alias=7").unwrap(); + test.replace(value).unwrap(); + + assert_eq!(test.flatten.flatty, 7); +}
CLI -o config overrides should accept aliases as documented ### Expected behavior As indicated by `man alacritty`, the `-o` option can be used to override configuration from the `alacritty.toml` config file with the properties specified by `man 5 alacritty`. One would therefore expect that ```alacritty -o 'colors.cursor.cursor="CellBackground"'``` leads to an invisible cursor. ### Actual behavior Instead, it gives the error ```Unable to override option 'colors.cursor.cursor="CellBackground"': Field 'cursor' does not exist``` and no change to the background color is effected. ### Workaround Inspecting the source code, this appears to stem from the fact that the `colors.cursor` configuration option is an `InvertedCellColors` struct, for which `cursor` is an alias for a property named `background`. Indeed, ```alacritty -o 'colors.cursor.background="CellBackground"'``` yields the desired result. The `-o` overrides should resolve those aliases since only the aliases are used in the documentation. ### Possible cause Digging a bit deeper, I think the relevant part of the code is the function `derive_deserialize` in `alacritty/alacritty_config_derive/src/config_deserialize/de_struct.rs` which implements `SerdeReplace` without using the result of `fields_deserializer` which includes the substitution of aliases. ### System OS: Linux 6.7.4-arch1-1 Version: alacritty 0.13.1 (fe2a3c56) Compositor: sway
41d2f1df4509148a6f1ffb3de59c2389a3a93283
[ "replace_derive_using_alias", "replace_derive_using_multiple_aliases", "replace_flatten_using_alias" ]
[ "replace_derive", "field_replacement", "replace_flatten", "config_deserialize" ]
[]
[]
2024-03-01T07:46:10Z
839fd7bc8bcafd73aac0259d2efdc273486c6a98
diff --git a/rslib/i18n/src/lib.rs b/rslib/i18n/src/lib.rs --- a/rslib/i18n/src/lib.rs +++ b/rslib/i18n/src/lib.rs @@ -22,13 +22,46 @@ type FluentBundle<T> = FluentBundleOrig<T, intl_memoizer::concurrent::IntlLangMe pub use fluent::fluent_args as tr_args; -pub trait Number: Into<FluentNumber> {} -impl Number for i32 {} -impl Number for i64 {} -impl Number for u32 {} -impl Number for f32 {} -impl Number for u64 {} -impl Number for usize {} +pub trait Number: Into<FluentNumber> { + fn round(self) -> Self; +} +impl Number for i32 { + #[inline] + fn round(self) -> Self { + self + } +} +impl Number for i64 { + #[inline] + fn round(self) -> Self { + self + } +} +impl Number for u32 { + #[inline] + fn round(self) -> Self { + self + } +} +impl Number for f32 { + // round to 2 decimal places + #[inline] + fn round(self) -> Self { + (self * 100.0).round() / 100.0 + } +} +impl Number for u64 { + #[inline] + fn round(self) -> Self { + self + } +} +impl Number for usize { + #[inline] + fn round(self) -> Self { + self + } +} fn remapped_lang_name(lang: &LanguageIdentifier) -> &str { let region = lang.region.as_ref().map(|v| v.as_str()); diff --git a/rslib/i18n/write_strings.rs b/rslib/i18n/write_strings.rs --- a/rslib/i18n/write_strings.rs +++ b/rslib/i18n/write_strings.rs @@ -97,7 +97,7 @@ fn build_vars(translation: &Translation) -> String { let rust_name = v.name.to_snake_case(); let trailer = match v.kind { VariableKind::Any => "", - VariableKind::Int | VariableKind::Float => ".into()", + VariableKind::Int | VariableKind::Float => ".round().into()", VariableKind::String => ".into()", }; writeln!(
ankitects__anki-3162
3,162
Hi! I realise this is a very trivial thing, but would it not be possible to display all of the numbers in decimal format (including 1, 2, 3, etc.)? Numbers expressed in the decimal format use the noun's plural form. Showing "1.00" will not only guarantee formatting consistency between the whole hours and the partials, but it will also address the plural problem that is mentioned above. Two birds, one stone. **_So, force decimals on all numbers_**: - 1 -> 1.00 - 2 -> 2.00 - 3 -> 3.00 - ... I guess it would be a lot easier to code than the alternative? It's explained much better on here: https://doc.rust-lang.org/std/fmt/#precision I hope that makes sense. Harvey R. Edit: Ah, I see that there is [this](https://github.com/ankitects/anki/blob/a1fa865bb2e324c38f2361c58315c5b046c31d46/rslib/i18n/src/lib.rs#L402) `let mut val: Cow<str> = with_max_precision.trim_end_matches('0').into();`. Then, in that case, you can ignore my suggestion.
[ "3102" ]
0.0
ankitects/anki
2024-04-23T03:09:35Z
diff --git a/rslib/i18n/src/lib.rs b/rslib/i18n/src/lib.rs --- a/rslib/i18n/src/lib.rs +++ b/rslib/i18n/src/lib.rs @@ -446,6 +479,14 @@ mod test { assert!(want_comma_as_decimal_separator(&[langid!("pl-PL")])); } + #[test] + fn decimal_rounding() { + let tr = I18n::new(&["en"]); + + assert_eq!(tr.browsing_cards_deleted(1.001), "1 card deleted."); + assert_eq!(tr.browsing_cards_deleted(1.01), "1.01 cards deleted."); + } + #[test] fn i18n() { // English template
“1 hours today” > I’ve noticed that if you study for exactly one hour, you’re told “Studied n cards in 1 hours today (_m_s/card).” > This is an incredibly minor point, but ideally it would say “1 hour” instead of “1 hours” (but be plural again for “1.1 hours”, “1.2 hours”, etc.). Originally reported on https://forums.ankiweb.net/t/1-hours-today/42956 It's caused by non-integer numbers that are rounded to an integer in format_number_values(), eg 1.0005 becomes 1.00 which ends up being to 1. I'm not sure we can easily fix this, as I think the plural choice is happening in fluent's code, not ours. Converting the fluent numbers to integers if they round to an integer might work?
4d20945319c3e68c4a8d10ad9c6d6eb9b985f16c
[ "test::decimal_rounding" ]
[ "test::i18n", "test::numbers" ]
[]
[]
2024-04-24T01:47:08Z
5e04e776efae33b311a850a0b6bae3104b90e1d4
diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -5,7 +5,7 @@ use std::error::Error as StdError; use std::fmt::{self, Debug, Display}; use std::mem::{self, ManuallyDrop}; use std::ops::{Deref, DerefMut}; -use std::ptr; +use std::ptr::{self, NonNull}; impl Error { /// Create a new error object from any error type. diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -29,11 +29,11 @@ impl Error { { let vtable = &ErrorVTable { object_drop: object_drop::<E>, - object_drop_front: object_drop_front::<E>, object_ref: object_ref::<E>, object_mut: object_mut::<E>, object_boxed: object_boxed::<E>, - object_is: object_is::<E>, + object_downcast: object_downcast::<E>, + object_drop_rest: object_drop_front::<E>, }; // Safety: passing vtable that operates on the right type E. diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -47,11 +47,11 @@ impl Error { let error: MessageError<M> = MessageError(message); let vtable = &ErrorVTable { object_drop: object_drop::<MessageError<M>>, - object_drop_front: object_drop_front::<MessageError<M>>, object_ref: object_ref::<MessageError<M>>, object_mut: object_mut::<MessageError<M>>, object_boxed: object_boxed::<MessageError<M>>, - object_is: object_is::<M>, + object_downcast: object_downcast::<M>, + object_drop_rest: object_drop_front::<M>, }; // Safety: MessageError is repr(transparent) so it is okay for the diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -66,11 +66,11 @@ impl Error { let error: DisplayError<M> = DisplayError(message); let vtable = &ErrorVTable { object_drop: object_drop::<DisplayError<M>>, - object_drop_front: object_drop_front::<DisplayError<M>>, object_ref: object_ref::<DisplayError<M>>, object_mut: object_mut::<DisplayError<M>>, object_boxed: object_boxed::<DisplayError<M>>, - object_is: object_is::<M>, + object_downcast: object_downcast::<M>, + object_drop_rest: object_drop_front::<M>, }; // Safety: DisplayError is repr(transparent) so it is okay for the diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -87,11 +87,11 @@ impl Error { let vtable = &ErrorVTable { object_drop: object_drop::<ContextError<C, E>>, - object_drop_front: object_drop_front::<ContextError<C, E>>, object_ref: object_ref::<ContextError<C, E>>, object_mut: object_mut::<ContextError<C, E>>, object_boxed: object_boxed::<ContextError<C, E>>, - object_is: object_is::<ContextError<C, E>>, + object_downcast: context_downcast::<C, E>, + object_drop_rest: context_drop_rest::<C, E>, }; // Safety: passing vtable that operates on the right type. diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -114,7 +114,7 @@ impl Error { let inner = Box::new(ErrorImpl { vtable, backtrace, - _error: error, + _object: error, }); let erased = mem::transmute::<Box<ErrorImpl<E>>, Box<ErrorImpl<()>>>(inner); let inner = ManuallyDrop::new(erased); diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -186,11 +186,11 @@ impl Error { let vtable = &ErrorVTable { object_drop: object_drop::<ContextError<C, Error>>, - object_drop_front: object_drop_front::<ContextError<C, Error>>, object_ref: object_ref::<ContextError<C, Error>>, object_mut: object_mut::<ContextError<C, Error>>, object_boxed: object_boxed::<ContextError<C, Error>>, - object_is: object_is::<ContextError<C, Error>>, + object_downcast: context_chain_downcast::<C>, + object_drop_rest: context_chain_drop_rest::<C>, }; // As the cause is anyhow::Error, we already have a backtrace for it. diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -255,13 +255,19 @@ impl Error { root_cause } - /// Returns `true` if `E` is the type wrapped by this error object. + /// Returns true if `E` is the type held by this error object. + /// + /// For errors with context, this method returns true if `E` matches the + /// type of the context `C` **or** the type of the error on which the + /// context has been attached. For details about the interaction between + /// context and downcasting, [see here]. + /// + /// [see here]: trait.Context.html#effect-on-downcasting pub fn is<E>(&self) -> bool where E: Display + Debug + Send + Sync + 'static, { - let target = TypeId::of::<E>(); - unsafe { (self.inner.vtable.object_is)(target) } + self.downcast_ref::<E>().is_some() } /// Attempt to downcast the error object to a concrete type. diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -269,19 +275,18 @@ impl Error { where E: Display + Debug + Send + Sync + 'static, { - if self.is::<E>() { + let target = TypeId::of::<E>(); + unsafe { + let addr = match (self.inner.vtable.object_downcast)(&self.inner, target) { + Some(addr) => addr, + None => return Err(self), + }; let outer = ManuallyDrop::new(self); - unsafe { - let error = ptr::read( - outer.inner.error() as *const (dyn StdError + Send + Sync) as *const E - ); - let inner = ptr::read(&outer.inner); - let erased = ManuallyDrop::into_inner(inner); - (erased.vtable.object_drop_front)(erased); - Ok(error) - } - } else { - Err(self) + let error = ptr::read(addr.cast::<E>().as_ptr()); + let inner = ptr::read(&outer.inner); + let erased = ManuallyDrop::into_inner(inner); + (erased.vtable.object_drop_rest)(erased, target); + Ok(error) } } diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -325,12 +330,10 @@ impl Error { where E: Display + Debug + Send + Sync + 'static, { - if self.is::<E>() { - Some(unsafe { - &*(self.inner.error() as *const (dyn StdError + Send + Sync) as *const E) - }) - } else { - None + let target = TypeId::of::<E>(); + unsafe { + let addr = (self.inner.vtable.object_downcast)(&self.inner, target)?; + Some(&*addr.cast::<E>().as_ptr()) } } diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -339,12 +342,10 @@ impl Error { where E: Display + Debug + Send + Sync + 'static, { - if self.is::<E>() { - Some(unsafe { - &mut *(self.inner.error_mut() as *mut (dyn StdError + Send + Sync) as *mut E) - }) - } else { - None + let target = TypeId::of::<E>(); + unsafe { + let addr = (self.inner.vtable.object_downcast)(&self.inner, target)?; + Some(&mut *addr.cast::<E>().as_ptr()) } } } diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -400,11 +401,11 @@ impl Drop for Error { struct ErrorVTable { object_drop: unsafe fn(Box<ErrorImpl<()>>), - object_drop_front: unsafe fn(Box<ErrorImpl<()>>), object_ref: unsafe fn(&ErrorImpl<()>) -> &(dyn StdError + Send + Sync + 'static), object_mut: unsafe fn(&mut ErrorImpl<()>) -> &mut (dyn StdError + Send + Sync + 'static), object_boxed: unsafe fn(Box<ErrorImpl<()>>) -> Box<dyn StdError + Send + Sync + 'static>, - object_is: unsafe fn(TypeId) -> bool, + object_downcast: unsafe fn(&ErrorImpl<()>, TypeId) -> Option<NonNull<()>>, + object_drop_rest: unsafe fn(Box<ErrorImpl<()>>, TypeId), } unsafe fn object_drop<E>(e: Box<ErrorImpl<()>>) { diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -414,10 +415,11 @@ unsafe fn object_drop<E>(e: Box<ErrorImpl<()>>) { drop(unerased); } -unsafe fn object_drop_front<E>(e: Box<ErrorImpl<()>>) { +unsafe fn object_drop_front<E>(e: Box<ErrorImpl<()>>, target: TypeId) { // Drop the fields of ErrorImpl other than E as well as the Box allocation, // without dropping E itself. This is used by downcast after doing a // ptr::read to take ownership of the E. + let _ = target; let unerased = mem::transmute::<Box<ErrorImpl<()>>, Box<ErrorImpl<ManuallyDrop<E>>>>(e); drop(unerased); } diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -426,14 +428,14 @@ unsafe fn object_ref<E>(e: &ErrorImpl<()>) -> &(dyn StdError + Send + Sync + 'st where E: StdError + Send + Sync + 'static, { - &(*(e as *const ErrorImpl<()> as *const ErrorImpl<E>))._error + &(*(e as *const ErrorImpl<()> as *const ErrorImpl<E>))._object } unsafe fn object_mut<E>(e: &mut ErrorImpl<()>) -> &mut (dyn StdError + Send + Sync + 'static) where E: StdError + Send + Sync + 'static, { - &mut (*(e as *mut ErrorImpl<()> as *mut ErrorImpl<E>))._error + &mut (*(e as *mut ErrorImpl<()> as *mut ErrorImpl<E>))._object } unsafe fn object_boxed<E>(e: Box<ErrorImpl<()>>) -> Box<dyn StdError + Send + Sync + 'static> diff --git a/src/error.rs b/src/error.rs --- a/src/error.rs +++ b/src/error.rs @@ -443,22 +445,111 @@ where mem::transmute::<Box<ErrorImpl<()>>, Box<ErrorImpl<E>>>(e) } -unsafe fn object_is<T>(target: TypeId) -> bool +unsafe fn object_downcast<E>(e: &ErrorImpl<()>, target: TypeId) -> Option<NonNull<()>> +where + E: 'static, +{ + if TypeId::of::<E>() == target { + let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<E>; + let addr = &(*unerased)._object as *const E as *mut (); + Some(NonNull::new_unchecked(addr)) + } else { + None + } +} + +unsafe fn context_downcast<C, E>(e: &ErrorImpl<()>, target: TypeId) -> Option<NonNull<()>> where - T: 'static, + C: 'static, + E: 'static, { - TypeId::of::<T>() == target + if TypeId::of::<C>() == target { + let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<C, E>>; + let addr = &(*unerased)._object.context as *const C as *mut (); + Some(NonNull::new_unchecked(addr)) + } else if TypeId::of::<E>() == target { + let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<C, E>>; + let addr = &(*unerased)._object.error as *const E as *mut (); + Some(NonNull::new_unchecked(addr)) + } else { + None + } } -// repr C to ensure that `E` remains in the final position +unsafe fn context_drop_rest<C, E>(e: Box<ErrorImpl<()>>, target: TypeId) +where + C: 'static, + E: 'static, +{ + // Called after downcasting by value to either the C or the E and doing a + // ptr::read to take ownership of that value. + if TypeId::of::<C>() == target { + let unerased = mem::transmute::< + Box<ErrorImpl<()>>, + Box<ErrorImpl<ContextError<ManuallyDrop<C>, E>>>, + >(e); + drop(unerased); + } else { + let unerased = mem::transmute::< + Box<ErrorImpl<()>>, + Box<ErrorImpl<ContextError<C, ManuallyDrop<E>>>>, + >(e); + drop(unerased); + } +} + +unsafe fn context_chain_downcast<C>(e: &ErrorImpl<()>, target: TypeId) -> Option<NonNull<()>> +where + C: 'static, +{ + if TypeId::of::<C>() == target { + let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<C, Error>>; + let addr = &(*unerased)._object.context as *const C as *mut (); + Some(NonNull::new_unchecked(addr)) + } else { + let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<C, Error>>; + let source = &(*unerased)._object.error; + (source.inner.vtable.object_downcast)(&source.inner, target) + } +} + +unsafe fn context_chain_drop_rest<C>(e: Box<ErrorImpl<()>>, target: TypeId) +where + C: 'static, +{ + // Called after downcasting by value to either the C or one of the causes + // and doing a ptr::read to take ownership of that value. + if TypeId::of::<C>() == target { + let unerased = mem::transmute::< + Box<ErrorImpl<()>>, + Box<ErrorImpl<ContextError<ManuallyDrop<C>, Error>>>, + >(e); + drop(unerased); + } else { + let unerased = mem::transmute::< + Box<ErrorImpl<()>>, + Box<ErrorImpl<ContextError<C, ManuallyDrop<Error>>>>, + >(e); + let inner = ptr::read(&unerased._object.error.inner); + drop(unerased); + let erased = ManuallyDrop::into_inner(inner); + (erased.vtable.object_drop_rest)(erased, target); + } +} + +// repr C to ensure that E remains in the final position. #[repr(C)] pub(crate) struct ErrorImpl<E> { vtable: &'static ErrorVTable, backtrace: Option<Backtrace>, - // NOTE: Don't use directly. Use only through vtable. Erased type may have different alignment. - _error: E, + // NOTE: Don't use directly. Use only through vtable. Erased type may have + // different alignment. + _object: E, } +// repr C to ensure that ContextError<C, E> has the same layout as +// ContextError<ManuallyDrop<C>, E> and ContextError<C, ManuallyDrop<E>>. +#[repr(C)] pub(crate) struct ContextError<C, E> { pub context: C, pub error: E, diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -286,6 +286,8 @@ pub type Result<T, E = Error> = std::result::Result<T, E>; /// This trait is sealed and cannot be implemented for types outside of /// `anyhow`. /// +/// <br> +/// /// # Example /// /// ``` diff --git a/src/lib.rs b/src/lib.rs --- a/src/lib.rs +++ b/src/lib.rs @@ -326,6 +328,100 @@ pub type Result<T, E = Error> = std::result::Result<T, E>; /// Caused by: /// No such file or directory (os error 2) /// ``` +/// +/// <br> +/// +/// # Effect on downcasting +/// +/// After attaching context of type `C` onto an error of type `E`, the resulting +/// `anyhow::Error` may be downcast to `C` **or** to `E`. +/// +/// That is, in codebases that rely on downcasting, Anyhow's context supports +/// both of the following use cases: +/// +/// - **Attaching context whose type is insignificant onto errors whose type +/// is used in downcasts.** +/// +/// In other error libraries whose context is not designed this way, it can +/// be risky to introduce context to existing code because new context might +/// break existing working downcasts. In Anyhow, any downcast that worked +/// before adding context will continue to work after you add a context, so +/// you should freely add human-readable context to errors wherever it would +/// be helpful. +/// +/// ``` +/// # use anyhow::bail; +/// # use thiserror::Error; +/// # +/// # #[derive(Error, Debug)] +/// # #[error("???")] +/// # struct SuspiciousError; +/// # +/// # fn helper() -> Result<()> { +/// # bail!(SuspiciousError); +/// # } +/// # +/// use anyhow::{Context, Result}; +/// +/// fn do_it() -> Result<()> { +/// helper().context("failed to complete the work")?; +/// # const IGNORE: &str = stringify! { +/// ... +/// # }; +/// # unreachable!() +/// } +/// +/// fn main() { +/// let err = do_it().unwrap_err(); +/// if let Some(e) = err.downcast_ref::<SuspiciousError>() { +/// // If helper() returned SuspiciousError, this downcast will +/// // correctly succeed even with the context in between. +/// # return; +/// } +/// # panic!("expected downcast to succeed"); +/// } +/// ``` +/// +/// - **Attaching context whose type is used in downcasts onto errors whose +/// type is insignificant.** +/// +/// Some codebases prefer to use machine-readable context to categorize +/// lower level errors in a way that will be actionable to higher levels of +/// the application. +/// +/// ``` +/// # use anyhow::bail; +/// # use thiserror::Error; +/// # +/// # #[derive(Error, Debug)] +/// # #[error("???")] +/// # struct HelperFailed; +/// # +/// # fn helper() -> Result<()> { +/// # bail!("no such file or directory"); +/// # } +/// # +/// use anyhow::{Context, Result}; +/// +/// fn do_it() -> Result<()> { +/// helper().context(HelperFailed)?; +/// # const IGNORE: &str = stringify! { +/// ... +/// # }; +/// # unreachable!() +/// } +/// +/// fn main() { +/// let err = do_it().unwrap_err(); +/// if let Some(e) = err.downcast_ref::<HelperFailed>() { +/// // If helper failed, this downcast will succeed because +/// // HelperFailed is the context that has been attached to +/// // that error. +/// # return; +/// } +/// # panic!("expected downcast to succeed"); +/// } +/// ``` pub trait Context<T, E>: context::private::Sealed { /// Wrap the error value with additional context. fn context<C>(self, context: C) -> Result<T, Error>
dtolnay__anyhow-34
34
For that matter, should `e.downcast_ref::<io::Error>()` succeed?
[ "32" ]
1.0
dtolnay/anyhow
2019-10-28T12:27:06Z
diff --git a/tests/test_context.rs b/tests/test_context.rs --- a/tests/test_context.rs +++ b/tests/test_context.rs @@ -1,4 +1,9 @@ -use anyhow::{Context, Result}; +mod drop; + +use crate::drop::{DetectDrop, Flag}; +use anyhow::{Context, Error, Result}; +use std::fmt::{self, Display}; +use thiserror::Error; // https://github.com/dtolnay/anyhow/issues/18 #[test] diff --git a/tests/test_context.rs b/tests/test_context.rs --- a/tests/test_context.rs +++ b/tests/test_context.rs @@ -8,3 +13,147 @@ fn test_inference() -> Result<()> { assert_eq!(y, 1); Ok(()) } + +macro_rules! context_type { + ($name:ident) => { + #[derive(Debug)] + struct $name { + message: &'static str, + drop: DetectDrop, + } + + impl Display for $name { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str(self.message) + } + } + }; +} + +context_type!(HighLevel); +context_type!(MidLevel); + +#[derive(Error, Debug)] +#[error("{message}")] +struct LowLevel { + message: &'static str, + drop: DetectDrop, +} + +struct Dropped { + low: Flag, + mid: Flag, + high: Flag, +} + +impl Dropped { + fn none(&self) -> bool { + !self.low.get() && !self.mid.get() && !self.high.get() + } + + fn all(&self) -> bool { + self.low.get() && self.mid.get() && self.high.get() + } +} + +fn make_chain() -> (Error, Dropped) { + let dropped = Dropped { + low: Flag::new(), + mid: Flag::new(), + high: Flag::new(), + }; + + let low = LowLevel { + message: "no such file or directory", + drop: DetectDrop::new(&dropped.low), + }; + + // impl Context for Result<T, E> + let mid = Err::<(), LowLevel>(low) + .context(MidLevel { + message: "failed to load config", + drop: DetectDrop::new(&dropped.mid), + }) + .unwrap_err(); + + // impl Context for Result<T, Error> + let high = Err::<(), Error>(mid) + .context(HighLevel { + message: "failed to start server", + drop: DetectDrop::new(&dropped.high), + }) + .unwrap_err(); + + (high, dropped) +} + +#[test] +fn test_downcast_ref() { + let (err, dropped) = make_chain(); + + assert!(!err.is::<String>()); + assert!(err.downcast_ref::<String>().is_none()); + + assert!(err.is::<HighLevel>()); + let high = err.downcast_ref::<HighLevel>().unwrap(); + assert_eq!(high.to_string(), "failed to start server"); + + assert!(err.is::<MidLevel>()); + let mid = err.downcast_ref::<MidLevel>().unwrap(); + assert_eq!(mid.to_string(), "failed to load config"); + + assert!(err.is::<LowLevel>()); + let low = err.downcast_ref::<LowLevel>().unwrap(); + assert_eq!(low.to_string(), "no such file or directory"); + + assert!(dropped.none()); + drop(err); + assert!(dropped.all()); +} + +#[test] +fn test_downcast_high() { + let (err, dropped) = make_chain(); + + let err = err.downcast::<HighLevel>().unwrap(); + assert!(!dropped.high.get()); + assert!(dropped.low.get() && dropped.mid.get()); + + drop(err); + assert!(dropped.all()); +} + +#[test] +fn test_downcast_mid() { + let (err, dropped) = make_chain(); + + let err = err.downcast::<MidLevel>().unwrap(); + assert!(!dropped.mid.get()); + assert!(dropped.low.get() && dropped.high.get()); + + drop(err); + assert!(dropped.all()); +} + +#[test] +fn test_downcast_low() { + let (err, dropped) = make_chain(); + + let err = err.downcast::<LowLevel>().unwrap(); + assert!(!dropped.low.get()); + assert!(dropped.mid.get() && dropped.high.get()); + + drop(err); + assert!(dropped.all()); +} + +#[test] +fn test_unsuccessful_downcast() { + let (err, dropped) = make_chain(); + + let err = err.downcast::<String>().unwrap_err(); + assert!(dropped.none()); + + drop(err); + assert!(dropped.all()); +}
Figure out how context should interact with downcasting For example if we have: ```rust let e = fs::read("/...").context(ReadFailed).unwrap_err(); match e.downcast_ref::<ReadFailed>() { ``` should this downcast succeed or fail?
2737bbeb59f50651ff54ca3d879a3f5d659a98ab
[ "test_downcast_low", "test_downcast_high", "test_downcast_mid" ]
[ "test_downcast_ref", "test_inference", "test_unsuccessful_downcast", "test_convert", "test_question_mark", "test_downcast", "test_downcast_mut", "test_drop", "test_large_alignment", "test_display", "test_ensure", "test_messages", "test_autotraits", "test_null_pointer_optimization", "test_error_size", "test_fmt_source", "test_literal_source", "test_variable_source", "test_io_source", "src/lib.rs - Chain (line 216)", "src/lib.rs - (line 134)", "src/error.rs - error::Error::chain (line 227)", "src/lib.rs - (line 14)", "src/lib.rs - (line 152)", "src/error.rs - error::Error::context (line 134)", "src/context.rs - context::Option<T> (line 62)", "src/lib.rs - (line 46)", "src/lib.rs - (line 90)", "src/lib.rs - Result (line 241)", "src/macros.rs - macros::ensure (line 85)", "src/macros.rs - macros::ensure (line 96)", "src/macros.rs - macros::anyhow (line 158)", "src/lib.rs - Result (line 255)", "src/macros.rs - macros::bail (line 25)", "src/macros.rs - macros::bail (line 7)" ]
[]
[]
2019-10-28T04:41:06Z
6088b60791fc063f35183df8a4706a8723a8568a
diff --git a/src/kind.rs b/src/kind.rs --- a/src/kind.rs +++ b/src/kind.rs @@ -45,7 +45,6 @@ // (&error).anyhow_kind().new(error) use crate::Error; -use std::error::Error as StdError; use std::fmt::{Debug, Display}; #[cfg(backtrace)] diff --git a/src/kind.rs b/src/kind.rs --- a/src/kind.rs +++ b/src/kind.rs @@ -80,13 +79,13 @@ pub trait TraitKind: Sized { } } -impl<T> TraitKind for T where T: StdError + Send + Sync + 'static {} +impl<E> TraitKind for E where E: Into<Error> {} impl Trait { pub fn new<E>(self, error: E) -> Error where - E: StdError + Send + Sync + 'static, + E: Into<Error>, { - Error::from_std(error, backtrace!()) + error.into() } }
dtolnay__anyhow-47
47
[ "46" ]
1.0
dtolnay/anyhow
2019-11-18T19:43:20Z
diff --git a/tests/test_source.rs b/tests/test_source.rs --- a/tests/test_source.rs +++ b/tests/test_source.rs @@ -53,3 +53,10 @@ fn test_io_source() { let error = anyhow!(TestError::Io(io)); assert_eq!("oh no!", error.source().unwrap().to_string()); } + +#[test] +fn test_anyhow_from_anyhow() { + let error = anyhow!("oh no!").context("context"); + let error = anyhow!(error); + assert_eq!("oh no!", error.source().unwrap().to_string()); +}
Usage of `bail!(error)` loses the context of `error` I was in a situation recently where I was doing: ```rust match some_result { Ok(()) => {} Err(e) => { if !err_is_ok(e) { bail!(e); } } } ``` in this case `e` was actually of type `anyhow::Error` so a `return Err(e)` would have worked just fine, but I was surprised when this `bail!()` lost the context of the error of `e`, presumably because it called `.to_string()` on the result and lost all the context information.
2737bbeb59f50651ff54ca3d879a3f5d659a98ab
[ "test_anyhow_from_anyhow" ]
[ "test_send", "test_sync", "test_iter", "test_len", "test_rev", "test_downcast_high", "test_downcast_low", "test_downcast_mid", "test_downcast_ref", "test_inference", "test_unsuccessful_downcast", "test_convert", "test_question_mark", "test_downcast", "test_downcast_mut", "test_large_alignment", "test_drop", "test_altdebug", "test_altdisplay", "test_display", "test_ensure", "test_messages", "test_autotraits", "test_error_size", "test_null_pointer_optimization", "test_fmt_source", "test_literal_source", "test_io_source", "test_variable_source", "src/error.rs - error::Error::context (line 185)", "src/lib.rs - Chain (line 291)", "src/lib.rs - (line 14)", "src/lib.rs - (line 152)", "src/context.rs - context::Option<T> (line 62)", "src/lib.rs - Context (line 369)", "src/error.rs - error::Error::msg (line 39)", "src/error.rs - error::Error::chain (line 278)", "src/macros.rs - macros::bail (line 7)", "src/macros.rs - macros::anyhow (line 158)", "src/lib.rs - (line 46)", "src/lib.rs - Result (line 317)", "src/lib.rs - Error (line 263)", "src/macros.rs - macros::ensure (line 96)", "src/error.rs - error::Error::downcast_ref (line 361)", "src/lib.rs - Result (line 331)", "src/macros.rs - macros::bail (line 25)", "src/lib.rs - Context (line 428)", "src/lib.rs - (line 90)", "src/lib.rs - Context (line 468)", "src/lib.rs - (line 134)", "src/macros.rs - macros::ensure (line 85)" ]
[]
[]
2019-11-18T19:46:40Z
2246959a46f627a455a1dc5ca0fff0d5c5f795e9
diff --git a/Cargo.lock b/Cargo.lock --- a/Cargo.lock +++ b/Cargo.lock @@ -748,7 +748,7 @@ dependencies = [ [[package]] name = "spinoso-time" -version = "0.7.0" +version = "0.7.1" dependencies = [ "once_cell", "regex", diff --git a/artichoke-backend/Cargo.toml b/artichoke-backend/Cargo.toml --- a/artichoke-backend/Cargo.toml +++ b/artichoke-backend/Cargo.toml @@ -36,7 +36,7 @@ spinoso-regexp = { version = "0.4.0", path = "../spinoso-regexp", optional = tru spinoso-securerandom = { version = "0.2.0", path = "../spinoso-securerandom", optional = true } spinoso-string = { version = "0.20.0", path = "../spinoso-string", features = ["always-nul-terminated-c-string-compat"] } spinoso-symbol = { version = "0.3.0", path = "../spinoso-symbol" } -spinoso-time = { version = "0.7.0", path = "../spinoso-time", features = ["tzrs"], default-features = false, optional = true } +spinoso-time = { version = "0.7.1", path = "../spinoso-time", features = ["tzrs"], default-features = false, optional = true } [dev-dependencies] quickcheck = { version = "1.0.3", default-features = false } diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -566,7 +566,7 @@ dependencies = [ [[package]] name = "spinoso-time" -version = "0.7.0" +version = "0.7.1" dependencies = [ "once_cell", "regex", diff --git a/spec-runner/Cargo.lock b/spec-runner/Cargo.lock --- a/spec-runner/Cargo.lock +++ b/spec-runner/Cargo.lock @@ -952,7 +952,7 @@ dependencies = [ [[package]] name = "spinoso-time" -version = "0.7.0" +version = "0.7.1" dependencies = [ "once_cell", "regex", diff --git a/spinoso-time/Cargo.toml b/spinoso-time/Cargo.toml --- a/spinoso-time/Cargo.toml +++ b/spinoso-time/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spinoso-time" -version = "0.7.0" +version = "0.7.1" authors = ["Ryan Lopopolo <rjl@hyperbo.la>"] description = """ Datetime handling for Artichoke Ruby diff --git a/spinoso-time/README.md b/spinoso-time/README.md --- a/spinoso-time/README.md +++ b/spinoso-time/README.md @@ -37,7 +37,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -spinoso-time = { version = "0.7.0", features = ["tzrs"] } +spinoso-time = { version = "0.7.1", features = ["tzrs"] } ``` ## Examples diff --git a/spinoso-time/src/time/tzrs/error.rs b/spinoso-time/src/time/tzrs/error.rs --- a/spinoso-time/src/time/tzrs/error.rs +++ b/spinoso-time/src/time/tzrs/error.rs @@ -2,6 +2,7 @@ use core::fmt; use core::num::TryFromIntError; +use core::time::TryFromFloatSecsError; use std::error; use std::str::Utf8Error; diff --git a/spinoso-time/src/time/tzrs/error.rs b/spinoso-time/src/time/tzrs/error.rs --- a/spinoso-time/src/time/tzrs/error.rs +++ b/spinoso-time/src/time/tzrs/error.rs @@ -150,8 +151,14 @@ impl From<TzOutOfRangeError> for TimeError { } impl From<IntOverflowError> for TimeError { - fn from(error: IntOverflowError) -> Self { - Self::IntOverflowError(error) + fn from(err: IntOverflowError) -> Self { + Self::IntOverflowError(err) + } +} + +impl From<TryFromFloatSecsError> for TimeError { + fn from(err: TryFromFloatSecsError) -> Self { + Self::TzOutOfRangeError(err.into()) } } diff --git a/spinoso-time/src/time/tzrs/error.rs b/spinoso-time/src/time/tzrs/error.rs --- a/spinoso-time/src/time/tzrs/error.rs +++ b/spinoso-time/src/time/tzrs/error.rs @@ -209,6 +216,12 @@ impl TzOutOfRangeError { } } +impl From<TryFromFloatSecsError> for TzOutOfRangeError { + fn from(_err: TryFromFloatSecsError) -> Self { + Self::new() + } +} + /// Error that indicates a given operation has resulted in an integer overflow. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct IntOverflowError { diff --git a/spinoso-time/src/time/tzrs/math.rs b/spinoso-time/src/time/tzrs/math.rs --- a/spinoso-time/src/time/tzrs/math.rs +++ b/spinoso-time/src/time/tzrs/math.rs @@ -161,9 +161,9 @@ impl Time { } if seconds.is_sign_positive() { - self.checked_add(Duration::from_secs_f64(seconds)) + self.checked_add(Duration::try_from_secs_f64(seconds)?) } else { - self.checked_sub(Duration::from_secs_f64(-seconds)) + self.checked_sub(Duration::try_from_secs_f64(-seconds)?) } } } diff --git a/spinoso-time/src/time/tzrs/math.rs b/spinoso-time/src/time/tzrs/math.rs --- a/spinoso-time/src/time/tzrs/math.rs +++ b/spinoso-time/src/time/tzrs/math.rs @@ -242,9 +242,9 @@ impl Time { } if seconds.is_sign_positive() { - self.checked_sub(Duration::from_secs_f64(seconds)) + self.checked_sub(Duration::try_from_secs_f64(seconds)?) } else { - self.checked_add(Duration::from_secs_f64(-seconds)) + self.checked_add(Duration::try_from_secs_f64(-seconds)?) } } }
artichoke__artichoke-2416
2,416
I've put up a stabilization PR for this feature in Rust `std` here: https://github.com/rust-lang/rust/pull/102271. These functions were stabilized and released today in Rust 1.66.0: - https://doc.rust-lang.org/stable/std/time/struct.Duration.html#method.try_from_secs_f32 - https://blog.rust-lang.org/2022/12/15/Rust-1.66.0.html#stabilized-apis
[ "2194" ]
4.1
artichoke/artichoke
2023-02-19T19:20:14Z
diff --git a/spinoso-time/src/time/tzrs/math.rs b/spinoso-time/src/time/tzrs/math.rs --- a/spinoso-time/src/time/tzrs/math.rs +++ b/spinoso-time/src/time/tzrs/math.rs @@ -304,6 +304,15 @@ mod tests { } } + #[test] + fn add_out_of_fixnum_range_float_sec() { + let dt = datetime(); + dt.checked_add_f64(f64::MAX).unwrap_err(); + + let dt = datetime(); + dt.checked_add_f64(f64::MIN).unwrap_err(); + } + #[test] fn add_subsec_float_to_time() { let dt = datetime(); diff --git a/spinoso-time/src/time/tzrs/math.rs b/spinoso-time/src/time/tzrs/math.rs --- a/spinoso-time/src/time/tzrs/math.rs +++ b/spinoso-time/src/time/tzrs/math.rs @@ -393,6 +402,15 @@ mod tests { } } + #[test] + fn sub_out_of_fixnum_range_float_sec() { + let dt = datetime(); + dt.checked_sub_f64(f64::MAX).unwrap_err(); + + let dt = datetime(); + dt.checked_sub_f64(f64::MIN).unwrap_err(); + } + #[test] fn sub_subsec_float_to_time() { let dt = datetime();
`Time::checked_add_f64` and `Time::checked_sub_f64` panic on too large input ```rust use core::time::Duration; fn main() { dbg!(Duration::from_secs_f64(f64::MAX)); } ``` Output: ``` Compiling playground v0.0.1 (/playground) Finished dev [unoptimized + debuginfo] target(s) in 0.58s Running `target/debug/playground` thread 'main' panicked at 'can not convert float seconds to Duration: value is either too big or NaN', /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/time.rs:744:23 note: [run with `RUST_BACKTRACE=1` environment variable to display a backtrace](https://play.rust-lang.org/#) ``` There is an unstable API, `Duration::try_from_secs_{f32, f64}` which will allow for a checked conversion. See: - https://github.com/rust-lang/rust/issues/83400 Once this API is stabilized, convert this code to use the fallible conversion: https://github.com/artichoke/artichoke/blob/2db53033309c3e4f923fdea960d0884c4b47d1c8/spinoso-time/src/time/tzrs/math.rs#L163-L167 https://github.com/artichoke/artichoke/blob/2db53033309c3e4f923fdea960d0884c4b47d1c8/spinoso-time/src/time/tzrs/math.rs#L244-L248
2246959a46f627a455a1dc5ca0fff0d5c5f795e9
[ "time::tzrs::math::tests::sub_out_of_fixnum_range_float_sec", "time::tzrs::math::tests::add_out_of_fixnum_range_float_sec" ]
[ "time::tzrs::math::tests::add_float_to_time", "time::tzrs::math::tests::rounding", "time::tzrs::offset::tests::fixed_zero_is_not_utc", "time::tzrs::offset::tests::from_str_hh_mm", "time::tzrs::offset::tests::from_str_hh_colon_mm", "time::tzrs::offset::tests::from_str_non_ascii_numeral_fixed_strings", "time::tzrs::offset::tests::tzrs_gh_34_handle_missing_transition_tzif_v1", "time::tzrs::offset::tests::utc_is_utc", "time::tzrs::math::tests::add_subsec_float_to_time", "time::tzrs::math::tests::rounding_rollup", "time::tzrs::offset::tests::from_str_fixed_strings_with_newlines", "time::tzrs::math::tests::add_int_to_time", "time::tzrs::offset::tests::fixed_time_zone_designation", "time::tzrs::offset::tests::from_binary_string", "time::tzrs::offset::tests::z_is_utc", "time::tzrs::tests::time_zone_fixed_offset", "time::tzrs::math::tests::sub_float_to_time", "time::tzrs::math::tests::sub_subsec_float_to_time", "time::tzrs::math::tests::sub_int_to_time", "time::tzrs::parts::tests::yday", "time::tzrs::offset::tests::from_str_invalid_fixed_strings", "time::tzrs::parts::tests::all_parts", "time::tzrs::offset::tests::offset_hhmm_from_seconds_exhaustive_5_bytes", "time::tzrs::offset::tests::fixed_time_zone_designation_exhaustive_no_panic", "src/time/tzrs/mod.rs - time::tzrs::Time::to_int (line 287)", "src/time/tzrs/mod.rs - time::tzrs::Time (line 53)", "src/time/tzrs/mod.rs - time::tzrs::Time::subsec_fractional (line 345)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::day (line 143)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_friday (line 470)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::hour (line 119)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_wednesday (line 422)", "src/time/tzrs/mod.rs - time::tzrs::Time (line 41)", "src/time/tzrs/mod.rs - time::tzrs::Time::with_timespec_and_offset (line 218)", "src/time/tzrs/convert.rs - time::tzrs::convert::Time::fmt (line 12)", "src/time/tzrs/offset.rs - time::tzrs::offset::Offset::is_utc (line 221)", "src/lib.rs - readme (line 113)", "src/time/tzrs/math.rs - time::tzrs::math::Time::round (line 18)", "src/time/tzrs/offset.rs - time::tzrs::offset::Offset::utc (line 103)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_tuesday (line 398)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_utc (line 250)", "src/time/tzrs/offset.rs - time::tzrs::offset::Offset::local (line 131)", "src/time/tzrs/offset.rs - time::tzrs::offset::Offset::fixed (line 176)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::day_of_year (line 517)", "src/time/tzrs/convert.rs - time::tzrs::convert::Time::to_array (line 104)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_sunday (line 350)", "src/time/tzrs/mod.rs - time::tzrs::Time::to_float (line 312)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_dst (line 299)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::day_of_week (line 327)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_thursday (line 446)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_saturday (line 493)", "src/time/tzrs/mod.rs - time::tzrs::Time::now (line 189)", "src/time/tzrs/mod.rs - time::tzrs::Time::new (line 132)", "src/time/tzrs/offset.rs - time::tzrs::offset::Offset::fixed (line 161)", "src/time/tzrs/mod.rs - time::tzrs::Time::try_from (line 252)", "src/time/tzrs/convert.rs - time::tzrs::convert::Time::strftime (line 45)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::is_monday (line 374)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::month (line 168)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::minute (line 95)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::second (line 70)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::microseconds (line 43)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::to_local (line 79)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::to_offset (line 15)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::year (line 193)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::utc_offset (line 274)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::set_offset (line 109)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::time_zone (line 217)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::to_utc (line 46)", "src/time/tzrs/parts.rs - time::tzrs::parts::Time::nanoseconds (line 16)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::set_offset_from_utc (line 209)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::set_local (line 144)", "src/time/tzrs/timezone.rs - time::tzrs::timezone::Time::set_utc (line 176)" ]
[]
[]
2023-02-19T19:33:19Z
c29ecd68714bddf5e27a9e347c902faa23b2a545
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -539,7 +539,7 @@ fn filter(i: &[u8]) -> IResult<&[u8], (&str, Option<Vec<Expr>>)> { } fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> { - let (i, (obj, filters)) = tuple((expr_index, many0(filter)))(i)?; + let (i, (obj, filters)) = tuple((expr_unary, many0(filter)))(i)?; let mut res = obj; for (fname, args) in filters { diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -557,7 +557,7 @@ fn expr_filtered(i: &[u8]) -> IResult<&[u8], Expr> { } fn expr_unary(i: &[u8]) -> IResult<&[u8], Expr> { - let (i, (op, expr)) = tuple((opt(alt((ws(tag("!")), ws(tag("-"))))), expr_filtered))(i)?; + let (i, (op, expr)) = tuple((opt(alt((ws(tag("!")), ws(tag("-"))))), expr_index))(i)?; Ok(( i, match op { diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -605,7 +605,7 @@ macro_rules! expr_prec_layer { } } -expr_prec_layer!(expr_muldivmod, expr_unary, "*", "/", "%"); +expr_prec_layer!(expr_muldivmod, expr_filtered, "*", "/", "%"); expr_prec_layer!(expr_addsub, expr_muldivmod, "+", "-"); expr_prec_layer!(expr_shifts, expr_addsub, ">>", "<<"); expr_prec_layer!(expr_band, expr_shifts, "&");
rinja-rs__askama-426
426
Oops -- we should fix that! Oops -- we should fix that!
[ "424", "424" ]
0.10
rinja-rs/askama
2021-01-05T14:44:35Z
diff --git a/askama_shared/src/parser.rs b/askama_shared/src/parser.rs --- a/askama_shared/src/parser.rs +++ b/askama_shared/src/parser.rs @@ -1126,7 +1126,41 @@ mod tests { #[test] fn test_parse_filter() { - super::parse("{{ strvar|e }}", &Syntax::default()).unwrap(); + use Expr::*; + let syntax = Syntax::default(); + assert_eq!( + super::parse("{{ strvar|e }}", &syntax).unwrap(), + vec![Node::Expr( + WS(false, false), + Filter("e", vec![Var("strvar")]), + )], + ); + assert_eq!( + super::parse("{{ 2|abs }}", &syntax).unwrap(), + vec![Node::Expr( + WS(false, false), + Filter("abs", vec![NumLit("2")]), + )], + ); + assert_eq!( + super::parse("{{ -2|abs }}", &syntax).unwrap(), + vec![Node::Expr( + WS(false, false), + Filter("abs", vec![Unary("-", NumLit("2").into())]), + )], + ); + assert_eq!( + super::parse("{{ (1 - 2)|abs }}", &syntax).unwrap(), + vec![Node::Expr( + WS(false, false), + Filter( + "abs", + vec![Group( + BinOp("-", NumLit("1").into(), NumLit("2").into()).into() + )] + ), + )], + ); } #[test]
Filters have precedence over unary operators Performing e.g. `{{ -2|abs }}` is parsed as `{{ -(2|abs) }}` resulting in `-2` being rendered. Filters have precedence over unary operators Performing e.g. `{{ -2|abs }}` is parsed as `{{ -(2|abs) }}` resulting in `-2` being rendered.
49252d2457f280026c020d0df46733578eb959a5
[ "parser::tests::test_parse_filter" ]
[ "filters::json::tests::test_json", "filters::tests::test_capitalize", "filters::tests::test_into_isize", "filters::tests::test_linebreaks", "parser::tests::change_delimiters_parse_filter", "parser::tests::test_associativity", "tests::find_absolute", "filters::tests::test_indent", "filters::tests::test_center", "tests::find_relative", "filters::tests::test_abs", "filters::tests::test_filesizeformat", "tests::test_default_config", "tests::is_not_exist_default_syntax - should panic", "parser::tests::test_precedence", "tests::get_source", "tests::find_relative_nonexistent - should panic", "tests::find_relative_sub", "tests::test_config_dirs", "parser::tests::test_invalid_block - should panic", "filters::tests::test_join", "parser::tests::test_parse_comments", "filters::tests::test_wordcount", "filters::tests::test_urlencoding", "filters::tests::test_lower", "filters::tests::test_linebreaksbr", "parser::tests::test_parse_path_call", "filters::tests::test_upper", "tests::escape_modes", "filters::tests::test_trim", "tests::add_syntax_two", "filters::tests::test_truncate", "tests::duplicated_syntax_name_on_list - should panic", "filters::tests::test_into_f64", "tests::add_syntax", "parser::tests::test_ws_splitter", "parser::tests::test_parse_var_call", "parser::tests::test_parse_root_path", "tests::use_default_at_syntax_name - should panic" ]
[ "filters::yaml::tests::test_yaml" ]
[]
2021-01-05T15:15:20Z
43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b
diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -248,15 +248,15 @@ impl<'a> Suffix<'a> { } fn r#macro(i: &'a str) -> IResult<&'a str, Self> { - fn nested_parenthesis(i: &str) -> IResult<&str, ()> { + fn nested_parenthesis(input: &str) -> IResult<&str, ()> { let mut nested = 0; let mut last = 0; let mut in_str = false; let mut escaped = false; - for (i, b) in i.chars().enumerate() { - if !(b == '(' || b == ')') || !in_str { - match b { + for (i, c) in input.char_indices() { + if !(c == '(' || c == ')') || !in_str { + match c { '(' => nested += 1, ')' => { if nested == 0 { diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -281,16 +281,16 @@ impl<'a> Suffix<'a> { } } - if escaped && b != '\\' { + if escaped && c != '\\' { escaped = false; } } if nested == 0 { - Ok((&i[last..], ())) + Ok((&input[last..], ())) } else { Err(nom::Err::Error(error_position!( - i, + input, ErrorKind::SeparatedNonEmptyList ))) }
rinja-rs__askama-861
861
[ "860" ]
0.12
rinja-rs/askama
2023-09-11T09:42:00Z
diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs --- a/askama_parser/src/tests.rs +++ b/askama_parser/src/tests.rs @@ -788,3 +788,10 @@ fn test_parse_array() { )], ); } + +#[test] +fn fuzzed_unicode_slice() { + let d = "{eeuuu{b&{!!&{!!11{{ + 0!(!1q҄א!)!!!!!!n!"; + assert!(Ast::from_str(d, &Syntax::default()).is_err()); +}
Fuzzing askama_parser results in panic Hi, fuzzing `askama_parser` resulted in panic at following line. https://github.com/djc/askama/blob/43e92aa3b6b9cd967a70bd0fd54d1f087d6ed76b/askama_parser/src/expr.rs#L290 I suppose it happens because crash input contains Cyrillic letters which are multi-byte and we need exact byte indices to avoid such panic in `[..]` notation. ```rust #[test] fn testing() { let d = "{eeuuu{b&{!!&{!!11{{ 0!(!1q҄א!)!!!!!!n!"; if let Ok(_) = Ast::from_str(d, &Syntax::default()) {} } ``` ``` running 1 test thread 'tests::testing' panicked at 'byte index 6 is not a char boundary; it is inside 'א' (bytes 5..7) of `!1q҄א!)!!!!!!n!`', askama_parser/src/expr.rs:290:22 stack backtrace: ```
4dab5f91ba15e7c238ddf6223ec7b45eef32cab4
[ "tests::fuzzed_unicode_slice" ]
[ "tests::change_delimiters_parse_filter", "tests::test_parse_const", "tests::test_parse_var_call", "tests::test_parse_path_call", "tests::test_ws_splitter", "tests::test_parse_numbers", "tests::test_associativity", "tests::test_parse_var", "tests::test_parse_comments", "tests::test_parse_root_path", "tests::test_missing_space_after_kw", "tests::test_parse_array", "tests::test_odd_calls", "tests::test_parse_tuple", "tests::test_parse_filter", "tests::test_rust_macro", "tests::test_precedence", "tests::test_invalid_block - should panic", "tests::test_parse_path" ]
[]
[]
2023-09-11T10:19:21Z
96a4a46586aa10f2bebc6b892e7dc43d764a9999
diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml --- a/askama_derive/Cargo.toml +++ b/askama_derive/Cargo.toml @@ -25,7 +25,7 @@ with-rocket = [] with-warp = [] [dependencies] -parser = { package = "askama_parser", version = "0.3", path = "../askama_parser" } +parser = { package = "askama_parser", version = "0.3.1", path = "../askama_parser" } mime = "0.3" mime_guess = "2" proc-macro2 = "1" diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -7,6 +7,7 @@ use std::{env, fs}; use serde::Deserialize; use crate::{CompileError, CRATE}; +use parser::expr::TWO_PLUS_CHAR_OPS; use parser::node::Whitespace; use parser::Syntax; diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -147,20 +148,23 @@ impl<'a> TryInto<Syntax<'a>> for RawSyntax<'a> { comment_end: self.comment_end.unwrap_or(default.comment_end), }; - for s in [ - syntax.block_start, - syntax.block_end, - syntax.expr_start, - syntax.expr_end, - syntax.comment_start, - syntax.comment_end, + for (s, kind) in [ + (syntax.block_start, "block_start"), + (syntax.block_end, "block_end"), + (syntax.expr_start, "expr_start"), + (syntax.expr_end, "expr_end"), + (syntax.comment_start, "comment_start"), + (syntax.comment_end, "comment_end"), ] { if s.len() < 2 { - return Err( - format!("delimiters must be at least two characters long: {s:?}").into(), - ); + return Err(format!( + "{kind} delimiter must be at least two characters long: {s:?}" + ) + .into()); } else if s.chars().any(|c| c.is_whitespace()) { - return Err(format!("delimiters may not contain white spaces: {s:?}").into()); + return Err(format!("{kind} delimiter may not contain whitespace: {s:?}").into()); + } else if TWO_PLUS_CHAR_OPS.contains(&s) { + return Err(format!("{kind} delimiter may not contain operators: {s:?}").into()); } } diff --git a/askama_parser/Cargo.toml b/askama_parser/Cargo.toml --- a/askama_parser/Cargo.toml +++ b/askama_parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "askama_parser" -version = "0.3.0" +version = "0.3.1" description = "Parser for Askama templates" documentation = "https://docs.rs/askama" keywords = ["markup", "template", "jinja2", "html"] diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -172,6 +172,7 @@ impl<'a> Expr<'a> { ))(i) } + // Keep in sync with `TWO_PLUS_CHAR_OPS`, below expr_prec_layer!(or, and, "||"); expr_prec_layer!(and, compare, "&&"); expr_prec_layer!(compare, bor, "==", "!=", ">=", ">", "<=", "<"); diff --git a/askama_parser/src/expr.rs b/askama_parser/src/expr.rs --- a/askama_parser/src/expr.rs +++ b/askama_parser/src/expr.rs @@ -430,3 +431,6 @@ impl<'a> Suffix<'a> { map(preceded(take_till(not_ws), char('?')), |_| Self::Try)(i) } } + +pub const TWO_PLUS_CHAR_OPS: &[&str] = + &["||", "&&", "==", "!=", ">=", "<=", "<<", ">>", "..", "..="];
rinja-rs__askama-1095
1,095
[ "1081" ]
0.13
rinja-rs/askama
2024-09-19T08:12:12Z
diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -486,7 +490,7 @@ mod tests { let config = Config::new(raw_config, None); assert_eq!( config.unwrap_err().msg, - r#"delimiters must be at least two characters long: "<""#, + r#"block_start delimiter must be at least two characters long: "<""#, ); let raw_config = r#" diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -497,7 +501,7 @@ mod tests { let config = Config::new(raw_config, None); assert_eq!( config.unwrap_err().msg, - r#"delimiters may not contain white spaces: " {{ ""#, + r#"block_start delimiter may not contain whitespace: " {{ ""#, ); let raw_config = r#"
Template parsing issues when using double angle brackets as delimiters With `expr` delimiters `<<` and `>>`, trying to use the template `<<a>> and <<b>>` complains about `and` not being a field. Here is a full example that produces the error "no field `and` on type `&HelloTemplate`": ```toml [[syntax]] name = "mwe" expr_start = "<<" expr_end = ">>" ``` ```rust #[derive(Template)] #[template(source = "<<a>> and <<b>>", syntax = "mwe", ext="")] struct HelloTemplate { a: u32, b: u32, } ``` Maybe worse, using `(<<a>> and) <<b>>` as the template produces "failed to parse template source". ```rust #[derive(Template)] #[template(source = "(<<a>> and) <<b>>", syntax = "mwe", ext = "")] struct HelloTemplate { a: u32, b: u32, } ``` Everything works fine if the delimiters are changed to eg `<!` and `!>`. I have not experimented with other pairs.
53b4b518f9a230665029560df038c318b2e55458
[ "config::tests::illegal_delimiters" ]
[ "config::tests::add_syntax_two", "config::tests::add_syntax", "config::tests::duplicated_syntax_name_on_list - should panic", "config::tests::find_absolute", "config::tests::find_relative", "config::tests::find_relative_nonexistent - should panic", "config::tests::find_relative_sub", "config::tests::get_source", "config::tests::is_not_exist_default_syntax - should panic", "config::tests::longer_delimiters", "config::tests::test_config_dirs", "config::tests::test_config_whitespace_error", "config::tests::test_default_config", "config::tests::test_whitespace_in_template", "input::tests::test_double_ext", "config::tests::test_whitespace_parsing", "config::tests::use_default_at_syntax_name - should panic", "input::tests::test_ext", "input::tests::test_only_jinja_ext", "input::tests::test_skip_jinja_ext" ]
[ "config::tests::escape_modes", "tests::check_if_let" ]
[]
2024-09-19T08:47:53Z
b14982f97ffd20039286171d56e6fcfab21f56bc
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -330,20 +330,14 @@ where /// Capitalize a value. The first character will be uppercase, all others lowercase. pub fn capitalize<T: fmt::Display>(s: T) -> Result<String> { - let mut s = s.to_string(); - - match s.get_mut(0..1).map(|s| { - s.make_ascii_uppercase(); - &*s - }) { - None => Ok(s), - _ => { - s.get_mut(1..).map(|s| { - s.make_ascii_lowercase(); - &*s - }); - Ok(s) + let s = s.to_string(); + match s.chars().next() { + Some(c) => { + let mut replacement: String = c.to_uppercase().collect(); + replacement.push_str(&s[c.len_utf8()..].to_lowercase()); + Ok(replacement) } + _ => Ok(s), } }
rinja-rs__askama-652
652
This custom filter does what i expected capitalize to do. ```rust mod filters { pub fn cap(s: &str) -> ::askama::Result<String> { match s.chars().next() { Some(c) => { if c.is_lowercase() { let mut replacement: String = c.to_uppercase().collect(); replacement.push_str(&s[c.len_utf8()..]); Ok(replacement) } else { Ok(s.to_string()) } } _ => Ok(s.to_string()) } } } ``` Thanks for the report, want to submit a PR? Ideally including a basic test would be great, too!
[ "651" ]
0.11
rinja-rs/askama
2022-03-26T15:32:24Z
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs --- a/askama_shared/src/filters/mod.rs +++ b/askama_shared/src/filters/mod.rs @@ -655,6 +649,9 @@ mod tests { assert_eq!(capitalize(&"").unwrap(), "".to_string()); assert_eq!(capitalize(&"FoO").unwrap(), "Foo".to_string()); assert_eq!(capitalize(&"foO BAR").unwrap(), "Foo bar".to_string()); + assert_eq!(capitalize(&"äØÄÅÖ").unwrap(), "Äøäåö".to_string()); + assert_eq!(capitalize(&"ß").unwrap(), "SS".to_string()); + assert_eq!(capitalize(&"ßß").unwrap(), "SSß".to_string()); } #[test]
Capitalize does not work with non ascii chars Capitalize filter only works with ascii chars not chars like å, ä and ö.
7b6f1df433a7f11612608644342b898cd6be8ff5
[ "filters::tests::test_capitalize" ]
[ "filters::tests::test_abs", "filters::json::tests::test_json", "filters::tests::test_center", "filters::tests::test_filesizeformat", "filters::tests::test_into_f64", "filters::tests::test_indent", "filters::tests::test_into_isize", "filters::tests::test_join", "filters::tests::test_linebreaks", "filters::tests::test_linebreaksbr", "filters::tests::test_lower", "filters::tests::test_paragraphbreaks", "filters::tests::test_trim", "filters::tests::test_truncate", "filters::tests::test_upper", "filters::tests::test_urlencoding", "filters::tests::test_wordcount", "input::tests::test_double_ext", "input::tests::test_ext", "input::tests::test_only_jinja_ext", "input::tests::test_skip_jinja_ext", "parser::tests::change_delimiters_parse_filter", "parser::tests::test_invalid_block - should panic", "parser::tests::test_parse_comments", "parser::tests::test_associativity", "parser::tests::test_parse_const", "parser::tests::test_odd_calls", "parser::tests::test_parse_filter", "parser::tests::test_parse_numbers", "parser::tests::test_parse_tuple", "tests::find_absolute", "parser::tests::test_ws_splitter", "tests::find_relative", "tests::find_relative_nonexistent - should panic", "tests::find_relative_sub", "parser::tests::test_parse_path_call", "tests::test_default_config", "tests::get_source", "tests::use_default_at_syntax_name - should panic", "tests::escape_modes", "tests::add_syntax", "parser::tests::test_precedence", "tests::is_not_exist_default_syntax - should panic", "parser::tests::test_parse_var_call", "parser::tests::test_parse_var", "tests::add_syntax_two", "tests::duplicated_syntax_name_on_list - should panic", "parser::tests::test_parse_root_path", "tests::test_config_dirs", "parser::tests::test_parse_path" ]
[ "filters::yaml::tests::test_yaml" ]
[]
2022-03-26T17:50:42Z