r-lib / rlang

Low-level API for programming with R
https://rlang.r-lib.org
Other
489 stars 131 forks source link

Fix bug in `vec_recycle_common()` #1701

Closed teunbrand closed 2 months ago

teunbrand commented 2 months ago

This PR aims to fix #1700.

It restores an error that should be thrown when size = 1 is requested, but input has larger vectors. Reprex from issue with this PR:

rlang:::vec_recycle_common(list(a = 1, b = 1:2), size = 1)
#> Error: Inputs can't be recycled to `size`.

Created on 2024-04-17 with reprex v2.1.0

lionel- commented 2 months ago

Can you add a test please?

teunbrand commented 2 months ago

Sure thing!

lionel- commented 2 months ago

Thanks!