'What does `source` do when given a directory?

I often happen to run a command like source mydirectory, where mydirectory is a ...directory, and not a shell script file (I guess I'm not that good at predicting autocompletion :p)

What puzzles me is that zsh does not complain, and returns 0 as status code; although that does not seem a normal call to source AFAIK.

# in zsh shell
# create an empty dir
$ mkdir /tmp/mydir

# "source" it
$ source /tmp/mydir && echo "success"
# output: 'success'

Meanwhile, bash will complain when asked to "source"

# in bash
$ source /tmp/mydir/ && echo "success"
# output: 'bash: source: /tmp/mydir/: is a directory'

Does someone know why this is a valid call in ZSH?

References I looked in

... to no avail

zsh


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source