[MU4 Issue] Part group barlines not respected in MusicXML import
Describe the bug Barlines connecting part-groups are not respected in MusicXML import except for the first two parts, and even there they are not respected in the final barline.
To Reproduce Steps to reproduce the behavior:
- Create a default score containing three or more groups from the same instrument family (here I chose Fl. Ob. Cl. and Bassoon).
- Notice that they are all part of the same part-group with barlines going across all parts (screenshot 1)
- Export as MusicXML (here I've done uncompressed for ease of looking at the score).
- Open the MusicXML file in MuseScore 4.0.0
- See that the barlines only go through the first two parts, and that the final barlines are not connected in those two parts (screenshot 2). The grouping brace, however, is imported properly.
Expected behavior The barlines should look the same upon import as they were on export.
Screenshots
MCSZ file in MuseScore:

After export and reimport as MusicXML:

Platform information
- OS: macOS 12.6
- MuseScore 4.0.0 w/o MuseHub
Additional context This problem first arose somewhere around MuseScore 3 -- sorry I'm only now getting around to posting it.
The <part-list> and <part-group> information in the musicxml produced by MuseScore 4 appears to be correct, and I can get the same results from musicxml produced by music21 and Finale.
The mcsz (4.0.0) and musicxml files from the screenshot are attached in the zip-file below.
(And thanks for supporting MusicXML v4.0 validation -- as the incoming Editor of the MusicXML spec, I appreciate this a lot!)
I'm a newbie to the actual MuseScore code, but it appears that the boolean concept of barLineSpan in StaffGroup or on a barline object, which indicates spanning to the next staff (part?) is being confused with an int barLineSpan on a Staff object which indicates how many staves are being spanned. (in importmxmlpass1.cpp)
There also seems to be a related bug (not appearing in this case) where nstaves() is not being counted in the barLineSpan calculations on MusicXML import, so that the number of parts being spanned is equal to the number of staves being spanned.
Looking into this. Problem confirmed, working on a solution.
Fix in pull request https://github.com/musescore/MuseScore/pull/15927