Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate seqan3::views::drop #2540

Merged
merged 8 commits into from
Apr 22, 2021
Merged

deprecate seqan3::views::drop #2540

merged 8 commits into from
Apr 22, 2021

Conversation

marehr
Copy link
Member

@marehr marehr commented Apr 20, 2021

@marehr marehr requested review from a team and SGSSGene and removed request for a team April 20, 2021 17:48
@vercel
Copy link

vercel bot commented Apr 20, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/seqan/seqan3/FEoSGaSXFyh5cxnRC9hukUZenGuP
✅ Preview: https://seqan3-git-fork-marehr-deprecatedrop-seqan.vercel.app

Copy link
Contributor

@SGSSGene SGSSGene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are missing some adjustments:
include/seqan3/alignment/pairwise/alignment_algorithm.hpp line 446
include/seqan3/search/detail/unidirectional_search_algorithm.hpp line 226
include/seqan3/io/sam_file/format_sam.hpp line 1158
include/seqan3/io/sam_file/format_sam.hpp line 1171

@marehr
Copy link
Member Author

marehr commented Apr 20, 2021

I think there are missing some adjustments:
include/seqan3/alignment/pairwise/alignment_algorithm.hpp line 446
include/seqan3/search/detail/unidirectional_search_algorithm.hpp line 226
include/seqan3/io/sam_file/format_sam.hpp line 1158
include/seqan3/io/sam_file/format_sam.hpp line 1171

Very nice catch. The interesting thing is that the library build completely through. I'm currently building seqan3 without the definition of seqan3::views::drop. That should show me potential left-overs :)

@marehr
Copy link
Member Author

marehr commented Apr 21, 2021

 In file included from ../../../seqan3/include/seqan3/search/fm_index/bi_fm_index.hpp:22,
                 from ../../../seqan3/test/unit/search/fm_index_cursor/bi_fm_index_cursor_collection_test.cpp:15:
../../../seqan3/include/seqan3/search/fm_index/bi_fm_index_cursor.hpp: In member function ‘void gtest_suite_bi_fm_index_cursor_collection_test_::serialisation<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_ = seqan3::bi_fm_index_cursor<seqan3::bi_fm_index<seqan3::dna4, seqan3::collection> >]’:
../../../seqan3/include/seqan3/search/fm_index/bi_fm_index_cursor.hpp:627:24: error: ‘it.seqan3::bi_fm_index_cursor<seqan3::bi_fm_index<seqan3::dna4, seqan3::collection> >::_last_char’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  627 |         sdsl_char_type c = _last_char;
      |                        ^
../../../seqan3/include/seqan3/search/fm_index/bi_fm_index_cursor.hpp: In member function ‘void gtest_suite_bi_fm_index_cursor_collection_test_::serialisation<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_ = seqan3::bi_fm_index_cursor<seqan3::bi_fm_index<seqan3::dna5, seqan3::collection> >]’:
../../../seqan3/include/seqan3/search/fm_index/bi_fm_index_cursor.hpp:627:24: error: ‘it.seqan3::bi_fm_index_cursor<seqan3::bi_fm_index<seqan3::dna5, seqan3::collection> >::_last_char’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  627 |         sdsl_char_type c = _last_char;
      |                        ^

@codecov
Copy link

codecov bot commented Apr 21, 2021

Codecov Report

Merging #2540 (a39007a) into master (e77f622) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2540      +/-   ##
==========================================
+ Coverage   98.22%   98.23%   +0.01%     
==========================================
  Files         269      269              
  Lines       10535    10540       +5     
==========================================
+ Hits        10348    10354       +6     
+ Misses        187      186       -1     
Impacted Files Coverage Δ
include/seqan3/range/views/drop.hpp 100.00% <ø> (ø)
...lude/seqan3/search/fm_index/bi_fm_index_cursor.hpp 100.00% <ø> (ø)
include/seqan3/search/fm_index/fm_index_cursor.hpp 100.00% <ø> (ø)
.../seqan3/alignment/pairwise/alignment_algorithm.hpp 100.00% <100.00%> (ø)
...ise/detail/pairwise_alignment_algorithm_banded.hpp 100.00% <100.00%> (ø)
include/seqan3/io/sam_file/format_sam.hpp 97.44% <100.00%> (+0.36%) ⬆️
include/seqan3/range/views/slice.hpp 100.00% <100.00%> (ø)
.../search/detail/unidirectional_search_algorithm.hpp 100.00% <100.00%> (ø)
include/seqan3/range/views/take.hpp 98.38% <0.00%> (-0.03%) ⬇️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e77f622...a39007a. Read the comment docs.

