Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seq[Foo[static[int]]] in cyclic types: type expected #6522

Open
mratsim opened this issue Oct 16, 2017 · 0 comments
Open

seq[Foo[static[int]]] in cyclic types: type expected #6522

mratsim opened this issue Oct 16, 2017 · 0 comments
Assignees

Comments

@mratsim
Copy link
Collaborator

mratsim commented Oct 16, 2017

From #6510

import asyncdispatch, asyncnet

type
  ClientMsg[T] = object
    msg: T

  ServerMsg[T] = object
    msg: T

  MockupClient[T] = object
    server: ServerMsg[T]
    client: ClientMsg[T]

  Server[T; serverMsgSize, clientMsgSize: static[int]] = ref object
      socket: AsyncSocket
      mockupClients: seq[MockupClient[T]]
      newConnection: Future[tuple[address: string, client: AsyncSocket]]
      msgBuffer: array[serverMsgSize, byte]
      clients: seq[Client[T, serverMsgSize, clientMsgSize]]  # just seq[Client] compiles, nimsuggest underlines the static int types

  Client[T; serverMsgSize, clientMsgSize: static[int]] = ref object
      socket: AsyncSocket
      address: string
      msgBuffer: array[clientMsgSize, byte]
      newMsg: Future[int]
      server: Server[T, serverMsgSize, clientMsgSize]

cc @zah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants