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

使用 submodel 的时候,报 the submodel ComplexRequest.instance is inexist 错误 #11

Open
wenzuochao opened this issue Jun 18, 2020 · 0 comments

Comments

@wenzuochao
Copy link

wenzuochao commented Jun 18, 2020

// source 代码
init();

model Request = {
  accesskey?: string(name='accesskey', description='accesskey'),
  region?: string(name='region', description='region'),
  instance: {
    instanceId: string(name='instanceId', description='instanceId'),
  }(name='instance', description='instance'),
}
// 错误代码
import Source;

model ComplexRequest = {
  instance: Source.Request.instance,
}

model Response {
  instance: ComplexRequest.instance,
}

SyntaxError: the submodel ComplexRequest.instance is inexist
at TypeChecker.error (node_modules/@[email protected]@@darabonba/parser/lib/semantic.js:338:11)
at TypeChecker.checkType (node_modules/
@[email protected]@@darabonba/parser/lib/semantic.js:743:16)
at TypeChecker.flatModel (node_modules/@[email protected]@@darabonba/parser/lib/semantic.js:2107:16)
at TypeChecker.visitModel (node_modules/
@[email protected]@@darabonba/parser/lib/semantic.js:2132:10)
at models.forEach (node_modules/@[email protected]@@darabonba/parser/lib/semantic.js:356:12)
at Array.forEach ()
at TypeChecker.checkModels (node_modules/
@[email protected]@@darabonba/parser/lib/semantic.js:355:12)
at TypeChecker.check (node_modules/@[email protected]@@darabonba/parser/lib/semantic.js:524:10)
at getChecker (node_modules/
@[email protected]@@darabonba/parser/lib/semantic.js:2140:44)
at analyze (node_modules/@[email protected]@@darabonba/parser/lib/semantic.js:2144:19)
at Object.parse (node_modules/
@[email protected]@@darabonba/parser/index.js:13:15)
at check (test/main.test.js:19:19)

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

No branches or pull requests

1 participant