diff --git a/doc/docs.md b/doc/docs.md index bfc754b9dd..99aa3bbbcb 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -480,7 +480,24 @@ fn main() { } } ``` +While variable shadowing is not allowed, field shadowing is allowed. +```v +pub struct Dimension { + width int = -1 + height int = -1 +} +pub struct Test { + Dimension + width int = 100 + // height int +} + +fn main() { + test := Test{} + println('${test.width} ${test.height} ${test.Dimension.width}') // 100 -1 -1 +} +``` ## V Types ### Primitive types @@ -7308,4 +7325,4 @@ Assignment Operators += -= *= /= %= &= |= ^= >>= <<= >>>= -``` +``` \ No newline at end of file