typeshelper: be even more thorough in resolving types#431
Draft
TvdW wants to merge 3 commits into
Draft
Conversation
TvdW
force-pushed
the
pointer-to-array-full
branch
from
July 2, 2026 19:10
3c97922 to
223e619
Compare
Contributor
Author
TvdW
force-pushed
the
pointer-to-array-full
branch
from
July 2, 2026 20:21
223e619 to
a7f305b
Compare
…ypes The x = append(x, ...) handling used the shallow IsSlice check, so parameters of named slice types (or aliases) silently skipped deep-assignment analysis. Use IsDeeplyType[*types.Slice] instead and drop the now-unused IsSlice. For named slice types the diagnostic attaches to the type's own annotation site rather than the parameter.
typeshelper.IsDeep is now a purely type-level predicate (fully resolving named types, aliases, and type parameters). The nilaway-specific policy — named deep types own their deep nilability at their type declaration (nilable(A[])), everything else at the expression's location — moves to the new annotation.DeepNilabilityIsLocal, next to DeepNilabilityAsNamedType, and all location-site decisions go through it. Also resolve aliases in DeepNilabilityAsNamedType: an alias of a named deep type previously fell through to ProduceTriggerNever, losing deep tracking entirely.
- UnwrapPtr sees through named pointer types and aliases (and is nil-safe). - GetFuncSignature resolves via Underlying, so named function types work (its own doc example previously returned nil since only *types.Alias was handled); this gives calls of named func-typed values the usual error-return handling. - TypeBarsNilness handles type parameters (a type parameter bars nil unless every term in its type set admits nil, per Go assignability) and aliases of type parameters. - IsPointer scans the type set once and accepts mixed pointer-like unions such as ~*int | ~[]int. - FuncIsOkReturning documents that requiring the literal bool (aliases included) is deliberate: a named boolean type signals the result means something other than the v, ok convention. Resolving named function types exposed that NodeTriggersFuncErrRet treated conversions to function types (f := MyFuncType(g)) as calls, panicking on an operand-count mismatch; skip expressions whose Fun denotes a type.
TvdW
force-pushed
the
pointer-to-array-full
branch
from
July 7, 2026 20:14
a7f305b to
0324607
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.