Convert a nullable type to its non-nullable type? : <p>I have a bunch of beans that have nullable properties like so:</p>

<pre><code>package myapp.mybeans;

data class Foo(val name : String?);
</code></pre>

<p>And I have a method in the global space like so:</p>

<pre><code>package myapp.global;

public fun makeNewBar(name : String) : Bar
{
  ...
}
</code></pre>

<p>And somewhere else, I need to make a <code>Bar</code> from the stuff that's inside <code>Foo</code>. So, I do this:</p>

<pre><code>package myapp.someplaceElse;

public fun getFoo() : Foo? { }
...
val foo : Foo? = getFoo();

if (foo == null) { ... return; }


// I know foo isn't null and *I know* that foo.name isn't null
// but I understand that the compiler doesn't.
// How do I convert String? to String here? if I do not want
// to change the definition of the parameters makeNewBar takes?
val bar : Bar = makeNewBar(foo.name);
</code></pre>

<p>Also, doing some conversion here with <code>foo.name</code> to cleanse it every time with every little thing, while on the one hand provides me compile-time guarantees and safety it is a big bother most of the time. Is there some short-hand to get around these scenarios?</p>
