Compiler Crashing #324

Closed
opened 2021-07-04 03:05:49 +09:00 by zxq9 · 2 comments
zxq9 commented 2021-07-04 03:05:49 +09:00 (Migrated from gitlab.com)

Created by: nikita-fuchs

Crashing on a saturday night:

contract Some_Other_Child_Contract =
    entrypoint sayHi() =
        "hello"


contract Identity = 
    record state = {
        name: string,
        surname: string,
        idNumber: int
        }

    entrypoint init(name: string, surname: string, idNumber: int) =
        { name = name,
          surname = surname,
          idNumber = idNumber
            }

    entrypoint getIdentity() =
        state


main contract IdentityService =

    stateful entrypoint createNewIdentity(name: string, surname: string, idNumber: int) =
        let identity = Chain.create(name, surname, idNumber) : Identity
        identity.address
        
*Created by: nikita-fuchs* Crashing on a saturday night: ``` contract Some_Other_Child_Contract = entrypoint sayHi() = "hello" contract Identity = record state = { name: string, surname: string, idNumber: int } entrypoint init(name: string, surname: string, idNumber: int) = { name = name, surname = surname, idNumber = idNumber } entrypoint getIdentity() = state main contract IdentityService = stateful entrypoint createNewIdentity(name: string, surname: string, idNumber: int) = let identity = Chain.create(name, surname, idNumber) : Identity identity.address ```
zxq9 commented 2021-07-04 03:09:31 +09:00 (Migrated from gitlab.com)

Created by: nikita-fuchs

"Same" thing happening also with Chain.clone:

contract Some_Other_Child_Contract =
    entrypoint sayHi() =
        "hello"


contract Identity = 
    record state = {
        name: string,
        surname: string,
        idNumber: int
        }

    entrypoint init(name: string, surname: string, idNumber: int) =
        { name = name,
          surname = surname,
          idNumber = idNumber
            }

    entrypoint getIdentity() =
        state


main contract IdentityService =

    stateful entrypoint createNewIdentity(cloneFrom: Identity, name: string, surname: string, idNumber: int) =
        let identity = Chain.clone(ref=cloneFrom, name, surname, idNumber) : Identity
        identity.address
        
*Created by: nikita-fuchs* "Same" thing happening also with Chain.clone: ``` contract Some_Other_Child_Contract = entrypoint sayHi() = "hello" contract Identity = record state = { name: string, surname: string, idNumber: int } entrypoint init(name: string, surname: string, idNumber: int) = { name = name, surname = surname, idNumber = idNumber } entrypoint getIdentity() = state main contract IdentityService = stateful entrypoint createNewIdentity(cloneFrom: Identity, name: string, surname: string, idNumber: int) = let identity = Chain.clone(ref=cloneFrom, name, surname, idNumber) : Identity identity.address ```
zxq9 commented 2021-07-05 16:41:13 +09:00 (Migrated from gitlab.com)

Created by: UlfNorell

The problem is that the state type from the child contract leaks into the parent contract. Work-around: add

type state = unit

to the main contract.

*Created by: UlfNorell* The problem is that the state type from the child contract leaks into the parent contract. Work-around: add ```sophia type state = unit ``` to the main contract.
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#324
No description provided.