(t *Type, node *ast.Node, reportError func(c *Checker, node *ast.Node, facts TypeFacts))
| 7388 | } |
| 7389 | |
| 7390 | func (c *Checker) checkNonNullTypeWithReporter(t *Type, node *ast.Node, reportError func(c *Checker, node *ast.Node, facts TypeFacts)) *Type { |
| 7391 | if c.strictNullChecks && t.flags&TypeFlagsUnknown != 0 { |
| 7392 | if ast.IsEntityNameExpression(node) { |
| 7393 | nodeText := entityNameToString(node) |
| 7394 | if len(nodeText) < 100 { |
| 7395 | c.error(node, diagnostics.X_0_is_of_type_unknown, nodeText) |
| 7396 | return c.errorType |
| 7397 | } |
| 7398 | } |
| 7399 | c.error(node, diagnostics.Object_is_of_type_unknown) |
| 7400 | return c.errorType |
| 7401 | } |
| 7402 | facts := c.getTypeFacts(t, TypeFactsIsUndefinedOrNull) |
| 7403 | if facts&TypeFactsIsUndefinedOrNull != 0 { |
| 7404 | reportError(c, node, facts) |
| 7405 | nonNullable := c.GetNonNullableType(t) |
| 7406 | if nonNullable.flags&(TypeFlagsNullable|TypeFlagsNever) != 0 { |
| 7407 | return c.errorType |
| 7408 | } |
| 7409 | return nonNullable |
| 7410 | } |
| 7411 | return t |
| 7412 | } |
| 7413 | |
| 7414 | func (c *Checker) checkNonNullNonVoidType(t *Type, node *ast.Node) *Type { |
| 7415 | nonNullType := c.checkNonNullType(t, node) |
no test coverage detected