summary refs log tree commit diff stats
path: root/compiler/platform.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2016-08-02 01:15:46 +0300
committerZahary Karadjov <zahary@gmail.com>2017-03-24 16:58:15 +0200
commit8cd5f1f8f53e9b286c7ca5af5245f20c052d47eb (patch)
treefdbfc1ce0daef36ac58e9957eb3417f57c861bbd /compiler/platform.nim
parent815724db713fb0f6f06570b9e85ce2434e7c45b8 (diff)
downloadNim-8cd5f1f8f53e9b286c7ca5af5245f20c052d47eb.tar.gz
introduce tyInferred for the unbound concept type params
* Why is tyInferred needed?

The bindings in TCandidate are capable of inferring types within a single
call expression. In concepts, we need to infer types in the same way, but
across the whole body of the concept.

Previously, once a concept type param was inferred, it was destructively
mutated using t.assignType, but this proved to be problematic in the presence
of overloads, because the bindings established while a non-matching overload
is tested must be reverted/forgotten. tyInferred offers a non-destructive way to
keep track of the inference progress.

While introducing new types usually requires a lot of code paths in the compiler
to updated, currently tyInferred is only a short-lived type within the concept body
pass and it's unlikely to introduce breakage elsewhere in the compiler.
Diffstat (limited to 'compiler/platform.nim')
0 files changed, 0 insertions, 0 deletions