sapmentors / cap-community

SAP CAP Community
MIT License
97 stars 26 forks source link

CDS 3.31.2 does not detect duplicate definition of an artefact as type and entity #54

Open gregorwolf opened 4 years ago

gregorwolf commented 4 years ago

Hello SAP CAP Team,

via the Incident 172922 / 2020 @David-Kunz already verified that the CDS compiler in with @sap/cds 3.31.2 does not recognise a duplicate definition of an artefact. In the commit https://github.com/gregorwolf/bookshop-demo/commit/34c43230e10c9abd1cac8e5c0eaa648368ca2557 I've added an example for the type User and entity User that works with 3.21.3. But as soon as I sue 3.31.2 the following error occurs at startup:

(node:91560) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '_target' of undefined
    at ApplicationService.on (/Users/gwolf/Documents/Projects/cap/bookshop-demo/node_modules/@sap/cds-services/lib/services/Service.js:494:42)
    at ApplicationService.module.exports (/Users/gwolf/Documents/Projects/cap/bookshop-demo/srv/admin-service.js:69:6)
    at ApplicationService.impl (/Users/gwolf/Documents/Projects/cap/bookshop-demo/node_modules/@sap/cds-services/lib/services/Service.js:244:32)
    at loaded.then.csn (/Users/gwolf/Documents/Projects/cap/bookshop-demo/node_modules/@sap/cds/lib/srv/serve.js:67:29)
(node:91560) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:91560) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Best regards Gregor