Question is, can a M lens handle a 40MP sensor. A dealer once told me that Leica have not inched past 24MP in order to preserve their M lenses.
There is not a question whether Leica M lenses can handle more resolution. They absolutely can, no question about that. It is however, a question if the mechanical rangefinder can handle the increased demand for higher focus accuracy. And in my opinion, it cannot. That is why my fantasy always has been to see M camera with some kind of optoelectronic rangefinder - one which would eliminate the mechanical aspect of the rangerfinder. just imagine having perfect focus every time with Summilux-M 75. Right now - no way. A ~50 MP sensor is probably gonna make it even worse. That said, I fully support the proposition of higher megapixels. People have not realized how wonderful these modern Sony BSI sensors are these days, so your ISO performance is not going to suffer (as demonstrated by Sony A7r III vs Sony A7 III), yet the difference in clarity and details is very obvious. It is also apparent in prints.
However, in my opinion even the SL is not the perfect solution to use M lenses. Based on my experience the best platform for M lenses remains to be M bodies. SL has different filter stack (I think it is about 1.0-1.1 mm, so bit thicker than the digital M) so depending on the lens a slight performance hit is apparent (e.g. I just hated how my Summicron-M 28 version 1 looked on SL, version 2 = much better). I would use L-mount lenses on SL body (apart from some exceptions, like Summilux-M 75 + SL is wonderful combination).