zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2k stars 592 forks source link

Cleanup Class Logic in the Slice Compiler #2264

Closed InsertCreativityHere closed 1 month ago

InsertCreativityHere commented 1 month ago

This PR removes any code-generation support for optional classes, replacing them with asserts to ensure the compiler never encounters an optional class type. This also lets us simplify our logic in some places.

It also adds a new isClassType function to the compiler. Every language had it's own version of this logic... So I deleted all those duplicate functions and we now use this single, centralized function instead. The base implementation returns false, and it's overridden by Class and Builtin (for Value and Object keywords).

It also also adds some tests to ensure the compiler does correctly reject optional classes, and types which are using them.