Copy link
Contributor

@SGSSGene SGSSGene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SGSSGene SGSSGene requested review from a team and eseiler and removed request for a team April 21, 2021 12:14
Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly questions

include/seqan3/core/platform.hpp Outdated Show resolved Hide resolved
test/performance/range/views/view_drop_benchmark.cpp Outdated Show resolved Hide resolved

if (end_pos < begin_pos)
throw std::invalid_argument{"end_pos argument to seqan3::views::slice must be >= the begin_pos argument."};

// urange | drop | take
return views::take(views::drop(std::forward<urng_t>(urange), begin_pos), end_pos - begin_pos);
// SEQAN3_WORKAROUND_GCC_100139 == 1 if std::views::{take, drop} does not type reduce (e.g. keep in type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this to me again?
I would have thought that I need to use views::type_reduce if the std::views did not type erase; but apparently it's the other way around?

Copy link
Member Author

@marehr marehr Apr 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a bit complicated xD

std::views::drop(range_t, 2) -> view_t has the following rules:

  1. range_t = std::span, returns view_t = std::span
  2. range_t = std::string_view, returns view_t = std::string_view
  3. range_t = std::ranges::subrange, returns view_t = std::ranges::subrange
  4. otherwise: view_t = std::ranges::drop_view<range_t>

Currently, gcc 10 and 11 always return view_t = std::ranges::drop_view<range_t>.

seqan3::views::type_reduce has some additional special rules:

  1. range_t is view, returns view as is
  • this line is problematic if we do view | type_reduce, because
    • a std::ranges::drop_view<range_t> will be passed through;
    • that means only type_reduce | view makes sense
    • one could argue that this rule should be checked in a different order (at least that the borrowed_range ones have priority)
  1. range_t = std::string const &, returns view_t = std::string_view
  2. range_t = std::ranges::contiguous_range && std::ranges::borrowed_range && std::ranges::sized_range, returns view_t = std::span
  3. range_t = std::ranges::random_access_range && std::ranges::borrowed_range && std::ranges::sized_range, returns view_t = std::ranges::subrange

Anyway, since only type_reduce | view makes sense right now, we need that std::views::drop stays in the same type, otherwise it will always wrap std::ranges::drop_view around any type.

Example:

view_t = range_t | seqan3::views::slice(0, 0);

range_t view_t if SEQAN3_WORKAROUND_GCC_100139 == 1 view_t if SEQAN3_WORKAROUND_GCC_100139 == 0 expected view_t
std::span std::span (explicit) std::span | type_reduce¹ | drop¹ | take¹ = std::span std::span
std::string_view std::string_view (explicit) std::string_view | type_reduce¹ | drop² | take² = std::string_view std::string_view
std::ranges::subrange std::ranges::subrange (explicit) std::ranges::subrange | type_reduce⁴ | drop³ | take³ = std::ranges::subrange std::ranges::subrange
std::string const & std::string_view (explicit) std::string const & | type_reduce² | drop² | take² = std::string_view std::string_view
std::ranges::contiguous_range && std::ranges::borrowed_range && std::ranges::sized_range std::span (explicit) range_t | type_reduce³ | drop¹ | take¹ = std::span std::span
std::ranges::random_access_range && std::ranges::borrowed_range && std::ranges::sized_range std::ranges::subrange (explicit) range_t | type_reduce⁴ | drop³ | take³ = std::ranges::subrange std::ranges::subrange

Superscript numbers denote rules.

…seqan3::dna4, seqan3::collection> >::_last_char’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Copy link
Member

@eseiler eseiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small stuff (I did one suggestion as comment instead of review, so it is above the review)

include/seqan3/range/views/drop.hpp Show resolved Hide resolved
include/seqan3/core/platform.hpp Outdated Show resolved Hide resolved
include/seqan3/range/views/drop.hpp Outdated Show resolved Hide resolved
Co-authored-by: Enrico Seiler <eseiler@users.noreply.github.com>
@eseiler eseiler enabled auto-merge (squash) April 22, 2021 09:45
@eseiler eseiler merged commit 41dd83e into seqan:master Apr 22, 2021
@marehr marehr deleted the deprecate_drop branch April 22, 2021 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deprecate seqan3::views::drop
3 participants