diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fe756447..404bcf81c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Code generation for `self` argument in optional struct methods: PR [#1284](https://github.com/tact-lang/tact/pull/1284) - 'The "remainder" field can only be the last field:' inspection now shows location: PR [#1300](https://github.com/tact-lang/tact/pull/1300) - Forbid "remainder" field at the middle of a contract storage: PR [#1301](https://github.com/tact-lang/tact/pull/1301) +- Forbid the `override` modifier for functions without the corresponding super-function: PR [#1302](https://github.com/tact-lang/tact/pull/1302) ### Docs diff --git a/src/types/__snapshots__/resolveDescriptors.spec.ts.snap b/src/types/__snapshots__/resolveDescriptors.spec.ts.snap index 027e1f1af..8aee4a3a1 100644 --- a/src/types/__snapshots__/resolveDescriptors.spec.ts.snap +++ b/src/types/__snapshots__/resolveDescriptors.spec.ts.snap @@ -463,6 +463,96 @@ Line 9, col 1: " `; +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-contract-from-base-trait 1`] = ` +":6:5: Function "foo" overrides nothing, remove "override" modifier or inherit any traits with this function +Line 6, col 5: + 5 | contract Test { +> 6 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 7 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-contract-with-inheritance 1`] = ` +":5:5: Function "foo" overrides nothing, remove "override" modifier +Line 5, col 5: + 4 | contract Test with T { +> 5 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 6 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-contract-with-multi-inheritance 1`] = ` +":11:5: Function "foo" overrides nothing, remove "override" modifier +Line 11, col 5: + 10 | contract Test with T, T2 { +> 11 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 12 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-contract-without-inheritance 1`] = ` +":4:5: Function "foo" overrides nothing, remove "override" modifier or inherit any traits with this function +Line 4, col 5: + 3 | contract Test { +> 4 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 5 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-trait-from-base-trait-2 1`] = ` +":6:5: Function "foo" overrides nothing, remove "override" modifier or inherit any traits with this function +Line 6, col 5: + 5 | trait Test { +> 6 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 7 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-trait-with-diamond-inheritance 1`] = ` +":16:5: Function "foo" overrides nothing, remove "override" modifier +Line 16, col 5: + 15 | trait Test with T2, T3 { +> 16 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 17 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-trait-with-inheritance 1`] = ` +":5:5: Function "foo" overrides nothing, remove "override" modifier +Line 5, col 5: + 4 | trait Test with T { +> 5 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 6 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-trait-with-multi-inheritance 1`] = ` +":11:5: Function "foo" overrides nothing, remove "override" modifier +Line 11, col 5: + 10 | trait Test with T, T2 { +> 11 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 12 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-function-in-trait-without-inheritance-2 1`] = ` +":4:5: Function "foo" overrides nothing, remove "override" modifier or inherit any traits with this function +Line 4, col 5: + 3 | trait Test { +> 4 | override fun foo() {} + ^~~~~~~~~~~~~~~~~~~~~ + 5 | } +" +`; + exports[`resolveDescriptors should fail descriptors for scope-contract-shadows-contract 1`] = ` ":12:1: Type "Main" already exists Line 12, col 1: @@ -13793,6 +13883,9727 @@ exports[`resolveDescriptors should resolve descriptors for message-opcode-expr 1 exports[`resolveDescriptors should resolve descriptors for message-opcode-expr 2`] = `[]`; +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun foo() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 10, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 9, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 11, + "kind": "trait", + "loc": trait Test with T { + override fun foo() {} +}, + "name": { + "id": 7, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 10, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 9, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun foo() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-from-base-trait 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 7, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait Test { + override fun foo() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 7, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-from-base-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-with-multi-inheritance 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T2 { + fun foo() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 13, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 12, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 14, + "kind": "contract", + "loc": contract Test with T, T2 { + override fun foo() {} +}, + "name": { + "id": 9, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 10, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 13, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 12, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": { + "ast": { + "id": 16, + "kind": "contract_init", + "loc": contract Test with T, T2 { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T2 { + fun foo() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-with-multi-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-with-multi-inheritance-from-base-trait 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 23, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + fun baz() {} +}, + "name": { + "id": 9, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 24, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 17, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 16, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 18, + "kind": "contract", + "loc": contract Test with T, T2 { + override fun foo() {} +}, + "name": { + "id": 13, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 14, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 15, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 17, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 16, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + "bar" => { + "ast": { + "attributes": [], + "id": 21, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + "baz" => { + "ast": { + "attributes": [], + "id": 22, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": { + "ast": { + "id": 20, + "kind": "contract_init", + "loc": contract Test with T, T2 { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 23, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + fun baz() {} +}, + "name": { + "id": 9, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 24, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-with-multi-inheritance-from-base-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun foo() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 10, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 9, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 11, + "kind": "contract", + "loc": contract Test with T { + override fun foo() {} +}, + "name": { + "id": 7, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 10, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 9, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": { + "ast": { + "id": 13, + "kind": "contract_init", + "loc": contract Test with T { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun foo() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-from-base-trait 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 7, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "contract", + "loc": contract Test { + override fun foo() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 7, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": { + "ast": { + "id": 10, + "kind": "contract_init", + "loc": contract Test { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-from-base-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-deep-inheritance 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 {}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 21, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 12, + "kind": "trait", + "loc": trait T3 with T2 {}, + "name": { + "id": 10, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 20, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 {}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 21, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 16, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 15, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 17, + "kind": "contract", + "loc": contract Test with T3 { + override fun foo() {} +}, + "name": { + "id": 13, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 14, + "kind": "id", + "loc": T3, + "text": "T3", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 16, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 15, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": { + "ast": { + "id": 19, + "kind": "contract_init", + "loc": contract Test with T3 { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 12, + "kind": "trait", + "loc": trait T3 with T2 {}, + "name": { + "id": 10, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 20, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 {}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 21, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 {}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 21, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T1 { fun foo() {} }, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 4, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T1", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-deep-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-deep-inheritance-in-middle 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 { fun foo() {} }, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 6, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 12, + "kind": "trait", + "loc": trait T3 with T2 {}, + "name": { + "id": 10, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 20, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 { fun foo() {} }, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 6, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 16, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 15, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 17, + "kind": "contract", + "loc": contract Test with T3 { + override fun foo() {} +}, + "name": { + "id": 13, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 14, + "kind": "id", + "loc": T3, + "text": "T3", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 16, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 15, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": { + "ast": { + "id": 19, + "kind": "contract_init", + "loc": contract Test with T3 { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 12, + "kind": "trait", + "loc": trait T3 with T2 {}, + "name": { + "id": 10, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 20, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 { fun foo() {} }, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 6, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 9, + "kind": "trait", + "loc": trait T2 with T1 { fun foo() {} }, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 6, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 8, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 7, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 3, + "kind": "id", + "loc": T1, + "text": "T1", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T1", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 58377, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-deep-inheritance-in-middle 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-diamond-inheritance 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 10, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 9, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 11, + "kind": "trait", + "loc": trait T2 with T { + fun baz() {} +}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 10, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 9, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + "bar" => { + "ast": { + "attributes": [], + "id": 26, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 15, + "kind": "function_def", + "loc": fun ban() {}, + "name": { + "id": 14, + "kind": "id", + "loc": ban, + "text": "ban", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 16, + "kind": "trait", + "loc": trait T3 with T { + fun ban() {} +}, + "name": { + "id": 12, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 13, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "ban" => { + "ast": { + "attributes": [], + "id": 15, + "kind": "function_def", + "loc": fun ban() {}, + "name": { + "id": 14, + "kind": "id", + "loc": ban, + "text": "ban", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "ban", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + "bar" => { + "ast": { + "attributes": [], + "id": 27, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 21, + "kind": "function_def", + "loc": override fun bar() {}, + "name": { + "id": 20, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 22, + "kind": "trait", + "loc": trait Test with T2, T3 { + override fun bar() {} +}, + "name": { + "id": 17, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 18, + "kind": "id", + "loc": T2, + "text": "T2", + }, + { + "id": 19, + "kind": "id", + "loc": T3, + "text": "T3", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 21, + "kind": "function_def", + "loc": override fun bar() {}, + "name": { + "id": 20, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + "baz" => { + "ast": { + "attributes": [], + "id": 24, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 9, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + "ban" => { + "ast": { + "attributes": [], + "id": 25, + "kind": "function_def", + "loc": fun ban() {}, + "name": { + "id": 14, + "kind": "id", + "loc": ban, + "text": "ban", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "ban", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 10, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 9, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 11, + "kind": "trait", + "loc": trait T2 with T { + fun baz() {} +}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 10, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 9, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + "bar" => { + "ast": { + "attributes": [], + "id": 26, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 15, + "kind": "function_def", + "loc": fun ban() {}, + "name": { + "id": 14, + "kind": "id", + "loc": ban, + "text": "ban", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 16, + "kind": "trait", + "loc": trait T3 with T { + fun ban() {} +}, + "name": { + "id": 12, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 13, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "ban" => { + "ast": { + "attributes": [], + "id": 15, + "kind": "function_def", + "loc": fun ban() {}, + "name": { + "id": 14, + "kind": "id", + "loc": ban, + "text": "ban", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "ban", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + "bar" => { + "ast": { + "attributes": [], + "id": 27, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T3", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 6, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 5, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 4, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + ], + "uid": 50251, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-diamond-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-multi-inheritance 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T2 { + fun foo() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 13, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 12, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 14, + "kind": "trait", + "loc": trait Test with T, T2 { + override fun foo() {} +}, + "name": { + "id": 9, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 10, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 13, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 12, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 3, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T2 { + fun foo() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 6, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 2, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-multi-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-multi-inheritance-from-base-trait 1`] = ` +[ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 22, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + fun baz() {} +}, + "name": { + "id": 9, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 23, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 17, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 16, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 18, + "kind": "trait", + "loc": trait Test with T, T2 { + override fun foo() {} +}, + "name": { + "id": 13, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 14, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 15, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 17, + "kind": "function_def", + "loc": override fun foo() {}, + "name": { + "id": 16, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": true, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + "bar" => { + "ast": { + "attributes": [], + "id": 20, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + "baz" => { + "ast": { + "attributes": [], + "id": 21, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "Test", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 8, + "kind": "trait", + "loc": trait T { + fun bar() {} +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "bar" => { + "ast": { + "attributes": [], + "id": 7, + "kind": "function_def", + "loc": fun bar() {}, + "name": { + "id": 6, + "kind": "id", + "loc": bar, + "text": "bar", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "bar", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 22, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + fun baz() {} +}, + "name": { + "id": 9, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 10, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + "foo" => { + "ast": { + "attributes": [], + "id": 23, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "T2", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait { + fun foo() {} +}, + "name": { + "id": 1, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "foo" => { + "ast": { + "attributes": [], + "id": 3, + "kind": "function_def", + "loc": fun foo() {}, + "name": { + "id": 2, + "kind": "id", + "loc": foo, + "text": "foo", + }, + "params": [], + "return": null, + "statements": [], + }, + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "foo", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, + }, + ], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-trait-with-multi-inheritance-from-base-trait 2`] = `[]`; + exports[`resolveDescriptors should resolve descriptors for scope-loops 1`] = `[]`; exports[`resolveDescriptors should resolve descriptors for scope-loops 2`] = ` diff --git a/src/types/resolveDescriptors.ts b/src/types/resolveDescriptors.ts index 6f24e8037..e63624fca 100644 --- a/src/types/resolveDescriptors.ts +++ b/src/types/resolveDescriptors.ts @@ -1,23 +1,23 @@ import { + AstAsmFunctionDef, + AstConstantDecl, AstConstantDef, - AstFieldDecl, AstContractInit, + AstExpression, + AstFieldDecl, + AstFunctionDecl, + AstFunctionDef, + AstId, + AstMapType, AstNativeFunctionDecl, AstNode, AstType, - idText, - AstId, + AstTypeId, eqNames, - AstFunctionDef, + FactoryAst, + idText, isSelfId, isSlice, - AstFunctionDecl, - AstConstantDecl, - AstExpression, - AstMapType, - AstTypeId, - AstAsmFunctionDef, - FactoryAst, } from "../grammar/ast"; import { traverse } from "../grammar/iterators"; import { @@ -25,14 +25,14 @@ import { throwCompilationError, throwInternalCompilerError, } from "../errors"; -import { CompilerContext, Store, createContextStore } from "../context"; +import { CompilerContext, createContextStore, Store } from "../context"; import { ConstantDescription, FieldDescription, - FunctionParameter, FunctionDescription, - InitParameter, + FunctionParameter, InitDescription, + InitParameter, printTypeRef, ReceiverSelector, receiverSelectorName, @@ -46,9 +46,9 @@ import { crc16 } from "../utils/crc16"; import { isSubsetOf } from "../utils/isSubsetOf"; import { evalConstantExpression } from "../constEval"; import { - resolveABIType, intMapKeyFormats, intMapValFormats, + resolveABIType, } from "./resolveABITypeRef"; import { enabledExternals } from "../config/features"; import { isRuntimeType } from "./isRuntimeType"; @@ -1574,6 +1574,27 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { // function copyTraits(contractOrTrait: TypeDescription) { + const inheritOnlyBaseTrait = contractOrTrait.traits.length === 1; + + // Check that "override" functions have a super function + for (const funInContractOrTrait of contractOrTrait.functions.values()) { + if (!funInContractOrTrait.isOverride) { + continue; + } + + const foundOverriddenFunction = contractOrTrait.traits.some((t) => + t.functions.has(funInContractOrTrait.name), + ); + + if (!foundOverriddenFunction) { + const msg = inheritOnlyBaseTrait + ? `Function "${funInContractOrTrait.name}" overrides nothing, remove "override" modifier or inherit any traits with this function` + : `Function "${funInContractOrTrait.name}" overrides nothing, remove "override" modifier`; + + throwCompilationError(msg, funInContractOrTrait.ast.loc); + } + } + for (const inheritedTrait of contractOrTrait.traits) { // Copy functions for (const traitFunction of inheritedTrait.functions.values()) { diff --git a/src/types/stmts-failed/init-vars-analysis-used-uninit-storage-override-fun-call.tact b/src/types/stmts-failed/init-vars-analysis-used-uninit-storage-override-fun-call.tact index bb15ba90b..0c826fa1d 100644 --- a/src/types/stmts-failed/init-vars-analysis-used-uninit-storage-override-fun-call.tact +++ b/src/types/stmts-failed/init-vars-analysis-used-uninit-storage-override-fun-call.tact @@ -9,7 +9,7 @@ trait AbstractTrait { abstract fun execute(): Int; } -contract Contract { +contract Contract with AbstractTrait { value: Int; init(arg: Bool) { self.execute(); @@ -20,4 +20,4 @@ contract Contract { self.value = self.value + 1; return self.value; } -} \ No newline at end of file +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-contract-from-base-trait.tact b/src/types/test-failed/override-for-non-existing-function-in-contract-from-base-trait.tact new file mode 100644 index 000000000..c38be3121 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-contract-from-base-trait.tact @@ -0,0 +1,7 @@ +trait BaseTrait { + fun bar() {} +} + +contract Test { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-contract-with-inheritance.tact b/src/types/test-failed/override-for-non-existing-function-in-contract-with-inheritance.tact new file mode 100644 index 000000000..a7a2dd7ea --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-contract-with-inheritance.tact @@ -0,0 +1,6 @@ +trait BaseTrait {} +trait T {} + +contract Test with T { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-contract-with-multi-inheritance.tact b/src/types/test-failed/override-for-non-existing-function-in-contract-with-multi-inheritance.tact new file mode 100644 index 000000000..b2ff74a3e --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-contract-with-multi-inheritance.tact @@ -0,0 +1,12 @@ +trait BaseTrait {} +trait T { + fun bar() {} +} + +trait T2 { + fun baz() {} +} + +contract Test with T, T2 { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-contract-without-inheritance.tact b/src/types/test-failed/override-for-non-existing-function-in-contract-without-inheritance.tact new file mode 100644 index 000000000..35a2e2498 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-contract-without-inheritance.tact @@ -0,0 +1,5 @@ +trait BaseTrait {} + +contract Test { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-trait-from-base-trait-2.tact b/src/types/test-failed/override-for-non-existing-function-in-trait-from-base-trait-2.tact new file mode 100644 index 000000000..e56932df7 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-trait-from-base-trait-2.tact @@ -0,0 +1,7 @@ +trait BaseTrait { + fun bar() {} +} + +trait Test { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-trait-with-diamond-inheritance.tact b/src/types/test-failed/override-for-non-existing-function-in-trait-with-diamond-inheritance.tact new file mode 100644 index 000000000..afa661581 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-trait-with-diamond-inheritance.tact @@ -0,0 +1,17 @@ +trait BaseTrait {} + +trait T { + fun bar() {} +} + +trait T2 with T { + fun baz() {} +} + +trait T3 with T { + fun ban() {} +} + +trait Test with T2, T3 { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-trait-with-inheritance.tact b/src/types/test-failed/override-for-non-existing-function-in-trait-with-inheritance.tact new file mode 100644 index 000000000..86e363029 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-trait-with-inheritance.tact @@ -0,0 +1,6 @@ +trait BaseTrait {} +trait T {} + +trait Test with T { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-trait-with-multi-inheritance.tact b/src/types/test-failed/override-for-non-existing-function-in-trait-with-multi-inheritance.tact new file mode 100644 index 000000000..ee3412eb2 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-trait-with-multi-inheritance.tact @@ -0,0 +1,12 @@ +trait BaseTrait {} +trait T { + fun bar() {} +} + +trait T2 { + fun baz() {} +} + +trait Test with T, T2 { + override fun foo() {} +} diff --git a/src/types/test-failed/override-for-non-existing-function-in-trait-without-inheritance-2.tact b/src/types/test-failed/override-for-non-existing-function-in-trait-without-inheritance-2.tact new file mode 100644 index 000000000..f266b6094 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-function-in-trait-without-inheritance-2.tact @@ -0,0 +1,5 @@ +trait BaseTrait {} + +trait Test { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-contract-from-base-trait.tact b/src/types/test/override-for-existing-function-in-contract-from-base-trait.tact new file mode 100644 index 000000000..5850b0948 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-contract-from-base-trait.tact @@ -0,0 +1,7 @@ +trait BaseTrait { + fun foo() {} +} + +trait Test { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-contract-with-multi-inheritance-from-base-trait.tact b/src/types/test/override-for-existing-function-in-contract-with-multi-inheritance-from-base-trait.tact new file mode 100644 index 000000000..268c1cb0c --- /dev/null +++ b/src/types/test/override-for-existing-function-in-contract-with-multi-inheritance-from-base-trait.tact @@ -0,0 +1,14 @@ +trait BaseTrait { + fun foo() {} +} +trait T { + fun bar() {} +} + +trait T2 { + fun baz() {} +} + +contract Test with T, T2 { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-contract-with-multi-inheritance.tact b/src/types/test/override-for-existing-function-in-contract-with-multi-inheritance.tact new file mode 100644 index 000000000..f5445f61a --- /dev/null +++ b/src/types/test/override-for-existing-function-in-contract-with-multi-inheritance.tact @@ -0,0 +1,10 @@ +trait BaseTrait {} +trait T {} + +trait T2 { + fun foo() {} +} + +contract Test with T, T2 { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-contract.tact b/src/types/test/override-for-existing-function-in-contract.tact new file mode 100644 index 000000000..6ac703839 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-contract.tact @@ -0,0 +1,8 @@ +trait BaseTrait {} +trait T { + fun foo() {} +} + +trait Test with T { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait-from-base-trait.tact b/src/types/test/override-for-existing-function-in-trait-from-base-trait.tact new file mode 100644 index 000000000..a07d554f8 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait-from-base-trait.tact @@ -0,0 +1,7 @@ +trait BaseTrait { + fun foo() {} +} + +contract Test { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait-with-deep-inheritance-in-middle.tact b/src/types/test/override-for-existing-function-in-trait-with-deep-inheritance-in-middle.tact new file mode 100644 index 000000000..32dc313f4 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait-with-deep-inheritance-in-middle.tact @@ -0,0 +1,11 @@ +trait BaseTrait {} + +trait T1 {} + +trait T2 with T1 { fun foo() {} } + +trait T3 with T2 {} + +contract Test with T3 { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait-with-deep-inheritance.tact b/src/types/test/override-for-existing-function-in-trait-with-deep-inheritance.tact new file mode 100644 index 000000000..7e0c97ea5 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait-with-deep-inheritance.tact @@ -0,0 +1,11 @@ +trait BaseTrait {} + +trait T1 { fun foo() {} } + +trait T2 with T1 {} + +trait T3 with T2 {} + +contract Test with T3 { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait-with-diamond-inheritance.tact b/src/types/test/override-for-existing-function-in-trait-with-diamond-inheritance.tact new file mode 100644 index 000000000..ddddb96ff --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait-with-diamond-inheritance.tact @@ -0,0 +1,17 @@ +trait BaseTrait {} + +trait T { + fun bar() {} +} + +trait T2 with T { + fun baz() {} +} + +trait T3 with T { + fun ban() {} +} + +trait Test with T2, T3 { + override fun bar() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait-with-multi-inheritance-from-base-trait.tact b/src/types/test/override-for-existing-function-in-trait-with-multi-inheritance-from-base-trait.tact new file mode 100644 index 000000000..41091c08a --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait-with-multi-inheritance-from-base-trait.tact @@ -0,0 +1,14 @@ +trait BaseTrait { + fun foo() {} +} +trait T { + fun bar() {} +} + +trait T2 { + fun baz() {} +} + +trait Test with T, T2 { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait-with-multi-inheritance.tact b/src/types/test/override-for-existing-function-in-trait-with-multi-inheritance.tact new file mode 100644 index 000000000..37ad7a6f7 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait-with-multi-inheritance.tact @@ -0,0 +1,10 @@ +trait BaseTrait {} +trait T {} + +trait T2 { + fun foo() {} +} + +trait Test with T, T2 { + override fun foo() {} +} diff --git a/src/types/test/override-for-existing-function-in-trait.tact b/src/types/test/override-for-existing-function-in-trait.tact new file mode 100644 index 000000000..8ecc75988 --- /dev/null +++ b/src/types/test/override-for-existing-function-in-trait.tact @@ -0,0 +1,8 @@ +trait BaseTrait {} +trait T { + fun foo() {} +} + +contract Test with T { + override fun foo() {} +}