diff --git a/dev-docs/CHANGELOG.md b/dev-docs/CHANGELOG.md index 4e5d26ef9..fef05a460 100644 --- a/dev-docs/CHANGELOG.md +++ b/dev-docs/CHANGELOG.md @@ -80,6 +80,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Runtime `sha256` now work for arbitrary strings with length >= 128: PR [#1626](https://github.com/tact-lang/tact/pull/1626) - Generated code in TypeScript wrappers for contract with `init(init: Init)`: PR [#1709](https://github.com/tact-lang/tact/pull/1709) - Error message for comment (text) receivers with 124 bytes or more: PR [#1711](https://github.com/tact-lang/tact/pull/1711) +- Support overriding constants and methods of BaseTrait: PR [#1591](https://github.com/tact-lang/tact/pull/1591) +- Forbid traits inherit implicitly from BaseTrait: PR [#1591](https://github.com/tact-lang/tact/pull/1591) +- Forbid the `override` modifier for constants without the corresponding super-constant: PR [#1591](https://github.com/tact-lang/tact/pull/1591) ### Docs diff --git a/docs/src/content/docs/ref/core-base.mdx b/docs/src/content/docs/ref/core-base.mdx index 8ccfbfe2e..e23150d18 100644 --- a/docs/src/content/docs/ref/core-base.mdx +++ b/docs/src/content/docs/ref/core-base.mdx @@ -6,7 +6,13 @@ prev: label: "OTP-006: Contract Package" --- -Every [contract](/book/contracts) and [trait](/book/types#traits) in Tact implicitly [inherits](/book/contracts#traits) the `BaseTrait{:tact}` trait, which contains a number of the most useful [internal functions](/book/contracts#internal-functions) for any kind of contract, and a constant `self.storageReserve{:tact}` aimed at advanced users of Tact. +Every [contract](/book/contracts) in Tact implicitly [inherits](/book/contracts#traits) the `BaseTrait{:tact}` trait, which contains a number of the most useful [internal functions](/book/contracts#internal-functions) for any kind of contract, and a constant `self.storageReserve{:tact}` aimed at advanced users of Tact. + +:::tip + + Prior to 1.6.0, `BaseTrait{:tact}` was also implicitly inherited by traits, but now you must explicitly specify `with BaseTrait{:tact}` for your traits to use it. + +::: ## Constants diff --git a/src/stdlib/stdlib.ts b/src/stdlib/stdlib.ts index 4883a8522..b829c24b3 100644 --- a/src/stdlib/stdlib.ts +++ b/src/stdlib/stdlib.ts @@ -10,10 +10,11 @@ files["libs/content.tact"] = "fQ=="; files["libs/deploy.tact"] = "Cm1lc3NhZ2UgRGVwbG95IHsKICAgIHF1ZXJ5SWQ6IEludCBhcyB1aW50NjQ7Cn0KCm1lc3NhZ2UgRGVwbG95T2sgewogICAgcXVlcnlJZDogSW50IGFzIHVpbnQ2NDsK" + - "fQoKdHJhaXQgRGVwbG95YWJsZSB7CiAgICByZWNlaXZlKGRlcGxveTogRGVwbG95KSB7CiAgICAgICAgc2VsZi5ub3RpZnkoRGVwbG95T2t7cXVlcnlJZDogZGVwbG95" + - "LnF1ZXJ5SWR9LnRvQ2VsbCgpKTsKICAgIH0KfQoKbWVzc2FnZSBGYWN0b3J5RGVwbG95IHsKICAgIHF1ZXJ5SWQ6IEludCBhcyB1aW50NjQ7CiAgICBjYXNoYmFjazog" + - "QWRkcmVzczsKfQoKdHJhaXQgRmFjdG9yeURlcGxveWFibGUgIHsKICAgIHJlY2VpdmUoZGVwbG95OiBGYWN0b3J5RGVwbG95KSB7CiAgICAgICAgc2VsZi5mb3J3YXJk" + - "KGRlcGxveS5jYXNoYmFjaywgRGVwbG95T2t7cXVlcnlJZDogZGVwbG95LnF1ZXJ5SWR9LnRvQ2VsbCgpLCBmYWxzZSwgbnVsbCk7CiAgICB9Cn0="; + "fQoKdHJhaXQgRGVwbG95YWJsZSB3aXRoIEJhc2VUcmFpdCB7CiAgICByZWNlaXZlKGRlcGxveTogRGVwbG95KSB7CiAgICAgICAgc2VsZi5ub3RpZnkoRGVwbG95T2t7" + + "cXVlcnlJZDogZGVwbG95LnF1ZXJ5SWR9LnRvQ2VsbCgpKTsKICAgIH0KfQoKbWVzc2FnZSBGYWN0b3J5RGVwbG95IHsKICAgIHF1ZXJ5SWQ6IEludCBhcyB1aW50NjQ7" + + "CiAgICBjYXNoYmFjazogQWRkcmVzczsKfQoKdHJhaXQgRmFjdG9yeURlcGxveWFibGUgd2l0aCBCYXNlVHJhaXQgIHsKICAgIHJlY2VpdmUoZGVwbG95OiBGYWN0b3J5" + + "RGVwbG95KSB7CiAgICAgICAgc2VsZi5mb3J3YXJkKGRlcGxveS5jYXNoYmFjaywgRGVwbG95T2t7cXVlcnlJZDogZGVwbG95LnF1ZXJ5SWR9LnRvQ2VsbCgpLCBmYWxz" + + "ZSwgbnVsbCk7CiAgICB9Cn0K"; files["libs/dns.fc"] = "c2xpY2UgZG5zX3N0cmluZ190b19pbnRlcm5hbChzbGljZSBkb21haW4pIGlubGluZV9yZWYgewoKICAgIDs7IFNwZWNpYWwgY2FzZSBmb3Igcm9vdCBkb21haW4KICAg" + "IGlmICgoZG9tYWluLnNsaWNlX2JpdHMoKSA9PSA4KSAmIChkb21haW4uc2xpY2VfcmVmcygpID09IDApKSB7CiAgICAgICAgaWYgKGRvbWFpbi5wcmVsb2FkX3VpbnQo" + @@ -89,13 +90,13 @@ files["libs/dns.tact"] = files["libs/ownable.tact"] = "bWVzc2FnZSBDaGFuZ2VPd25lciB7CiAgICBxdWVyeUlkOiBJbnQgYXMgdWludDY0OwogICAgbmV3T3duZXI6IEFkZHJlc3M7Cn0KCm1lc3NhZ2UgQ2hhbmdlT3duZXJP" + "ayB7CiAgICBxdWVyeUlkOiBJbnQgYXMgdWludDY0OwogICAgbmV3T3duZXI6IEFkZHJlc3M7Cn0KCkBpbnRlcmZhY2UoIm9yZy50b24ub3duYWJsZSIpCnRyYWl0IE93" + - "bmFibGUgewogICAgb3duZXI6IEFkZHJlc3M7CgogICAgZnVuIHJlcXVpcmVPd25lcigpIHsKICAgICAgICBuYXRpdmVUaHJvd1VubGVzcygxMzIsIHNlbmRlcigpID09" + - "IHNlbGYub3duZXIpOwogICAgfQoKICAgIGdldCBmdW4gb3duZXIoKTogQWRkcmVzcyB7CiAgICAgICAgcmV0dXJuIHNlbGYub3duZXI7CiAgICB9Cn0KCkBpbnRlcmZh" + - "Y2UoIm9yZy50b24ub3duYWJsZS50cmFuc2ZlcmFibGUudjIiKQp0cmFpdCBPd25hYmxlVHJhbnNmZXJhYmxlIHdpdGggT3duYWJsZSB7CgogICAgb3duZXI6IEFkZHJl" + - "c3M7CgogICAgcmVjZWl2ZShtc2c6IENoYW5nZU93bmVyKSB7CiAgICAgICAgCiAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIHNlbmRlciBpcyB0aGUgb3duZXIKICAgICAg" + - "ICBzZWxmLnJlcXVpcmVPd25lcigpOwoKICAgICAgICAvLyBVcGRhdGUgb3duZXIKICAgICAgICBzZWxmLm93bmVyID0gbXNnLm5ld093bmVyOwoKICAgICAgICAvLyBS" + - "ZXBseSByZXN1bHQKICAgICAgICBzZWxmLnJlcGx5KENoYW5nZU93bmVyT2t7IHF1ZXJ5SWQ6IG1zZy5xdWVyeUlkLCBuZXdPd25lcjptc2cubmV3T3duZXIgfS50b0Nl" + - "bGwoKSk7CiAgICB9Cn0="; + "bmFibGUgd2l0aCBCYXNlVHJhaXQgewogICAgb3duZXI6IEFkZHJlc3M7CgogICAgZnVuIHJlcXVpcmVPd25lcigpIHsKICAgICAgICBuYXRpdmVUaHJvd1VubGVzcygx" + + "MzIsIHNlbmRlcigpID09IHNlbGYub3duZXIpOwogICAgfQoKICAgIGdldCBmdW4gb3duZXIoKTogQWRkcmVzcyB7CiAgICAgICAgcmV0dXJuIHNlbGYub3duZXI7CiAg" + + "ICB9Cn0KCkBpbnRlcmZhY2UoIm9yZy50b24ub3duYWJsZS50cmFuc2ZlcmFibGUudjIiKQp0cmFpdCBPd25hYmxlVHJhbnNmZXJhYmxlIHdpdGggT3duYWJsZSB7Cgog" + + "ICAgb3duZXI6IEFkZHJlc3M7CgogICAgcmVjZWl2ZShtc2c6IENoYW5nZU93bmVyKSB7CiAgICAgICAgCiAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIHNlbmRlciBpcyB0" + + "aGUgb3duZXIKICAgICAgICBzZWxmLnJlcXVpcmVPd25lcigpOwoKICAgICAgICAvLyBVcGRhdGUgb3duZXIKICAgICAgICBzZWxmLm93bmVyID0gbXNnLm5ld093bmVy" + + "OwoKICAgICAgICAvLyBSZXBseSByZXN1bHQKICAgICAgICBzZWxmLnJlcGx5KENoYW5nZU93bmVyT2t7IHF1ZXJ5SWQ6IG1zZy5xdWVyeUlkLCBuZXdPd25lcjptc2cu" + + "bmV3T3duZXIgfS50b0NlbGwoKSk7CiAgICB9Cn0K"; files["libs/stoppable.tact"] = "aW1wb3J0ICIuL293bmFibGUiOwoKQGludGVyZmFjZSgib3JnLnRvbi5zdG9wcGFibGUiKQp0cmFpdCBTdG9wcGFibGUgd2l0aCBPd25hYmxlIHsKICAgIAogICAgc3Rv" + "cHBlZDogQm9vbDsKICAgIG93bmVyOiBBZGRyZXNzOwoKICAgIGZ1biByZXF1aXJlTm90U3RvcHBlZCgpIHsKICAgICAgICByZXF1aXJlKCFzZWxmLnN0b3BwZWQsICJD" + diff --git a/src/stdlib/stdlib/libs/deploy.tact b/src/stdlib/stdlib/libs/deploy.tact index ff27a53a0..d54d1970e 100644 --- a/src/stdlib/stdlib/libs/deploy.tact +++ b/src/stdlib/stdlib/libs/deploy.tact @@ -7,7 +7,7 @@ message DeployOk { queryId: Int as uint64; } -trait Deployable { +trait Deployable with BaseTrait { receive(deploy: Deploy) { self.notify(DeployOk{queryId: deploy.queryId}.toCell()); } @@ -18,8 +18,8 @@ message FactoryDeploy { cashback: Address; } -trait FactoryDeployable { +trait FactoryDeployable with BaseTrait { receive(deploy: FactoryDeploy) { self.forward(deploy.cashback, DeployOk{queryId: deploy.queryId}.toCell(), false, null); } -} \ No newline at end of file +} diff --git a/src/stdlib/stdlib/libs/ownable.tact b/src/stdlib/stdlib/libs/ownable.tact index 907c9ed95..429e36dba 100644 --- a/src/stdlib/stdlib/libs/ownable.tact +++ b/src/stdlib/stdlib/libs/ownable.tact @@ -9,7 +9,7 @@ message ChangeOwnerOk { } @interface("org.ton.ownable") -trait Ownable { +trait Ownable with BaseTrait { owner: Address; fun requireOwner() { @@ -37,4 +37,4 @@ trait OwnableTransferable with Ownable { // Reply result self.reply(ChangeOwnerOk{ queryId: msg.queryId, newOwner:msg.newOwner }.toCell()); } -} \ No newline at end of file +} diff --git a/src/test/e2e-emulated/base-trait-constant-override-1.spec.ts b/src/test/e2e-emulated/base-trait-constant-override-1.spec.ts new file mode 100644 index 000000000..da54f801d --- /dev/null +++ b/src/test/e2e-emulated/base-trait-constant-override-1.spec.ts @@ -0,0 +1,36 @@ +import { toNano } from "@ton/core"; +import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; +import { TraitsConstantContract } from "./contracts/output/base-trait-constant-override-1_TraitsConstantContract"; +import "@ton/test-utils"; + +describe("base-trait-constant-override-1", () => { + let blockchain: Blockchain; + let treasure: SandboxContract; + let contract: SandboxContract; + + beforeEach(async () => { + blockchain = await Blockchain.create(); + treasure = await blockchain.treasury("treasure"); + + contract = blockchain.openContract( + await TraitsConstantContract.fromInit(), + ); + + const deployResult = await contract.send( + treasure.getSender(), + { value: toNano("0.5") }, + null, + ); + + expect(deployResult.transactions).toHaveTransaction({ + from: treasure.address, + to: contract.address, + success: true, + deploy: true, + }); + }); + + it("should override constant correctly", async () => { + expect(await contract.getConstant()).toEqual(100n); + }); +}); diff --git a/src/test/e2e-emulated/base-trait-constant-override-2.spec.ts b/src/test/e2e-emulated/base-trait-constant-override-2.spec.ts new file mode 100644 index 000000000..fa11ea724 --- /dev/null +++ b/src/test/e2e-emulated/base-trait-constant-override-2.spec.ts @@ -0,0 +1,36 @@ +import { toNano } from "@ton/core"; +import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; +import { TraitsConstantContract } from "./contracts/output/base-trait-constant-override-2_TraitsConstantContract"; +import "@ton/test-utils"; + +describe("base-trait-constant-override-2", () => { + let blockchain: Blockchain; + let treasure: SandboxContract; + let contract: SandboxContract; + + beforeEach(async () => { + blockchain = await Blockchain.create(); + treasure = await blockchain.treasury("treasure"); + + contract = blockchain.openContract( + await TraitsConstantContract.fromInit(), + ); + + const deployResult = await contract.send( + treasure.getSender(), + { value: toNano("0.5") }, + null, + ); + + expect(deployResult.transactions).toHaveTransaction({ + from: treasure.address, + to: contract.address, + success: true, + deploy: true, + }); + }); + + it("should override constant correctly", async () => { + expect(await contract.getConstant()).toEqual(10000n); + }); +}); diff --git a/src/test/e2e-emulated/base-trait-function-override.spec.ts b/src/test/e2e-emulated/base-trait-function-override.spec.ts new file mode 100644 index 000000000..2a4613b95 --- /dev/null +++ b/src/test/e2e-emulated/base-trait-function-override.spec.ts @@ -0,0 +1,36 @@ +import { toNano } from "@ton/core"; +import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; +import { BaseTraitsFunctionContract } from "./contracts/output/base-trait-function-override_BaseTraitsFunctionContract"; +import "@ton/test-utils"; + +describe("base-trait-function-override", () => { + let blockchain: Blockchain; + let treasure: SandboxContract; + let contract: SandboxContract; + + beforeEach(async () => { + blockchain = await Blockchain.create(); + treasure = await blockchain.treasury("treasure"); + + contract = blockchain.openContract( + await BaseTraitsFunctionContract.fromInit(), + ); + + const deployResult = await contract.send( + treasure.getSender(), + { value: toNano("10") }, + null, + ); + + expect(deployResult.transactions).toHaveTransaction({ + from: treasure.address, + to: contract.address, + success: true, + deploy: true, + }); + }); + + it("should override function correctly", async () => { + expect(await contract.getValue()).toEqual(1000n); + }); +}); diff --git a/src/test/e2e-emulated/contracts/base-trait-constant-override-1.tact b/src/test/e2e-emulated/contracts/base-trait-constant-override-1.tact new file mode 100644 index 000000000..76a967093 --- /dev/null +++ b/src/test/e2e-emulated/contracts/base-trait-constant-override-1.tact @@ -0,0 +1,13 @@ +trait OverrideBaseTraitConstant with BaseTrait { + override const storageReserve: Int = 100; +} + +contract TraitsConstantContract with OverrideBaseTraitConstant { + receive() { + // deploy + } + + get fun constant(): Int { + return self.storageReserve; + } +} diff --git a/src/test/e2e-emulated/contracts/base-trait-constant-override-2.tact b/src/test/e2e-emulated/contracts/base-trait-constant-override-2.tact new file mode 100644 index 000000000..3395fb501 --- /dev/null +++ b/src/test/e2e-emulated/contracts/base-trait-constant-override-2.tact @@ -0,0 +1,17 @@ +trait OverrideBaseTraitConstantWithVirtual with BaseTrait { + override virtual const storageReserve: Int = 100; +} + +trait OverrideOverridden with OverrideBaseTraitConstantWithVirtual { + override const storageReserve: Int = 10000; +} + +contract TraitsConstantContract with OverrideOverridden { + receive() { + // deploy + } + + get fun constant(): Int { + return self.storageReserve; + } +} diff --git a/src/test/e2e-emulated/contracts/base-trait-function-override.tact b/src/test/e2e-emulated/contracts/base-trait-function-override.tact new file mode 100644 index 000000000..1f39f9c35 --- /dev/null +++ b/src/test/e2e-emulated/contracts/base-trait-function-override.tact @@ -0,0 +1,20 @@ +trait OverrideBaseTraitFunction with BaseTrait { + value: Int; + + override fun notify(body: Cell?) { + self.value = 1000; + } +} + +contract BaseTraitsFunctionContract with OverrideBaseTraitFunction { + value: Int = 0; + + receive() { + // deploy + } + + get fun value(): Int { + self.notify(null); + return self.value; + } +} diff --git a/src/test/e2e-emulated/contracts/traits.tact b/src/test/e2e-emulated/contracts/traits.tact index f13df02b2..d7851fd8a 100644 --- a/src/test/e2e-emulated/contracts/traits.tact +++ b/src/test/e2e-emulated/contracts/traits.tact @@ -1,4 +1,4 @@ -trait Animal { +trait Animal with BaseTrait { abstract fun getType(): String; abstract fun getSound(): String; @@ -33,7 +33,16 @@ trait Laika with Dog { } } -contract LaikaContract with Laika { - // empty contract, we just inherit everything from the traits +trait WithConstant { + virtual const foo: Int = 10; } +trait IWantToOverrideConstant with WithConstant { + override const foo: Int = 100; +} + +contract LaikaContract with Laika, IWantToOverrideConstant { + get fun fooConstant(): Int { + return self.foo; + } +} diff --git a/src/test/e2e-emulated/traits.spec.ts b/src/test/e2e-emulated/traits.spec.ts index 5b43f1d2b..5a2eb4ddd 100644 --- a/src/test/e2e-emulated/traits.spec.ts +++ b/src/test/e2e-emulated/traits.spec.ts @@ -33,4 +33,9 @@ describe("traits", () => { // Check the contract's behavior after deployment expect(await contract.getSay()).toBe("I am a Laika and I say Woof"); }); + + it("should override constant correctly", async () => { + // Check the contract's behavior after deployment + expect(await contract.getFooConstant()).toBe(100n); + }); }); diff --git a/src/types/__snapshots__/resolveDescriptors.spec.ts.snap b/src/types/__snapshots__/resolveDescriptors.spec.ts.snap index 047d27008..133d6e95a 100644 --- a/src/types/__snapshots__/resolveDescriptors.spec.ts.snap +++ b/src/types/__snapshots__/resolveDescriptors.spec.ts.snap @@ -495,6 +495,60 @@ exports[`resolveDescriptors should fail descriptors for native-fun-getter 1`] = " `; +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-constant-in-contract-from-base-trait 1`] = ` +":8:5: Constant "BAR" overrides nothing, remove "override" modifier or inherit any traits with this constant + 7 | contract Test { +> 8 | override const BAR: Int = 10; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 9 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-constant-in-contract-with-multi-inheritance 1`] = ` +":13:5: Constant "FOO" overrides nothing, remove "override" modifier + 12 | contract Test with T, T2 { +> 13 | override const FOO: Int = 10; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 14 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-constant-in-contract-without-inheritance 1`] = ` +":6:5: Constant "FOO" overrides nothing, remove "override" modifier or inherit any traits with this constant + 5 | contract Test { +> 6 | override const FOO: Int = 100; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-constant-in-trait-from-base-trait 1`] = ` +":8:5: Constant "BAR" overrides nothing, remove "override" modifier or inherit any traits with this constant + 7 | trait Test { +> 8 | override const BAR: Int = 10; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 9 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-constant-in-trait-with-multi-inheritance 1`] = ` +":13:5: Constant "FOO" overrides nothing, remove "override" modifier + 12 | trait Test with T, T2 { +> 13 | override const FOO: Int = 10; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 14 | } +" +`; + +exports[`resolveDescriptors should fail descriptors for override-for-non-existing-constant-in-trait-without-inheritance 1`] = ` +":6:5: Constant "FOO" overrides nothing, remove "override" modifier or inherit any traits with this constant + 5 | trait Test { +> 6 | override const FOO: Int = 100; + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7 | } +" +`; + 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 5 | contract Test { @@ -550,7 +604,7 @@ exports[`resolveDescriptors should fail descriptors for override-for-non-existin `; 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 +":5:5: Function "foo" overrides nothing, remove "override" modifier or inherit any traits with this function 4 | trait Test with T { > 5 | override fun foo() {} ^~~~~~~~~~~~~~~~~~~~~ @@ -3501,40 +3555,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-const-overri "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -3786,40 +3807,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-const-overri "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -4002,40 +3990,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-const-overri "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -4307,40 +4262,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-const-overri "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -5501,40 +5423,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-getter-overr "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -5850,40 +5739,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-getter-overr "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -6102,40 +5958,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-getter-overr "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -6479,40 +6302,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-getter-overr "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -6688,40 +6478,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-with-as-type "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, { @@ -6979,40 +6736,7 @@ exports[`resolveDescriptors should resolve descriptors for contract-with-as-type "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, ], @@ -14005,17 +13729,46 @@ 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`] = ` +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract 1`] = ` [ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, { "ast": { "attributes": [], "declarations": [], - "id": 2, + "id": 4, "kind": "trait", "loc": trait BaseTrait {}, "name": { - "id": 1, + "id": 3, "kind": "id", "loc": BaseTrait, "text": "BaseTrait", @@ -14045,73 +13798,89 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "declarations": [ { "attributes": [], - "id": 5, - "kind": "function_def", - "loc": fun foo() {}, + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, "name": { - "id": 4, + "id": 6, "kind": "id", - "loc": foo, - "text": "foo", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", }, - "params": [], - "return": null, - "statements": [], }, ], - "id": 6, + "id": 10, "kind": "trait", "loc": trait T { - fun foo() {} + const BAR: Int = 10; }, "name": { - "id": 3, + "id": 5, "kind": "id", "loc": T, "text": "T", }, "traits": [], }, - "constants": [], - "dependsOn": [], - "fields": [], - "functions": Map { - "foo" => { + "constants": [ + { "ast": { "attributes": [], - "id": 5, - "kind": "function_def", - "loc": fun foo() {}, + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, "name": { - "id": 4, + "id": 6, "kind": "id", - "loc": foo, - "text": "foo", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", }, - "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": { + "loc": const BAR: Int = 10;, + "name": "BAR", + "type": { "kind": "ref", - "name": "T", + "name": "Int", "optional": false, }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, }, - }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, "header": null, "init": null, "interfaces": [], @@ -14122,40 +13891,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -14165,95 +13901,120 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing { "attributes": [ { - "kind": "function_attribute", "loc": override, "type": "override", }, ], - "id": 10, - "kind": "function_def", - "loc": override fun foo() {}, + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, "name": { - "id": 9, + "id": 13, "kind": "id", - "loc": foo, - "text": "foo", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", }, - "params": [], - "return": null, - "statements": [], }, ], - "id": 11, - "kind": "trait", - "loc": trait Test with T { - override fun foo() {} + "id": 17, + "kind": "contract", + "loc": contract Test with T { + override const BAR: Int = 100; }, "name": { - "id": 7, + "id": 11, "kind": "id", "loc": Test, "text": "Test", }, "traits": [ { - "id": 8, + "id": 12, "kind": "id", "loc": T, "text": "T", }, ], }, - "constants": [], - "dependsOn": [], - "fields": [], - "functions": Map { - "foo" => { + "constants": [ + { "ast": { "attributes": [ { - "kind": "function_attribute", "loc": override, "type": "override", }, ], - "id": 10, - "kind": "function_def", - "loc": override fun foo() {}, + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, "name": { - "id": 9, + "id": 13, "kind": "id", - "loc": foo, - "text": "foo", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", }, - "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": { + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { "kind": "ref", - "name": "Test", + "name": "Int", "optional": false, }, + "value": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, }, - }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, "header": null, - "init": null, + "init": { + "ast": { + "id": 19, + "kind": "contract_init", + "loc": contract Test with T { + override const BAR: Int = 100; +}, + "params": [], + "statements": [], + }, + "params": [], + }, "interfaces": [], - "kind": "trait", + "kind": "contract", "name": "Test", "origin": "user", "partialFieldCount": 0, @@ -14265,11 +14026,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "ast": { "attributes": [], "declarations": [], - "id": 2, + "id": 4, "kind": "trait", "loc": trait BaseTrait {}, "name": { - "id": 1, + "id": 3, "kind": "id", "loc": BaseTrait, "text": "BaseTrait", @@ -14299,73 +14060,89 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "declarations": [ { "attributes": [], - "id": 5, - "kind": "function_def", - "loc": fun foo() {}, + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, "name": { - "id": 4, + "id": 6, "kind": "id", - "loc": foo, - "text": "foo", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", }, - "params": [], - "return": null, - "statements": [], }, ], - "id": 6, + "id": 10, "kind": "trait", "loc": trait T { - fun foo() {} + const BAR: Int = 10; }, "name": { - "id": 3, + "id": 5, "kind": "id", "loc": T, "text": "T", }, "traits": [], }, - "constants": [], - "dependsOn": [], - "fields": [], - "functions": Map { - "foo" => { + "constants": [ + { "ast": { "attributes": [], - "id": 5, - "kind": "function_def", - "loc": fun foo() {}, + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, "name": { - "id": 4, + "id": 6, "kind": "id", - "loc": foo, - "text": "foo", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", }, - "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": { + "loc": const BAR: Int = 10;, + "name": "BAR", + "type": { "kind": "ref", - "name": "T", + "name": "Int", "optional": false, }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, }, - }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, "header": null, "init": null, "interfaces": [], @@ -14376,63 +14153,6606 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "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`] = ` -[ +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract-from-base-trait 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const BAR: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 15, + "kind": "contract", + "loc": contract Test with BaseTrait { + override const BAR: Int = 100; +}, + "name": { + "id": 9, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 10, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": { + "ast": { + "id": 17, + "kind": "contract_init", + "loc": contract Test with BaseTrait { + override const BAR: Int = 100; +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const BAR: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract-from-base-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract-with-multi-inheritance 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 3, + "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": 6, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 5, + "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": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + const BAR: Int = 100; +}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 20, + "kind": "contract", + "loc": contract Test with T, T2 { + override const BAR: Int = 100; +}, + "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": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": { + "ast": { + "id": 22, + "kind": "contract_init", + "loc": contract Test with T, T2 { + override const BAR: Int = 100; +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 3, + "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": 6, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 5, + "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": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + const BAR: Int = 100; +}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract-with-multi-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract-with-multi-inheritance-from-base-trait 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const FOO: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 13, + "initializer": { + "base": 10, + "id": 12, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 10, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 11, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 14, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 9, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 13, + "initializer": { + "base": 10, + "id": 12, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 10, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 11, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 12, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 20, + "kind": "trait", + "loc": trait T2 { + const BAZ: Int = 100; +}, + "name": { + "id": 15, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 27, + "initializer": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const FOO: Int = 100;, + "name": { + "id": 24, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 25, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 28, + "kind": "contract", + "loc": contract Test with T, T2 { + override const FOO: Int = 100; +}, + "name": { + "id": 21, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 22, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 23, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 27, + "initializer": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const FOO: Int = 100;, + "name": { + "id": 24, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 25, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 33, + "initializer": { + "base": 10, + "id": 32, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 10, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 31, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 32, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 36, + "initializer": { + "base": 10, + "id": 35, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 34, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 35, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": { + "ast": { + "id": 30, + "kind": "contract_init", + "loc": contract Test with T, T2 { + override const FOO: Int = 100; +}, + "params": [], + "statements": [], + }, + "params": [], + }, + "interfaces": [], + "kind": "contract", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const FOO: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 13, + "initializer": { + "base": 10, + "id": 12, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 10, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 11, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 14, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 9, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 13, + "initializer": { + "base": 10, + "id": 12, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 10, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 11, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 12, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 20, + "kind": "trait", + "loc": trait T2 { + const BAZ: Int = 100; +}, + "name": { + "id": 15, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-contract-with-multi-inheritance-from-base-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 3, + "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": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 10; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 10;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 17, + "kind": "trait", + "loc": trait Test with T { + override const BAR: Int = 100; +}, + "name": { + "id": 11, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 12, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 10; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 10;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 10;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 10, + "value": 10n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-from-base-trait 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const BAR: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 15, + "kind": "trait", + "loc": trait Test with BaseTrait { + override const BAR: Int = 100; +}, + "name": { + "id": 9, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 10, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const BAR: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-from-base-trait 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-deep-inheritance-in-middle 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 3, + "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": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 13, + "kind": "trait", + "loc": trait T2 with T1 { const BAR: Int = 100; }, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 16, + "kind": "trait", + "loc": trait T3 with T2 {}, + "name": { + "id": 14, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 15, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 27, + "initializer": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 25, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 13, + "kind": "trait", + "loc": trait T2 with T1 { const BAR: Int = 100; }, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 22, + "initializer": { + "base": 10, + "id": 21, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 19, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 20, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 23, + "kind": "trait", + "loc": trait Test with T3 { + override const BAR: Int = 100; +}, + "name": { + "id": 17, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 18, + "kind": "id", + "loc": T3, + "text": "T3", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 22, + "initializer": { + "base": 10, + "id": 21, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 19, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 20, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 21, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 16, + "kind": "trait", + "loc": trait T3 with T2 {}, + "name": { + "id": 14, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 15, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 27, + "initializer": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 25, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 26, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 13, + "kind": "trait", + "loc": trait T2 with T1 { const BAR: Int = 100; }, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 13, + "kind": "trait", + "loc": trait T2 with T1 { const BAR: Int = 100; }, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T1, + "text": "T1", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 12, + "initializer": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 9, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 10, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 11, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T1 {}, + "name": { + "id": 5, + "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": [], + "uid": 58377, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-deep-inheritance-in-middle 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-diamond-inheritance 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 3, + "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": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 17, + "kind": "trait", + "loc": trait T2 with T { + const BAZ: Int = 100; +}, + "name": { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 12, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 39, + "initializer": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 37, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 23, + "initializer": { + "base": 10, + "id": 22, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 20, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 21, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 24, + "kind": "trait", + "loc": trait T3 with T { + override const BAR: Int = 100; +}, + "name": { + "id": 18, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 19, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 23, + "initializer": { + "base": 10, + "id": 22, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 20, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 21, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 22, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + ], + "uid": 50251, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 31, + "initializer": { + "base": 10, + "id": 30, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 28, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 29, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 32, + "kind": "trait", + "loc": trait Test with T2, T3 { + override const BAR: Int = 100; +}, + "name": { + "id": 25, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 26, + "kind": "id", + "loc": T2, + "text": "T2", + }, + { + "id": 27, + "kind": "id", + "loc": T3, + "text": "T3", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 31, + "initializer": { + "base": 10, + "id": 30, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 28, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 29, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 30, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 36, + "initializer": { + "base": 10, + "id": 35, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 34, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 35, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 17, + "kind": "trait", + "loc": trait T2 with T { + const BAZ: Int = 100; +}, + "name": { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [ + { + "id": 12, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 16, + "initializer": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 13, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 14, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 15, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 39, + "initializer": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 37, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + ], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 23, + "initializer": { + "base": 10, + "id": 22, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 20, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 21, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 24, + "kind": "trait", + "loc": trait T3 with T { + override const BAR: Int = 100; +}, + "name": { + "id": 18, + "kind": "id", + "loc": T3, + "text": "T3", + }, + "traits": [ + { + "id": 19, + "kind": "id", + "loc": T, + "text": "T", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 23, + "initializer": { + "base": 10, + "id": 22, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 20, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 21, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 22, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T3", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 10, + "kind": "trait", + "loc": trait T { + const BAR: Int = 100; +}, + "name": { + "id": 5, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 9, + "initializer": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 6, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 7, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 8, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 6769, + }, + ], + "uid": 50251, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-diamond-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-multi-inheritance 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [], + "id": 4, + "kind": "trait", + "loc": trait BaseTrait {}, + "name": { + "id": 3, + "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": 6, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 5, + "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": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + const BAR: Int = 100; +}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 20, + "kind": "trait", + "loc": trait Test with T, T2 { + override const BAR: Int = 100; +}, + "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": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 19, + "initializer": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const BAR: Int = 100;, + "name": { + "id": 16, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 17, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 18, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [], + "id": 6, + "kind": "trait", + "loc": trait T {}, + "name": { + "id": 5, + "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": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 12, + "kind": "trait", + "loc": trait T2 { + const BAR: Int = 100; +}, + "name": { + "id": 7, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 11, + "initializer": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 8, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 9, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 10, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-multi-inheritance 2`] = `[]`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-multi-inheritance-from-base-trait 1`] = ` +[ + { + "ast": { + "id": 2, + "kind": "primitive_type_decl", + "loc": primitive Int;, + "name": { + "id": 1, + "kind": "id", + "loc": Int, + "text": "Int", + }, + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "primitive_type_decl", + "name": "Int", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 38154, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const FOO: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 15, + "kind": "trait", + "loc": trait T with BaseTrait { + const BAR: Int = 100; +}, + "name": { + "id": 9, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [ + { + "id": 10, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 39, + "initializer": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 37, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const FOO: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 20, + "initializer": { + "base": 10, + "id": 19, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 17, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 18, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 21, + "kind": "trait", + "loc": trait T2 { + const BAZ: Int = 100; +}, + "name": { + "id": 16, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 20, + "initializer": { + "base": 10, + "id": 19, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 17, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 18, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 19, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 28, + "initializer": { + "base": 10, + "id": 27, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const FOO: Int = 100;, + "name": { + "id": 25, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 26, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 29, + "kind": "trait", + "loc": trait Test with T, T2 { + override const FOO: Int = 100; +}, + "name": { + "id": 22, + "kind": "id", + "loc": Test, + "text": "Test", + }, + "traits": [ + { + "id": 23, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 24, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [ + { + "loc": override, + "type": "override", + }, + ], + "id": 28, + "initializer": { + "base": 10, + "id": 27, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": override const FOO: Int = 100;, + "name": { + "id": 25, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 26, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": override const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 27, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 33, + "initializer": { + "base": 10, + "id": 32, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 31, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 32, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 36, + "initializer": { + "base": 10, + "id": 35, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 17, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 34, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 35, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Test", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 15, + "kind": "trait", + "loc": trait T with BaseTrait { + const BAR: Int = 100; +}, + "name": { + "id": 9, + "kind": "id", + "loc": T, + "text": "T", + }, + "traits": [ + { + "id": 10, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + ], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 14, + "initializer": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAR: Int = 100;, + "name": { + "id": 11, + "kind": "id", + "loc": BAR, + "text": "BAR", + }, + "type": { + "id": 12, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAR: Int = 100;, + "name": "BAR", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 13, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + { + "ast": { + "attributes": [], + "id": 39, + "initializer": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 37, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 38, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": [ + { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const FOO: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 8, + "kind": "trait", + "loc": trait BaseTrait { + const FOO: Int = 100; +}, + "name": { + "id": 3, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 7, + "initializer": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const FOO: Int = 100;, + "name": { + "id": 4, + "kind": "id", + "loc": FOO, + "text": "FOO", + }, + "type": { + "id": 5, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const FOO: Int = 100;, + "name": "FOO", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 6, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "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": 20, + "initializer": { + "base": 10, + "id": 19, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 17, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 18, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + ], + "id": 21, + "kind": "trait", + "loc": trait T2 { + const BAZ: Int = 100; +}, + "name": { + "id": 16, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [ + { + "ast": { + "attributes": [], + "id": 20, + "initializer": { + "base": 10, + "id": 19, + "kind": "number", + "loc": 100, + "value": 100n, + }, + "kind": "constant_def", + "loc": const BAZ: Int = 100;, + "name": { + "id": 17, + "kind": "id", + "loc": BAZ, + "text": "BAZ", + }, + "type": { + "id": 18, + "kind": "type_id", + "loc": Int, + "text": "Int", + }, + }, + "loc": const BAZ: Int = 100;, + "name": "BAZ", + "type": { + "kind": "ref", + "name": "Int", + "optional": false, + }, + "value": { + "base": 10, + "id": 19, + "kind": "number", + "loc": 100, + "value": 100n, + }, + }, + ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 54378, + }, + ], + "uid": 44104, + }, +] +`; + +exports[`resolveDescriptors should resolve descriptors for override-for-existing-constant-in-trait-with-multi-inheritance-from-base-trait 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": 3, + "id": 5, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 4, "kind": "id", "loc": foo, "text": "foo", @@ -14442,16 +20762,16 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 4, + "id": 6, "kind": "trait", - "loc": trait BaseTrait { + "loc": trait T { fun foo() {} }, "name": { - "id": 1, + "id": 3, "kind": "id", - "loc": BaseTrait, - "text": "BaseTrait", + "loc": T, + "text": "T", }, "traits": [], }, @@ -14462,11 +20782,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 3, + "id": 5, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 4, "kind": "id", "loc": foo, "text": "foo", @@ -14490,7 +20810,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "BaseTrait", + "name": "T", "optional": false, }, }, @@ -14499,14 +20819,14 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "BaseTrait", + "name": "T", "origin": "user", "partialFieldCount": 0, "receivers": [], "signature": null, "tlb": null, "traits": [], - "uid": 1020, + "uid": 6769, }, { "ast": { @@ -14520,11 +20840,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "type": "override", }, ], - "id": 7, + "id": 10, "kind": "function_def", "loc": override fun foo() {}, "name": { - "id": 6, + "id": 9, "kind": "id", "loc": foo, "text": "foo", @@ -14534,18 +20854,25 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 8, + "id": 11, "kind": "trait", - "loc": trait Test { + "loc": trait Test with T { override fun foo() {} }, "name": { - "id": 5, + "id": 7, "kind": "id", "loc": Test, "text": "Test", }, - "traits": [], + "traits": [ + { + "id": 8, + "kind": "id", + "loc": T, + "text": "T", + }, + ], }, "constants": [], "dependsOn": [], @@ -14560,11 +20887,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "type": "override", }, ], - "id": 7, + "id": 10, "kind": "function_def", "loc": override fun foo() {}, "name": { - "id": 6, + "id": 9, "kind": "id", "loc": foo, "text": "foo", @@ -14610,11 +20937,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "declarations": [ { "attributes": [], - "id": 3, + "id": 5, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 4, "kind": "id", "loc": foo, "text": "foo", @@ -14624,16 +20951,16 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 4, + "id": 6, "kind": "trait", - "loc": trait BaseTrait { + "loc": trait T { fun foo() {} }, "name": { - "id": 1, + "id": 3, "kind": "id", - "loc": BaseTrait, - "text": "BaseTrait", + "loc": T, + "text": "T", }, "traits": [], }, @@ -14644,11 +20971,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 3, + "id": 5, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 4, "kind": "id", "loc": foo, "text": "foo", @@ -14672,7 +20999,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "BaseTrait", + "name": "T", "optional": false, }, }, @@ -14681,14 +21008,14 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "BaseTrait", + "name": "T", "origin": "user", "partialFieldCount": 0, "receivers": [], "signature": null, "tlb": null, "traits": [], - "uid": 1020, + "uid": 6769, }, ], "uid": 44104, @@ -14696,118 +21023,21 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing ] `; -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 2`] = `[]`; -exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-with-multi-inheritance 1`] = ` +exports[`resolveDescriptors should resolve descriptors for override-for-existing-function-in-contract-from-base-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": [], - "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, + "id": 3, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 6, + "id": 2, "kind": "id", "loc": foo, "text": "foo", @@ -14817,16 +21047,16 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 8, + "id": 4, "kind": "trait", - "loc": trait T2 { + "loc": trait BaseTrait { fun foo() {} }, "name": { - "id": 5, + "id": 1, "kind": "id", - "loc": T2, - "text": "T2", + "loc": BaseTrait, + "text": "BaseTrait", }, "traits": [], }, @@ -14837,11 +21067,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 7, + "id": 3, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 6, + "id": 2, "kind": "id", "loc": foo, "text": "foo", @@ -14858,63 +21088,30 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, }, - ], - "uid": 54378, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, }, { "ast": { @@ -14928,11 +21125,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "type": "override", }, ], - "id": 13, + "id": 8, "kind": "function_def", "loc": override fun foo() {}, "name": { - "id": 12, + "id": 7, "kind": "id", "loc": foo, "text": "foo", @@ -14942,29 +21139,23 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 14, - "kind": "contract", - "loc": contract Test with T, T2 { + "id": 9, + "kind": "trait", + "loc": trait Test with BaseTrait { override fun foo() {} }, "name": { - "id": 9, + "id": 5, "kind": "id", "loc": Test, "text": "Test", }, "traits": [ { - "id": 10, - "kind": "id", - "loc": T, - "text": "T", - }, - { - "id": 11, + "id": 6, "kind": "id", - "loc": T2, - "text": "T2", + "loc": BaseTrait, + "text": "BaseTrait", }, ], }, @@ -14981,11 +21172,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "type": "override", }, ], - "id": 13, + "id": 8, "kind": "function_def", "loc": override fun foo() {}, "name": { - "id": 12, + "id": 7, "kind": "id", "loc": foo, "text": "foo", @@ -15015,20 +21206,9 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, }, "header": null, - "init": { - "ast": { - "id": 16, - "kind": "contract_init", - "loc": contract Test with T, T2 { - override fun foo() {} -}, - "params": [], - "statements": [], - }, - "params": [], - }, + "init": null, "interfaces": [], - "kind": "contract", + "kind": "trait", "name": "Test", "origin": "user", "partialFieldCount": 0, @@ -15036,114 +21216,17 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "id": 3, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 6, + "id": 2, "kind": "id", "loc": foo, "text": "foo", @@ -15153,16 +21236,16 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 8, + "id": 4, "kind": "trait", - "loc": trait T2 { + "loc": trait BaseTrait { fun foo() {} }, "name": { - "id": 5, + "id": 1, "kind": "id", - "loc": T2, - "text": "T2", + "loc": BaseTrait, + "text": "BaseTrait", }, "traits": [], }, @@ -15173,11 +21256,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 7, + "id": 3, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 6, + "id": 2, "kind": "id", "loc": foo, "text": "foo", @@ -15201,7 +21284,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "BaseTrait", "optional": false, }, }, @@ -15210,69 +21293,100 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "T2", + "name": "BaseTrait", "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, + "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", }, - ], - "uid": 44104, + "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": [], + "uid": 6769, }, -] -`; - -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, + "id": 7, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 6, "kind": "id", "loc": foo, "text": "foo", @@ -15282,16 +21396,16 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 4, + "id": 8, "kind": "trait", - "loc": trait BaseTrait { + "loc": trait T2 { fun foo() {} }, "name": { - "id": 1, + "id": 5, "kind": "id", - "loc": BaseTrait, - "text": "BaseTrait", + "loc": T2, + "text": "T2", }, "traits": [], }, @@ -15302,11 +21416,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 3, + "id": 7, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 6, "kind": "id", "loc": foo, "text": "foo", @@ -15330,7 +21444,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "BaseTrait", + "name": "T2", "optional": false, }, }, @@ -15339,95 +21453,85 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "BaseTrait", + "name": "T2", "origin": "user", "partialFieldCount": 0, "receivers": [], "signature": null, "tlb": null, "traits": [], - "uid": 1020, + "uid": 54378, }, { "ast": { "attributes": [], "declarations": [ { - "attributes": [], - "id": 7, + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 13, "kind": "function_def", - "loc": fun bar() {}, + "loc": override fun foo() {}, "name": { - "id": 6, + "id": 12, "kind": "id", - "loc": bar, - "text": "bar", + "loc": foo, + "text": "foo", }, "params": [], "return": null, "statements": [], }, ], - "id": 8, - "kind": "trait", - "loc": trait T { - fun bar() {} + "id": 14, + "kind": "contract", + "loc": contract Test with T, T2 { + override fun foo() {} }, "name": { - "id": 5, + "id": 9, "kind": "id", - "loc": T, - "text": "T", + "loc": Test, + "text": "Test", }, - "traits": [], + "traits": [ + { + "id": 10, + "kind": "id", + "loc": T, + "text": "T", + }, + { + "id": 11, + "kind": "id", + "loc": T2, + "text": "T2", + }, + ], }, "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, + "attributes": [ + { + "kind": "function_attribute", + "loc": override, + "type": "override", + }, + ], + "id": 13, "kind": "function_def", - "loc": fun foo() {}, + "loc": override fun foo() {}, "name": { - "id": 2, + "id": 12, "kind": "id", "loc": foo, "text": "foo", @@ -15440,7 +21544,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isGetter": false, "isInline": false, "isMutating": true, - "isOverride": false, + "isOverride": true, "isVirtual": false, "methodId": null, "name": "foo", @@ -15451,33 +21555,108 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T", + "name": "Test", "optional": false, }, }, }, "header": null, - "init": null, + "init": { + "ast": { + "id": 16, + "kind": "contract_init", + "loc": contract Test with T, T2 { + override fun foo() {} +}, + "params": [], + "statements": [], + }, + "params": [], + }, "interfaces": [], - "kind": "trait", - "name": "T", + "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": [], + "uid": 6769, + }, { "ast": { "attributes": [], "declarations": [ { "attributes": [], - "id": 3, + "id": 7, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 6, "kind": "id", "loc": foo, "text": "foo", @@ -15487,16 +21666,16 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 4, + "id": 8, "kind": "trait", - "loc": trait BaseTrait { + "loc": trait T2 { fun foo() {} }, "name": { - "id": 1, + "id": 5, "kind": "id", - "loc": BaseTrait, - "text": "BaseTrait", + "loc": T2, + "text": "T2", }, "traits": [], }, @@ -15507,11 +21686,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 3, + "id": 7, "kind": "function_def", "loc": fun foo() {}, "name": { - "id": 2, + "id": 6, "kind": "id", "loc": foo, "text": "foo", @@ -15535,7 +21714,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "BaseTrait", + "name": "T2", "optional": false, }, }, @@ -15544,48 +21723,55 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "BaseTrait", + "name": "T2", "origin": "user", "partialFieldCount": 0, "receivers": [], "signature": null, "tlb": null, "traits": [], - "uid": 1020, + "uid": 54378, }, ], - "uid": 6769, + "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": 11, + "id": 3, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun foo() {}, "name": { - "id": 10, + "id": 2, "kind": "id", - "loc": baz, - "text": "baz", + "loc": foo, + "text": "foo", }, "params": [], "return": null, "statements": [], }, ], - "id": 12, + "id": 4, "kind": "trait", - "loc": trait T2 { - fun baz() {} + "loc": trait BaseTrait { + fun foo() {} }, "name": { - "id": 9, + "id": 1, "kind": "id", - "loc": T2, - "text": "T2", + "loc": BaseTrait, + "text": "BaseTrait", }, "traits": [], }, @@ -15593,17 +21779,17 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "dependsOn": [], "fields": [], "functions": Map { - "baz" => { + "foo" => { "ast": { "attributes": [], - "id": 11, + "id": 3, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun foo() {}, "name": { - "id": 10, + "id": 2, "kind": "id", - "loc": baz, - "text": "baz", + "loc": foo, + "text": "foo", }, "params": [], "return": null, @@ -15616,7 +21802,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "baz", + "name": "foo", "origin": "user", "params": [], "returns": { @@ -15624,21 +21810,72 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "BaseTrait", "optional": false, }, }, - "foo" => { + }, + "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": 24, + "id": 7, "kind": "function_def", - "loc": fun foo() {}, + "loc": fun bar() {}, "name": { - "id": 2, + "id": 6, "kind": "id", - "loc": foo, - "text": "foo", + "loc": bar, + "text": "bar", }, "params": [], "return": null, @@ -15651,7 +21888,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "foo", + "name": "bar", "origin": "user", "params": [], "returns": { @@ -15659,7 +21896,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "T", "optional": false, }, }, @@ -15668,100 +21905,99 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "T2", + "name": "T", "origin": "user", "partialFieldCount": 0, "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { + "traits": [], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { "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() {} -}, + "id": 11, + "kind": "function_def", + "loc": fun baz() {}, "name": { - "id": 1, + "id": 10, "kind": "id", - "loc": BaseTrait, - "text": "BaseTrait", + "loc": baz, + "text": "baz", }, - "traits": [], + "params": [], + "return": null, + "statements": [], }, - "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, - }, + ], + "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": [], }, - "header": null, - "init": null, - "interfaces": [], - "kind": "trait", - "name": "BaseTrait", + "isAbstract": false, + "isGetter": false, + "isInline": false, + "isMutating": true, + "isOverride": false, + "isVirtual": false, + "methodId": null, + "name": "baz", "origin": "user", - "partialFieldCount": 0, - "receivers": [], - "signature": null, - "tlb": null, - "traits": [], - "uid": 1020, + "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": [], "uid": 54378, }, { @@ -16021,232 +22257,24 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "kind": "ref", + "name": "BaseTrait", + "optional": false, + }, }, - ], - "uid": 6769, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "BaseTrait", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "uid": 1020, }, { "ast": { @@ -16254,30 +22282,30 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "declarations": [ { "attributes": [], - "id": 11, + "id": 7, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun bar() {}, "name": { - "id": 10, + "id": 6, "kind": "id", - "loc": baz, - "text": "baz", + "loc": bar, + "text": "bar", }, "params": [], "return": null, "statements": [], }, ], - "id": 12, + "id": 8, "kind": "trait", - "loc": trait T2 { - fun baz() {} + "loc": trait T { + fun bar() {} }, "name": { - "id": 9, + "id": 5, "kind": "id", - "loc": T2, - "text": "T2", + "loc": T, + "text": "T", }, "traits": [], }, @@ -16285,17 +22313,17 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "dependsOn": [], "fields": [], "functions": Map { - "baz" => { + "bar" => { "ast": { "attributes": [], - "id": 11, + "id": 7, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun bar() {}, "name": { - "id": 10, + "id": 6, "kind": "id", - "loc": baz, - "text": "baz", + "loc": bar, + "text": "bar", }, "params": [], "return": null, @@ -16308,7 +22336,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "baz", + "name": "bar", "origin": "user", "params": [], "returns": { @@ -16316,21 +22344,72 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "T", "optional": false, }, }, - "foo" => { + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], + "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": 24, + "id": 11, "kind": "function_def", - "loc": fun foo() {}, + "loc": fun baz() {}, "name": { - "id": 2, + "id": 10, "kind": "id", - "loc": foo, - "text": "foo", + "loc": baz, + "text": "baz", }, "params": [], "return": null, @@ -16343,7 +22422,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "foo", + "name": "baz", "origin": "user", "params": [], "returns": { @@ -16366,94 +22445,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 54378, }, ], @@ -16568,53 +22560,20 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + }, }, - ], + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], "uid": 6769, }, { @@ -16846,40 +22805,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -17294,40 +23220,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, { @@ -17403,38 +23296,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -17516,40 +23377,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -17628,38 +23456,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -17733,38 +23529,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -17824,62 +23588,29 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "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": [], "uid": 58377, }, ], @@ -17966,40 +23697,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -18224,38 +23922,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -18329,38 +23995,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -18442,40 +24076,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -18562,40 +24163,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -18674,38 +24242,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -18787,40 +24323,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -18889,58 +24392,25 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + }, + "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": [], "uid": 58377, }, ], @@ -19014,40 +24484,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, { @@ -19139,38 +24576,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -19200,40 +24605,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -19312,38 +24684,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -19433,38 +24773,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -19494,40 +24802,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -19546,56 +24821,23 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "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": [], "uid": 58377, }, ], @@ -19820,38 +25062,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -19941,38 +25151,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -20002,40 +25180,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -20070,40 +25215,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -20198,38 +25310,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -20259,40 +25339,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -20327,40 +25374,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 58377, }, ], @@ -20467,61 +25481,28 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "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": [], "uid": 6769, }, { @@ -20650,38 +25631,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -20765,40 +25714,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -20930,38 +25846,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -21045,40 +25929,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -21263,38 +26114,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -21421,38 +26240,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -21519,57 +26306,24 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "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": [], "uid": 6769, }, ], @@ -21658,40 +26412,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -21820,38 +26541,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -21935,40 +26624,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -22045,40 +26701,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -22164,40 +26787,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 54378, }, { @@ -22309,38 +26899,6 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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": [], @@ -22357,53 +26915,20 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "dependsOn": [], + "fields": [], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], "uid": 6769, }, { @@ -22489,40 +27014,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 54378, }, ], @@ -22627,256 +27119,55 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "id": 8, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun bar() {}, "name": { - "id": 10, + "id": 7, "kind": "id", - "loc": baz, - "text": "baz", + "loc": bar, + "text": "bar", }, "params": [], "return": null, "statements": [], }, ], - "id": 12, + "id": 9, "kind": "trait", - "loc": trait T2 { - fun baz() {} + "loc": trait T with BaseTrait { + fun bar() {} }, "name": { - "id": 9, + "id": 5, "kind": "id", - "loc": T2, - "text": "T2", + "loc": T, + "text": "T", }, - "traits": [], + "traits": [ + { + "id": 6, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + ], }, "constants": [], "dependsOn": [], "fields": [], "functions": Map { - "baz" => { + "bar" => { "ast": { "attributes": [], - "id": 11, + "id": 8, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun bar() {}, "name": { - "id": 10, + "id": 7, "kind": "id", - "loc": baz, - "text": "baz", + "loc": bar, + "text": "bar", }, "params": [], "return": null, @@ -22889,7 +27180,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "baz", + "name": "bar", "origin": "user", "params": [], "returns": { @@ -22897,7 +27188,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "T", "optional": false, }, }, @@ -22932,7 +27223,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "T", "optional": false, }, }, @@ -22941,7 +27232,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "init": null, "interfaces": [], "kind": "trait", - "name": "T2", + "name": "T", "origin": "user", "partialFieldCount": 0, "receivers": [], @@ -23035,6 +27326,92 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "uid": 1020, }, ], + "uid": 6769, + }, + { + "ast": { + "attributes": [], + "declarations": [ + { + "attributes": [], + "id": 12, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 11, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 13, + "kind": "trait", + "loc": trait T2 { + fun baz() {} +}, + "name": { + "id": 10, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { + "ast": { + "attributes": [], + "id": 12, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 11, + "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, + }, + }, + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], "uid": 54378, }, { @@ -23049,11 +27426,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "type": "override", }, ], - "id": 17, + "id": 18, "kind": "function_def", "loc": override fun foo() {}, "name": { - "id": 16, + "id": 17, "kind": "id", "loc": foo, "text": "foo", @@ -23063,26 +27440,26 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 18, + "id": 19, "kind": "trait", "loc": trait Test with T, T2 { override fun foo() {} }, "name": { - "id": 13, + "id": 14, "kind": "id", "loc": Test, "text": "Test", }, "traits": [ { - "id": 14, + "id": 15, "kind": "id", "loc": T, "text": "T", }, { - "id": 15, + "id": 16, "kind": "id", "loc": T2, "text": "T2", @@ -23102,11 +27479,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "type": "override", }, ], - "id": 17, + "id": 18, "kind": "function_def", "loc": override fun foo() {}, "name": { - "id": 16, + "id": 17, "kind": "id", "loc": foo, "text": "foo", @@ -23137,11 +27514,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "bar" => { "ast": { "attributes": [], - "id": 20, + "id": 21, "kind": "function_def", "loc": fun bar() {}, "name": { - "id": 6, + "id": 7, "kind": "id", "loc": bar, "text": "bar", @@ -23172,11 +27549,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "baz" => { "ast": { "attributes": [], - "id": 21, + "id": 22, "kind": "function_def", "loc": fun baz() {}, "name": { - "id": 10, + "id": 11, "kind": "id", "loc": baz, "text": "baz", @@ -23222,97 +27599,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, + "id": 8, "kind": "function_def", "loc": fun bar() {}, "name": { - "id": 6, + "id": 7, "kind": "id", "loc": bar, "text": "bar", @@ -23322,9 +27613,9 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "statements": [], }, ], - "id": 8, + "id": 9, "kind": "trait", - "loc": trait T { + "loc": trait T with BaseTrait { fun bar() {} }, "name": { @@ -23333,7 +27624,14 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "loc": T, "text": "T", }, - "traits": [], + "traits": [ + { + "id": 6, + "kind": "id", + "loc": BaseTrait, + "text": "BaseTrait", + }, + ], }, "constants": [], "dependsOn": [], @@ -23342,11 +27640,11 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "bar" => { "ast": { "attributes": [], - "id": 7, + "id": 8, "kind": "function_def", "loc": fun bar() {}, "name": { - "id": 6, + "id": 7, "kind": "id", "loc": bar, "text": "bar", @@ -23377,7 +27675,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "foo" => { "ast": { "attributes": [], - "id": 22, + "id": 23, "kind": "function_def", "loc": fun foo() {}, "name": { @@ -23516,30 +27814,30 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "declarations": [ { "attributes": [], - "id": 11, + "id": 3, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun foo() {}, "name": { - "id": 10, + "id": 2, "kind": "id", - "loc": baz, - "text": "baz", + "loc": foo, + "text": "foo", }, "params": [], "return": null, "statements": [], }, ], - "id": 12, + "id": 4, "kind": "trait", - "loc": trait T2 { - fun baz() {} + "loc": trait BaseTrait { + fun foo() {} }, "name": { - "id": 9, + "id": 1, "kind": "id", - "loc": T2, - "text": "T2", + "loc": BaseTrait, + "text": "BaseTrait", }, "traits": [], }, @@ -23547,17 +27845,17 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "dependsOn": [], "fields": [], "functions": Map { - "baz" => { + "foo" => { "ast": { "attributes": [], - "id": 11, + "id": 3, "kind": "function_def", - "loc": fun baz() {}, + "loc": fun foo() {}, "name": { - "id": 10, + "id": 2, "kind": "id", - "loc": baz, - "text": "baz", + "loc": foo, + "text": "foo", }, "params": [], "return": null, @@ -23570,7 +27868,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "baz", + "name": "foo", "origin": "user", "params": [], "returns": { @@ -23578,21 +27876,72 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing }, "self": { "kind": "ref", - "name": "T2", + "name": "BaseTrait", "optional": false, }, }, - "foo" => { + }, + "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": 12, + "kind": "function_def", + "loc": fun baz() {}, + "name": { + "id": 11, + "kind": "id", + "loc": baz, + "text": "baz", + }, + "params": [], + "return": null, + "statements": [], + }, + ], + "id": 13, + "kind": "trait", + "loc": trait T2 { + fun baz() {} +}, + "name": { + "id": 10, + "kind": "id", + "loc": T2, + "text": "T2", + }, + "traits": [], + }, + "constants": [], + "dependsOn": [], + "fields": [], + "functions": Map { + "baz" => { "ast": { "attributes": [], - "id": 23, + "id": 12, "kind": "function_def", - "loc": fun foo() {}, + "loc": fun baz() {}, "name": { - "id": 2, + "id": 11, "kind": "id", - "loc": foo, - "text": "foo", + "loc": baz, + "text": "baz", }, "params": [], "return": null, @@ -23605,7 +27954,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "isOverride": false, "isVirtual": false, "methodId": null, - "name": "foo", + "name": "baz", "origin": "user", "params": [], "returns": { @@ -23628,94 +27977,7 @@ exports[`resolveDescriptors should resolve descriptors for override-for-existing "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, - }, - ], + "traits": [], "uid": 54378, }, ], @@ -25854,65 +30116,32 @@ exports[`resolveDescriptors should resolve descriptors for trait-foreach 1`] = ` "isInline": false, "isMutating": true, "isOverride": false, - "isVirtual": false, - "methodId": null, - "name": "test", - "origin": "user", - "params": [], - "returns": { - "kind": "void", - }, - "self": { - "kind": "ref", - "name": "TraitWithForeach", - "optional": false, - }, - }, - }, - "header": null, - "init": null, - "interfaces": [], - "kind": "trait", - "name": "TraitWithForeach", - "origin": "user", - "partialFieldCount": 0, - "receivers": [], - "signature": null, - "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, + "isVirtual": false, + "methodId": null, + "name": "test", + "origin": "user", + "params": [], + "returns": { + "kind": "void", + }, + "self": { + "kind": "ref", + "name": "TraitWithForeach", + "optional": false, + }, }, - ], + }, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "TraitWithForeach", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], "uid": 20892, }, { @@ -26405,40 +30634,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-foreach 1`] = ` "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait { }, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 20892, }, ], @@ -26604,40 +30800,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-int-field-with- "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, { @@ -26750,38 +30913,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-int-field-with- "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -26874,40 +31005,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-int-field-with- "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, ], @@ -27083,40 +31181,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, { @@ -27229,38 +31294,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -27352,51 +31385,18 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f }, }, ], - "functions": Map {}, - "header": null, - "init": null, - "interfaces": [], - "kind": "trait", - "name": "Foo", - "origin": "user", - "partialFieldCount": 0, - "receivers": [], - "signature": null, - "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "Foo", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [], "uid": 10576, }, ], @@ -27572,40 +31572,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -27788,38 +31755,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -27922,40 +31857,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -28141,38 +32043,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -28275,40 +32145,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -28570,38 +32407,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -28766,54 +32571,22 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "type": { "kind": "ref", "name": "Int", - "optional": false, - }, - }, - ], - "functions": Map {}, - "header": null, - "init": null, - "interfaces": [], - "kind": "trait", - "name": "T2", - "origin": "user", - "partialFieldCount": 0, - "receivers": [], - "signature": null, - "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "kind": "id", - "loc": BaseTrait, - "text": "BaseTrait", - }, - "traits": [], + "optional": false, }, - "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, }, + ], + "functions": Map {}, + "header": null, + "init": null, + "interfaces": [], + "kind": "trait", + "name": "T2", + "origin": "user", + "partialFieldCount": 0, + "receivers": [], + "signature": null, + "tlb": null, + "traits": [ { "ast": { "attributes": [], @@ -28916,40 +32689,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -29057,40 +32797,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, { @@ -29273,38 +32980,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -29407,40 +33082,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-f "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 6769, }, ], @@ -29619,40 +33261,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-i "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, { @@ -29755,38 +33364,6 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-i "signature": null, "tlb": null, "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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": [], @@ -29889,40 +33466,7 @@ exports[`resolveDescriptors should resolve descriptors for trait-with-as-typed-i "receivers": [], "signature": null, "tlb": null, - "traits": [ - { - "ast": { - "attributes": [], - "declarations": [], - "id": 4, - "kind": "trait", - "loc": trait BaseTrait {}, - "name": { - "id": 3, - "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, - }, - ], + "traits": [], "uid": 10576, }, ], diff --git a/src/types/resolveDescriptors.ts b/src/types/resolveDescriptors.ts index 88ae0169c..f59be7fbd 100644 --- a/src/types/resolveDescriptors.ts +++ b/src/types/resolveDescriptors.ts @@ -588,14 +588,6 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { traitDecl.loc, ); } - if ( - traitDecl.attributes.find((v) => v.type === "override") - ) { - throwCompilationError( - `Trait constant cannot be overridden`, - traitDecl.loc, - ); - } types .get(idText(a.name))! .constants.push(buildConstantDescription(traitDecl)); @@ -1519,7 +1511,12 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { ); } } - visit("BaseTrait"); + + // implicitly inherit from BaseTrait only in contracts + if (t.ast.kind === "contract") { + visit("BaseTrait"); + } + for (const s of t.ast.traits) { visit(idText(s)); } @@ -1608,14 +1605,40 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { ); 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`; + const msg = + contractOrTrait.traits.length === 0 || 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); } } + // Check that "override" constants have a super constant + for (const constantInContractOrTrait of contractOrTrait.constants.values()) { + const isOverride = constantInContractOrTrait.ast.attributes.find( + (a) => a.type === "override", + ); + if (!isOverride) { + continue; + } + + const foundOverriddenConstant = contractOrTrait.traits.some((t) => + t.constants.some( + (c) => c.name === constantInContractOrTrait.name, + ), + ); + + if (!foundOverriddenConstant) { + const msg = + contractOrTrait.traits.length === 0 || inheritOnlyBaseTrait + ? `Constant "${constantInContractOrTrait.name}" overrides nothing, remove "override" modifier or inherit any traits with this constant` + : `Constant "${constantInContractOrTrait.name}" overrides nothing, remove "override" modifier`; + + throwCompilationError(msg, constantInContractOrTrait.ast.loc); + } + } + for (const inheritedTrait of contractOrTrait.traits) { // Copy functions for (const traitFunction of inheritedTrait.functions.values()) { @@ -1689,10 +1712,17 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { funInContractOrTrait.ast.loc, ); } - throwCompilationError( - `Function "${traitFunction.name}" is already defined in trait "${inheritedTrait.name}"`, - funInContractOrTrait.ast.loc, - ); + + if ( + traitFunction.ast.attributes.find( + (v) => v.type === "override", + ) === undefined + ) { + throwCompilationError( + `Function "${traitFunction.name}" is already defined in trait "${inheritedTrait.name}"`, + funInContractOrTrait.ast.loc, + ); + } } // Register function @@ -1755,10 +1785,17 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { constInContractOrTrait.ast.loc, ); } - throwCompilationError( - `Constant "${traitConstant.name}" is already defined in trait "${inheritedTrait.name}"`, - constInContractOrTrait.ast.loc, - ); + + if ( + traitConstant.ast.attributes.find( + (v) => v.type === "override", + ) === undefined + ) { + throwCompilationError( + `Constant "${traitConstant.name}" is already defined in trait "${inheritedTrait.name}"`, + constInContractOrTrait.ast.loc, + ); + } } const contractField = contractOrTrait.fields.find( (v) => v.name === traitConstant.name, @@ -1771,6 +1808,18 @@ export function resolveDescriptors(ctx: CompilerContext, Ast: FactoryAst) { ); } + if ( + traitConstant.ast.attributes.find( + (v) => v.type === "override", + ) + ) { + // remove overridden constant + contractOrTrait.constants = + contractOrTrait.constants.filter( + (c) => c.name !== traitConstant.name, + ); + } + // Register constant contractOrTrait.constants.push({ ...traitConstant, diff --git a/src/types/test-failed/override-for-non-existing-constant-in-contract-from-base-trait.tact b/src/types/test-failed/override-for-non-existing-constant-in-contract-from-base-trait.tact new file mode 100644 index 000000000..a63f1117a --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-constant-in-contract-from-base-trait.tact @@ -0,0 +1,9 @@ +primitive Int; + +trait BaseTrait { + const FOO: Int = 10; +} + +contract Test { + override const BAR: Int = 10; +} diff --git a/src/types/test-failed/override-for-non-existing-constant-in-contract-with-multi-inheritance.tact b/src/types/test-failed/override-for-non-existing-constant-in-contract-with-multi-inheritance.tact new file mode 100644 index 000000000..fe2ab9154 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-constant-in-contract-with-multi-inheritance.tact @@ -0,0 +1,14 @@ +primitive Int; + +trait BaseTrait {} +trait T { + const BAR: Int = 10; +} + +trait T2 { + const BAZ: Int = 10; +} + +contract Test with T, T2 { + override const FOO: Int = 10; +} diff --git a/src/types/test-failed/override-for-non-existing-constant-in-contract-without-inheritance.tact b/src/types/test-failed/override-for-non-existing-constant-in-contract-without-inheritance.tact new file mode 100644 index 000000000..5cebcce96 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-constant-in-contract-without-inheritance.tact @@ -0,0 +1,7 @@ +primitive Int; + +trait BaseTrait {} + +contract Test { + override const FOO: Int = 100; +} diff --git a/src/types/test-failed/override-for-non-existing-constant-in-trait-from-base-trait.tact b/src/types/test-failed/override-for-non-existing-constant-in-trait-from-base-trait.tact new file mode 100644 index 000000000..6a3f1f1dd --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-constant-in-trait-from-base-trait.tact @@ -0,0 +1,9 @@ +primitive Int; + +trait BaseTrait { + const FOO: Int = 10; +} + +trait Test { + override const BAR: Int = 10; +} diff --git a/src/types/test-failed/override-for-non-existing-constant-in-trait-with-multi-inheritance.tact b/src/types/test-failed/override-for-non-existing-constant-in-trait-with-multi-inheritance.tact new file mode 100644 index 000000000..770730c89 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-constant-in-trait-with-multi-inheritance.tact @@ -0,0 +1,14 @@ +primitive Int; + +trait BaseTrait {} +trait T { + const BAR: Int = 10; +} + +trait T2 { + const BAZ: Int = 10; +} + +trait Test with T, T2 { + override const FOO: Int = 10; +} diff --git a/src/types/test-failed/override-for-non-existing-constant-in-trait-without-inheritance.tact b/src/types/test-failed/override-for-non-existing-constant-in-trait-without-inheritance.tact new file mode 100644 index 000000000..c9a13d053 --- /dev/null +++ b/src/types/test-failed/override-for-non-existing-constant-in-trait-without-inheritance.tact @@ -0,0 +1,7 @@ +primitive Int; + +trait BaseTrait {} + +trait Test { + override const FOO: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-contract-from-base-trait.tact b/src/types/test/override-for-existing-constant-in-contract-from-base-trait.tact new file mode 100644 index 000000000..917acd1b6 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-contract-from-base-trait.tact @@ -0,0 +1,9 @@ +primitive Int; + +trait BaseTrait { + const BAR: Int = 100; +} + +contract Test with BaseTrait { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-contract-with-multi-inheritance-from-base-trait.tact b/src/types/test/override-for-existing-constant-in-contract-with-multi-inheritance-from-base-trait.tact new file mode 100644 index 000000000..615786bc1 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-contract-with-multi-inheritance-from-base-trait.tact @@ -0,0 +1,17 @@ +primitive Int; + +trait BaseTrait { + const FOO: Int = 100; +} + +trait T { + const BAR: Int = 100; +} + +trait T2 { + const BAZ: Int = 100; +} + +contract Test with T, T2 { + override const FOO: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-contract-with-multi-inheritance.tact b/src/types/test/override-for-existing-constant-in-contract-with-multi-inheritance.tact new file mode 100644 index 000000000..97775035c --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-contract-with-multi-inheritance.tact @@ -0,0 +1,12 @@ +primitive Int; + +trait BaseTrait {} +trait T {} + +trait T2 { + const BAR: Int = 100; +} + +contract Test with T, T2 { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-contract.tact b/src/types/test/override-for-existing-constant-in-contract.tact new file mode 100644 index 000000000..3d35974b9 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-contract.tact @@ -0,0 +1,10 @@ +primitive Int; + +trait BaseTrait {} +trait T { + const BAR: Int = 10; +} + +contract Test with T { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-trait-from-base-trait.tact b/src/types/test/override-for-existing-constant-in-trait-from-base-trait.tact new file mode 100644 index 000000000..dad41adf9 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-trait-from-base-trait.tact @@ -0,0 +1,9 @@ +primitive Int; + +trait BaseTrait { + const BAR: Int = 100; +} + +trait Test with BaseTrait { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-trait-with-deep-inheritance-in-middle.tact b/src/types/test/override-for-existing-constant-in-trait-with-deep-inheritance-in-middle.tact new file mode 100644 index 000000000..22173123b --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-trait-with-deep-inheritance-in-middle.tact @@ -0,0 +1,13 @@ +primitive Int; + +trait BaseTrait {} + +trait T1 {} + +trait T2 with T1 { const BAR: Int = 100; } + +trait T3 with T2 {} + +trait Test with T3 { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-trait-with-diamond-inheritance.tact b/src/types/test/override-for-existing-constant-in-trait-with-diamond-inheritance.tact new file mode 100644 index 000000000..61e20ef5e --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-trait-with-diamond-inheritance.tact @@ -0,0 +1,19 @@ +primitive Int; + +trait BaseTrait {} + +trait T { + const BAR: Int = 100; +} + +trait T2 with T { + const BAZ: Int = 100; +} + +trait T3 with T { + override const BAR: Int = 100; +} + +trait Test with T2, T3 { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-trait-with-multi-inheritance-from-base-trait.tact b/src/types/test/override-for-existing-constant-in-trait-with-multi-inheritance-from-base-trait.tact new file mode 100644 index 000000000..afe7a3674 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-trait-with-multi-inheritance-from-base-trait.tact @@ -0,0 +1,16 @@ +primitive Int; + +trait BaseTrait { + const FOO: Int = 100; +} +trait T with BaseTrait { + const BAR: Int = 100; +} + +trait T2 { + const BAZ: Int = 100; +} + +trait Test with T, T2 { + override const FOO: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-trait-with-multi-inheritance.tact b/src/types/test/override-for-existing-constant-in-trait-with-multi-inheritance.tact new file mode 100644 index 000000000..1fa9a74c4 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-trait-with-multi-inheritance.tact @@ -0,0 +1,12 @@ +primitive Int; + +trait BaseTrait {} +trait T {} + +trait T2 { + const BAR: Int = 100; +} + +trait Test with T, T2 { + override const BAR: Int = 100; +} diff --git a/src/types/test/override-for-existing-constant-in-trait.tact b/src/types/test/override-for-existing-constant-in-trait.tact new file mode 100644 index 000000000..c6e5bafc2 --- /dev/null +++ b/src/types/test/override-for-existing-constant-in-trait.tact @@ -0,0 +1,10 @@ +primitive Int; + +trait BaseTrait {} +trait T { + const BAR: Int = 10; +} + +trait Test with T { + override const BAR: Int = 100; +} 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 index 5850b0948..e8806c325 100644 --- 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 @@ -2,6 +2,6 @@ trait BaseTrait { fun foo() {} } -trait Test { +trait Test with BaseTrait { override fun foo() {} } 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 index 41091c08a..229fd2de4 100644 --- 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 @@ -1,7 +1,7 @@ trait BaseTrait { fun foo() {} } -trait T { +trait T with BaseTrait { fun bar() {} }