Improve error location of missing object.ToString() for concatenation#71890
Improve error location of missing object.ToString() for concatenation#71890AlekseyTs merged 2 commits intodotnet:mainfrom DoctorKrolic:better-missing-member-location
object.ToString() for concatenation#71890Conversation
I would like to suggest making a more general change instead:
Refers to: src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringConcat.cs:369 in 2d37bbc. [](commit_id = 2d37bbc, deletion_comment = False) |
|
Done with review pass (commit 1). |
|
Since this change is significantly less complicated (I would even say trivial), I think we should delay merging until after the other PR is merged. |
See, this is the reason I did it in the first place. This is a type of chage which brings barely noticable improvment, but for equally barely noticable effort
There is a slight problem here. I kinda trapped myself since tests, added in #71793 (specifically in a288d21) depend on this new error location. I would prefer to resolve a simple merge conflict rather than change all locations in those tests back and forth in different PRs. |
Still not a reason to not follow a guideline and bundle it with an unrelated change. From a contributor aware of the guideline, I personally expect the contributor to follow it, i.e. not sending a PR with an unrelated change for review, rather than doing that and waiting if a request will be made to revert it. |
I primarily wanted to avoid a blanket merge from 'main' to the other PR. For whatever reason, the tool that we are using for code reviews might "go of the rails" after merges like that. I guess I would be comfortable if you merge the specific commit rather than the entire |
|
@dotnet/roslyn-compiler For the second review |
No problem with that. Sorry for creating this issue in the first place |
|
@DoctorKrolic Thank you for the contribution. Note, I squashed the commits together while merging this PR, this is what we usually do. |
Extracted from #71793 (suggested in #71793 (comment))
Currently if
object.ToString()member is missing error is reported on the whole concatenation. It makes more sense to report in on the argument, which actually requested that member.E.g. consider concatenation
a + b + cwhereais a string andbandcare not. Ifobject.ToString()is missing without a chage of this PR error locations will be forb-a + band forc- the wholea + b + c. This PR chages it so that errors are reported directly onbandc. Added 2 tests to show this behavior for 3 and 4 concatenation argumentsI know that this is a very minor change and I would not normally make it, but since such separation of changes was requested by a compiler team meber, here is it. The "fix" is just several charachters long. And regardless of whether this is accepted or not, a lot more tests of missing
object.ToString()for concatenation are about to come in #71793