/*
 * Copyright 2013-2014 must-be.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.mustbe.consulo.csharp.ide.highlight.check.impl;

import org.jetbrains.annotations.NotNull;
import org.mustbe.consulo.csharp.ide.highlight.check.AbstractCompilerCheck;
import org.mustbe.consulo.csharp.lang.psi.CSharpLocalVariable;
import org.mustbe.consulo.dotnet.resolve.DotNetTypeRef;

/**
 * @author VISTALL
 * @since 03.09.14
 */
public class CS0818 extends AbstractCompilerCheck<CSharpLocalVariable>
{
	@Override
	public boolean accept(@NotNull CSharpLocalVariable element)
	{
		return element.toTypeRef(false) == DotNetTypeRef.AUTO_TYPE && element.getInitializer() == null;
	}
}

@@ -832,16 +832,98 @@
 riable;%0A
+import org.mustbe.consulo.csharp.lang.psi.impl.source.CSharpForeachStatementImpl;%0A
 import o
@@ -1165,16 +1165,105 @@
 ent)%0A%09%7B%0A
+%09%09if(element.getParent() instanceof CSharpForeachStatementImpl)%0A%09%09%7B%0A%09%09%09return false;%0A%09%09%7D%0A
 %09%09return

fix CS0818 for foreach statement