Bug: Private Implemented Interface Members are accessible outside


A small bug I have encountered, as the tilte states: you can put Interface member in private section of (record/class) and still call it outside, for instance in Main(). The IDE (Water) correctly hides those Members from Intellisense but sadly you can just write them Down and it still compiles fine and even the functions are being called successfully, consider the attached project:

oxyrest.zip (567.1 KB)

Best regards


PS: Version of Elements: (stable)

I believe that’s as designed/a side effect of how interfaces are handled. they are always public.

hmm but then Im curiours why does Water doesnt show it on intelisense, tbf I think they really should be only allowed in public section, so a small compiler error should occur when used in any other modifier, for me personally atleast its more intuitive, but hey… nothjing to cry on if you guys wanna stick to that idea/implementation, i will have to adept to this, no problem :slight_smile: But if you wanna stick to that, Water should always then show them on intellisense, to keep sync with compiler.

I would rather like to take back the statement, when I said, its ok to let it like this, since actually, it creates alot of confusion i feel since u are able to put in alot of other visibility-sections and, considering a 200 LoC class, where u cant at some point properly distingusish perfeclt which function comes from where (if alot of polymorphism, interfaces etc… is used) and out of the sudden at compiling you wonder why certain private functions are being called publicly. I think its really good to raise a compiler error for that, imho.

Agreed, that should be consistent and seems to be a CC bug. I’ll log.

Thanks, logged as bugs://85352

I’ll leave to tot he compile team to decide which side to fix — this too might come down to a “that’s just how .NET needs it”, but in either case, CC and compile should be made consistent. I agree that preferably private interface methods shucked only be accessible by casting to the interface type.